Пример #1
0
        static void CommandSpeed(CommandArg[] args)
        {
            float time = args[0].Float;

            Terminal.Log("Your Game speed is set to " + time);
            Time.timeScale = time;
        }
Пример #2
0
        static void CommandHelp(CommandArg[] args)
        {
            if (args.Length == 0)
            {
                foreach (var command in Terminal.Shell.Commands)
                {
                    Terminal.Log("{0}: {1}", command.Key.PadRight(16), command.Value.help);
                }
                return;
            }

            string command_name = args[0].String.ToUpper();

            if (!Terminal.Shell.Commands.ContainsKey(command_name))
            {
                Terminal.Shell.IssueErrorMessage("Command {0} could not be found.", command_name);
                return;
            }

            string help = Terminal.Shell.Commands[command_name].help;

            if (help == null)
            {
                Terminal.Log("{0} does not provide any help documentation.", command_name);
            }
            else
            {
                Terminal.Log(help);
            }
        }
        static void CommandTime(CommandArg[] args)
        {
            var sw = new Stopwatch();

            sw.Start();

            Terminal.Shell.RunCommand(JoinArguments(args));

            sw.Stop();
            Terminal.Log("Time: {0}ms", (double)sw.ElapsedTicks / 10000);
        }
Пример #4
0
        static void CommandPrintCopyBuffer(CommandArg[] args)
        {
            string str = UnityEngine.GUIUtility.systemCopyBuffer;

            if (Terminal.IssuedError)
            {
                return;
            }

            Terminal.Log("copy buffer = {0}", str);
        }
Пример #5
0
        static void CommandWriteCopyBuffer(CommandArg[] args)
        {
            string whiteStr = args[0].String;

            UnityEngine.GUIUtility.systemCopyBuffer = whiteStr;
            if (Terminal.IssuedError)
            {
                return;
            }

            Terminal.Log("white success! copy buffer = {0}", whiteStr);
        }
Пример #6
0
        static void CommandAdd(CommandArg[] args)
        {
            int a = args[0].Int;
            int b = args[1].Int;

            if (Terminal.IssuedError)
            {
                return;                       // Error will be handled by Terminal
            }
            int result = a + b;

            Terminal.Log("{0} + {1} = {2}", a, b, result);
        }
Пример #7
0
        static void CommandSet(CommandArg[] args)
        {
            if (args.Length == 0)
            {
                foreach (var kv in Terminal.Shell.Variables)
                {
                    Terminal.Log("{0}: {1}", kv.Key.PadRight(16), kv.Value);
                }
                return;
            }

            string variable_name = args[0].String;

            if (variable_name[0] == '$')
            {
                Terminal.Log(TerminalLogType.Warning, "Warning: Variable name starts with '$', '${0}'.", variable_name);
            }

            Terminal.Shell.SetVariable(variable_name, JoinArguments(args, 1));
        }
Пример #8
0
        static void CommandTrace(CommandArg[] args)
        {
            int log_count = Terminal.Buffer.Logs.Count;

            if (log_count - 2 < 0)
            {
                Terminal.Log("Nothing to trace.");
                return;
            }

            var log_item = Terminal.Buffer.Logs[log_count - 2];

            if (log_item.stack_trace == "")
            {
                Terminal.Log("{0} (no trace)", log_item.message);
            }
            else
            {
                Terminal.Log(log_item.stack_trace);
            }
        }
Пример #9
0
        static void CommandShowScene(CommandArg[] args)
        {
            int count = SceneManager.sceneCountInBuildSettings;

            Terminal.Log(count + " Scenes In Build Settings");
            if (count <= 0)
            {
                Terminal.Log("No scenes in Build Settings!!!");
            }
            else
            {
                Terminal.Log("-----Here Are All Scenes In Build Settings-----");
                for (int i = 0; i < count; i++)
                {
                    string temp  = SceneUtility.GetScenePathByBuildIndex(i);
                    int    end   = temp.LastIndexOf(".");
                    int    start = temp.LastIndexOf("/");
                    Terminal.Log(temp.Substring(start + 1, end - start - 1));
                }
                Terminal.Log("-----------------------------------------------");
            }
        }
Пример #10
0
 static void CommandPrint(CommandArg[] args)
 {
     Terminal.Log(JoinArguments(args));
 }
Пример #11
0
 [RegisterCommand(Help = "What could this mean?", MaxArgCount = 0)] //CUSTOM COMMAND
 static void CommandDream(CommandArg[] args)
 {
     Terminal.Log("good...luck.opening..the....door");
 }