Пример #1
0
        // Token: 0x06002532 RID: 9522 RVA: 0x000B86BC File Offset: 0x000B68BC
        private void CD(Console.LogEntry log, string name)
        {
            if (name == "..")
            {
                if (this.selectGO != null)
                {
                    if (this.selectGO.transform.parent != null)
                    {
                        this.selectGO = this.selectGO.transform.parent.gameObject;
                    }
                    else
                    {
                        this.selectGO = null;
                    }
                    log.commandType = 2;
                    this.ShowPath(false);
                    return;
                }
            }
            else if (name == "\\")
            {
                this.selectGO   = null;
                log.commandType = 2;
                return;
            }
            Transform transform = Methods.Find <Transform>(this.selectGO, name);

            if (transform != null)
            {
                this.selectGO = transform.gameObject;
                this.ShowPath(false);
                log.commandType = 2;
            }
        }
Пример #2
0
 // Token: 0x0600252C RID: 9516 RVA: 0x000B8298 File Offset: 0x000B6498
 private void Clear(Console.LogEntry log, string cmd)
 {
     if (cmd == "clear")
     {
         this.logs.Clear();
         log.commandType = 2;
         return;
     }
     if (cmd == "input")
     {
         for (int i = 0; i < this.logs.Count; i++)
         {
             if (!this.logs[i].unityLog)
             {
                 this.logs.RemoveAt(i--);
             }
         }
         log.commandType = 2;
         return;
     }
     if (cmd == "unity")
     {
         for (int j = 0; j < this.logs.Count; j++)
         {
             if (this.logs[j].unityLog)
             {
                 this.logs.RemoveAt(j--);
             }
         }
         log.commandType = 2;
     }
 }
Пример #3
0
 // Token: 0x0600252F RID: 9519 RVA: 0x000B85A0 File Offset: 0x000B67A0
 private void Components(Console.LogEntry log)
 {
     if (this.selectGO == null)
     {
         log.commandType = 1;
         return;
     }
     Component[] components = this.selectGO.GetComponents <Component>();
     this.ShowPath(true);
     for (int i = 0; i < components.Length; i++)
     {
         if (components[i] != null)
         {
             Console.Log(components[i].GetType().Name, 0, null, null);
         }
     }
     log.commandType = 2;
 }
Пример #4
0
 // Token: 0x06002536 RID: 9526 RVA: 0x000B8F9A File Offset: 0x000B719A
 private void AnimateColor(Color col, Console.LogEntry log, float multi)
 {
     GUI.color = Color.Lerp(col * multi, col, Mathf.Abs(Mathf.Sin(Time.time)));
 }
Пример #5
0
        // Token: 0x06002535 RID: 9525 RVA: 0x000B88C0 File Offset: 0x000B6AC0
        private void OnGUI()
        {
            if (!this.showConsole)
            {
                return;
            }
            this.window.x    = 225f;
            this.window.y    = 5f;
            this.window.yMax = (float)(this.lines * 20 + 30);
            this.window.xMax = (float)Screen.width - this.window.x;
            GUI.Box(this.window, "Console");
            this.inputRect.x    = this.window.x + 5f;
            this.inputRect.y    = this.window.yMax - 25f;
            this.inputRect.xMax = this.window.xMax - 10f;
            this.inputRect.yMax = this.window.yMax - 5f;
            if (this.showInputLog)
            {
                if (GUI.GetNameOfFocusedControl() == "ConsoleInput" && Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return)
                {
                    this.showLast = true;
                    this.ExecuteCommand(this.inputText);
                    this.inputText = string.Empty;
                }
                GUI.SetNextControlName("ConsoleInput");
                GUI.changed    = false;
                this.inputText = GUI.TextField(this.inputRect, this.inputText);
                if (GUI.changed && this.inputText.Contains("`"))
                {
                    this.inputText = this.inputText.Replace("`", "");
                    this.SetConsoleActive(!this.showConsole);
                }
                if (this.setFocus)
                {
                    this.setFocus = false;
                    GUI.FocusControl("ConsoleInput");
                }
            }
            if (this.showInputLog)
            {
                GUI.color = Color.green;
            }
            else
            {
                GUI.color = Color.grey;
            }
            if (GUI.Button(new Rect(this.window.xMin + 5f, this.window.yMin + 5f, 75f, 20f), "Input Log"))
            {
                this.showInputLog = !this.showInputLog;
            }
            if (this.showUnityLog)
            {
                GUI.color = Color.green;
            }
            else
            {
                GUI.color = Color.grey;
            }
            if (GUI.Button(new Rect(this.window.xMin + 85f, this.window.yMin + 5f, 75f, 20f), "Unity Log"))
            {
                this.showUnityLog = !this.showUnityLog;
            }
            GUI.color = Color.white;
            if (!this.showInputLog && !this.showUnityLog)
            {
                this.showInputLog = true;
            }
            this.logRect.x        = this.window.x + 5f;
            this.logRect.y        = this.window.y + 25f;
            this.logRect.xMax     = this.window.xMax - 20f;
            this.logRect.yMax     = this.logRect.y + 20f;
            this.vScrollRect.x    = this.window.xMax - 15f;
            this.vScrollRect.y    = this.logRect.y;
            this.vScrollRect.xMax = this.window.xMax - 5f;
            this.vScrollRect.yMax = this.window.yMax - 45f;
            float num = Mathf.Ceil(this.vScrollRect.height / 20f);

            if (this.showLast && Event.current.type != EventType.Repaint)
            {
                this.scrollPos = (float)this.logs.Count;
            }
            GUI.changed    = false;
            this.scrollPos = GUI.VerticalScrollbar(this.vScrollRect, this.scrollPos, (num > (float)(this.logs.Count - 1)) ? ((float)(this.logs.Count - 1)) : (num - 1f), 0f, (float)(this.logs.Count - 1));
            if (GUI.changed)
            {
                this.showLast = false;
            }
            int num2 = (int)this.scrollPos;

            if (num2 < 0)
            {
                num2 = 0;
            }
            int num3 = num2 + (int)num;

            if (num3 > this.logs.Count)
            {
                num3 = this.logs.Count;
            }
            int num4 = num3 - num2;
            int num5 = num2;
            int num6 = 0;

            while (num6 != num4 && num5 < this.logs.Count)
            {
                Console.LogEntry logEntry = this.logs[num5];
                if ((logEntry.unityLog && this.showUnityLog) || (!logEntry.unityLog && this.showInputLog))
                {
                    if (logEntry.logType == LogType.Warning)
                    {
                        this.AnimateColor(Color.yellow, logEntry, 0.75f);
                    }
                    else if (logEntry.logType == LogType.Error)
                    {
                        this.AnimateColor(Color.red, logEntry, 0.75f);
                    }
                    else if (logEntry.logType == LogType.Exception)
                    {
                        this.AnimateColor(Color.magenta, logEntry, 0.75f);
                    }
                    else if (logEntry.unityLog)
                    {
                        this.AnimateColor(Color.white, logEntry, 0.75f);
                    }
                    else if (logEntry.commandType == 1)
                    {
                        GUI.color = new Color(0f, 0.5f, 0f);
                    }
                    else if (logEntry.commandType == 2)
                    {
                        GUI.color = Color.green;
                    }
                    else if (logEntry.go != null)
                    {
                        GUI.color = (logEntry.go.activeSelf ? Color.white : (Color.white * 0.7f));
                    }
                    string text = logEntry.logString;
                    if (text.Contains("*color-"))
                    {
                        if (text.Contains("*color-green#"))
                        {
                            text      = text.Replace("*color-green#", "");
                            GUI.color = Color.green;
                        }
                        else if (text.Contains("*color-blue#"))
                        {
                            text      = text.Replace("*color-blue#", "");
                            GUI.color = Color.blue;
                        }
                    }
                    GUI.Label(this.logRect, num5 + ") ");
                    this.logRect.xMin = this.logRect.xMin + 55f;
                    GUI.Label(this.logRect, text + ((logEntry.stackTrace != "") ? (" (" + logEntry.stackTrace + ")") : ""));
                    this.logRect.xMin = this.logRect.xMin - 55f;
                    GUI.color         = Color.white;
                    this.logRect.y    = this.logRect.y + 20f;
                    num6++;
                }
                num5++;
            }
        }
Пример #6
0
 // Token: 0x06002525 RID: 9509 RVA: 0x000B7894 File Offset: 0x000B5A94
 private void ExecuteCommand(string cmd)
 {
     this.logs.Add(new Console.LogEntry(cmd, "", LogType.Log, false, 1, null, null));
     Console.LogEntry logEntry = this.logs[this.logs.Count - 1];
     if (cmd == "?")
     {
         Console.Log("'F1' to show/hide console", 0, null, null);
         Console.Log("'dir', 'dirAll', 'dirSort', 'cd', 'show', 'showAll', 'hide', 'hideAll'", 0, null, null);
         Console.Log("'components', 'lines', 'clear', 'gc collect'", 0, null, null);
         Console.Log("'select (MeshCombineStudio name)', ", 0, null, null);
         Console.Log("'report MeshCombineStudio'", 0, null, null);
         Console.Log("'combine', 'uncombine', 'combine automatic on/off'", 0, null, null);
         Console.Log("'max bounds factor (float)/off'", 0, null, null);
         Console.Log("'vertex input limit (float)/off'", 0, null, null);
         Console.Log("'vertex input limit lod (float)/off'", 0, null, null);
         Console.Log("'cell size (float)'", 0, null, null);
         logEntry.commandType = 2;
         return;
     }
     if (cmd == "gc collect")
     {
         GC.Collect();
         logEntry.commandType = 2;
         return;
     }
     if (cmd == "dir")
     {
         this.Dir();
         logEntry.commandType = 2;
         return;
     }
     if (cmd == "components")
     {
         this.Components(logEntry);
         return;
     }
     if (cmd.Contains("lines "))
     {
         int.TryParse(cmd.Replace("lines ", ""), out this.lines);
         this.lines           = Mathf.Clamp(this.lines, 5, 50);
         logEntry.commandType = 2;
         return;
     }
     if (cmd == "cd..")
     {
         this.CD(logEntry, "..");
         return;
     }
     if (cmd == "cd\\")
     {
         this.CD(logEntry, "\\");
         return;
     }
     if (cmd.Contains("cd "))
     {
         this.CD(logEntry, cmd.Replace("cd ", ""));
         return;
     }
     if (cmd.Contains("show "))
     {
         Transform transform = Methods.Find <Transform>(this.selectGO, cmd.Replace("show ", ""));
         if (transform != null)
         {
             transform.gameObject.SetActive(true);
             logEntry.commandType = 2;
             return;
         }
     }
     else if (cmd == "show")
     {
         if (this.selectGO != null)
         {
             this.selectGO.SetActive(true);
             logEntry.commandType = 2;
             return;
         }
     }
     else
     {
         if (cmd.Contains("showAll "))
         {
             this.SetActiveContains(cmd.Replace("showAll ", ""), true);
             logEntry.commandType = 2;
             return;
         }
         if (cmd.Contains("hide "))
         {
             GameObject gameObject = GameObject.Find(cmd.Replace("hide ", ""));
             if (gameObject != null)
             {
                 gameObject.SetActive(false);
                 logEntry.commandType = 2;
                 return;
             }
         }
         else
         {
             if (cmd.Contains("hideAll "))
             {
                 this.SetActiveContains(cmd.Replace("hideAll ", ""), false);
                 logEntry.commandType = 2;
                 return;
             }
             if (cmd == "hide")
             {
                 if (this.selectGO != null)
                 {
                     this.selectGO.SetActive(false);
                     logEntry.commandType = 2;
                     return;
                 }
             }
             else
             {
                 if (cmd.Contains("clear"))
                 {
                     this.Clear(logEntry, cmd.Replace("clear ", ""));
                     return;
                 }
                 if (cmd.Contains("dir "))
                 {
                     this.DirContains(cmd.Replace("dir ", ""));
                     logEntry.commandType = 2;
                     return;
                 }
                 if (cmd == "dirAll")
                 {
                     this.DirAll();
                     logEntry.commandType = 2;
                     return;
                 }
                 if (cmd.Contains("dirSort "))
                 {
                     this.DirSort(cmd.Replace("dirSort ", ""));
                     logEntry.commandType = 2;
                     return;
                 }
                 if (cmd == "dirSort")
                 {
                     this.DirSort();
                     logEntry.commandType = 2;
                     return;
                 }
                 if (cmd.Contains("cell size "))
                 {
                     int num;
                     int.TryParse(cmd.Replace("cell size ", ""), out num);
                     if (num < 4)
                     {
                         Console.Log("cell size should be bigger than 4", 0, null, null);
                         return;
                     }
                     if (this.selectedMeshCombiner != null)
                     {
                         this.selectedMeshCombiner.cellSize = num;
                         this.selectedMeshCombiner.AddObjectsAutomatically();
                         if (this.combineAutomatic)
                         {
                             this.selectedMeshCombiner.CombineAll();
                         }
                         this.ReportMeshCombiner(this.selectedMeshCombiner, false);
                         logEntry.commandType = 2;
                         return;
                     }
                 }
                 else
                 {
                     if (cmd == "report MeshCombineStudio")
                     {
                         this.ReportMeshCombiners(true);
                         logEntry.commandType = 2;
                         return;
                     }
                     if (cmd == "combine")
                     {
                         if (this.selectedMeshCombiner != null)
                         {
                             this.selectedMeshCombiner.octreeContainsObjects = false;
                             this.selectedMeshCombiner.CombineAll();
                             this.ReportMeshCombiner(this.selectedMeshCombiner, false);
                             logEntry.commandType = 2;
                             return;
                         }
                     }
                     else if (cmd == "uncombine")
                     {
                         if (this.selectedMeshCombiner != null)
                         {
                             this.selectedMeshCombiner.DestroyCombinedObjects();
                             this.ReportMeshCombiner(this.selectedMeshCombiner, false);
                             logEntry.commandType = 2;
                             return;
                         }
                     }
                     else
                     {
                         if (cmd == "combine automatic off")
                         {
                             this.combineAutomatic = false;
                             logEntry.commandType  = 2;
                             return;
                         }
                         if (cmd == "combine automatic on")
                         {
                             this.combineAutomatic = true;
                             logEntry.commandType  = 2;
                             return;
                         }
                         if (cmd.Contains("select "))
                         {
                             if (this.SelectMeshCombiner(cmd.Replace("select ", "")) == 2)
                             {
                                 this.ReportMeshCombiner(this.selectedMeshCombiner, false);
                                 logEntry.commandType = 2;
                                 return;
                             }
                         }
                         else if (cmd == "max bounds factor off")
                         {
                             if (this.selectedMeshCombiner != null)
                             {
                                 this.selectedMeshCombiner.searchOptions.useMaxBoundsFactor = false;
                                 this.selectedMeshCombiner.AddObjectsAutomatically();
                                 if (this.combineAutomatic)
                                 {
                                     this.selectedMeshCombiner.CombineAll();
                                 }
                                 this.ReportMeshCombiner(this.selectedMeshCombiner, false);
                                 logEntry.commandType = 2;
                                 return;
                             }
                         }
                         else if (cmd.Contains("max bounds factor "))
                         {
                             float num2;
                             float.TryParse(cmd.Replace("max bounds factor ", ""), out num2);
                             if (num2 < 1f)
                             {
                                 Console.Log("max bounds factor needs to be bigger than 1", 0, null, null);
                                 return;
                             }
                             if (this.selectedMeshCombiner != null)
                             {
                                 this.selectedMeshCombiner.searchOptions.useMaxBoundsFactor = true;
                                 this.selectedMeshCombiner.searchOptions.maxBoundsFactor    = num2;
                                 this.selectedMeshCombiner.AddObjectsAutomatically();
                                 if (this.combineAutomatic)
                                 {
                                     this.selectedMeshCombiner.CombineAll();
                                 }
                                 this.ReportMeshCombiner(this.selectedMeshCombiner, false);
                                 logEntry.commandType = 2;
                                 return;
                             }
                         }
                         else if (cmd == "vertex input limit off")
                         {
                             if (this.selectedMeshCombiner != null)
                             {
                                 this.selectedMeshCombiner.searchOptions.useVertexInputLimit = false;
                                 this.selectedMeshCombiner.AddObjectsAutomatically();
                                 if (this.combineAutomatic)
                                 {
                                     this.selectedMeshCombiner.CombineAll();
                                 }
                                 this.ReportMeshCombiner(this.selectedMeshCombiner, false);
                                 logEntry.commandType = 2;
                                 return;
                             }
                         }
                         else if (cmd.Contains("vertex input limit "))
                         {
                             int num3;
                             int.TryParse(cmd.Replace("vertex input limit ", ""), out num3);
                             if (num3 < 1)
                             {
                                 Console.Log("vertex input limit needs to be bigger than 1", 0, null, null);
                                 return;
                             }
                             if (this.selectedMeshCombiner != null)
                             {
                                 this.selectedMeshCombiner.searchOptions.useVertexInputLimit = true;
                                 this.selectedMeshCombiner.searchOptions.vertexInputLimit    = num3;
                                 this.selectedMeshCombiner.AddObjectsAutomatically();
                                 if (this.combineAutomatic)
                                 {
                                     this.selectedMeshCombiner.CombineAll();
                                 }
                                 this.ReportMeshCombiner(this.selectedMeshCombiner, false);
                                 logEntry.commandType = 2;
                             }
                         }
                     }
                 }
             }
         }
     }
 }