Skip to content

Commit 2294ece

Browse files
authored
Merge pull request #2 from Theadd/develop
Develop
2 parents 4110b2b + e357745 commit 2294ece

51 files changed

Lines changed: 5127 additions & 749 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@
99

1010
# CUSTOM
1111
/*.DotSettings.user
12+
/RELEASES/
13+
/Folder.DotSettings.user
14+
Folder.DotSettings.user

DevTools.Humankind.GUITools.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,10 @@
419419
<HintPath>$(HUMANKIND_REFERENCED_LIBRARIES_PATH)\UnityEngine.XRModule.dll</HintPath>
420420
<Private>false</Private>
421421
</Reference>
422+
<Reference Include="Amplitude.Wwise">
423+
<HintPath>$(HUMANKIND_REFERENCED_LIBRARIES_PATH)\Amplitude.Wwise.dll</HintPath>
424+
<Private>false</Private>
425+
</Reference>
422426
<Reference Include="Modding.Humankind.DevTools">
423427
<HintPath>$(DevToolsPATH)</HintPath>
424428
<Private>false</Private>

Folder.DotSettings.user

Lines changed: 0 additions & 2 deletions
This file was deleted.

GUITools.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace DevTools.Humankind.GUITools
66
{
7-
[BepInPlugin(PLUGIN_GUID, "GUITools", "1.2.1.0")]
7+
[BepInPlugin(PLUGIN_GUID, "GUITools", "1.3.0.0")]
88
[BepInDependency("Modding.Humankind.DevTools")]
99
[BepInDependency("DevTools.Humankind.SharedAssets")]
1010
public class GUITools : BaseUnityPlugin

MainTools.cs

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
using System;
2-
using System.IO;
3-
using System.Linq;
42
using Modding.Humankind.DevTools;
53
using Modding.Humankind.DevTools.DeveloperTools.UI;
64
using DevTools.Humankind.GUITools.UI;
7-
using HarmonyLib;
8-
using Amplitude.Mercury.Presentation;
9-
using BepInEx;
10-
using BepInEx.Configuration;
115
using DevTools.Humankind.GUITools.UI.PauseMenu;
6+
using StyledGUI;
127

138
namespace DevTools.Humankind.GUITools
149
{
@@ -29,11 +24,14 @@ public static class MainTools
2924
public static FameToolWindow FameWindow { get; set; }
3025
public static EndGameToolWindow EndGameWindow { get; set; }
3126
public static GameStatsWindow StatsWindow { get; set; }
27+
public static BackScreenWindow BackScreen { get; set; }
3228

3329
public static void Main()
3430
{
3531
if (IsDebugModeEnabled) Debug();
3632

33+
UIController.OnceGUIHasLoaded(() => StyledGUIUtility.DefaultSkin = UIController.DefaultSkin);
34+
PopupToolWindow.Open<BackScreenWindow>(w => BackScreen = w);
3735
PopupToolWindow.Open<MainToolbar>(w => Toolbar = w);
3836
PopupToolWindow.Open<InGameMenuWindow>(w => InGameMenu = w);
3937

@@ -45,24 +43,31 @@ public static void Main()
4543
// PopupToolWindow.Open<EndGameToolWindow>(w => EndGameWindow = w);
4644
// PopupToolWindow.Open<GameStatsWindow>(w => StatsWindow = w);
4745

48-
// HumankindDevTools.RegisterAction(new KeyboardShortcut(UnityEngine.KeyCode.Home), "ToggleBasicToolWindow", ToggleBasicToolWindow);
49-
HumankindDevTools.RegisterAction(new KeyboardShortcut(UnityEngine.KeyCode.Home), "ToggleHideToolbarWindow", ToggleHideToolbarWindow);
50-
HumankindDevTools.RegisterAction(new KeyboardShortcut(UnityEngine.KeyCode.Tab), "ToggleGameOverviewWindow", ToggleGameOverviewWindow);
51-
52-
HumankindDevTools.RegisterAction(
46+
// HumankindDevTools.RegisterAction(new KeyboardShortcut(UnityEngine.KeyCode.UpArrow, UnityEngine.KeyCode.LeftControl), "ToggleBasicToolWindow", ToggleBasicToolWindow);
47+
// HumankindDevTools.RegisterAction(new KeyboardShortcut(UnityEngine.KeyCode.Home), "ToggleHideToolbarWindow", ToggleHideToolbarWindow);
48+
// HumankindDevTools.RegisterAction(new KeyboardShortcut(UnityEngine.KeyCode.Tab), "ToggleGameOverviewWindow", ToggleGameOverviewWindow);
49+
50+
/*HumankindDevTools.RegisterAction(
5351
new KeyboardShortcut(UnityEngine.KeyCode.Insert),
5452
"ToggleHideAllGUITools",
55-
ToggleHideAllUIWindows);
56-
53+
ToggleHideAllUIWindows);*/
54+
5755
// Maps [ESC] key to: GodMode.Enabled = false
5856
// HumankindDevTools.RegisterAction(new KeyboardShortcut(UnityEngine.KeyCode.Escape), "CancelGodMode", CancelGodMode);
5957

60-
// ToggleGameOverviewWindow();
58+
// ToggleGameOverviewWindow();
59+
// ToggleBasicToolWindow();
60+
61+
/*HumankindDevTools.RegisterAction(
62+
new KeyboardShortcut(UnityEngine.KeyCode.F4, UnityEngine.KeyCode.LeftShift),
63+
"RebuildConstructibles",
64+
ConstructibleStore.Rebuild);*/
6165
}
6266

6367
public static void ToggleHideToolbarWindow() => GlobalSettings.HideToolbarWindow.Value = !GlobalSettings.HideToolbarWindow.Value;
6468

65-
public static void ToggleHideAllUIWindows() => FloatingToolWindow.HideAllGUITools = !FloatingToolWindow.HideAllGUITools;
69+
public static void ToggleHideAllUIWindows() =>
70+
Loggr.Log("HIDDING ALL GUI TOOLS WINDOWS IS TEMPORARILY DISABLED", ConsoleColor.Magenta); //FloatingToolWindow.HideAllGUITools = !FloatingToolWindow.HideAllGUITools);
6671

6772
// public static void CancelGodMode() => AccessTools.PropertySetter(typeof(GodMode), "Enabled")?.Invoke(null, new object[] { false });
6873

@@ -103,20 +108,22 @@ public static void Unload(bool saveState = false) {
103108
FameWindow?.Close();
104109
EndGameWindow?.Close();
105110
StatsWindow?.Close();
111+
BackScreen?.Close();
112+
ScreenLocker.Unload();
106113
}
107114

108115
private static void Debug()
109116
{
110-
var scriptsPath = Path.Combine(Paths.GameRootPath, "scripts");
117+
/*var scriptsPath = Path.Combine(Paths.GameRootPath, "scripts");
111118
var files = Directory.GetFiles(scriptsPath, "*.cs", SearchOption.AllDirectories)
112119
.Where(path => path.Substring(scriptsPath.Length, 5) != "\\obj\\");
113120
114-
Loggr.Log(string.Join("\n", files), ConsoleColor.DarkYellow);
121+
Loggr.Log(string.Join("\n", files), ConsoleColor.DarkYellow);*/
115122

116123
// When true, draws a colored border for all UIOverlays backing a FloatingToolWindow derived class
117124
UIOverlay.DEBUG_DRAW_OVERLAY = false;
118125
// When not true, adds more verbosity to console output
119-
Modding.Humankind.DevTools.DevTools.QuietMode = true;
126+
Modding.Humankind.DevTools.DevTools.QuietMode = false;
120127
}
121128
}
122129
}

StyledGUI/Graphics.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using UnityEngine;
2+
3+
namespace StyledGUI
4+
{
5+
public static class Graphics
6+
{
7+
public static Texture2D WhiteTexture = CreateSinglePixelTexture2D(new Color(1f, 1f, 1f, 1f));
8+
public static Texture2D BlackTexture = CreateSinglePixelTexture2D(new Color(0, 0, 0, 1f));
9+
public static Texture2D TransparentTexture = CreateSinglePixelTexture2D(new Color(1f, 1f, 1f, 0f));
10+
11+
public static Texture2D CreateSinglePixelTexture2D(Color color)
12+
{
13+
Texture2D tex = new Texture2D(1,1);
14+
tex.SetPixel(0, 0, color);
15+
tex.Apply();
16+
17+
return tex;
18+
}
19+
20+
public static void DrawHorizontalLine(float alpha = 0.45f)
21+
{
22+
var r = GUILayoutUtility.GetRect(1f, 1f);
23+
GUI.DrawTexture(new Rect(r.x, r.y, r.width - 3f, 1f),
24+
WhiteTexture, ScaleMode.StretchToFill, true,
25+
1f, new Color(1f, 1f, 1f, alpha), 0,0);
26+
}
27+
28+
public static void DrawHorizontalLine(float alpha, float width)
29+
{
30+
var r = GUILayoutUtility.GetRect(1f, 1f);
31+
GUI.DrawTexture(new Rect(r.x, r.y, width, 1f),
32+
WhiteTexture, ScaleMode.StretchToFill, true,
33+
1f, new Color(1f, 1f, 1f, alpha), 0,0);
34+
}
35+
}
36+
}

StyledGUI/Grid/CellSpanGrid.cs

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
using System;
2+
using UnityEngine;
3+
4+
namespace StyledGUI
5+
{
6+
7+
public interface ICellSpan
8+
{
9+
GUILayoutOption CellSpan1 { get; set; }
10+
GUILayoutOption CellSpan2 { get; set; }
11+
GUILayoutOption CellSpan3 { get; set; }
12+
GUILayoutOption CellSpan4 { get; set; }
13+
GUILayoutOption CellSpan5 { get; set; }
14+
GUILayoutOption CellSpan6 { get; set; }
15+
GUILayoutOption CellSpan7 { get; set; }
16+
GUILayoutOption CellSpan8 { get; set; }
17+
GUILayoutOption CellSpan9 { get; set; }
18+
GUILayoutOption CellSpan10 { get; set; }
19+
float GetCellWidth();
20+
float GetCellSpace();
21+
float GetCellHeight();
22+
}
23+
24+
public abstract class CellSpanGrid : ICellSpan
25+
{
26+
public float CellWidth;
27+
public float CellSpace;
28+
public GUILayoutOption CellSpan1 { get; set; }
29+
public GUILayoutOption CellSpan2 { get; set; }
30+
public GUILayoutOption CellSpan3 { get; set; }
31+
public GUILayoutOption CellSpan4 { get; set; }
32+
public GUILayoutOption CellSpan5 { get; set; }
33+
public GUILayoutOption CellSpan6 { get; set; }
34+
public GUILayoutOption CellSpan7 { get; set; }
35+
public GUILayoutOption CellSpan8 { get; set; }
36+
public GUILayoutOption CellSpan9 { get; set; }
37+
public GUILayoutOption CellSpan10 { get; set; }
38+
public GUILayoutOption CellSpan(int numCells) => GUILayout.Width(CellWidth * numCells + CellSpace * (numCells - 1));
39+
40+
public CellSpanGrid()
41+
{
42+
Resize(34f, 1f);
43+
}
44+
45+
public CellSpanGrid(float cellWidth, float cellSpace)
46+
{
47+
Resize(cellWidth, cellSpace);
48+
}
49+
50+
public CellSpanGrid Resize(float cellWidth, float cellSpace)
51+
{
52+
CellWidth = cellWidth;
53+
CellSpace = cellSpace;
54+
CellSpan1 = CellSpan(1);
55+
CellSpan2 = CellSpan(2);
56+
CellSpan3 = CellSpan(3);
57+
CellSpan4 = CellSpan(4);
58+
CellSpan5 = CellSpan(5);
59+
CellSpan6 = CellSpan(6);
60+
CellSpan7 = CellSpan(7);
61+
CellSpan8 = CellSpan(8);
62+
CellSpan9 = CellSpan(9);
63+
CellSpan10 = CellSpan(10);
64+
65+
return this;
66+
}
67+
68+
public float GetCellWidth() => CellWidth;
69+
public float GetCellSpace() => CellSpace;
70+
public virtual float GetCellHeight() => 22f;
71+
}
72+
73+
74+
}

StyledGUI/Grid/GridStyles.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System;
2+
using UnityEngine;
3+
4+
namespace StyledGUI
5+
{
6+
public interface IStyledGrid : ICellSpan
7+
{
8+
Color CellTintColor { get; set; }
9+
Color CellTintColorAlt { get; set; }
10+
Color IconTintColor { get; set; }
11+
Color CellButtonTintColor { get; set; }
12+
Color SelectedCellTintColor { get; set; }
13+
}
14+
15+
public abstract class GridStyles : CellSpanGrid, IStyledGrid
16+
{
17+
public virtual Color CellTintColor { get; set; } = new Color(0.9f, 0.9f, 0.85f, 1f);
18+
public virtual Color CellTintColorAlt { get; set; } = new Color(0.6f, 0.6f, 0.6f, 1f);
19+
public virtual Color IconTintColor { get; set; } = new Color(1f, 1f, 1f, 0.7f);
20+
public virtual Color CellButtonTintColor { get; set; } = new Color32(85, 136, 254, 230);
21+
public virtual Color SelectedCellTintColor { get; set; } = new Color32(40, 86, 240, 255);
22+
23+
}
24+
}

StyledGUI/Grid/StyledGridEx.cs

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
using UnityEngine;
2+
3+
namespace StyledGUI
4+
{
5+
public static class StyledGridEx
6+
{
7+
public static IStyledGrid Row(this IStyledGrid self, GUIStyle style, params GUILayoutOption[] options)
8+
{
9+
GUILayout.BeginHorizontal(style, options);
10+
11+
return self;
12+
}
13+
14+
public static IStyledGrid Row(this IStyledGrid self, params GUILayoutOption[] options)
15+
{
16+
GUILayout.BeginHorizontal(Styles.RowStyle, options);
17+
18+
return self;
19+
}
20+
21+
public static IStyledGrid EndRow(this IStyledGrid self)
22+
{
23+
GUILayout.EndHorizontal();
24+
25+
return self;
26+
}
27+
28+
public static IStyledGrid EmptyRow(this IStyledGrid self, params GUILayoutOption[] options)
29+
{
30+
GUILayout.BeginHorizontal(Styles.StaticRowStyle, options);
31+
GUILayout.Label(" ", Styles.RowHeaderStyle);
32+
GUILayout.EndHorizontal();
33+
34+
return self;
35+
}
36+
37+
public static IStyledGrid VerticalStack(this IStyledGrid self, params GUILayoutOption[] options)
38+
{
39+
GUILayout.BeginVertical(Styles.StaticRowStyle, options);
40+
41+
return self;
42+
}
43+
44+
public static IStyledGrid EndVerticalStack(this IStyledGrid self, params GUILayoutOption[] options)
45+
{
46+
GUILayout.EndVertical();
47+
48+
return self;
49+
}
50+
51+
public static IStyledGrid Cell(this IStyledGrid self, string text, GUIStyle style, params GUILayoutOption[] options)
52+
{
53+
GUILayout.Label(text, style, options);
54+
55+
return self;
56+
}
57+
58+
public static IStyledGrid Cell(this IStyledGrid self, string text, params GUILayoutOption[] options)
59+
{
60+
GUILayout.Label(text, Styles.CellStyle, options);
61+
62+
return self;
63+
}
64+
65+
public static IStyledGrid Cell(this IStyledGrid self, string text, Color color, params GUILayoutOption[] options)
66+
{
67+
var prevColor = GUI.backgroundColor;
68+
GUI.backgroundColor = color;
69+
70+
GUILayout.Label("<size=11>" + text + "</size>", Styles.CellStyle, options);
71+
72+
GUI.backgroundColor = prevColor;
73+
74+
return self;
75+
}
76+
77+
public static IStyledGrid Cell(this IStyledGrid self, string text, GUIStyle style, Color color, params GUILayoutOption[] options)
78+
{
79+
var prevColor = GUI.backgroundColor;
80+
GUI.backgroundColor = color;
81+
82+
GUILayout.Label("<size=11>" + text + "</size>", style, options);
83+
84+
GUI.backgroundColor = prevColor;
85+
86+
return self;
87+
}
88+
89+
public static IStyledGrid RowHeader(this IStyledGrid self, string text, GUIStyle style, params GUILayoutOption[] options)
90+
{
91+
GUILayout.Label("<size=10><b>" + text + "</b></size>", style, options);
92+
93+
return self;
94+
}
95+
96+
public static IStyledGrid RowHeader(this IStyledGrid self, string text, params GUILayoutOption[] options)
97+
{
98+
GUILayout.Label("<size=10>" + text + "</size>", Styles.RowHeaderStyle, options);
99+
100+
return self;
101+
}
102+
103+
104+
public static IStyledGrid DrawHorizontalLine(this IStyledGrid self, float alpha = 0.3f)
105+
{
106+
Graphics.DrawHorizontalLine(alpha);
107+
108+
return self;
109+
}
110+
111+
public static IStyledGrid DrawHorizontalLine(this IStyledGrid self, float alpha, float width)
112+
{
113+
Graphics.DrawHorizontalLine(alpha, width);
114+
115+
return self;
116+
}
117+
118+
public static IStyledGrid Space(this IStyledGrid self, float size)
119+
{
120+
GUILayout.Space(size);
121+
122+
return self;
123+
}
124+
}
125+
}

0 commit comments

Comments
 (0)