Esempio n. 1
0
        public void Cmd_Dir(Command.Exec e)
        {
            List <KeyValuePair <string, object> > list = Listing(workingTransform);
            UnityConsole console = GetComponent <UnityConsole>();

            for (int i = 0; i < list.Count; ++i)
            {
                console.WriteLine(list[i].Key);
            }
        }
Esempio n. 2
0
        public void Cmd_Pwd(Command.Exec e)
        {
            UnityConsole console = GetComponent <UnityConsole>();
            string       pwd     = "/";

            if (workingTransform != null)
            {
                pwd += workingTransform.HierarchyPath();
            }
            console.WriteLine(pwd);
        }
        public void DoCommand(string text)
        {
            UnityConsole console = GetComponent <UnityConsole>();

            CommanderInstance.ParseCommand(new Commander.Instruction(text, this), console.Write, out Tokenizer t);
            if (t?.errors?.Count > 0)
            {
                console.PushForeColor(ConsoleColor.Red);
                console.WriteLine(t.GetErrorString());
                Show.Log(t.GetErrorString());
                console.PopForeColor();
            }
            WhenCommandRuns?.Invoke(text);
        }
        public void Cmd_Echo(Command.Exec e)
        {
            UnityConsole  console = GetComponent <UnityConsole>();
            StringBuilder sb      = new StringBuilder();

            for (int i = 1; i < e.tok.tokens.Count; ++i)
            {
                object result = e.tok.tokens[i].Resolve(e.tok, e.src);
                if (result == null)
                {
                    result = "";
                }
                if (!(result is string))
                {
                    result = result.StringifySmall();
                }
                sb.Append(result.ToString());
            }
            console.WriteLine(sb.ToString());
        }