CSLE.RegHelper_Type.Math2Value C# (CSharp) 메소드

Math2Value() 공개 메소드

public Math2Value ( CLS_Content env, char code, object left, CLS_Content right, CLType &returntype ) : object
env CLS_Content
code char
left object
right CLS_Content
returntype CLType
리턴 object
        public virtual object Math2Value(CLS_Content env, char code, object left, CLS_Content.Value right, out CLType returntype)
        {
            returntype = type;
            System.Reflection.MethodInfo call = null;
            //var m = ((Type)type).GetMembers();
            if (code == '+')
            {
                if ((Type)right.type == typeof(string))
                {
                    returntype = typeof(string);
                    return left.ToString() + right.value as string;
                }
                call = _type.GetMethod("op_Addition", new Type[] { this.type, right.type });
            }
            else if (code == '-')//base = {CLScriptExt.Vector3 op_Subtraction(CLScriptExt.Vector3, CLScriptExt.Vector3)}
                call = _type.GetMethod("op_Subtraction", new Type[] { this.type, right.type });
            else if (code == '*')//[2] = {CLScriptExt.Vector3 op_Multiply(CLScriptExt.Vector3, CLScriptExt.Vector3)}
                call = _type.GetMethod("op_Multiply", new Type[] { this.type, right.type });
            else if (code == '/')//[3] = {CLScriptExt.Vector3 op_Division(CLScriptExt.Vector3, CLScriptExt.Vector3)}
                call = _type.GetMethod("op_Division", new Type[] { this.type, right.type });
            else if (code == '%')//[4] = {CLScriptExt.Vector3 op_Modulus(CLScriptExt.Vector3, CLScriptExt.Vector3)}
                call = _type.GetMethod("op_Modulus", new Type[] { this.type, right.type });


            var obj = call.Invoke(null, new object[] { left, right.value });
            //function.StaticCall(env,"op_Addtion",new List<ICL>{})
            return obj;
        }