CrabUI
Loading...
Searching...
No Matches
Debug Commands.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Reflection;
5using System.Diagnostics;
6using System.Runtime.CompilerServices;
7using System.IO;
8
9using Barotrauma;
10using Microsoft.Xna.Framework;
11using Microsoft.Xna.Framework.Input;
12using Microsoft.Xna.Framework.Graphics;
13using HarmonyLib;
14
15namespace CrabUI
16{
17 public partial class CUI
18 {
19 internal static void AddDebugCommands()
20 {
21 AddedCommands.Add(new DebugConsole.Command("cuidebug", "", CUIDebug_Command));
22 AddedCommands.Add(new DebugConsole.Command("cuimg", "", CUIMG_Command));
23 AddedCommands.Add(new DebugConsole.Command("cuidraworder", "", CUIDrawOrder_Command));
24 AddedCommands.Add(new DebugConsole.Command("cuiprinttree", "", CUIPrintTree_Command));
25 AddedCommands.Add(new DebugConsole.Command("printsprites", "", PrintSprites_Command));
26 AddedCommands.Add(new DebugConsole.Command("cuidebugprops", "", CUIDebugProps_Command));
27
28 DebugConsole.Commands.InsertRange(0, AddedCommands);
29 }
30
31 public static void CUIDebug_Command(string[] args)
32 {
33 if (CUIDebugWindow.Main == null) CUIDebugWindow.Open();
34 else CUIDebugWindow.Close();
35 }
36
37 public static void CUIDebugProps_Command(string[] args)
38 {
39 if (CUIPropsDebug.Opened) CUI.Log($"Already opened");
40 else CUIPropsDebug.Open();
41 }
42 public static void CUIMG_Command(string[] args) => CUIMagnifyingGlass.ToggleEquip();
43
44 public static void CUIDrawOrder_Command(string[] args)
45 {
46 foreach (CUIComponent c in CUI.Main.Flat) { CUI.Log(c); }
47 }
48
49 public static void CUIPrintTree_Command(string[] args)
50 {
51 CUI.Main?.PrintTree();
52 CUI.TopMain?.PrintTree();
53 }
54
55 public static void PrintSprites_Command(string[] args)
56 {
57 foreach (GUIComponentStyle style in GUIStyle.ComponentStyles)
58 {
59 CUI.Log($"{style.Name} {style.Sprites.Count}");
60 }
61 }
62 }
63}