public override Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda)
        {
            Action dele;

            if (lambda.expr_func != null)
            {
                dele = () =>
                {
#if UNITY_EDITOR
                    try{
#endif
                    lambda.expr_func.ComputeValue(lambda.content);
#if UNITY_EDITOR
                }catch (System.Exception ex) { lambda.content.environment.logger.Log_Error(ex.Message + "\n" + lambda.content.DumpStack() + ex); }
#endif
                };
            }
            else
            {
                dele = () => { };
            }

            if (this.sysType != typeof(Action))
            {
                return(Delegate.CreateDelegate(this.sysType, dele.Target, dele.Method));
            }
            else
            {
                return(dele);
            }
        }
        public override Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda)
        {
            Action dele;
            if (lambda.expr_func != null)
            {
                dele = () =>
                {
            #if UNITY_EDITOR
                    try{
            #endif
                    lambda.expr_func.ComputeValue(lambda.content);
            #if UNITY_EDITOR
                    }catch (System.Exception ex) { lambda.content.environment.logger.Log_Error(ex.Message + "\n" + lambda.content.DumpStack() + ex); }
            #endif
                };
            }
            else
            {
                dele = () => { };
            }

            if (this.sysType != typeof(Action))
            {
                return Delegate.CreateDelegate(this.sysType, dele.Target, dele.Method);
            }
            else
            {
                return dele;
            }
        }
Example #3
0
        public override Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda)
        {
            NonVoidDelegate dele;

            if (lambda.expr_func != null)
            {
                dele = delegate(T param0, T1 param1, T2 param2)
                {
#if UNITY_EDITOR
                    try{
#endif
                    lambda.content.DepthAdd();
                    lambda.content.DefineAndSet(lambda.paramNames[0], typeof(T), param0);
                    lambda.content.DefineAndSet(lambda.paramNames[1], typeof(T1), param1);
                    lambda.content.DefineAndSet(lambda.paramNames[2], typeof(T2), param2);
                    CLS_Content.Value retValue = lambda.expr_func.ComputeValue(lambda.content);
                    lambda.content.DepthRemove();
                    return((ReturnType)retValue.value);

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

            return(Delegate.CreateDelegate(this.type, dele.Target, dele.Method));
        }
        public Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda)
        {
            var pnames = lambda.paramNames;
            var expr = lambda.expr_func;
            Action dele = () =>
            {
                if (expr != null)
                {
                    CLS_Content content = lambda.content.Clone();
                    content.DepthAdd();

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

                    expr.ComputeValue(content);

                    content.DepthRemove();
                }
            };
            Delegate d = dele as Delegate;
            if ((Type)this.type != typeof(Action))
            {
                return Delegate.CreateDelegate(this.type, d.Target, d.Method);
            }
            else
            {
                return dele;
            }
        }
        public override Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda)
        {
            Action <T, T1> dele;

            if (lambda.expr_func != null)
            {
                dele = (T param0, T1 param1) =>
                {
#if UNITY_EDITOR
                    try{
#endif
                    lambda.content.DepthAdd();
                    lambda.content.DefineAndSet(lambda.paramNames[0], typeof(T), param0);
                    lambda.content.DefineAndSet(lambda.paramNames[1], typeof(T1), param1);
                    lambda.expr_func.ComputeValue(lambda.content);
                    lambda.content.DepthRemove();
#if UNITY_EDITOR
                }catch (System.Exception ex) { lambda.content.environment.logger.Log_Error(ex.Message + "\n" + lambda.content.DumpStack() + ex); }
#endif
                };
            }
            else
            {
                dele = (T param0, T1 param1) => { };
            }

            if (this.sysType != typeof(Action <T, T1>))
            {
                return(Delegate.CreateDelegate(this.sysType, dele.Target, dele.Method));
            }
            else
            {
                return(dele);
            }
        }
        public Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda)
        {
            var    pnames = lambda.paramNames;
            var    expr   = lambda.expr_func;
            Action dele   = () =>
            {
                if (expr != null)
                {
                    CLS_Content content = lambda.content.Clone();
                    content.DepthAdd();


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

                    expr.ComputeValue(content);

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

            if ((Type)this.type != typeof(Action))
            {
                return(Delegate.CreateDelegate(this.type, d.Target, d.Method));
            }
            else
            {
                return(dele);
            }
        }
        public override Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda)
        {
            NonVoidDelegate dele;

            if (lambda.expr_func != null)
            {
                dele = delegate()
                {
#if UNITY_EDITOR
                    try{
#endif
                    CLS_Content.Value retValue = lambda.expr_func.ComputeValue(lambda.content);
                    return((ReturnType)retValue.value);

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

            return(Delegate.CreateDelegate(this.type, dele.Target, dele.Method));
        }
        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));
        }
Example #9
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);
            }
        }
Example #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));
        }
Example #11
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 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));
        }
Example #13
0
        public Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda)
        {
            var pnames = lambda.paramNames;
            var expr   = lambda.expr_func;

            NonVoidDelegate dele = delegate() {
                if (expr != null)
                {
                    CLS_Content content = lambda.content.Clone();

                    content.DepthAdd();
                    CLS_Content.Value retValue = expr.ComputeValue(content);
                    content.DepthRemove();
                    return((ReturnType)retValue.value);
                }
                return(default(ReturnType));
            };

            Delegate d = dele;

            return(Delegate.CreateDelegate(this.type, d.Target, d.Method));
        }
        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);
            }
        }
Example #15
0
 public virtual Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda)
 {
     throw new Exception("请重载实现功能");
 }
Example #16
0
 public virtual Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda)
 {
     throw new Exception("请重载实现功能");
 }
        public Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda)
        {
            CLS_Content content = lambda.content.Clone();
            //var pnames = lambda.paramNames;
            var expr = lambda.expr_func;
            Action dele = () =>
            {
                if (expr != null)
                {
                    try
                    {
                        content.DepthAdd();


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

                        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());
                    }
                }
            };
            Delegate d = dele as Delegate;
            if ((Type)this.type != typeof(Action))
            {
                return Delegate.CreateDelegate(this.type, d.Target, d.Method);
            }
            else
            {
                return dele;
            }
        }