DefineAndSet() public méthode

public DefineAndSet ( string name, CLType type, object value ) : void
name string
type CLType
value object
Résultat void
Exemple #1
0
        public Delegate CreateDelegate(ICLS_Environment env, DeleFunction delefunc)
        {
            CLS_Content        content = new CLS_Content(env);
            DeleFunction       _func   = delefunc;
            Action <T, T1, T2> dele    = (T param0, T1 param1, T2 param2) =>
            {
                content.DepthAdd();
                content.CallThis = _func.callthis;
                content.CallType = _func.calltype;
                content.function = _func.function;
                var func = _func.calltype.functions[_func.function];

                content.DefineAndSet(func._paramnames[0], func._paramtypes[0].type, param0);
                content.DefineAndSet(func._paramnames[1], func._paramtypes[1].type, param1);
                content.DefineAndSet(func._paramnames[2], func._paramtypes[2].type, param2);

                func.expr_runtime.ComputeValue(content);
                content.DepthRemove();
            };
            Delegate d = dele as Delegate;

            if ((Type)this.type != typeof(Action <T, T1, T2>))
            {
                return(Delegate.CreateDelegate(this.type, d.Target, d.Method));
            }
            else
            {
                return(dele);
            }
        }
Exemple #2
0
        public Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda)
        {
            CLS_Content        content = lambda.content.Clone();
            var                pnames  = lambda.paramNames;
            var                expr    = lambda.expr_func;
            Action <T, T1, T2> dele    = (T param0, T1 param1, T2 param2) =>
            {
                content.DepthAdd();


                content.DefineAndSet(pnames[0], typeof(T), param0);
                content.DefineAndSet(pnames[1], typeof(T1), param1);
                content.DefineAndSet(pnames[2], typeof(T2), param2);
                expr.ComputeValue(content);

                content.DepthRemove();
            };
            Delegate d = dele as Delegate;

            if ((Type)this.type != typeof(Action <T, T1, T2>))
            {
                return(Delegate.CreateDelegate(this.type, d.Target, d.Method));
            }
            else
            {
                return(dele);
            }
        }
        public Delegate CreateDelegate(ICLS_Environment env, DeleFunction delefunc)
        {
            DeleFunction _func = delefunc;
            Delegate     _dele = delefunc.cacheFunction(null);

            if (_dele != null)
            {
                return(_dele);
            }
            NonVoidDelegate dele = delegate(T param0, T1 param1, T2 param2) {
                var func = _func.calltype.functions[_func.function];
                if (func.expr_runtime != null)
                {
                    CLS_Content content = new CLS_Content(env);

                    content.DepthAdd();
                    content.CallThis = _func.callthis;
                    content.CallType = _func.calltype;
                    content.function = _func.function;

                    content.DefineAndSet(func._paramnames[0], func._paramtypes[0].type, param0);
                    content.DefineAndSet(func._paramnames[1], func._paramtypes[1].type, param1);
                    content.DefineAndSet(func._paramnames[2], func._paramtypes[2].type, param2);

                    CLS_Content.Value retValue = func.expr_runtime.ComputeValue(content);
                    content.DepthRemove();

                    return((ReturnType)retValue.value);
                }
                return(default(ReturnType));
            };

            _dele = Delegate.CreateDelegate(this.type, dele.Target, dele.Method);
            return(delefunc.cacheFunction(_dele));
        }
        public Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda)
        {
            var pnames = lambda.paramNames;
            var expr   = lambda.expr_func;

            NonVoidDelegate dele = delegate(T param0, T1 param1, T2 param2) {
                if (expr != null)
                {
                    CLS_Content content = lambda.content.Clone();

                    content.DepthAdd();

                    content.DefineAndSet(pnames[0], typeof(T), param0);
                    content.DefineAndSet(pnames[1], typeof(T1), param1);
                    content.DefineAndSet(pnames[2], typeof(T2), param2);
                    CLS_Content.Value retValue = expr.ComputeValue(content);

                    content.DepthRemove();

                    return((ReturnType)retValue.value);
                }
                return(default(ReturnType));
            };

            Delegate d = dele as Delegate;

            return(Delegate.CreateDelegate(this.type, d.Target, d.Method));
        }
Exemple #5
0
        public Delegate CreateDelegate(ICLS_Environment env, DeleFunction delefunc)
        {
            DeleFunction _func = delefunc;
            Delegate     _dele = delefunc.cacheFunction(this._type, null);

            if (_dele != null)
            {
                return(_dele);
            }
            Action <T, T1, T2> dele = (T param0, T1 param1, T2 param2) =>
            {
                var func = _func.calltype.functions[_func.function];
                if (func.expr_runtime != null)
                {
                    CLS_Content content = new CLS_Content(env, true);
                    try
                    {
                        content.DepthAdd();
                        content.CallThis = _func.callthis;
                        content.CallType = _func.calltype;
                        content.function = _func.function;


                        content.DefineAndSet(func._paramnames[0], func._paramtypes[0].type, param0);
                        content.DefineAndSet(func._paramnames[1], func._paramtypes[1].type, param1);
                        content.DefineAndSet(func._paramnames[2], func._paramtypes[2].type, param2);

                        func.expr_runtime.ComputeValue(content);
                        content.DepthRemove();
                    }
                    catch (Exception err)
                    {
                        string errinfo = "Dump Call in:";
                        if (_func.calltype != null)
                        {
                            errinfo += _func.calltype.Name + "::";
                        }
                        if (_func.function != null)
                        {
                            errinfo += _func.function;
                        }
                        errinfo += "\n";
                        env.logger.Log(errinfo + content.Dump());
                        throw err;
                    }
                }
            };
            Delegate d = dele as Delegate;

            if ((Type)this.type != typeof(Action))
            {
                _dele = Delegate.CreateDelegate(this.type, d.Target, d.Method);
            }
            else
            {
                _dele = dele;
            }
            return(delefunc.cacheFunction(this._type, _dele));
        }
        public Delegate CreateDelegate(ICLS_Environment env, DeleFunction delefunc)
        {
            DeleFunction _func = delefunc;
            Delegate     _dele = delefunc.cacheFunction(this._type, null);

            if (_dele != null)
            {
                return(_dele);
            }
            NonVoidDelegate dele = delegate(T param0, T1 param1, T2 param2)
            {
                var func = _func.calltype.functions[_func.function];
                if (func.expr_runtime != null)
                {
                    CLS_Content content = new CLS_Content(env, true);
                    try
                    {
                        content.DepthAdd();
                        content.CallThis = _func.callthis;
                        content.CallType = _func.calltype;
                        content.function = _func.function;

                        content.DefineAndSet(func._paramnames[0], func._paramtypes[0].type, param0);
                        content.DefineAndSet(func._paramnames[1], func._paramtypes[1].type, param1);
                        content.DefineAndSet(func._paramnames[2], func._paramtypes[2].type, param2);

                        CLS_Content.Value retValue = func.expr_runtime.ComputeValue(content);
                        content.DepthRemove();

                        return((ReturnType)retValue.value);
                    }
                    catch (Exception err)
                    {
                        string errinfo = "Dump Call in:";
                        if (_func.calltype != null)
                        {
                            errinfo += _func.calltype.Name + "::";
                        }
                        if (_func.function != null)
                        {
                            errinfo += _func.function;
                        }
                        errinfo += "\n";
                        env.logger.Log(errinfo + content.Dump());
                        throw err;
                    }
                }
                return(default(ReturnType));
            };

            _dele = Delegate.CreateDelegate(this.type, dele.Target, dele.Method);
            return(delefunc.cacheFunction(this._type, _dele));
        }
Exemple #7
0
        public Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda)
        {
            CLS_Content        content = lambda.content.Clone();
            var                pnames  = lambda.paramNames;
            var                expr    = lambda.expr_func;
            Action <T, T1, T2> dele    = (T param0, T1 param1, T2 param2) =>
            {
                if (expr != null)
                {
                    try
                    {
                        content.DepthAdd();

                        content.DefineAndSet(pnames[0], typeof(T), param0);
                        content.DefineAndSet(pnames[1], typeof(T1), param1);
                        content.DefineAndSet(pnames[2], typeof(T2), param2);
                        expr.ComputeValue(content);

                        content.DepthRemove();
                    }
                    catch (Exception err)
                    {
                        string errinfo = "Dump Call lambda in:";
                        if (content.CallType != null)
                        {
                            errinfo += content.CallType.Name + "::";
                        }
                        if (content.function != null)
                        {
                            errinfo += content.function;
                        }
                        errinfo += "\n";
                        env.logger.Log(errinfo + content.Dump());
                        throw err;
                    }
                }
            };
            Delegate d = dele as Delegate;

            if ((Type)this.type != typeof(Action <T, T1, T2>))
            {
                return(Delegate.CreateDelegate(this.type, d.Target, d.Method));
            }
            else
            {
                return(dele);
            }
        }
        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;
        }
        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);
        }
Exemple #10
0
        public Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda)
        {
            CLS_Content content = lambda.content.Clone();
            var         pnames  = lambda.paramNames;
            var         expr    = lambda.expr_func;

            NonVoidDelegate dele = delegate(T param)
            {
                if (expr != null)
                {
                    try
                    {
                        content.DepthAdd();

                        content.DefineAndSet(pnames[0], typeof(T), param);
                        CLS_Content.Value retValue = expr.ComputeValue(content);

                        content.DepthRemove();
                        return((ReturnType)retValue.value);
                    }
                    catch (Exception err)
                    {
                        env.logger.Log(content.Dump());
                        throw err;
                    }
                }
                return(default(ReturnType));
            };

            Delegate d = dele as Delegate;

            return(Delegate.CreateDelegate(this.type, d.Target, d.Method));
        }
Exemple #11
0
        public override Delegate CreateDelegate(ICLS_Environment env, DeleFunction delefunc)
        {
            Delegate _dele = delefunc.cacheFunction(null);

            if (_dele != null)
            {
                return(_dele);
            }

            var func = delefunc.calltype.functions[delefunc.function];
            Action <T, T1, T2> dele;

            if (func.expr_runtime != null)
            {
                dele = (T param0, T1 param1, T2 param2) =>
                {
                    CLS_Content content = CLS_Content.NewContent(env);
#if UNITY_EDITOR
                    try{
#endif
                    content.CallThis = delefunc.callthis;
                    content.CallType = delefunc.calltype;
                    content.DefineAndSet(func._paramnames[0], func._paramtypes[0].type, param0);
                    content.DefineAndSet(func._paramnames[1], func._paramtypes[1].type, param1);
                    content.DefineAndSet(func._paramnames[2], func._paramtypes[2].type, param2);
                    func.expr_runtime.ComputeValue(content);
                    CLS_Content.PoolContent(content);
#if UNITY_EDITOR
                }catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); }
#endif
                };
            }
            else
            {
                dele = (T param0, T1 param1, T2 param2) => { };
            }

            if (this.sysType != typeof(Action <T, T1, T2>))
            {
                _dele = Delegate.CreateDelegate(this.sysType, dele.Target, dele.Method);
            }
            else
            {
                _dele = dele;
            }
            return(delefunc.cacheFunction(_dele));
        }
Exemple #12
0
        public CLS_Content.Value StaticCall(CLS_Content contentParent, string function, IList <CLS_Content.Value> _params)
        {
            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);
                    }
                    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();
                        }

                        return(value);
                    }
                }
            }
            throw new NotImplementedException();
        }
        public Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda)
        {
            CLS_Content content = lambda.content.Clone();
            var         pnames  = lambda.paramNames;
            var         expr    = lambda.expr_func;

            NonVoidDelegate dele = delegate(T param0, T1 param1)
            {
                if (expr != null)
                {
                    try
                    {
                        content.DepthAdd();

                        content.DefineAndSet(pnames[0], typeof(T), param0);
                        content.DefineAndSet(pnames[1], typeof(T1), param1);

                        CLS_Content.Value retValue = expr.ComputeValue(content);

                        content.DepthRemove();

                        return((ReturnType)retValue.value);
                    }
                    catch (Exception err)
                    {
                        string errinfo = "Dump Call lambda in:";
                        if (content.CallType != null)
                        {
                            errinfo += content.CallType.Name + "::";
                        }
                        if (content.function != null)
                        {
                            errinfo += content.function;
                        }
                        errinfo += "\n";
                        env.logger.Log(errinfo + content.Dump());
                        throw err;
                    }
                }
                return(default(ReturnType));
            };

            Delegate d = dele as Delegate;

            return(Delegate.CreateDelegate(this.type, d.Target, d.Method));
        }
 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;
 }
        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;
        }
        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);
        }
        public override Delegate CreateDelegate(ICLS_Environment env, DeleFunction delefunc)
        {
            Delegate _dele = delefunc.cacheFunction(null);

            if (_dele != null)
            {
                return(_dele);
            }

            var             func = delefunc.calltype.functions[delefunc.function];
            NonVoidDelegate dele;

            if (func.expr_runtime != null)
            {
                dele = delegate(T param, T1 param1)
                {
                    CLS_Content content = CLS_Content.NewContent(env);
#if UNITY_EDITOR
                    try{
#endif
                    content.CallThis = delefunc.callthis;
                    content.CallType = delefunc.calltype;
                    content.DefineAndSet(func._paramnames[0], func._paramtypes[0].type, param);
                    content.DefineAndSet(func._paramnames[1], func._paramtypes[1].type, param1);
                    CLS_Content.Value retValue = func.expr_runtime.ComputeValue(content);
                    CLS_Content.PoolContent(content);
                    return((ReturnType)retValue.value);

#if UNITY_EDITOR
                }catch (System.Exception ex) { content.environment.logger.Log_Error(ex.Message + "\n" + content.DumpStack() + ex); return(default(ReturnType)); }
#endif
                };
            }
            else
            {
                dele = delegate(T param, T1 param1) { return(default(ReturnType)); };
            }

            _dele = Delegate.CreateDelegate(this.type, dele.Target, dele.Method);
            return(delefunc.cacheFunction(_dele));
        }
        public Delegate CreateDelegate(ICLS_Environment env, DeleFunction delefunc)
        {
            DeleFunction _func = delefunc;
            Delegate     _dele = delefunc.cacheFunction(null);

            if (_dele != null)
            {
                return(_dele);
            }
            Action <T, T1> dele = (T param0, T1 param1) =>
            {
                var func = _func.calltype.functions[_func.function];

                if (func.expr_runtime != null)
                {
                    CLS_Content content = new CLS_Content(env);

                    content.DepthAdd();
                    content.CallThis = _func.callthis;
                    content.CallType = _func.calltype;
                    content.function = _func.function;

                    content.DefineAndSet(func._paramnames[0], func._paramtypes[0].type, param0);
                    content.DefineAndSet(func._paramnames[1], func._paramtypes[1].type, param1);

                    func.expr_runtime.ComputeValue(content);
                    content.DepthRemove();
                }
            };
            Delegate d = dele as Delegate;

            if ((Type)this.type != typeof(Action))
            {
                _dele = Delegate.CreateDelegate(this.type, d.Target, d.Method);
            }
            else
            {
                _dele = dele;
            }
            return(delefunc.cacheFunction(_dele));
        }
Exemple #19
0
 public void SetValue(string name, object v)
 {
     if (env == null)
     {
         Init();
     }
     if (content == null)
     {
         content = env.CreateContent();
     }
     content.DefineAndSet(name, v.GetType(), v);
 }
 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);
 }
        public Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda)
        {
            CLS_Content content = lambda.content.Clone();
            var         pnames  = lambda.paramNames;
            var         expr    = lambda.expr_func;
            Action <T>  dele    = (T param0) =>
            {
                if (expr != null)
                {
                    try
                    {
                        content.DepthAdd();


                        content.DefineAndSet(pnames[0], typeof(T), param0);

                        expr.ComputeValue(content);

                        content.DepthRemove();
                    }
                    catch (Exception err)
                    {
                        env.logger.Log(content.Dump());
                        throw err;
                    }
                }
            };
            Delegate d = dele as Delegate;

            if ((Type)this.type != typeof(Action <T>))
            {
                return(Delegate.CreateDelegate(this.type, d.Target, d.Method));
            }
            else
            {
                return(dele);
            }
        }
        public CLS_Content.Value StaticCall(CLS_Content contentParent, string func, BetterList <CLS_Content.Value> _params)
        {
            if (staticMemberContent == null)
            {
                NewStatic(contentParent.environment);
            }

            // 静态函数判断
            Function fun;

            if (this.functions.TryGetValue(func, out fun))
            {
#if UNITY_EDITOR
                if (!fun.bStatic)
                {
                    throw new Exception("成员函数必须通过实例来调用: " + this.Name + "." + func);
                }
#endif
                CLS_Content.Value value = null;
                if (fun.expr_runtime != null)
                {
                    CLS_Content content = CLS_Content.NewContent(contentParent.environment);
#if UNITY_EDITOR
                    contentParent.InStackContent(content);//把这个上下文推给上层的上下文,这样如果崩溃是可以一层层找到原因的
#endif
                    content.CallType = this;
                    content.CallThis = null;

                    for (int i = 0, count = fun._paramtypes.Count; i < count; i++)
                    {
                        content.DefineAndSet(fun._paramnames[i], fun._paramtypes[i].type, _params[i].value);
                    }

                    value = fun.expr_runtime.ComputeValue(content);
                    if (value != null)
                    {
                        value.breakBlock = 0;
                    }
#if UNITY_EDITOR
                    contentParent.OutStackContent(content);
#endif
                    CLS_Content.PoolContent(content);
                }
                return(value);
            }

            // 委托判断
            CLS_Content.Value smDeleVal;
            if (this.staticMemberValues.TryGetValue(func, out smDeleVal))
            {
                Delegate dele = smDeleVal.value as Delegate;
                if (dele != null)
                {
                    CLS_Content.Value value = new CLS_Content.Value();
                    value.type = null;
                    object[] objs = CLS_Content.ParamObjsArray[_params.size];
                    for (int i = 0; i < _params.size; 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("未实现静态函数: " + this.Name + "." + func);
        }
Exemple #23
0
        public CLS_Content.Value MemberCall(CLS_Content contentParent, object object_this, string func, IList <CLS_Content.Value> _params)
        {
            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();
        }
        public CLS_Content.Value MemberCall(CLS_Content contentParent, object object_this, string func, BetterList <CLS_Content.Value> _params, bool isBaseCall = false)
        {
            SInstance callThis = object_this as SInstance;

            // 成员函数判断
            Function fun;

            if (this.functions.TryGetValue(func, out fun))
            {
#if UNITY_EDITOR
                if (fun.bStatic)
                {
                    throw new Exception("不能通过实例来调用静态函数: " + this.Name + "." + func);
                }
#endif
                CLS_Content.Value value = null;

                SType callType = this;

                if (isBaseCall)
                {
                    SType          tempType = contentParent.CallType.BaseType;
                    SType.Function tempFun;
                    while (tempType != null)
                    {
                        if (tempType.functions.TryGetValue(func, out tempFun))
                        {
                            if (tempFun.ownerType == null || tempFun.ownerType == tempType)
                            {
                                callType = tempType;
                                fun      = tempFun;
                                break;
                            }
                        }
                        tempType = tempType.BaseType;
                    }
                }
                else
                {
                    if (callType != callThis.type)
                    {
                        SType    tempType = callThis.type;
                        Function tempFun;
                        while (tempType != null)
                        {
                            if (tempType.functions.TryGetValue(func, out tempFun))
                            {
                                if (tempFun.ownerType == null || tempFun.ownerType == tempType)
                                {
                                    callType = tempType;
                                    fun      = tempFun;
                                    break;
                                }
                            }
                            tempType = tempType.BaseType;
                        }
                    }
                    else if (fun.ownerType != null && fun.ownerType != callType)
                    {
                        callType = fun.ownerType;
                    }
                }

                if (fun.expr_runtime != null)
                {
                    CLS_Content content = CLS_Content.NewContent(contentParent.environment);
#if UNITY_EDITOR
                    contentParent.InStackContent(content);//把这个上下文推给上层的上下文,这样如果崩溃是可以一层层找到原因的
#endif
                    content.CallType = callType;
                    content.CallThis = callThis;

                    for (int i = 0, count = fun._paramtypes.Count; i < count; i++)
                    {
                        content.DefineAndSet(fun._paramnames[i], fun._paramtypes[i].type, _params[i].value);
                    }

                    value = fun.expr_runtime.ComputeValue(content);
                    if (value != null)
                    {
                        value.breakBlock = 0;
                    }
#if UNITY_EDITOR
                    contentParent.OutStackContent(content);
#endif
                    CLS_Content.PoolContent(content);
                }

                return(value);
            }

            // 委托判断
            CLS_Content.Value mDeleVal;
            if (callThis.member.TryGetValue(func, out mDeleVal))
            {
                Delegate dele = mDeleVal.value as Delegate;
                if (dele != null)
                {
                    CLS_Content.Value value = new CLS_Content.Value();
                    value.type = null;
                    object[] objs = CLS_Content.ParamObjsArray[_params.size];
                    for (int i = 0; i < _params.size; 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("未实现成员函数: " + this.Name + "." + func);
        }
        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();
        }
        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();
        }