Example #1
0
        public static void AddLocalVariable(ParserFunction local, string varName = "")
        {
            NormalizeValue(local);
            local.m_isGlobal = false;

            lock (s_variables)
            {
                if (s_lastExecutionLevel == null)
                {
                    s_lastExecutionLevel = new StackLevel();
                    s_locals.Push(s_lastExecutionLevel);
                }
            }

            var name = Constants.ConvertName(string.IsNullOrWhiteSpace(varName) ? local.Name : varName);

            local.Name = Constants.GetRealName(name);
            if (local is GetVarFunction)
            {
                ((GetVarFunction)local).Value.ParamName = local.Name;
            }
            s_lastExecutionLevel.Variables[name] = local;
#if UNITY_EDITOR == false && UNITY_STANDALONE == false && __ANDROID__ == false && __IOS__ == false
            Translation.AddTempKeyword(name);
#endif
            var handle = OnVariableChange;
            if (handle != null && local is GetVarFunction)
            {
                handle.Invoke(local.Name, ((GetVarFunction)local).Value, false);
            }
        }
Example #2
0
        public static void AddLocalVariable(ParserFunction local)
        {
            NormalizeValue(local);
            local.m_isGlobal = false;
            StackLevel locals = null;

            if (s_locals.Count == 0)
            {
                locals = new StackLevel();
                s_locals.Push(locals);
            }
            else
            {
                locals = s_locals.Peek();
            }

            var name = Constants.ConvertName(local.Name);

            local.Name = Constants.GetRealName(name);
            if (local is GetVarFunction)
            {
                ((GetVarFunction)local).Value.ParamName = local.Name;
            }
            locals.Variables[name] = local;
#if UNITY_EDITOR == false && UNITY_STANDALONE == false && __ANDROID__ == false && __IOS__ == false
            Translation.AddTempKeyword(name);
#endif
        }
Example #3
0
        public static void AddGlobal(string name, ParserFunction function,
                                     bool isNative = true)
        {
            Utils.CheckLegalName(name);
            name = Constants.ConvertName(name);
            NormalizeValue(function);
            function.isNative = isNative;

            var  handle = OnVariableChange;
            bool exists = handle != null && s_variables.ContainsKey(name);

            s_variables[name] = function;

            function.Name = Constants.GetRealName(name);
#if UNITY_EDITOR == false && UNITY_STANDALONE == false && __ANDROID__ == false && __IOS__ == false
            if (!isNative)
            {
                Translation.AddTempKeyword(name);
            }
#endif
            if (handle != null && function is GetVarFunction)
            {
                handle.Invoke(function.Name, ((GetVarFunction)function).Value, exists);
            }
        }
Example #4
0
        public static void AddGlobal(string name, ParserFunction function,
                                     bool isNative = true)
        {
            function.isNative = isNative;
            s_functions[name] = function;

            if (string.IsNullOrWhiteSpace(function.Name))
            {
                function.Name = name;
            }
            if (!isNative)
            {
                Translation.AddTempKeyword(name);
            }
        }
        public static void AddGlobal(string name, ParserFunction function,
                                     bool isNative = true)
        {
            name = Constants.ConvertName(name);
            NormalizeValue(function);
            function.isNative = isNative;
            s_variables[name] = function;

            function.Name = Constants.GetRealName(name);
#if UNITY_EDITOR == false && UNITY_STANDALONE == false && __ANDROID__ == false && __IOS__ == false
            if (!isNative)
            {
                Translation.AddTempKeyword(name);
            }
#endif
        }
Example #6
0
        public static void AddLocalVariable(ParserFunction local)
        {
            local.m_isGlobal = false;
            StackLevel locals = null;

            if (s_locals.Count == 0)
            {
                locals = new StackLevel();
                s_locals.Push(locals);
            }
            else
            {
                locals = s_locals.Peek();
            }

            locals.Variables[local.Name] = local;
            Translation.AddTempKeyword(local.Name);
        }