当前位置: 首页>>代码示例>>C#>>正文


C# CLS_Content.DefineAndSet方法代码示例

本文整理汇总了C#中CSLE.CLS_Content.DefineAndSet方法的典型用法代码示例。如果您正苦于以下问题:C# CLS_Content.DefineAndSet方法的具体用法?C# CLS_Content.DefineAndSet怎么用?C# CLS_Content.DefineAndSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSLE.CLS_Content的用法示例。


在下文中一共展示了CLS_Content.DefineAndSet方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: ComputeValue

 public CLS_Content.Value ComputeValue(CLS_Content content)
 {
     content.InStack(this);
     if (_listParam != null && _listParam.Count > 0)
         content.DefineAndSet(value_name, value_type, _listParam[0].ComputeValue(content).value);
     else
         content.Define(value_name, value_type);
     content.OutStack(this);
     return null;
 }
开发者ID:wpszz,项目名称:CSLightForUnity,代码行数:10,代码来源:CLS_Expression_Define.cs

示例3: ComputeValue

        public CLS_Content.Value ComputeValue(CLS_Content content)
        {
            content.InStack(this);
            List<string> depth__;
            content.Record(out depth__);
            try
            {
                ICLS_Expression expr = listParam[0];
                if (expr is CLS_Expression_Block)
                {
                    expr.ComputeValue(content);
                }
                else
                {
                    content.DepthAdd();
                    expr.ComputeValue(content);
                    content.DepthRemove();
                }

            }
            catch (Exception err)
            {
                bool bParse = false;
                int i = 1;
                while (i < listParam.Count)
                {
                    CLS_Expression_Define def = listParam[i] as CLS_Expression_Define;
                    if (err.GetType()==(Type)def.value_type || err.GetType().IsSubclassOf((Type)def.value_type))
                    {
                        content.DepthAdd();
                        content.DefineAndSet(def.value_name, def.value_type, err);

                        listParam[i + 1].ComputeValue(content);
                        content.DepthRemove();
                        bParse = true;
                        break;
                    }
                    i += 2;
                }
                if (!bParse)
                {
                    throw err;
                }
            }
            content.Restore(depth__, this);
            //while((bool)expr_continue.value);

            //for 逻辑
            //做数学计算
            //从上下文取值
            //_value = null;
            content.OutStack(this);
            return null;
        }
开发者ID:GraphicGame,项目名称:CSLightStudio,代码行数:54,代码来源:CLS_Expression_LoopTry.cs

示例4: MemberCall

        public CLS_Content.Value MemberCall(CLS_Content contentParent, object object_this, string func, IList<CLS_Content.Value> _params,MethodCache cache=null)
        {
            if (cache != null)
            {
                cache.cachefail = true;
            }
            if (this.functions.ContainsKey(func))
            {
                if (this.functions[func].bStatic == false)
                {
                    CLS_Content content = new CLS_Content(contentParent.environment, true);

                    contentParent.InStack(content);//把这个上下文推给上层的上下文,这样如果崩溃是可以一层层找到原因的
                    content.CallType = this;
                    content.CallThis = object_this as SInstance;
                    content.function = func;
                    for (int i = 0; i < this.functions[func]._paramtypes.Count; i++)
                    //int i = 0;
                    //foreach (var p in this.functions[func]._params)
                    {
                        content.DefineAndSet(this.functions[func]._paramnames[i], this.functions[func]._paramtypes[i].type, _params[i].value);
                        //i++;
                    }
                    CLS_Content.Value value = null;
                    var funcobj = this.functions[func];
                    if (this.bInterface)
                    {
                        content.CallType = (object_this as SInstance).type;
                        funcobj = (object_this as SInstance).type.functions[func];
                    }
                    if (funcobj.expr_runtime != null)
                    {
                        value = funcobj.expr_runtime.ComputeValue(content);
                        if (value != null)
                            value.breakBlock = 0;
                    }
                    contentParent.OutStack(content);

                    return value;
                }
            }
            else if (this.members.ContainsKey(func))
            {
                if (this.members[func].bStatic == false)
                {
                    Delegate dele = (object_this as SInstance).member[func].value as Delegate;
                    if (dele != null)
                    {
                        CLS_Content.Value value = new CLS_Content.Value();
                        value.type = null;
                        object[] objs = new object[_params.Count];
                        for (int i = 0; i < _params.Count; i++)
                        {
                            objs[i] = _params[i].value;
                        }
                        value.value = dele.DynamicInvoke(objs);
                        if (value.value != null)
                            value.type = value.value.GetType();
                        value.breakBlock = 0;
                        return value;
                    }
                }

            }
            throw new NotImplementedException();
        }
开发者ID:qq1792,项目名称:CSLightStudio,代码行数:66,代码来源:CLS_Type_Class.cs

示例5: StaticCall

        public CLS_Content.Value StaticCall(CLS_Content contentParent, string function, IList<CLS_Content.Value> _params, MethodCache cache = null)
        {
            if(cache!=null)
            {
                cache.cachefail = true;
            }
            NewStatic(contentParent.environment);
            if (this.functions.ContainsKey(function))
            {
                if (this.functions[function].bStatic == true)
                {
                    CLS_Content content = new CLS_Content(contentParent.environment, true);

                    contentParent.InStack(content);//把这个上下文推给上层的上下文,这样如果崩溃是可以一层层找到原因的
                    content.CallType = this;
                    content.CallThis = null;
                    content.function = function;
                    // int i = 0;
                    for (int i = 0; i < functions[function]._paramtypes.Count; i++)
                    //foreach (var p in this.functions[function]._params)
                    {
                        content.DefineAndSet(functions[function]._paramnames[i], functions[function]._paramtypes[i].type, _params[i].value);
                        //i++;
                    }
                    //var value = this.functions[function].expr_runtime.ComputeValue(content);
                    CLS_Content.Value value = null;
                    if (this.functions[function].expr_runtime != null)
                    {
                        value = this.functions[function].expr_runtime.ComputeValue(content);
                        if(value!=null)
                            value.breakBlock = 0;
                    }
                    else
                    {

                    }
                    contentParent.OutStack(content);

                    return value;
                }
            }
            else if (this.members.ContainsKey(function))
            {
                if (this.members[function].bStatic == true)
                {
                    Delegate dele = this.staticMemberInstance[function].value as Delegate;
                    if (dele != null)
                    {
                        CLS_Content.Value value = new CLS_Content.Value();
                        value.type = null;
                        object[] objs = new object[_params.Count];
                        for (int i = 0; i < _params.Count; i++)
                        {
                            objs[i] = _params[i].value;
                        }
                        value.value = dele.DynamicInvoke(objs);
                        if (value.value != null)
                            value.type = value.value.GetType();
                        value.breakBlock = 0;
                        return value;
                    }
                }

            }
            throw new NotImplementedException();
        }
开发者ID:qq1792,项目名称:CSLightStudio,代码行数:66,代码来源:CLS_Type_Class.cs


注:本文中的CSLE.CLS_Content.DefineAndSet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。