本文整理汇总了C#中CSLE.CLS_Content类的典型用法代码示例。如果您正苦于以下问题:C# CLS_Content类的具体用法?C# CLS_Content怎么用?C# CLS_Content使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CLS_Content类属于CSLE命名空间,在下文中一共展示了CLS_Content类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ComputeValue
public CLS_Content.Value ComputeValue(CLS_Content content)
{
content.InStack(this);
CLS_Content.Value result = new CLS_Content.Value();
result.type = typeof(bool);
bool bleft = (bool)listParam[0].ComputeValue(content).value;
if (mathop == '&')
{
if (!bleft)
{
result.value = false;
}
else
{
result.value = bleft && (bool)listParam[1].ComputeValue(content).value;
}
}
else if (mathop == '|')
{
if (bleft)
{
result.value = true;
}
else
{
result.value = bleft || (bool)listParam[1].ComputeValue(content).value;
}
}
content.OutStack(this);
return result;
}
开发者ID:wpszz,项目名称:CSLightForUnity,代码行数:34,代码来源:CLS_Expression_Math2ValueAndOR.cs
示例2: ComputeValue
public CLS_Content.Value ComputeValue(CLS_Content content)
{
content.InStack(this);
List<object> list = new List<object>();
int count = listParam[0] == null ? (listParam.Count - 1) : (int)listParam[0].ComputeValue(content).value;
if (count == 0)
throw new Exception("不能创建0长度数组");
CLS_Content.Value vcount = new CLS_Content.Value();
vcount.type = typeof(int);
vcount.value = count;
for (int i = 1; i < listParam.Count; i++)
{
//if (listParam[i] != null)
{
list.Add(listParam[i].ComputeValue(content).value);
}
}
List<CLS_Content.Value> p = new List<CLS_Content.Value>();
p.Add(vcount);
var outvalue = type.function.New(content, p);
for (int i = 0; i < list.Count; i++)
{
type.function.IndexSet(content, outvalue.value, i, list[i]);
}
content.OutStack(this);
return outvalue;
}
开发者ID:GraphicGame,项目名称:CSLightStudio,代码行数:28,代码来源:CLS_Expression_FunctionNewArray.cs
示例3: ComputeValue
public CLS_Content.Value ComputeValue(CLS_Content content)
{
content.InStack(this);
content.DepthAdd();
CLS_Content.Value vrt = null;
CLS_Expression_Define define = listParam[0] as CLS_Expression_Define;
define.ComputeValue(content);
IEnumerator it = (listParam[1].ComputeValue(content).value as IEnumerable).GetEnumerator();
ICLS_Expression expr_block = listParam[2];
while (it.MoveNext())
{
content.Set(define.value_name, it.Current);
if (expr_block != null)
{
CLS_Content.Value v = expr_block.ComputeValue(content);
if (v != null)
{
if (v.breakBlock > 2)
vrt = v;
if (v.breakBlock > 1)
break;
}
}
}
content.DepthRemove();
content.OutStack(this);
return vrt;
}
开发者ID:wpszz,项目名称:CSLightForUnity,代码行数:34,代码来源:CLS_Expression_LoopForEach.cs
示例4: ComputeValue
public CLS_Content.Value ComputeValue(CLS_Content content)
{
CLS_Content.Value value = new CLS_Content.Value();
value.type = typeof(DeleLambda);
value.value = new DeleLambda(content, this.listParam[0].listParam, this.listParam[1]);
return value;
}
开发者ID:wpszz,项目名称:CSLightForUnity,代码行数:7,代码来源:CLS_Expression_Lambda.cs
示例5: Call
public CLS_Content.Value Call(CLS_Content content, IList<CLS_Content.Value> param)
{
CLS_Content.Value v = new CLS_Content.Value();
List<object> objs = new List<object>();
//var _params = dele.Method.GetParameters();
for (int i = 0; i < this.defvalues.Count; i++)
{
if (i >= param.Count)
{
objs.Add(defvalues[i]);
}
else
{
if (this.paramtype[i] == (Type)param[i].type)
{
objs.Add(param[i].value);
}
else
{
object conv = content.environment.GetType(param[i].type).ConvertTo(content, param[i].value, paramtype[i]);
objs.Add(conv);
}
}
}
v.type = this.returntype;
v.value = dele.DynamicInvoke(objs.ToArray());
return v;
}
开发者ID:GraphicGame,项目名称:CSLightStudio,代码行数:28,代码来源:RegHelper_Function.cs
示例6: New
public override CLS_Content.Value New(CLS_Content content, BetterList<CLS_Content.Value> _params)
{
CLS_Content.Value val = new CLS_Content.Value();
val.type = typeof(SphereCollider);
val.value = new SphereCollider();
return val;
}
开发者ID:wpszz,项目名称:CSLightForUnity,代码行数:7,代码来源:ToCSLightSphereCollider.cs
示例7: Math2Value
public object Math2Value(CLS_Content env, char code, object left, CLS_Content.Value right, out CLType returntype)
{
returntype = typeof(float);
if ((Type)right.type == typeof(int))
{
if (code == '+')
return (float)left + (float)(int)right.value;
else if (code == '-')
return (float)left - (float)(int)right.value;
else if (code == '*')
return (float)left * (float)(int)right.value;
else if (code == '/')
return (float)left / (float)(int)right.value;
else if (code == '%')
return (float)left % (float)(int)right.value;
}
else if ((Type)right.type == typeof(uint))
{
if (code == '+')
return (float)left + (float)(uint)right.value;
else if (code == '-')
return (float)left - (float)(uint)right.value;
else if (code == '*')
return (float)left * (float)(uint)right.value;
else if (code == '/')
return (float)left / (float)(uint)right.value;
else if (code == '%')
return (float)left % (float)(uint)right.value;
}
else if ((Type)right.type == typeof(double))
{
returntype = typeof(double);
if (code == '+')
return (double)(float)left + (double)right.value;
else if (code == '-')
return (double)(float)left - (double)right.value;
else if (code == '*')
return (double)(float)left * (double)right.value;
else if (code == '/')
return (double)(float)left / (double)right.value;
else if (code == '%')
return (double)(float)left % (double)right.value;
}
else if ((Type)right.type == typeof(float))
{
returntype = typeof(float);
if (code == '+')
return (float)left + (float)right.value;
else if (code == '-')
return (float)left - (float)right.value;
else if (code == '*')
return (float)left * (float)right.value;
else if (code == '/')
return (float)left / (float)right.value;
else if (code == '%')
return (float)left % (float)right.value;
}
throw new NotImplementedException();
}
开发者ID:GraphicGame,项目名称:CSLightStudio,代码行数:60,代码来源:CLS_Type_Float.cs
示例8: OnGUI
void OnGUI()
{
if (GUI.Button(new Rect(0, 0, 200, 50), "Eval use String"))
{
Script.ClearValue();
string callExpr ="ScriptClass1 sc =new ScriptClass1();\n"+
"sc.defHP1=200;\n"+
"sc.defHP2=300;\n"+
"return sc.GetHP();";
object i = Script.Execute(callExpr);
result = "result=" + i;
}
if (GUI.Button(new Rect(200, 0, 200, 50), "Eval use Code"))
{
Script.ClearValue();
CSLE.CLS_Content content = new CSLE.CLS_Content(Script.env);
//得到脚本类型
var typeOfScript = Script.env.GetTypeByKeyword("ScriptClass1");
//调用脚本类构造创造一个实例
var thisOfScript = typeOfScript.function.New(content, null).value;
//调用脚本类成员变量赋值
//Debug.LogWarning(thisOfScript+","+ typeOfScript+","+ typeOfScript.function);
typeOfScript.function.MemberValueSet(content, thisOfScript, "defHP1", 200);
typeOfScript.function.MemberValueSet(content, thisOfScript, "defHP2", 300);
//调用脚本类成员函数
var returnvalue = typeOfScript.function.MemberCall(content, thisOfScript, "GetHP", null);
object i = returnvalue.value;
result = "result=" + i;
}
GUI.Label(new Rect(0, 50, 200, 50), result);
}
开发者ID:GraphicGame,项目名称:CSLightStudio,代码行数:35,代码来源:scriptTest1_02.cs
示例9: ComputeValue
public CLS_Content.Value ComputeValue(CLS_Content content)
{
content.InStack(this);
content.DepthAdd();
CLS_Content.Value vrt = null;
ICLS_Expression expr_while = listParam[1];
ICLS_Expression expr_block = listParam[0];
do
{
if (expr_block != null)
{
CLS_Content.Value v = expr_block.ComputeValue(content);
if (v != null)
{
if (v.breakBlock > 2)
vrt = v;
if (v.breakBlock > 1)
break;
}
}
} while ((bool)expr_while.ComputeValue(content).value);
content.DepthRemove();
content.OutStack(this);
return vrt;
}
开发者ID:wpszz,项目名称:CSLightForUnity,代码行数:29,代码来源:CLS_Expression_LoopDowhile.cs
示例10: ComputeValue
public CLS_Content.Value ComputeValue(CLS_Content content)
{
content.InStack(this);
int arraySize = listParam[0] == null ? (listParam.Count - 1) : (int)listParam[0].ComputeValue(content).value;
if (arraySize == 0)
throw new Exception("不能创建0长度数组");
int initValCount = listParam.Count - 1;
object[] initVals = new object[initValCount];
for (int i = 1; i < listParam.Count; i++)
{
initVals[i - 1] = listParam[i].ComputeValue(content).value;
}
CLS_Content.Value vcount = new CLS_Content.Value();
vcount.type = typeof(int);
vcount.value = arraySize;
BetterList<CLS_Content.Value> _params = CLS_Content.NewParamList();
_params.Add(vcount);
CLS_Content.Value newVal = type.function.New(content, _params);
for (int i = 0; i < initValCount; i++)
{
type.function.IndexSet(content, newVal.value, i, initVals[i]);
}
CLS_Content.PoolParamList(_params);
content.OutStack(this);
return newVal;
}
开发者ID:wpszz,项目名称:CSLightForUnity,代码行数:31,代码来源:CLS_Expression_FunctionNewArray.cs
示例11: ComputeValue
public CLS_Content.Value ComputeValue(CLS_Content content)
{
content.InStack(this);
//var parent = listParam[0].ComputeValue(content);
//var type = content.environment.GetType(parent.type);
List<CLS_Content.Value> _params = new List<CLS_Content.Value>();
for (int i = 0; i < listParam.Count; i++)
{
_params.Add(listParam[i].ComputeValue(content));
}
CLS_Content.Value value = null;
if (cache == null || cache.cachefail)
{
cache = new MethodCache();
value = type.function.StaticCall(content, functionName, _params, cache);
}
else
{
value = type.function.StaticCallCache(content, _params, cache);
}
content.OutStack(this);
return value;
//做数学计算
//从上下文取值
//_value = null;
//return null;
}
开发者ID:qq1792,项目名称:CSLightStudio,代码行数:28,代码来源:CLS_Expression_StaticFunction.cs
示例12: Math2Value
public override object Math2Value(CLS_Content env, char code, object left, CLS_Content.Value right, out CLType returntype)
{
returntype = null;
Delegate rightDele = null;
if (right.value is DeleFunction)
rightDele = CreateDelegate(env.environment, right.value as DeleFunction);
else if (right.value is DeleLambda)
rightDele = CreateDelegate(env.environment, right.value as DeleLambda);
else if (right.value is Delegate)
rightDele = right.value as Delegate;
if (rightDele != null)
{
Delegate leftDele = left as Delegate;
if (left == null)
return rightDele;
if (code == '+')
return Delegate.Combine(leftDele, rightDele);
if (code == '-')
return Delegate.Remove(leftDele, rightDele);
}
throw new NotSupportedException("" + right.value);
}
开发者ID:wpszz,项目名称:CSLightForUnity,代码行数:26,代码来源:RegHelper_Dele.cs
示例13: ComputeValue
public CLS_Content.Value ComputeValue(CLS_Content content)
{
content.InStack(this);
var parent = listParam[0].ComputeValue(content);
var typefunction = content.environment.GetType(parent.type).function;
if(parent.type is object)
{
SInstance s = parent.value as SInstance;
if(s!=null)
{
typefunction = s.type;
}
}
List<CLS_Content.Value> _params = new List<CLS_Content.Value>();
for (int i = 1; i < listParam.Count; i++)
{
_params.Add(listParam[i].ComputeValue(content));
}
CLS_Content.Value value = null;
if (cache == null||cache.cachefail)
{
cache = new MethodCache();
value = typefunction.MemberCall(content, parent.value, functionName, _params,cache);
}
else
{
value = typefunction.MemberCallCache(content, parent.value, _params, cache);
}
content.OutStack(this);
return value;
//做数学计算
//从上下文取值
//_value = null;
//return null;
}
开发者ID:qq1792,项目名称:CSLightStudio,代码行数:35,代码来源:CLS_Expression_MemberFunction.cs
示例14: ComputeValue
public CLS_Content.Value ComputeValue(CLS_Content content)
{
content.InStack(this);
CLS_Content.Value rv = new CLS_Content.Value();
{
var v = listParam[0].ComputeValue(content);
{
rv.type = v.type;
rv.value = v.value;
}
Exception err = v.value as Exception;
if (err != null)
{
throw err;
}
else
{
throw new Exception(v.ToString());
}
}
content.OutStack(this);
return rv;
//for 逻辑
//做数学计算
//从上下文取值
//_value = null;
}
开发者ID:GraphicGame,项目名称:CSLightStudio,代码行数:31,代码来源:CLS_Expression_Throw.cs
示例15: ComputeValue
public CLS_Content.Value ComputeValue(CLS_Content content)
{
content.InStack(this);
var parent = listParam[0].ComputeValue(content);
if (parent == null)
{
throw new Exception("调用空对象的方法:" + listParam[0].ToString() + ":" + ToString());
}
ICLS_TypeFunction typefunction = content.environment.GetType(parent.type).function;
if(parent.type is object)
{
SInstance s =parent.value as SInstance;
if(s!=null)
{
typefunction = s.type;
}
}
//var type = content.environment.GetType(parent.type);
var value=typefunction.MemberValueGet(content, parent.value, membername);
content.OutStack(this);
return value;
//做数学计算
//从上下文取值
//_value = null;
//return null;
}
开发者ID:lightszero,项目名称:cslightcore,代码行数:27,代码来源:CLS_Expression_MemberFind.cs
示例16: ComputeValue
public CLS_Content.Value ComputeValue(CLS_Content content)
{
content.InStack(this);
CLS_Content.Value value = type.function.StaticValueGet(content, staticmembername);
content.OutStack(this);
return value;
}
开发者ID:wpszz,项目名称:CSLightForUnity,代码行数:7,代码来源:CLS_Expression_StaticFind.cs
示例17: ComputeValue
public CLS_Content.Value ComputeValue(CLS_Content content)
{
content.InStack(this);
if (_listParam != null && _listParam.Count > 0)
{
CLS_Content.Value v = _listParam[0].ComputeValue(content);
object val = v.value;
if ((Type)value_type == typeof(CLS_Type_Var.var))
{
if(v.type!=null)
value_type = v.type;
}
else if (v.type != value_type)
{
val = content.environment.GetType(v.type).ConvertTo(content, v.value, value_type);
}
content.DefineAndSet(value_name, value_type, val);
}
else
{
content.Define(value_name, value_type);
}
//设置环境变量为
content.OutStack(this);
return null;
}
开发者ID:GraphicGame,项目名称:CSLightStudio,代码行数:32,代码来源:CLS_Expression_Define.cs
示例18: ConvertTo
public virtual object ConvertTo(CLS_Content env, object src, CLType targetType)
{
//type.get
if (_type.IsEnum)
{
if ((Type)targetType == typeof(int))
return System.Convert.ToInt32(src);
else if ((Type)targetType == typeof(uint))
return System.Convert.ToUInt32(src);
else if ((Type)targetType == typeof(short))
return System.Convert.ToInt16(src);
else if ((Type)targetType == typeof(ushort))
return System.Convert.ToUInt16(src);
else
{
return System.Convert.ToInt32(src);
}
}
var ms = _type.GetMethods();
foreach (var m in ms)
{
if ((m.Name == "op_Implicit" || m.Name == "op_Explicit") && m.ReturnType == (Type)targetType)
{
return m.Invoke(null, new object[] { src });
}
}
return src;
}
开发者ID:GraphicGame,项目名称:CSLightStudio,代码行数:31,代码来源:RegHelper_Type.cs
示例19: ComputeValue
public CLS_Content.Value ComputeValue(CLS_Content content)
{
content.InStack(this);
CLS_Content.Value rv = new CLS_Content.Value();
rv.breakBlock = 10;
if (listParam.Count > 0&&listParam[0]!=null)
{
var v = listParam[0].ComputeValue(content);
{
rv.type = v.type;
rv.value = v.value;
}
}
else
{
rv.type = typeof(void);
}
content.OutStack(this);
return rv;
//for 逻辑
//做数学计算
//从上下文取值
//_value = null;
}
开发者ID:GraphicGame,项目名称:CSLightStudio,代码行数:25,代码来源:CLS_Expression_LoopReturn.cs
示例20: New
public override CLS_Content.Value New(CLS_Content content, BetterList<CLS_Content.Value> _params)
{
CLS_Content.Value val = new CLS_Content.Value();
val.type = typeof(UnityEngine.Random);
val.value = new UnityEngine.Random();
return val;
}
开发者ID:wpszz,项目名称:CSLightForUnity,代码行数:7,代码来源:ToCSLightRandom.cs
注:本文中的CSLE.CLS_Content类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论