Exemple #1
0
        public static void ExecuteCommand(string commandName, bool emitWarning = true)
        {
            CommandInfo comInfo = CommandManager.Instance.GetCommandInfo(commandName);

            if (emitWarning && comInfo == null)
            {
                Debug.LogWarningFormat("Monkey Warning: {0} " +
                                       "is not a valid command name: the command " +
                                       "couldn't be executed", commandName);
                return;
            }

            if (!comInfo.IsParametric)
            {
                comInfo.ExecuteCommand();
                return;
            }

            if (!CurrentPanel)
            {
                ShowNewPanel();
            }
            else
            {
                if (!CurrentPanel.isActiveMode)
                {
                    ActivatePanel();
                }
                else
                {
                    CurrentPanel.Focus();
                }
            }

            ParametricCommandExecution exec =
                new ParametricCommandExecution(comInfo, CurrentPanel);

            CurrentPanel.ActivateParametricMode(exec);
        }