Beispiel #1
0
        public override CLS_Content.Value MemberCall(CLS_Content content, object object_this, string function, BetterList <CLS_Content.Value> _params, bool isBaseCall = false)
        {
            if (function == "ClosestPointOnBounds")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Vector3);
                val.value = ((Collider)object_this).ClosestPointOnBounds(((Vector3)_params[0].value));
                return(val);
            }

            return(base.MemberCall(content, object_this, function, _params, isBaseCall));
        }
Beispiel #2
0
        public override void MemberValueSet(CLS_Content content, object object_this, string valuename, object value, bool isBaseCall = false)
        {
            Quaternion newVal = (Quaternion)object_this;

            if (valuename == "eulerAngles")
            {
                newVal.eulerAngles = ((Vector3)value);
            }
            else if (valuename == "w")
            {
                newVal.w = Convert.ToSingle(value);
            }
            else if (valuename == "x")
            {
                newVal.x = Convert.ToSingle(value);
            }
            else if (valuename == "y")
            {
                newVal.y = Convert.ToSingle(value);
            }
            else if (valuename == "z")
            {
                newVal.z = Convert.ToSingle(value);
            }
            else
            {
                base.MemberValueSet(content, object_this, valuename, value, isBaseCall);
            }
            ICLS_Expression         expLeft     = content.CallExpression.listParam[0];
            CLS_Expression_GetValue expGetValue = expLeft as CLS_Expression_GetValue;

            if (expGetValue != null)
            {
                content.Set(expGetValue.value_name, newVal);
                return;
            }
            CLS_Expression_MemberFind expMemberFind = expLeft as CLS_Expression_MemberFind;

            if (expMemberFind != null)
            {
                expGetValue = expMemberFind.listParam[0] as CLS_Expression_GetValue;
                if (content.CallExpression is CLS_Expression_SelfOpWithValue)
                {
                    content.Set(expGetValue.value_name, newVal);
                    return;
                }
                CLS_Content.Value val = content.Get(expGetValue.value_name);
                content.environment.GetType(val.type).function.MemberValueSet(content, val.value, expMemberFind.membername, newVal);
                return;
            }

            base.MemberValueSet(content, object_this, valuename, value, isBaseCall);
        }
        public override CLS_Content.Value MemberCall(CLS_Content content, object object_this, string function, BetterList <CLS_Content.Value> _params, bool isBaseCall = false)
        {
            CLS_Content.Value retVal = null;

            Color newVal = (Color)object_this;

            if (function == "Equals")
            {
                retVal = new CLS_Content.Value();

                retVal.type  = typeof(bool);
                retVal.value = newVal.Equals(_params[0].value);
            }
            else if (function == "ToString")
            {
                if (_params.size == 0)
                {
                    retVal       = new CLS_Content.Value();
                    retVal.type  = typeof(string);
                    retVal.value = newVal.ToString();
                }
                else if (_params.size == 1)
                {
                    retVal       = new CLS_Content.Value();
                    retVal.type  = typeof(string);
                    retVal.value = newVal.ToString(((string)_params[0].value));
                }
            }
            else
            {
                return(base.MemberCall(content, object_this, function, _params, isBaseCall));
            }
            ICLS_Expression         expLeft     = content.CallExpression.listParam[0];
            CLS_Expression_GetValue expGetValue = expLeft as CLS_Expression_GetValue;

            if (expGetValue != null)
            {
                content.Set(expGetValue.value_name, newVal);
                return(retVal);
            }
            CLS_Expression_MemberFind expMemberFind = expLeft as CLS_Expression_MemberFind;

            if (expMemberFind != null)
            {
                expGetValue = expMemberFind.listParam[0] as CLS_Expression_GetValue;
                CLS_Content.Value val = content.Get(expGetValue.value_name);
                content.environment.GetType(val.type).function.MemberValueSet(content, val.value, expMemberFind.membername, newVal);
                return(retVal);
            }

            return(base.MemberCall(content, object_this, function, _params, isBaseCall));
        }
        public override void MemberValueSet(CLS_Content content, object object_this, string valuename, object value, bool isBaseCall = false)
        {
            Color newVal = (Color)object_this;

            if (valuename == "a")
            {
                newVal.a = Convert.ToSingle(value);
            }
            else if (valuename == "b")
            {
                newVal.b = Convert.ToSingle(value);
            }
            else if (valuename == "g")
            {
                newVal.g = Convert.ToSingle(value);
            }
            else if (valuename == "r")
            {
                newVal.r = Convert.ToSingle(value);
            }
            else
            {
                base.MemberValueSet(content, object_this, valuename, value, isBaseCall);
            }
            ICLS_Expression         expLeft     = content.CallExpression.listParam[0];
            CLS_Expression_GetValue expGetValue = expLeft as CLS_Expression_GetValue;

            if (expGetValue != null)
            {
                content.Set(expGetValue.value_name, newVal);
                return;
            }
            CLS_Expression_MemberFind expMemberFind = expLeft as CLS_Expression_MemberFind;

            if (expMemberFind != null)
            {
                expGetValue = expMemberFind.listParam[0] as CLS_Expression_GetValue;
                if (content.CallExpression is CLS_Expression_SelfOpWithValue)
                {
                    content.Set(expGetValue.value_name, newVal);
                    return;
                }
                CLS_Content.Value val = content.Get(expGetValue.value_name);
                content.environment.GetType(val.type).function.MemberValueSet(content, val.value, expMemberFind.membername, newVal);
                return;
            }

            base.MemberValueSet(content, object_this, valuename, value, isBaseCall);
        }
Beispiel #5
0
    public override object Math2Value(CLS_Content content, char code, object left, CLS_Content.Value right, out CLType returntype)
    {
        if (code == '*')
        {
            if (right.value is Quaternion)
            {
                returntype = typeof(Quaternion);
                return(((Quaternion)left) * ((Quaternion)right.value));
            }
            if (right.value is Vector3)
            {
                returntype = typeof(Vector3);
                return(((Quaternion)left) * ((Vector3)right.value));
            }
        }

        return(base.Math2Value(content, code, left, right, out returntype));
    }
Beispiel #6
0
        public override CLS_Content.Value StaticCall(CLS_Content content, string function, BetterList <CLS_Content.Value> _params)
        {
            if (function == "Equals")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(bool);
                val.value = Time.Equals(_params[0].value, _params[1].value);
                return(val);
            }
            else if (function == "ReferenceEquals")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(bool);
                val.value = Time.ReferenceEquals(_params[0].value, _params[1].value);
                return(val);
            }

            return(base.StaticCall(content, function, _params));
        }
Beispiel #7
0
        public override CLS_Content.Value MemberCall(CLS_Content content, object object_this, string function, BetterList <CLS_Content.Value> _params, bool isBaseCall = false)
        {
            if (function == "Equals")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(bool);
                val.value = ((Time)object_this).Equals(_params[0].value);
                return(val);
            }
            else if (function == "ToString")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(string);
                val.value = ((Time)object_this).ToString();
                return(val);
            }

            return(base.MemberCall(content, object_this, function, _params, isBaseCall));
        }
        public override CLS_Content.Value New(CLS_Content content, BetterList <CLS_Content.Value> _params)
        {
            if (_params.size == 4)
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Color);
                val.value = new Color(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value), Convert.ToSingle(_params[2].value), Convert.ToSingle(_params[3].value));
                return(val);
            }
            if (_params.size == 3)
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Color);
                val.value = new Color(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value), Convert.ToSingle(_params[2].value));
                return(val);
            }

            return(base.New(content, _params));
        }
Beispiel #9
0
    // 调用脚本静态函数
    public object CallStatic(string className, string funName, params object[] _params)
    {
#if UNITY_EDITOR
        try
        {
            if (string.IsNullOrEmpty(className) || string.IsNullOrEmpty(funName))
            {
                return(null);
            }
#endif
        CLS_Type_Class type = m_clsEnv.GetTypeByKeywordQuiet(className) as CLS_Type_Class;
        if (type == null)
        {
            Debug.LogWarning(string.Format("CallStatic({0}.{1}): class not found!", className, funName));
            return(null);
        }

        if (!type.compiled)
        {
            RuntimeCompilerClass(className);
        }

        BetterList <CLS_Content.Value> paramList = ScriptParamConvert(_params);
        CLS_Content.Value retVal = type.function.StaticCall(m_clsContent, funName, paramList);
        CLS_Content.PoolParamList(paramList);
        return(retVal != null ? retVal.value : null);

#if UNITY_EDITOR
    }

    catch (System.Exception ex)
    {
        Debug.LogError(DumpStack(ex));
        return(null);
    }
#endif
    }
Beispiel #10
0
    public override object Math2Value(CLS_Content content, char code, object left, CLS_Content.Value right, out CLType returntype)
    {
        if (code == '+')
        {
            if (right.value is Color)
            {
                returntype = typeof(Color);
                return(((Color)left) + ((Color)right.value));
            }
        }
        if (code == '-')
        {
            returntype = typeof(Color);
            return(((Color)left) - ((Color)right.value));
        }
        if (code == '*')
        {
            if (right.value is Color)
            {
                returntype = typeof(Color);
                return(((Color)left) * ((Color)right.value));
            }
            if (right.value is float)
            {
                returntype = typeof(Color);
                return(((Color)left) * Convert.ToSingle(right.value));
            }
        }
        if (code == '/')
        {
            returntype = typeof(Color);
            return(((Color)left) / Convert.ToSingle(right.value));
        }

        return(base.Math2Value(content, code, left, right, out returntype));
    }
        public override CLS_Content.Value StaticCall(CLS_Content content, string function, BetterList <CLS_Content.Value> _params)
        {
            if (function == "Equals")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(bool);
                val.value = UnityEngine.Random.Equals(_params[0].value, _params[1].value);
                return(val);
            }
            else if (function == "Range")
            {
                if ((_params[0].value is int) && (_params[1].value is int))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(int);
                    val.value = UnityEngine.Random.Range(Convert.ToInt32(_params[0].value), Convert.ToInt32(_params[1].value));
                    return(val);
                }
                else if ((_params[0].value is IConvertible) && (_params[1].value is IConvertible))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(float);
                    val.value = UnityEngine.Random.Range(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value));
                    return(val);
                }
            }
            else if (function == "ReferenceEquals")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(bool);
                val.value = UnityEngine.Random.ReferenceEquals(_params[0].value, _params[1].value);
                return(val);
            }

            return(base.StaticCall(content, function, _params));
        }
    public override bool MathLogic(CLS_Content content, logictoken code, object left, CLS_Content.Value right)
    {
        if (code == logictoken.equal)
        {
            return(((UnityEngine.Object)left) == ((UnityEngine.Object)right.value));
        }
        if (code == logictoken.not_equal)
        {
            return(((UnityEngine.Object)left) != ((UnityEngine.Object)right.value));
        }

        return(base.MathLogic(content, code, left, right));
    }
Beispiel #13
0
        public override CLS_Content.Value MemberCall(CLS_Content content, object object_this, string function, BetterList <CLS_Content.Value> _params, bool isBaseCall = false)
        {
            if (function == "DetachChildren")
            {
                ((Transform)object_this).DetachChildren();
                return(CLS_Content.Value.Void);
            }
            else if (function == "Find")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Transform);
                val.value = ((Transform)object_this).Find(((string)_params[0].value));
                return(val);
            }
            else if (function == "FindChild")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Transform);
                val.value = ((Transform)object_this).FindChild(((string)_params[0].value));
                return(val);
            }
            else if (function == "GetChild")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Transform);
                val.value = ((Transform)object_this).GetChild(Convert.ToInt32(_params[0].value));
                return(val);
            }
            else if (function == "GetEnumerator")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(IEnumerator);
                val.value = ((Transform)object_this).GetEnumerator();
                return(val);
            }
            else if (function == "GetSiblingIndex")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(int);
                val.value = ((Transform)object_this).GetSiblingIndex();
                return(val);
            }
            else if (function == "InverseTransformDirection")
            {
                if (_params.size == 1 && (_params[0].value is Vector3))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Vector3);
                    val.value = ((Transform)object_this).InverseTransformDirection(((Vector3)_params[0].value));
                    return(val);
                }
                else if (_params.size == 3 && (_params[0].value is IConvertible) && (_params[1].value is IConvertible) && (_params[2].value is IConvertible))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Vector3);
                    val.value = ((Transform)object_this).InverseTransformDirection(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value), Convert.ToSingle(_params[2].value));
                    return(val);
                }
            }
            else if (function == "InverseTransformPoint")
            {
                if (_params.size == 1 && (_params[0].value is Vector3))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Vector3);
                    val.value = ((Transform)object_this).InverseTransformPoint(((Vector3)_params[0].value));
                    return(val);
                }
                else if (_params.size == 3 && (_params[0].value is IConvertible) && (_params[1].value is IConvertible) && (_params[2].value is IConvertible))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Vector3);
                    val.value = ((Transform)object_this).InverseTransformPoint(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value), Convert.ToSingle(_params[2].value));
                    return(val);
                }
            }
            else if (function == "InverseTransformVector")
            {
                if (_params.size == 1 && (_params[0].value is Vector3))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Vector3);
                    val.value = ((Transform)object_this).InverseTransformVector(((Vector3)_params[0].value));
                    return(val);
                }
                else if (_params.size == 3 && (_params[0].value is IConvertible) && (_params[1].value is IConvertible) && (_params[2].value is IConvertible))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Vector3);
                    val.value = ((Transform)object_this).InverseTransformVector(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value), Convert.ToSingle(_params[2].value));
                    return(val);
                }
            }
            else if (function == "IsChildOf")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(bool);
                val.value = ((Transform)object_this).IsChildOf(((Transform)_params[0].value));
                return(val);
            }
            else if (function == "LookAt")
            {
                if (_params.size == 1 && (_params[0].value is Vector3))
                {
                    ((Transform)object_this).LookAt(((Vector3)_params[0].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 1 && (_params[0].value == null || _params[0].value is Transform))
                {
                    ((Transform)object_this).LookAt(((Transform)_params[0].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 2 && (_params[0].value is Vector3) && (_params[1].value is Vector3))
                {
                    ((Transform)object_this).LookAt(((Vector3)_params[0].value), ((Vector3)_params[1].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 2 && (_params[0].value == null || _params[0].value is Transform) && (_params[1].value is Vector3))
                {
                    ((Transform)object_this).LookAt(((Transform)_params[0].value), ((Vector3)_params[1].value));
                    return(CLS_Content.Value.Void);
                }
            }
            else if (function == "Rotate")
            {
                if (_params.size == 1 && (_params[0].value is Vector3))
                {
                    ((Transform)object_this).Rotate(((Vector3)_params[0].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 2 && (_params[0].value is Vector3) && (_params[1].value is Space))
                {
                    ((Transform)object_this).Rotate(((Vector3)_params[0].value), ((Space)_params[1].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 2 && (_params[0].value is Vector3) && (_params[1].value is IConvertible))
                {
                    ((Transform)object_this).Rotate(((Vector3)_params[0].value), Convert.ToSingle(_params[1].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 3 && (_params[0].value is IConvertible) && (_params[1].value is IConvertible) && (_params[2].value is IConvertible))
                {
                    ((Transform)object_this).Rotate(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value), Convert.ToSingle(_params[2].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 3 && (_params[0].value is Vector3) && (_params[1].value is IConvertible) && (_params[2].value is Space))
                {
                    ((Transform)object_this).Rotate(((Vector3)_params[0].value), Convert.ToSingle(_params[1].value), ((Space)_params[2].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 4 && (_params[0].value is IConvertible) && (_params[1].value is IConvertible) && (_params[2].value is IConvertible) && (_params[3].value is Space))
                {
                    ((Transform)object_this).Rotate(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value), Convert.ToSingle(_params[2].value), ((Space)_params[3].value));
                    return(CLS_Content.Value.Void);
                }
            }
            else if (function == "RotateAround")
            {
                ((Transform)object_this).RotateAround(((Vector3)_params[0].value), ((Vector3)_params[1].value), Convert.ToSingle(_params[2].value));
                return(CLS_Content.Value.Void);
            }
            else if (function == "SetAsFirstSibling")
            {
                ((Transform)object_this).SetAsFirstSibling();
                return(CLS_Content.Value.Void);
            }
            else if (function == "SetAsLastSibling")
            {
                ((Transform)object_this).SetAsLastSibling();
                return(CLS_Content.Value.Void);
            }
            else if (function == "SetParent")
            {
                if (_params.size == 1 && (_params[0].value == null || _params[0].value is Transform))
                {
                    ((Transform)object_this).SetParent(((Transform)_params[0].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 2 && (_params[0].value == null || _params[0].value is Transform) && (_params[1].value is IConvertible))
                {
                    ((Transform)object_this).SetParent(((Transform)_params[0].value), Convert.ToBoolean(_params[1].value));
                    return(CLS_Content.Value.Void);
                }
            }
            else if (function == "SetSiblingIndex")
            {
                ((Transform)object_this).SetSiblingIndex(Convert.ToInt32(_params[0].value));
                return(CLS_Content.Value.Void);
            }
            else if (function == "TransformDirection")
            {
                if (_params.size == 1 && (_params[0].value is Vector3))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Vector3);
                    val.value = ((Transform)object_this).TransformDirection(((Vector3)_params[0].value));
                    return(val);
                }
                else if (_params.size == 3 && (_params[0].value is IConvertible) && (_params[1].value is IConvertible) && (_params[2].value is IConvertible))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Vector3);
                    val.value = ((Transform)object_this).TransformDirection(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value), Convert.ToSingle(_params[2].value));
                    return(val);
                }
            }
            else if (function == "TransformPoint")
            {
                if (_params.size == 1 && (_params[0].value is Vector3))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Vector3);
                    val.value = ((Transform)object_this).TransformPoint(((Vector3)_params[0].value));
                    return(val);
                }
                else if (_params.size == 3 && (_params[0].value is IConvertible) && (_params[1].value is IConvertible) && (_params[2].value is IConvertible))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Vector3);
                    val.value = ((Transform)object_this).TransformPoint(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value), Convert.ToSingle(_params[2].value));
                    return(val);
                }
            }
            else if (function == "TransformVector")
            {
                if (_params.size == 1 && (_params[0].value is Vector3))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Vector3);
                    val.value = ((Transform)object_this).TransformVector(((Vector3)_params[0].value));
                    return(val);
                }
                else if (_params.size == 3 && (_params[0].value is IConvertible) && (_params[1].value is IConvertible) && (_params[2].value is IConvertible))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Vector3);
                    val.value = ((Transform)object_this).TransformVector(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value), Convert.ToSingle(_params[2].value));
                    return(val);
                }
            }
            else if (function == "Translate")
            {
                if (_params.size == 1 && (_params[0].value is Vector3))
                {
                    ((Transform)object_this).Translate(((Vector3)_params[0].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 2 && (_params[0].value is Vector3) && (_params[1].value is Space))
                {
                    ((Transform)object_this).Translate(((Vector3)_params[0].value), ((Space)_params[1].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 2 && (_params[0].value is Vector3) && (_params[1].value == null || _params[1].value is Transform))
                {
                    ((Transform)object_this).Translate(((Vector3)_params[0].value), ((Transform)_params[1].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 3 && (_params[0].value is IConvertible) && (_params[1].value is IConvertible) && (_params[2].value is IConvertible))
                {
                    ((Transform)object_this).Translate(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value), Convert.ToSingle(_params[2].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 4 && (_params[0].value is IConvertible) && (_params[1].value is IConvertible) && (_params[2].value is IConvertible) && (_params[3].value is Space))
                {
                    ((Transform)object_this).Translate(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value), Convert.ToSingle(_params[2].value), ((Space)_params[3].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 4 && (_params[0].value is IConvertible) && (_params[1].value is IConvertible) && (_params[2].value is IConvertible) && (_params[3].value == null || _params[3].value is Transform))
                {
                    ((Transform)object_this).Translate(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value), Convert.ToSingle(_params[2].value), ((Transform)_params[3].value));
                    return(CLS_Content.Value.Void);
                }
            }

            return(base.MemberCall(content, object_this, function, _params, isBaseCall));
        }
Beispiel #14
0
        public override CLS_Content.Value StaticCall(CLS_Content content, string function, BetterList <CLS_Content.Value> _params)
        {
            if (function == "Angle")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Vector3.Angle(((Vector3)_params[0].value), ((Vector3)_params[1].value));
                return(val);
            }
            else if (function == "ClampMagnitude")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Vector3);
                val.value = Vector3.ClampMagnitude(((Vector3)_params[0].value), Convert.ToSingle(_params[1].value));
                return(val);
            }
            else if (function == "Cross")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Vector3);
                val.value = Vector3.Cross(((Vector3)_params[0].value), ((Vector3)_params[1].value));
                return(val);
            }
            else if (function == "Distance")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Vector3.Distance(((Vector3)_params[0].value), ((Vector3)_params[1].value));
                return(val);
            }
            else if (function == "Dot")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Vector3.Dot(((Vector3)_params[0].value), ((Vector3)_params[1].value));
                return(val);
            }
            else if (function == "Equals")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(bool);
                val.value = Vector3.Equals(_params[0].value, _params[1].value);
                return(val);
            }
            else if (function == "Lerp")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Vector3);
                val.value = Vector3.Lerp(((Vector3)_params[0].value), ((Vector3)_params[1].value), Convert.ToSingle(_params[2].value));
                return(val);
            }
            else if (function == "LerpUnclamped")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Vector3);
                val.value = Vector3.LerpUnclamped(((Vector3)_params[0].value), ((Vector3)_params[1].value), Convert.ToSingle(_params[2].value));
                return(val);
            }
            else if (function == "Magnitude")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Vector3.Magnitude(((Vector3)_params[0].value));
                return(val);
            }
            else if (function == "Max")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Vector3);
                val.value = Vector3.Max(((Vector3)_params[0].value), ((Vector3)_params[1].value));
                return(val);
            }
            else if (function == "Min")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Vector3);
                val.value = Vector3.Min(((Vector3)_params[0].value), ((Vector3)_params[1].value));
                return(val);
            }
            else if (function == "MoveTowards")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Vector3);
                val.value = Vector3.MoveTowards(((Vector3)_params[0].value), ((Vector3)_params[1].value), Convert.ToSingle(_params[2].value));
                return(val);
            }
            else if (function == "Normalize")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Vector3);
                val.value = Vector3.Normalize(((Vector3)_params[0].value));
                return(val);
            }
            else if (function == "Project")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Vector3);
                val.value = Vector3.Project(((Vector3)_params[0].value), ((Vector3)_params[1].value));
                return(val);
            }
            else if (function == "ProjectOnPlane")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Vector3);
                val.value = Vector3.ProjectOnPlane(((Vector3)_params[0].value), ((Vector3)_params[1].value));
                return(val);
            }
            else if (function == "ReferenceEquals")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(bool);
                val.value = Vector3.ReferenceEquals(_params[0].value, _params[1].value);
                return(val);
            }
            else if (function == "Reflect")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Vector3);
                val.value = Vector3.Reflect(((Vector3)_params[0].value), ((Vector3)_params[1].value));
                return(val);
            }
            else if (function == "RotateTowards")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Vector3);
                val.value = Vector3.RotateTowards(((Vector3)_params[0].value), ((Vector3)_params[1].value), Convert.ToSingle(_params[2].value), Convert.ToSingle(_params[3].value));
                return(val);
            }
            else if (function == "Scale")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Vector3);
                val.value = Vector3.Scale(((Vector3)_params[0].value), ((Vector3)_params[1].value));
                return(val);
            }
            else if (function == "Slerp")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Vector3);
                val.value = Vector3.Slerp(((Vector3)_params[0].value), ((Vector3)_params[1].value), Convert.ToSingle(_params[2].value));
                return(val);
            }
            else if (function == "SlerpUnclamped")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Vector3);
                val.value = Vector3.SlerpUnclamped(((Vector3)_params[0].value), ((Vector3)_params[1].value), Convert.ToSingle(_params[2].value));
                return(val);
            }
            else if (function == "SqrMagnitude")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Vector3.SqrMagnitude(((Vector3)_params[0].value));
                return(val);
            }

            return(base.StaticCall(content, function, _params));
        }
 object ReadField(ProtoReader reader, Type memberT, string sClassName, CLS_Environment environment)
 {
     if (memberT == typeof(int))
     {
         return(reader.ReadInt32());
     }
     else if (memberT == typeof(uint))
     {
         return(reader.ReadUInt32());
     }
     else if (memberT == typeof(bool))
     {
         return(reader.ReadBoolean());
     }
     else if (memberT == typeof(byte))
     {
         return(reader.ReadByte());
     }
     else if (memberT == typeof(sbyte))
     {
         return(reader.ReadSByte());
     }
     else if (memberT == typeof(float))
     {
         return(reader.ReadSingle());
     }
     else if (memberT == typeof(double))
     {
         return(reader.ReadDouble());
     }
     else if (memberT == typeof(short))
     {
         return(reader.ReadInt16());
     }
     else if (memberT == typeof(ushort))
     {
         return(reader.ReadUInt16());
     }
     else if (memberT == typeof(long))
     {
         return(reader.ReadInt64());
     }
     else if (memberT == typeof(ulong))
     {
         return(reader.ReadUInt64());
     }
     else if (memberT == typeof(string))
     {
         return(reader.ReadString());
     }
     else if (memberT == typeof(byte[]))
     {
         return(ProtoReader.AppendBytes(null, reader));
     }
     else if (memberT == typeof(SInstance))
     {
         SubItemToken   st     = ProtoReader.StartSubItem(reader);
         CLS_Type_Class sClass = environment.GetTypeByKeywordQuiet(sClassName) as CLS_Type_Class;
         if (!sClass.compiled)
         {
             RuntimeCompilerClass(sClassName);
         }
         CLS_Content       content = CLS_Content.NewContent(environment);
         CLS_Content.Value retVal  = sClass.function.New(content, m_emptyParams);
         CLS_Content.PoolContent(content);
         SInstance sInstance = (SInstance)retVal.value;
         ReadSInstance(reader, sInstance, environment);
         ProtoReader.EndSubItem(st, reader);
         return(sInstance);
     }
     else
     {
         throw new NotImplementedException("未实现类型: " + memberT);
     }
 }
Beispiel #16
0
        public override CLS_Content.Value StaticCall(CLS_Content content, string function, BetterList <CLS_Content.Value> _params)
        {
            if (function == "Angle")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Quaternion.Angle(((Quaternion)_params[0].value), ((Quaternion)_params[1].value));
                return(val);
            }
            else if (function == "AngleAxis")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Quaternion);
                val.value = Quaternion.AngleAxis(Convert.ToSingle(_params[0].value), ((Vector3)_params[1].value));
                return(val);
            }
            else if (function == "Dot")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Quaternion.Dot(((Quaternion)_params[0].value), ((Quaternion)_params[1].value));
                return(val);
            }
            else if (function == "Equals")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(bool);
                val.value = Quaternion.Equals(_params[0].value, _params[1].value);
                return(val);
            }
            else if (function == "Euler")
            {
                if (_params.size == 1 && (_params[0].value is Vector3))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Quaternion);
                    val.value = Quaternion.Euler(((Vector3)_params[0].value));
                    return(val);
                }
                else if (_params.size == 3 && (_params[0].value is IConvertible) && (_params[1].value is IConvertible) && (_params[2].value is IConvertible))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Quaternion);
                    val.value = Quaternion.Euler(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value), Convert.ToSingle(_params[2].value));
                    return(val);
                }
            }
            else if (function == "FromToRotation")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Quaternion);
                val.value = Quaternion.FromToRotation(((Vector3)_params[0].value), ((Vector3)_params[1].value));
                return(val);
            }
            else if (function == "Inverse")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Quaternion);
                val.value = Quaternion.Inverse(((Quaternion)_params[0].value));
                return(val);
            }
            else if (function == "Lerp")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Quaternion);
                val.value = Quaternion.Lerp(((Quaternion)_params[0].value), ((Quaternion)_params[1].value), Convert.ToSingle(_params[2].value));
                return(val);
            }
            else if (function == "LerpUnclamped")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Quaternion);
                val.value = Quaternion.LerpUnclamped(((Quaternion)_params[0].value), ((Quaternion)_params[1].value), Convert.ToSingle(_params[2].value));
                return(val);
            }
            else if (function == "LookRotation")
            {
                if (_params.size == 1)
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Quaternion);
                    val.value = Quaternion.LookRotation(((Vector3)_params[0].value));
                    return(val);
                }
                else if (_params.size == 2)
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Quaternion);
                    val.value = Quaternion.LookRotation(((Vector3)_params[0].value), ((Vector3)_params[1].value));
                    return(val);
                }
            }
            else if (function == "ReferenceEquals")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(bool);
                val.value = Quaternion.ReferenceEquals(_params[0].value, _params[1].value);
                return(val);
            }
            else if (function == "RotateTowards")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Quaternion);
                val.value = Quaternion.RotateTowards(((Quaternion)_params[0].value), ((Quaternion)_params[1].value), Convert.ToSingle(_params[2].value));
                return(val);
            }
            else if (function == "Slerp")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Quaternion);
                val.value = Quaternion.Slerp(((Quaternion)_params[0].value), ((Quaternion)_params[1].value), Convert.ToSingle(_params[2].value));
                return(val);
            }
            else if (function == "SlerpUnclamped")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Quaternion);
                val.value = Quaternion.SlerpUnclamped(((Quaternion)_params[0].value), ((Quaternion)_params[1].value), Convert.ToSingle(_params[2].value));
                return(val);
            }

            return(base.StaticCall(content, function, _params));
        }
Beispiel #17
0
        public override CLS_Content.Value StaticCall(CLS_Content content, string function, BetterList <CLS_Content.Value> _params)
        {
            if (function == "Abs")
            {
                if ((_params[0].value is int))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(int);
                    val.value = Mathf.Abs(Convert.ToInt32(_params[0].value));
                    return(val);
                }
                else if ((_params[0].value is IConvertible))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(float);
                    val.value = Mathf.Abs(Convert.ToSingle(_params[0].value));
                    return(val);
                }
            }
            else if (function == "Acos")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.Acos(Convert.ToSingle(_params[0].value));
                return(val);
            }
            else if (function == "Approximately")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(bool);
                val.value = Mathf.Approximately(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value));
                return(val);
            }
            else if (function == "Asin")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.Asin(Convert.ToSingle(_params[0].value));
                return(val);
            }
            else if (function == "Atan")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.Atan(Convert.ToSingle(_params[0].value));
                return(val);
            }
            else if (function == "Atan2")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.Atan2(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value));
                return(val);
            }
            else if (function == "Ceil")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.Ceil(Convert.ToSingle(_params[0].value));
                return(val);
            }
            else if (function == "CeilToInt")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(int);
                val.value = Mathf.CeilToInt(Convert.ToSingle(_params[0].value));
                return(val);
            }
            else if (function == "Clamp")
            {
                if ((_params[0].value is int) && (_params[1].value is int) && (_params[2].value is int))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(int);
                    val.value = Mathf.Clamp(Convert.ToInt32(_params[0].value), Convert.ToInt32(_params[1].value), Convert.ToInt32(_params[2].value));
                    return(val);
                }
                else if ((_params[0].value is IConvertible) && (_params[1].value is IConvertible) && (_params[2].value is IConvertible))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(float);
                    val.value = Mathf.Clamp(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value), Convert.ToSingle(_params[2].value));
                    return(val);
                }
            }
            else if (function == "Clamp01")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.Clamp01(Convert.ToSingle(_params[0].value));
                return(val);
            }
            else if (function == "ClosestPowerOfTwo")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(int);
                val.value = Mathf.ClosestPowerOfTwo(Convert.ToInt32(_params[0].value));
                return(val);
            }
            else if (function == "Cos")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.Cos(Convert.ToSingle(_params[0].value));
                return(val);
            }
            else if (function == "DeltaAngle")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.DeltaAngle(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value));
                return(val);
            }
            else if (function == "Equals")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(bool);
                val.value = Mathf.Equals(_params[0].value, _params[1].value);
                return(val);
            }
            else if (function == "Exp")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.Exp(Convert.ToSingle(_params[0].value));
                return(val);
            }
            else if (function == "FloatToHalf")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(ushort);
                val.value = Mathf.FloatToHalf(Convert.ToSingle(_params[0].value));
                return(val);
            }
            else if (function == "Floor")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.Floor(Convert.ToSingle(_params[0].value));
                return(val);
            }
            else if (function == "FloorToInt")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(int);
                val.value = Mathf.FloorToInt(Convert.ToSingle(_params[0].value));
                return(val);
            }
            else if (function == "Gamma")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.Gamma(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value), Convert.ToSingle(_params[2].value));
                return(val);
            }
            else if (function == "GammaToLinearSpace")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.GammaToLinearSpace(Convert.ToSingle(_params[0].value));
                return(val);
            }
            else if (function == "HalfToFloat")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.HalfToFloat(Convert.ToUInt16(_params[0].value));
                return(val);
            }
            else if (function == "InverseLerp")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.InverseLerp(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value), Convert.ToSingle(_params[2].value));
                return(val);
            }
            else if (function == "IsPowerOfTwo")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(bool);
                val.value = Mathf.IsPowerOfTwo(Convert.ToInt32(_params[0].value));
                return(val);
            }
            else if (function == "Lerp")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.Lerp(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value), Convert.ToSingle(_params[2].value));
                return(val);
            }
            else if (function == "LerpAngle")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.LerpAngle(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value), Convert.ToSingle(_params[2].value));
                return(val);
            }
            else if (function == "LerpUnclamped")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.LerpUnclamped(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value), Convert.ToSingle(_params[2].value));
                return(val);
            }
            else if (function == "LinearToGammaSpace")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.LinearToGammaSpace(Convert.ToSingle(_params[0].value));
                return(val);
            }
            else if (function == "Log")
            {
                if (_params.size == 1)
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(float);
                    val.value = Mathf.Log(Convert.ToSingle(_params[0].value));
                    return(val);
                }
                else if (_params.size == 2)
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(float);
                    val.value = Mathf.Log(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value));
                    return(val);
                }
            }
            else if (function == "Log10")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.Log10(Convert.ToSingle(_params[0].value));
                return(val);
            }
            else if (function == "Max")
            {
                if (_params.size == 2 && (_params[0].value is int) && (_params[1].value is int))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(int);
                    val.value = Mathf.Max(Convert.ToInt32(_params[0].value), Convert.ToInt32(_params[1].value));
                    return(val);
                }
                else if (_params.size == 2 && (_params[0].value is IConvertible) && (_params[1].value is IConvertible))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(float);
                    val.value = Mathf.Max(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value));
                    return(val);
                }
            }
            else if (function == "Min")
            {
                if (_params.size == 2 && (_params[0].value is int) && (_params[1].value is int))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(int);
                    val.value = Mathf.Min(Convert.ToInt32(_params[0].value), Convert.ToInt32(_params[1].value));
                    return(val);
                }
                else if (_params.size == 2 && (_params[0].value is IConvertible) && (_params[1].value is IConvertible))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(float);
                    val.value = Mathf.Min(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value));
                    return(val);
                }
            }
            else if (function == "MoveTowards")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.MoveTowards(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value), Convert.ToSingle(_params[2].value));
                return(val);
            }
            else if (function == "MoveTowardsAngle")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.MoveTowardsAngle(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value), Convert.ToSingle(_params[2].value));
                return(val);
            }
            else if (function == "NextPowerOfTwo")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(int);
                val.value = Mathf.NextPowerOfTwo(Convert.ToInt32(_params[0].value));
                return(val);
            }
            else if (function == "PerlinNoise")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.PerlinNoise(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value));
                return(val);
            }
            else if (function == "PingPong")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.PingPong(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value));
                return(val);
            }
            else if (function == "Pow")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.Pow(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value));
                return(val);
            }
            else if (function == "ReferenceEquals")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(bool);
                val.value = Mathf.ReferenceEquals(_params[0].value, _params[1].value);
                return(val);
            }
            else if (function == "Repeat")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.Repeat(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value));
                return(val);
            }
            else if (function == "Round")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.Round(Convert.ToSingle(_params[0].value));
                return(val);
            }
            else if (function == "RoundToInt")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(int);
                val.value = Mathf.RoundToInt(Convert.ToSingle(_params[0].value));
                return(val);
            }
            else if (function == "Sign")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.Sign(Convert.ToSingle(_params[0].value));
                return(val);
            }
            else if (function == "Sin")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.Sin(Convert.ToSingle(_params[0].value));
                return(val);
            }
            else if (function == "SmoothStep")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.SmoothStep(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value), Convert.ToSingle(_params[2].value));
                return(val);
            }
            else if (function == "Sqrt")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.Sqrt(Convert.ToSingle(_params[0].value));
                return(val);
            }
            else if (function == "Tan")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(float);
                val.value = Mathf.Tan(Convert.ToSingle(_params[0].value));
                return(val);
            }

            return(base.StaticCall(content, function, _params));
        }
Beispiel #18
0
        public override CLS_Content.Value StaticCall(CLS_Content content, string function, BetterList <CLS_Content.Value> _params)
        {
            if (function == "Assert")
            {
                if (_params.size == 1 && (_params[0].value is bool))
                {
                    Debug.Assert(Convert.ToBoolean(_params[0].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 2 && (_params[0].value is bool) && (_params[1].value == null || _params[1].value is string))
                {
                    Debug.Assert(Convert.ToBoolean(_params[0].value), ((string)_params[1].value));
                    return(CLS_Content.Value.Void);
                }
            }
            else if (function == "Break")
            {
                Debug.Break();
                return(CLS_Content.Value.Void);
            }
            else if (function == "ClearDeveloperConsole")
            {
                Debug.ClearDeveloperConsole();
                return(CLS_Content.Value.Void);
            }
            else if (function == "DebugBreak")
            {
                Debug.DebugBreak();
                return(CLS_Content.Value.Void);
            }
            else if (function == "DrawLine")
            {
                if (_params.size == 2 && (_params[0].value is Vector3) && (_params[1].value is Vector3))
                {
                    Debug.DrawLine(((Vector3)_params[0].value), ((Vector3)_params[1].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 3 && (_params[0].value is Vector3) && (_params[1].value is Vector3) && (_params[2].value is Color))
                {
                    Debug.DrawLine(((Vector3)_params[0].value), ((Vector3)_params[1].value), ((Color)_params[2].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 4 && (_params[0].value is Vector3) && (_params[1].value is Vector3) && (_params[2].value is Color) && (_params[3].value is IConvertible))
                {
                    Debug.DrawLine(((Vector3)_params[0].value), ((Vector3)_params[1].value), ((Color)_params[2].value), Convert.ToSingle(_params[3].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 5 && (_params[0].value is Vector3) && (_params[1].value is Vector3) && (_params[2].value is Color) && (_params[3].value is IConvertible) && (_params[4].value is IConvertible))
                {
                    Debug.DrawLine(((Vector3)_params[0].value), ((Vector3)_params[1].value), ((Color)_params[2].value), Convert.ToSingle(_params[3].value), Convert.ToBoolean(_params[4].value));
                    return(CLS_Content.Value.Void);
                }
            }
            else if (function == "DrawRay")
            {
                if (_params.size == 2 && (_params[0].value is Vector3) && (_params[1].value is Vector3))
                {
                    Debug.DrawRay(((Vector3)_params[0].value), ((Vector3)_params[1].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 3 && (_params[0].value is Vector3) && (_params[1].value is Vector3) && (_params[2].value is Color))
                {
                    Debug.DrawRay(((Vector3)_params[0].value), ((Vector3)_params[1].value), ((Color)_params[2].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 4 && (_params[0].value is Vector3) && (_params[1].value is Vector3) && (_params[2].value is Color) && (_params[3].value is IConvertible))
                {
                    Debug.DrawRay(((Vector3)_params[0].value), ((Vector3)_params[1].value), ((Color)_params[2].value), Convert.ToSingle(_params[3].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 5 && (_params[0].value is Vector3) && (_params[1].value is Vector3) && (_params[2].value is Color) && (_params[3].value is IConvertible) && (_params[4].value is IConvertible))
                {
                    Debug.DrawRay(((Vector3)_params[0].value), ((Vector3)_params[1].value), ((Color)_params[2].value), Convert.ToSingle(_params[3].value), Convert.ToBoolean(_params[4].value));
                    return(CLS_Content.Value.Void);
                }
            }
            else if (function == "Equals")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(bool);
                val.value = Debug.Equals(_params[0].value, _params[1].value);
                return(val);
            }
            else if (function == "Log")
            {
                if (_params.size == 1)
                {
                    Debug.Log(_params[0].value);
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 2 && (_params[1].value == null || _params[1].value is UnityEngine.Object))
                {
                    Debug.Log(_params[0].value, ((UnityEngine.Object)_params[1].value));
                    return(CLS_Content.Value.Void);
                }
            }
            else if (function == "LogError")
            {
                if (_params.size == 1)
                {
                    Debug.LogError(_params[0].value);
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 2 && (_params[1].value == null || _params[1].value is UnityEngine.Object))
                {
                    Debug.LogError(_params[0].value, ((UnityEngine.Object)_params[1].value));
                    return(CLS_Content.Value.Void);
                }
            }
            else if (function == "LogException")
            {
                if (_params.size == 1 && (_params[0].value == null || _params[0].value is Exception))
                {
                    Debug.LogException(((Exception)_params[0].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 2 && (_params[0].value == null || _params[0].value is Exception) && (_params[1].value == null || _params[1].value is UnityEngine.Object))
                {
                    Debug.LogException(((Exception)_params[0].value), ((UnityEngine.Object)_params[1].value));
                    return(CLS_Content.Value.Void);
                }
            }
            else if (function == "LogWarning")
            {
                if (_params.size == 1)
                {
                    Debug.LogWarning(_params[0].value);
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 2 && (_params[1].value == null || _params[1].value is UnityEngine.Object))
                {
                    Debug.LogWarning(_params[0].value, ((UnityEngine.Object)_params[1].value));
                    return(CLS_Content.Value.Void);
                }
            }
            else if (function == "ReferenceEquals")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(bool);
                val.value = Debug.ReferenceEquals(_params[0].value, _params[1].value);
                return(val);
            }

            return(base.StaticCall(content, function, _params));
        }
        public override CLS_Content.Value MemberCall(CLS_Content content, object object_this, string function, BetterList <CLS_Content.Value> _params, bool isBaseCall = false)
        {
            if (function == "AddComponent")
            {
                if (_params.size == 1 && (_params[0].value == null || _params[0].value is Type))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Component);
                    val.value = ((GameObject)object_this).AddComponent(((Type)_params[0].value));
                    return(val);
                }
            }
            else if (function == "BroadcastMessage")
            {
                if (_params.size == 1 && (_params[0].value == null || _params[0].value is string))
                {
                    ((GameObject)object_this).BroadcastMessage(((string)_params[0].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 2 && (_params[0].value == null || _params[0].value is string) && (_params[1].value is SendMessageOptions))
                {
                    ((GameObject)object_this).BroadcastMessage(((string)_params[0].value), ((SendMessageOptions)_params[1].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 2 && (_params[0].value == null || _params[0].value is string))
                {
                    ((GameObject)object_this).BroadcastMessage(((string)_params[0].value), _params[1].value);
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 3 && (_params[0].value == null || _params[0].value is string) && (_params[2].value is SendMessageOptions))
                {
                    ((GameObject)object_this).BroadcastMessage(((string)_params[0].value), _params[1].value, ((SendMessageOptions)_params[2].value));
                    return(CLS_Content.Value.Void);
                }
            }
            else if (function == "CompareTag")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(bool);
                val.value = ((GameObject)object_this).CompareTag(((string)_params[0].value));
                return(val);
            }
            else if (function == "Equals")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(bool);
                val.value = ((GameObject)object_this).Equals(_params[0].value);
                return(val);
            }
            else if (function == "GetComponent")
            {
                if (_params.size == 1 && (_params[0].value == null || _params[0].value is string))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Component);
                    val.value = ((GameObject)object_this).GetComponent(((string)_params[0].value));
                    return(val);
                }
                else if (_params.size == 1 && (_params[0].value == null || _params[0].value is Type))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Component);
                    val.value = ((GameObject)object_this).GetComponent(((Type)_params[0].value));
                    return(val);
                }
            }
            else if (function == "GetComponentInChildren")
            {
                if (_params.size == 1 && (_params[0].value == null || _params[0].value is Type))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Component);
                    val.value = ((GameObject)object_this).GetComponentInChildren(((Type)_params[0].value));
                    return(val);
                }
            }
            else if (function == "GetComponentInParent")
            {
                if (_params.size == 1 && (_params[0].value == null || _params[0].value is Type))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Component);
                    val.value = ((GameObject)object_this).GetComponentInParent(((Type)_params[0].value));
                    return(val);
                }
            }
            else if (function == "GetComponents")
            {
                if (_params.size == 1 && (_params[0].value == null || _params[0].value is Type))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Component[]);
                    val.value = ((GameObject)object_this).GetComponents(((Type)_params[0].value));
                    return(val);
                }
                else if (_params.size == 2 && (_params[0].value == null || _params[0].value is Type) && (_params[1].value == null || _params[1].value is List <Component>))
                {
                    ((GameObject)object_this).GetComponents(((Type)_params[0].value), ((List <Component>)_params[1].value));
                    return(CLS_Content.Value.Void);
                }
            }
            else if (function == "GetComponentsInChildren")
            {
                if (_params.size == 1 && (_params[0].value == null || _params[0].value is Type))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Component[]);
                    val.value = ((GameObject)object_this).GetComponentsInChildren(((Type)_params[0].value));
                    return(val);
                }
                else if (_params.size == 2 && (_params[0].value == null || _params[0].value is Type) && (_params[1].value is IConvertible))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Component[]);
                    val.value = ((GameObject)object_this).GetComponentsInChildren(((Type)_params[0].value), Convert.ToBoolean(_params[1].value));
                    return(val);
                }
            }
            else if (function == "GetComponentsInParent")
            {
                if (_params.size == 1 && (_params[0].value == null || _params[0].value is Type))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Component[]);
                    val.value = ((GameObject)object_this).GetComponentsInParent(((Type)_params[0].value));
                    return(val);
                }
                else if (_params.size == 2 && (_params[0].value == null || _params[0].value is Type) && (_params[1].value is IConvertible))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Component[]);
                    val.value = ((GameObject)object_this).GetComponentsInParent(((Type)_params[0].value), Convert.ToBoolean(_params[1].value));
                    return(val);
                }
            }
            else if (function == "GetInstanceID")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(int);
                val.value = ((GameObject)object_this).GetInstanceID();
                return(val);
            }
            else if (function == "SendMessage")
            {
                if (_params.size == 1 && (_params[0].value == null || _params[0].value is string))
                {
                    ((GameObject)object_this).SendMessage(((string)_params[0].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 2 && (_params[0].value == null || _params[0].value is string) && (_params[1].value is SendMessageOptions))
                {
                    ((GameObject)object_this).SendMessage(((string)_params[0].value), ((SendMessageOptions)_params[1].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 2 && (_params[0].value == null || _params[0].value is string))
                {
                    ((GameObject)object_this).SendMessage(((string)_params[0].value), _params[1].value);
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 3 && (_params[0].value == null || _params[0].value is string) && (_params[2].value is SendMessageOptions))
                {
                    ((GameObject)object_this).SendMessage(((string)_params[0].value), _params[1].value, ((SendMessageOptions)_params[2].value));
                    return(CLS_Content.Value.Void);
                }
            }
            else if (function == "SendMessageUpwards")
            {
                if (_params.size == 1 && (_params[0].value == null || _params[0].value is string))
                {
                    ((GameObject)object_this).SendMessageUpwards(((string)_params[0].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 2 && (_params[0].value == null || _params[0].value is string) && (_params[1].value is SendMessageOptions))
                {
                    ((GameObject)object_this).SendMessageUpwards(((string)_params[0].value), ((SendMessageOptions)_params[1].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 2 && (_params[0].value == null || _params[0].value is string))
                {
                    ((GameObject)object_this).SendMessageUpwards(((string)_params[0].value), _params[1].value);
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 3 && (_params[0].value == null || _params[0].value is string) && (_params[2].value is SendMessageOptions))
                {
                    ((GameObject)object_this).SendMessageUpwards(((string)_params[0].value), _params[1].value, ((SendMessageOptions)_params[2].value));
                    return(CLS_Content.Value.Void);
                }
            }
            else if (function == "SetActive")
            {
                ((GameObject)object_this).SetActive(Convert.ToBoolean(_params[0].value));
                return(CLS_Content.Value.Void);
            }
            else if (function == "ToString")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(string);
                val.value = ((GameObject)object_this).ToString();
                return(val);
            }

            return(base.MemberCall(content, object_this, function, _params, isBaseCall));
        }
Beispiel #20
0
        public override CLS_Content.Value MemberCall(CLS_Content content, object object_this, string function, BetterList <CLS_Content.Value> _params, bool isBaseCall = false)
        {
            if (function == "CancelInvoke")
            {
                if (_params.size == 0)
                {
                    ((MonoBehaviour)object_this).CancelInvoke();
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 1)
                {
                    ((MonoBehaviour)object_this).CancelInvoke(((string)_params[0].value));
                    return(CLS_Content.Value.Void);
                }
            }
            else if (function == "Invoke")
            {
                ((MonoBehaviour)object_this).Invoke(((string)_params[0].value), Convert.ToSingle(_params[1].value));
                return(CLS_Content.Value.Void);
            }
            else if (function == "InvokeRepeating")
            {
                ((MonoBehaviour)object_this).InvokeRepeating(((string)_params[0].value), Convert.ToSingle(_params[1].value), Convert.ToSingle(_params[2].value));
                return(CLS_Content.Value.Void);
            }
            else if (function == "IsInvoking")
            {
                if (_params.size == 0)
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(bool);
                    val.value = ((MonoBehaviour)object_this).IsInvoking();
                    return(val);
                }
                else if (_params.size == 1)
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(bool);
                    val.value = ((MonoBehaviour)object_this).IsInvoking(((string)_params[0].value));
                    return(val);
                }
            }
            else if (function == "StartCoroutine")
            {
                if (_params.size == 1 && (_params[0].value == null || _params[0].value is string))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Coroutine);
                    val.value = ((MonoBehaviour)object_this).StartCoroutine(((string)_params[0].value));
                    return(val);
                }
                else if (_params.size == 1 && (_params[0].value is IEnumerator))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Coroutine);
                    val.value = ((MonoBehaviour)object_this).StartCoroutine(((IEnumerator)_params[0].value));
                    return(val);
                }
                else if (_params.size == 2 && (_params[0].value == null || _params[0].value is string))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(Coroutine);
                    val.value = ((MonoBehaviour)object_this).StartCoroutine(((string)_params[0].value), _params[1].value);
                    return(val);
                }
            }
            else if (function == "StartCoroutine_Auto")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(Coroutine);
                val.value = ((MonoBehaviour)object_this).StartCoroutine_Auto(((IEnumerator)_params[0].value));
                return(val);
            }
            else if (function == "StopAllCoroutines")
            {
                ((MonoBehaviour)object_this).StopAllCoroutines();
                return(CLS_Content.Value.Void);
            }
            else if (function == "StopCoroutine")
            {
                if ((_params[0].value == null || _params[0].value is string))
                {
                    ((MonoBehaviour)object_this).StopCoroutine(((string)_params[0].value));
                    return(CLS_Content.Value.Void);
                }
                else if ((_params[0].value is IEnumerator))
                {
                    ((MonoBehaviour)object_this).StopCoroutine(((IEnumerator)_params[0].value));
                    return(CLS_Content.Value.Void);
                }
                else if ((_params[0].value == null || _params[0].value is Coroutine))
                {
                    ((MonoBehaviour)object_this).StopCoroutine(((Coroutine)_params[0].value));
                    return(CLS_Content.Value.Void);
                }
            }

            return(base.MemberCall(content, object_this, function, _params, isBaseCall));
        }
        public override CLS_Content.Value StaticCall(CLS_Content content, string function, BetterList <CLS_Content.Value> _params)
        {
            if (function == "CreatePrimitive")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(GameObject);
                val.value = GameObject.CreatePrimitive(((PrimitiveType)_params[0].value));
                return(val);
            }
            else if (function == "Destroy")
            {
                if (_params.size == 1 && (_params[0].value == null || _params[0].value is UnityEngine.Object))
                {
                    GameObject.Destroy(((UnityEngine.Object)_params[0].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 2 && (_params[0].value == null || _params[0].value is UnityEngine.Object) && (_params[1].value is IConvertible))
                {
                    GameObject.Destroy(((UnityEngine.Object)_params[0].value), Convert.ToSingle(_params[1].value));
                    return(CLS_Content.Value.Void);
                }
            }
            else if (function == "DestroyImmediate")
            {
                if (_params.size == 1 && (_params[0].value == null || _params[0].value is UnityEngine.Object))
                {
                    GameObject.DestroyImmediate(((UnityEngine.Object)_params[0].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 2 && (_params[0].value == null || _params[0].value is UnityEngine.Object) && (_params[1].value is IConvertible))
                {
                    GameObject.DestroyImmediate(((UnityEngine.Object)_params[0].value), Convert.ToBoolean(_params[1].value));
                    return(CLS_Content.Value.Void);
                }
            }
            else if (function == "DestroyObject")
            {
                if (_params.size == 1 && (_params[0].value == null || _params[0].value is UnityEngine.Object))
                {
                    GameObject.DestroyObject(((UnityEngine.Object)_params[0].value));
                    return(CLS_Content.Value.Void);
                }
                else if (_params.size == 2 && (_params[0].value == null || _params[0].value is UnityEngine.Object) && (_params[1].value is IConvertible))
                {
                    GameObject.DestroyObject(((UnityEngine.Object)_params[0].value), Convert.ToSingle(_params[1].value));
                    return(CLS_Content.Value.Void);
                }
            }
            else if (function == "DontDestroyOnLoad")
            {
                GameObject.DontDestroyOnLoad(((UnityEngine.Object)_params[0].value));
                return(CLS_Content.Value.Void);
            }
            else if (function == "Equals")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(bool);
                val.value = GameObject.Equals(_params[0].value, _params[1].value);
                return(val);
            }
            else if (function == "Find")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(GameObject);
                val.value = GameObject.Find(((string)_params[0].value));
                return(val);
            }
            else if (function == "FindGameObjectsWithTag")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(GameObject[]);
                val.value = GameObject.FindGameObjectsWithTag(((string)_params[0].value));
                return(val);
            }
            else if (function == "FindGameObjectWithTag")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(GameObject);
                val.value = GameObject.FindGameObjectWithTag(((string)_params[0].value));
                return(val);
            }
            else if (function == "FindObjectOfType")
            {
                if (_params.size == 1 && (_params[0].value == null || _params[0].value is Type))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(UnityEngine.Object);
                    val.value = GameObject.FindObjectOfType(((Type)_params[0].value));
                    return(val);
                }
            }
            else if (function == "FindObjectsOfType")
            {
                if (_params.size == 1 && (_params[0].value == null || _params[0].value is Type))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(UnityEngine.Object[]);
                    val.value = GameObject.FindObjectsOfType(((Type)_params[0].value));
                    return(val);
                }
            }
            else if (function == "FindWithTag")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(GameObject);
                val.value = GameObject.FindWithTag(((string)_params[0].value));
                return(val);
            }
            else if (function == "Instantiate")
            {
                if (_params.size == 1 && (_params[0].value == null || _params[0].value is UnityEngine.Object))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(UnityEngine.Object);
                    val.value = GameObject.Instantiate(((UnityEngine.Object)_params[0].value));
                    return(val);
                }
                else if (_params.size == 3 && (_params[0].value == null || _params[0].value is UnityEngine.Object) && (_params[1].value is Vector3) && (_params[2].value is Quaternion))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(UnityEngine.Object);
                    val.value = GameObject.Instantiate(((UnityEngine.Object)_params[0].value), ((Vector3)_params[1].value), ((Quaternion)_params[2].value));
                    return(val);
                }
            }
            else if (function == "ReferenceEquals")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(bool);
                val.value = GameObject.ReferenceEquals(_params[0].value, _params[1].value);
                return(val);
            }

            return(base.StaticCall(content, function, _params));
        }
Beispiel #22
0
        public override CLS_Content.Value StaticCall(CLS_Content content, string function, BetterList <CLS_Content.Value> _params)
        {
            if (function == "Abs")
            {
                if ((_params[0].value is sbyte))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(sbyte);
                    val.value = Math.Abs(((sbyte)_params[0].value));
                    return(val);
                }
                else if ((_params[0].value is short))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(short);
                    val.value = Math.Abs(Convert.ToInt16(_params[0].value));
                    return(val);
                }
                else if ((_params[0].value is int))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(int);
                    val.value = Math.Abs(Convert.ToInt32(_params[0].value));
                    return(val);
                }
                else if ((_params[0].value is long))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(long);
                    val.value = Math.Abs(Convert.ToInt64(_params[0].value));
                    return(val);
                }
                else if ((_params[0].value is float))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(float);
                    val.value = Math.Abs(Convert.ToSingle(_params[0].value));
                    return(val);
                }
                else if ((_params[0].value is IConvertible))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(double);
                    val.value = Math.Abs(Convert.ToDouble(_params[0].value));
                    return(val);
                }
            }
            else if (function == "Acos")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(double);
                val.value = Math.Acos(Convert.ToDouble(_params[0].value));
                return(val);
            }
            else if (function == "Asin")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(double);
                val.value = Math.Asin(Convert.ToDouble(_params[0].value));
                return(val);
            }
            else if (function == "Atan")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(double);
                val.value = Math.Atan(Convert.ToDouble(_params[0].value));
                return(val);
            }
            else if (function == "Atan2")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(double);
                val.value = Math.Atan2(Convert.ToDouble(_params[0].value), Convert.ToDouble(_params[1].value));
                return(val);
            }
            else if (function == "Ceiling")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(double);
                val.value = Math.Ceiling(Convert.ToDouble(_params[0].value));
                return(val);
            }
            else if (function == "Cos")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(double);
                val.value = Math.Cos(Convert.ToDouble(_params[0].value));
                return(val);
            }
            else if (function == "Cosh")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(double);
                val.value = Math.Cosh(Convert.ToDouble(_params[0].value));
                return(val);
            }
            else if (function == "Exp")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(double);
                val.value = Math.Exp(Convert.ToDouble(_params[0].value));
                return(val);
            }
            else if (function == "Floor")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(double);
                val.value = Math.Floor(Convert.ToDouble(_params[0].value));
                return(val);
            }
            else if (function == "IEEERemainder")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(double);
                val.value = Math.IEEERemainder(Convert.ToDouble(_params[0].value), Convert.ToDouble(_params[1].value));
                return(val);
            }
            else if (function == "Log")
            {
                if (_params.size == 1)
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(double);
                    val.value = Math.Log(Convert.ToDouble(_params[0].value));
                    return(val);
                }
                else if (_params.size == 2)
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(double);
                    val.value = Math.Log(Convert.ToDouble(_params[0].value), Convert.ToDouble(_params[1].value));
                    return(val);
                }
            }
            else if (function == "Log10")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(double);
                val.value = Math.Log10(Convert.ToDouble(_params[0].value));
                return(val);
            }
            else if (function == "Max")
            {
                if ((_params[0].value is sbyte) && (_params[1].value is sbyte))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(sbyte);
                    val.value = Math.Max(((sbyte)_params[0].value), ((sbyte)_params[1].value));
                    return(val);
                }
                else if ((_params[0].value is byte) && (_params[1].value is byte))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(byte);
                    val.value = Math.Max(Convert.ToByte(_params[0].value), Convert.ToByte(_params[1].value));
                    return(val);
                }
                else if ((_params[0].value is short) && (_params[1].value is short))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(short);
                    val.value = Math.Max(Convert.ToInt16(_params[0].value), Convert.ToInt16(_params[1].value));
                    return(val);
                }
                else if ((_params[0].value is ushort) && (_params[1].value is ushort))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(ushort);
                    val.value = Math.Max(Convert.ToUInt16(_params[0].value), Convert.ToUInt16(_params[1].value));
                    return(val);
                }
                else if ((_params[0].value is int) && (_params[1].value is int))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(int);
                    val.value = Math.Max(Convert.ToInt32(_params[0].value), Convert.ToInt32(_params[1].value));
                    return(val);
                }
                else if ((_params[0].value is uint) && (_params[1].value is uint))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(uint);
                    val.value = Math.Max(Convert.ToUInt32(_params[0].value), Convert.ToUInt32(_params[1].value));
                    return(val);
                }
                else if ((_params[0].value is long) && (_params[1].value is long))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(long);
                    val.value = Math.Max(Convert.ToInt64(_params[0].value), Convert.ToInt64(_params[1].value));
                    return(val);
                }
                else if ((_params[0].value is ulong) && (_params[1].value is ulong))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(ulong);
                    val.value = Math.Max(Convert.ToUInt64(_params[0].value), Convert.ToUInt64(_params[1].value));
                    return(val);
                }
                else if ((_params[0].value is float) && (_params[1].value is float))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(float);
                    val.value = Math.Max(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value));
                    return(val);
                }
                else if ((_params[0].value is IConvertible) && (_params[1].value is IConvertible))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(double);
                    val.value = Math.Max(Convert.ToDouble(_params[0].value), Convert.ToDouble(_params[1].value));
                    return(val);
                }
            }
            else if (function == "Min")
            {
                if ((_params[0].value is sbyte) && (_params[1].value is sbyte))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(sbyte);
                    val.value = Math.Min(((sbyte)_params[0].value), ((sbyte)_params[1].value));
                    return(val);
                }
                else if ((_params[0].value is byte) && (_params[1].value is byte))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(byte);
                    val.value = Math.Min(Convert.ToByte(_params[0].value), Convert.ToByte(_params[1].value));
                    return(val);
                }
                else if ((_params[0].value is short) && (_params[1].value is short))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(short);
                    val.value = Math.Min(Convert.ToInt16(_params[0].value), Convert.ToInt16(_params[1].value));
                    return(val);
                }
                else if ((_params[0].value is ushort) && (_params[1].value is ushort))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(ushort);
                    val.value = Math.Min(Convert.ToUInt16(_params[0].value), Convert.ToUInt16(_params[1].value));
                    return(val);
                }
                else if ((_params[0].value is int) && (_params[1].value is int))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(int);
                    val.value = Math.Min(Convert.ToInt32(_params[0].value), Convert.ToInt32(_params[1].value));
                    return(val);
                }
                else if ((_params[0].value is uint) && (_params[1].value is uint))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(uint);
                    val.value = Math.Min(Convert.ToUInt32(_params[0].value), Convert.ToUInt32(_params[1].value));
                    return(val);
                }
                else if ((_params[0].value is long) && (_params[1].value is long))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(long);
                    val.value = Math.Min(Convert.ToInt64(_params[0].value), Convert.ToInt64(_params[1].value));
                    return(val);
                }
                else if ((_params[0].value is ulong) && (_params[1].value is ulong))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(ulong);
                    val.value = Math.Min(Convert.ToUInt64(_params[0].value), Convert.ToUInt64(_params[1].value));
                    return(val);
                }
                else if ((_params[0].value is float) && (_params[1].value is float))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(float);
                    val.value = Math.Min(Convert.ToSingle(_params[0].value), Convert.ToSingle(_params[1].value));
                    return(val);
                }
                else if ((_params[0].value is IConvertible) && (_params[1].value is IConvertible))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(double);
                    val.value = Math.Min(Convert.ToDouble(_params[0].value), Convert.ToDouble(_params[1].value));
                    return(val);
                }
            }
            else if (function == "Pow")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(double);
                val.value = Math.Pow(Convert.ToDouble(_params[0].value), Convert.ToDouble(_params[1].value));
                return(val);
            }
            else if (function == "Round")
            {
                if (_params.size == 1 && (_params[0].value is IConvertible))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(double);
                    val.value = Math.Round(Convert.ToDouble(_params[0].value));
                    return(val);
                }
                else if (_params.size == 2 && (_params[0].value is IConvertible) && (_params[1].value is MidpointRounding))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(double);
                    val.value = Math.Round(Convert.ToDouble(_params[0].value), ((MidpointRounding)_params[1].value));
                    return(val);
                }
                else if (_params.size == 2 && (_params[0].value is IConvertible) && (_params[1].value is int))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(double);
                    val.value = Math.Round(Convert.ToDouble(_params[0].value), Convert.ToInt32(_params[1].value));
                    return(val);
                }
                else if (_params.size == 3 && (_params[0].value is IConvertible) && (_params[1].value is int) && (_params[2].value is MidpointRounding))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(double);
                    val.value = Math.Round(Convert.ToDouble(_params[0].value), Convert.ToInt32(_params[1].value), ((MidpointRounding)_params[2].value));
                    return(val);
                }
            }
            else if (function == "Sign")
            {
                if ((_params[0].value is sbyte))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(int);
                    val.value = Math.Sign(((sbyte)_params[0].value));
                    return(val);
                }
                else if ((_params[0].value is short))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(int);
                    val.value = Math.Sign(Convert.ToInt16(_params[0].value));
                    return(val);
                }
                else if ((_params[0].value is int))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(int);
                    val.value = Math.Sign(Convert.ToInt32(_params[0].value));
                    return(val);
                }
                else if ((_params[0].value is long))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(int);
                    val.value = Math.Sign(Convert.ToInt64(_params[0].value));
                    return(val);
                }
                else if ((_params[0].value is float))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(int);
                    val.value = Math.Sign(Convert.ToSingle(_params[0].value));
                    return(val);
                }
                else if ((_params[0].value is IConvertible))
                {
                    CLS_Content.Value val = new CLS_Content.Value();
                    val.type  = typeof(int);
                    val.value = Math.Sign(Convert.ToDouble(_params[0].value));
                    return(val);
                }
            }
            else if (function == "Sin")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(double);
                val.value = Math.Sin(Convert.ToDouble(_params[0].value));
                return(val);
            }
            else if (function == "Sinh")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(double);
                val.value = Math.Sinh(Convert.ToDouble(_params[0].value));
                return(val);
            }
            else if (function == "Sqrt")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(double);
                val.value = Math.Sqrt(Convert.ToDouble(_params[0].value));
                return(val);
            }
            else if (function == "Tan")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(double);
                val.value = Math.Tan(Convert.ToDouble(_params[0].value));
                return(val);
            }
            else if (function == "Tanh")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(double);
                val.value = Math.Tanh(Convert.ToDouble(_params[0].value));
                return(val);
            }
            else if (function == "Truncate")
            {
                CLS_Content.Value val = new CLS_Content.Value();
                val.type  = typeof(double);
                val.value = Math.Truncate(Convert.ToDouble(_params[0].value));
                return(val);
            }

            return(base.StaticCall(content, function, _params));
        }