예제 #1
0
        /*!
         * Check if next chunk is an Array and returns it. returns empty string if not an array
         * */
        private static string CheckArray(object context, string input)
        {
            string rString = "^[a-z10-9_]+(?=\\[[a-z0-9_]+\\])";
            string capture = "";

            Match match = Regex.Match(input, rString, RegexOptions.IgnoreCase);

            if (match.Success)
            {
                capture = match.Value;
                System.Type objectType = MethodicalExecutor.GetTypeFromClass(context, capture);
                if (objectType.IsArray)
                {
                    return(capture);
                }
            }
            return("");
        }
예제 #2
0
        /*!
         * Calls commands to the selected monobehaviour using invoke
         *
         * */
        private void CallCommand()
        {
            if (go == null)
            {
                //display.Insert(0,new MethodicalMessage("No monobehavior selected!",MethodicalMessage.MessageTypes.Error));
                //return;
            }
            if (command.Equals(""))
            {
                display.Insert(0, new MethodicalMessage("No command entered!", MethodicalMessage.MessageTypes.Error));
                return;
            }
            commandCalled = true;
            MethodicalExecutor.isStatic   = staticMode;
            MethodicalExecutor.root       = go;
            MethodicalExecutor.staticRoot = staticVariable;

            MethodicalObject chain = MethodicalInterpreter.MakeChain(go, command);



            object returnValue = MethodicalExecutor.execute(chain);

            commands.Insert(0, command);
            display.Insert(0, command);
            if (chain.GetType().Equals(typeof(MethodicalErrorObject)))
            {
                display.Insert(0, new MethodicalMessage(chain.ToString(), MethodicalMessage.MessageTypes.Error));
            }
            else if (returnValue != null && returnValue.GetType().Equals(typeof(MethodicalErrorObject)))
            {
                display.Insert(0, new MethodicalMessage(returnValue.ToString(), MethodicalMessage.MessageTypes.Error));
            }
            else if (returnValue != null)
            {
                display.Insert(0, new MethodicalMessage("-     " + returnValue, MethodicalMessage.MessageTypes.Return));
            }
            command       = "";
            commandIndex  = -1;
            cachedCommand = "";
            EditorGUI.FocusTextInControl("MethodicalCommandField");
        }