Пример #1
0
 public static void ListGameObjects(RequestContext context, string[] args)
 {
     if (args == null || args.Length == 0)
     {
         CUDLR.Console.Log("  Hierarchy TREE:");
         UnityEngine.GameObject[] objects = UnityEngine.Object.FindObjectsOfType <GameObject> ().Where(t => t.transform.parent == null).ToArray();
         foreach (UnityEngine.Object obj in objects)
         {
             CUDLR.Console.Log("\t" + obj.name);
         }
     }
     else if (args.Length == 1)
     {
         var path = args [0];
         UnityEngine.GameObject[] objects = UnityEngine.Object.FindObjectsOfType <GameObject> ().Where(t => t.transform.GetAbsolutePath() == path).ToArray();
         if (objects.Length >= 1)
         {
             for (int i = 0; i < objects.Length; i++)
             {
                 var go = objects [i];
                 //Console.Log("\t" + go.transform.GetAbsolutePath());
                 for (int j = 0; j < go.transform.childCount; j++)
                 {
                     var child = go.transform.GetChild(j);
                     CUDLR.Console.Log("\t\t" + child.GetAbsolutePath());
                 }
             }
         }
         else
         {
             Console.Log("can not find :" + args [0]);
         }
     }
 }
Пример #2
0
    public static void Pull(RequestContext context)
    {
        string module = Uri.UnescapeDataString(context.Request.QueryString.Get("file"));
        var    path   = LogManager.Instance.GetModuleLogFilePath(module);

        try
        {
            context.Response.WriteFile(path, "application/octet-stream", true);
            Console.Log("downloading... " + path);
        }
        catch (Exception e)
        {
            Console.Log("\tERROR:" + e.Message + "\n" + e.StackTrace);
        }
    }
Пример #3
0
        public string _complete(string[] partialCommand, int index, string result)
        {
            if (partialCommand.Length == index && m_command != null)
            {
                // this is a valid command... so we do nothing
                return(result);
            }
            else if (partialCommand.Length == index)
            {
                // This is valid but incomplete.. print all of the subcommands
                Console.LogCommand(result);
                foreach (string key in m_subcommands.Keys.OrderBy(m => m))
                {
                    Console.Log(result + " " + key);
                }
                return(result + " ");
            }
            else if (partialCommand.Length == (index + 1))
            {
                string partial = partialCommand[index];
                if (m_subcommands.ContainsKey(partial))
                {
                    result += partial;
                    return(m_subcommands[partial]._complete(partialCommand, index + 1, result));
                }

                // Find any subcommands that match our partial command
                List <string> matches = new List <string>();
                foreach (string key in m_subcommands.Keys.OrderBy(m => m))
                {
                    if (key.StartsWith(partial))
                    {
                        matches.Add(key);
                    }
                }

                if (matches.Count == 1)
                {
                    // Only one command found, log nothing and return the complete command for the user input
                    return(result + matches[0] + " ");
                }
                else if (matches.Count > 1)
                {
                    // list all the options for the user and return partial
                    Console.LogCommand(result + partial);
                    foreach (string match in matches)
                    {
                        Console.Log(result + match);
                    }
                }
                return(result + partial);
            }

            string token = partialCommand[index];

            if (!m_subcommands.ContainsKey(token))
            {
                return(result);
            }
            result += token + " ";
            return(m_subcommands[token]._complete(partialCommand, index + 1, result));
        }
Пример #4
0
 public static void Play()
 {
     Time.timeScale = 1;
     Console.Log("\tdone!");
 }
Пример #5
0
 public static void Pause()
 {
     Time.timeScale = 0;
     Console.Log("\tdone!");
 }