|
1 | 1 | using System.Collections.Generic; |
| 2 | +using MelonLoader; |
2 | 3 | using UnityEngine; |
3 | 4 | using UnityEngine.InputSystem; |
4 | 5 |
|
5 | 6 | namespace PawMapLoader.Res.GUI |
6 | 7 | { |
7 | | - // This GUI crashes the game and I don't know why. |
8 | 8 |
|
9 | 9 | public class PawScriptConsole |
10 | 10 | { |
@@ -32,34 +32,41 @@ public static void GUIUpdate() |
32 | 32 | { |
33 | 33 | if (!ConsoleShown) return; |
34 | 34 |
|
35 | | - if (Event.current.type != EventType.Repaint && Event.current.type != EventType.Layout) |
36 | | - Event.current.Use(); |
37 | | - |
| 35 | + MelonLogger.Msg("crdraw"); |
38 | 36 | ConsoleRect = UnityEngine.GUI.Window(0, ConsoleRect, (UnityEngine.GUI.WindowFunction)DrawConsole, "PawScript Console"); |
39 | 37 | } |
40 | 38 |
|
41 | 39 | public static void DrawConsole(int wid) |
42 | 40 | { |
| 41 | + MelonLogger.Msg("start"); |
43 | 42 | GUILayout.BeginVertical(); |
44 | 43 |
|
| 44 | + MelonLogger.Msg("1"); |
45 | 45 | ScrollPos = GUILayout.BeginScrollView(ScrollPos, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); |
| 46 | + MelonLogger.Msg("2"); |
46 | 47 | foreach (var line in Logs) |
47 | 48 | { |
48 | 49 | GUILayout.Label(line); |
49 | 50 | } |
| 51 | + MelonLogger.Msg("3"); |
50 | 52 | GUILayout.EndScrollView(); |
51 | | - |
| 53 | + MelonLogger.Msg("4"); |
52 | 54 | GUILayout.BeginHorizontal(); |
53 | | - inptex = GUILayout.TextField(inptex, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); |
54 | | - if (GUILayout.Button("Send", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))) |
| 55 | + MelonLogger.Msg("5"); |
| 56 | + inptex = GUILayout.TextField(inptex, GUILayout.ExpandWidth(true), GUILayout.Height(30)); |
| 57 | + MelonLogger.Msg("6"); |
| 58 | + if (GUILayout.Button("Send", GUILayout.Width(80), GUILayout.Height(30))) |
55 | 59 | { |
56 | 60 | HandleInput(inptex); |
57 | 61 | inptex = ""; |
58 | 62 | } |
| 63 | + MelonLogger.Msg("7"); |
59 | 64 | GUILayout.EndHorizontal(); |
| 65 | + MelonLogger.Msg("8"); |
60 | 66 | GUILayout.EndVertical(); |
61 | | - |
| 67 | + MelonLogger.Msg("9"); |
62 | 68 | UnityEngine.GUI.DragWindow(); |
| 69 | + MelonLogger.Msg("10"); |
63 | 70 | } |
64 | 71 |
|
65 | 72 | public static void HandleInput(string input) |
|
0 commit comments