Skip to content

Commit ef0e181

Browse files
Merge pull request #495 from josephabyt/master
Debug page
2 parents 970dd26 + db42eca commit ef0e181

File tree

5 files changed

+165
-3
lines changed

5 files changed

+165
-3
lines changed

Menu/Buttons.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,16 @@ public class Buttons
167167
new ButtonInfo { buttonText = "Disable Menu Title", method =() => {if (pageButtonType != 1) { Main.pageSize = 9; Main.buttonOffset = -1; hidetitle = true; } }, disableMethod =() => {Main.pageSize = 8; Main.buttonOffset = 0; hidetitle = false; }, toolTip = "Hides the menu title, allowing for more buttons per page."},
168168
new ButtonInfo { buttonText = "Disable Search Button", enableMethod =() => disableSearchButton = true, disableMethod =() => disableSearchButton = false, toolTip = "Disables the search button at the bottom of the menu."},
169169
new ButtonInfo { buttonText = "Disable Return Button", enableMethod =() => disableReturnButton = true, disableMethod =() => disableReturnButton = false, toolTip = "Disables the return button at the bottom of the menu."},
170+
new ButtonInfo { buttonText = "Info Button", enableMethod =() => enableDebugButton = true, disableMethod =() => enableDebugButton = false, toolTip = "Disables the information button at the bottom of the menu."},
170171
new ButtonInfo { buttonText = "Disable Page Buttons", enableMethod =() => Settings.DisablePageButtons(), disableMethod =() => disablePageButtons = false, toolTip = "Disables the page buttons. Recommended with Joystick Menu."},
171172
new ButtonInfo { buttonText = "Disable Page Number", enableMethod =() => noPageNumber = true, disableMethod =() => noPageNumber = false, toolTip = "Disables the current page number in the title text."},
172173
new ButtonInfo { buttonText = "Disable FPS Counter", enableMethod =() => disableFpsCounter = true, disableMethod =() => disableFpsCounter = false, toolTip = "Disables the FPS counter."},
173174
new ButtonInfo { buttonText = "Disable Drop Menu", enableMethod =() => dropOnRemove = false, disableMethod =() => dropOnRemove = true, toolTip = "Makes the menu despawn instead of falling."},
174175
new ButtonInfo { buttonText = "Disable Board Colors", overlapText = "Disable Custom Boards", enableMethod =() => Settings.DisableBoardColors(), disableMethod =() => Settings.EnableBoardColors(), toolTip = "Disables the board colors to look legitimate on screen share."},
175176
new ButtonInfo { buttonText = "Disable Custom Text Colors", enableMethod =() => disableBoardTextColor = true, disableMethod =() => disableBoardTextColor = false, toolTip = "Disables the text colors on the boards to make them match their original theme."},
176177

178+
new ButtonInfo { buttonText = "Info Hide ID", enableMethod =() => Settings.hideId = true, disableMethod =() => Settings.hideId = false, toolTip = "Hides your ID in the information page."},
179+
177180
new ButtonInfo { buttonText = "Hide Text on Camera", enableMethod =() => hideTextOnCamera = true, disableMethod =() => hideTextOnCamera = false, overlapText = "Streamer Mode Menu Text", toolTip = "Makes the menu's text only render on VR."},
178181
new ButtonInfo { buttonText = "Hide Pointer", enableMethod =() => hidePointer = true, disableMethod =() => hidePointer = false, toolTip = "Hides the pointer above your head."},
179182
new ButtonInfo { buttonText = "Hide Settings", enableMethod =() => hideSettings = true, disableMethod =() => hideSettings = false, toolTip = "Hides all settings from the Enabled Mods tab, and all arraylists."},
@@ -1550,7 +1553,8 @@ public class Buttons
15501553

15511554
new ButtonInfo[] { // Internal Mods (hidden from user) [25]
15521555
new ButtonInfo { buttonText = "Search", method =() => Settings.Search(), isTogglable = false, toolTip = "Lets you search for specific mods."},
1553-
new ButtonInfo { buttonText = "Global Return", method =() => Settings.GlobalReturn(), isTogglable = false, toolTip = "Returns you to the previous category."}
1556+
new ButtonInfo { buttonText = "Global Return", method =() => Settings.GlobalReturn(), isTogglable = false, toolTip = "Returns you to the previous category."},
1557+
new ButtonInfo { buttonText = "Debug Screen", method =() => Settings.Debug(), enableMethod =() => Settings.ShowDebug(), disableMethod =() => Settings.HideDebug(), toolTip = "Shows game and modding related information."}
15541558
},
15551559

15561560
new ButtonInfo[] { // Sound Library [26]

Menu/Main.cs

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,6 +1707,103 @@ private static void AddSearchButton() // Me :D -Twig
17071707
OutlineCanvasObject(searchImage, 0);
17081708
}
17091709

1710+
private static void AddDebugButton()
1711+
{
1712+
GameObject buttonObject = GameObject.CreatePrimitive(PrimitiveType.Cube);
1713+
if (!UnityInput.Current.GetKey(KeyCode.Q) && !isPcWhenSearching)
1714+
buttonObject.layer = 2;
1715+
1716+
if (themeType == 30)
1717+
buttonObject.GetComponent<Renderer>().enabled = false;
1718+
1719+
buttonObject.GetComponent<BoxCollider>().isTrigger = true;
1720+
buttonObject.transform.parent = menu.transform;
1721+
buttonObject.transform.rotation = Quaternion.identity;
1722+
1723+
buttonObject.transform.localScale = new Vector3(0.09f, 0.102f, 0.08f);
1724+
// Fat menu theorem
1725+
// To get the fat position of a button:
1726+
// original x * (0.7 / 0.45) or 1.555555556
1727+
if (thinMenu)
1728+
buttonObject.transform.localPosition = new Vector3(0.56f, 0.450f, -0.58f);
1729+
else
1730+
buttonObject.transform.localPosition = new Vector3(0.56f, 0.7f, -0.58f);
1731+
1732+
buttonObject.AddComponent<Classes.Button>().relatedText = "Debug Screen";
1733+
1734+
if (shouldOutline)
1735+
OutlineObj(buttonObject, swapButtonColors ? isSearching : !isSearching);
1736+
1737+
GradientColorKey[] pressedColors = new[]
1738+
{
1739+
new GradientColorKey(buttonClickedA, 0f),
1740+
new GradientColorKey(buttonClickedB, 0.5f),
1741+
new GradientColorKey(buttonClickedA, 1f)
1742+
};
1743+
1744+
GradientColorKey[] releasedColors = new[]
1745+
{
1746+
new GradientColorKey(buttonDefaultA, 0f),
1747+
new GradientColorKey(buttonDefaultB, 0.5f),
1748+
new GradientColorKey(buttonDefaultA, 1f)
1749+
};
1750+
1751+
ColorChanger colorChanger = buttonObject.AddComponent<ColorChanger>();
1752+
if (GetIndex("Debug Screen").enabled)
1753+
{
1754+
colorChanger.isRainbow = themeType == 6;
1755+
colorChanger.isPastelRainbow = themeType == 51;
1756+
colorChanger.isSlowFade = slowFadeColors;
1757+
colorChanger.isEpileptic = themeType == 47;
1758+
colorChanger.isMonkeColors = themeType == 8;
1759+
colorChanger.colors = new Gradient
1760+
{
1761+
colorKeys = swapButtonColors ? releasedColors : pressedColors
1762+
};
1763+
}
1764+
else
1765+
{
1766+
colorChanger.colors = new Gradient
1767+
{
1768+
colorKeys = swapButtonColors ? pressedColors : releasedColors
1769+
};
1770+
}
1771+
1772+
if (shouldRound)
1773+
RoundObj(buttonObject);
1774+
1775+
Image searchImage = new GameObject
1776+
{
1777+
transform =
1778+
{
1779+
parent = canvasObj.transform
1780+
}
1781+
}.AddComponent<Image>();
1782+
if (debugIcon == null)
1783+
debugIcon = LoadTextureFromResource("iiMenu.Resources.info.png");
1784+
1785+
if (debugMat == null)
1786+
debugMat = new Material(searchImage.material);
1787+
1788+
searchImage.material = debugMat;
1789+
searchImage.material.SetTexture("_MainTex", debugIcon);
1790+
searchImage.color = isSearching ? textClicked : textColor;
1791+
1792+
RectTransform imageTransform = searchImage.GetComponent<RectTransform>();
1793+
imageTransform.localPosition = Vector3.zero;
1794+
imageTransform.sizeDelta = new Vector2(.03f, .03f);
1795+
1796+
if (thinMenu)
1797+
imageTransform.localPosition = new Vector3(.064f, 0.35f / 2.6f, -0.58f / 2.6f);
1798+
else
1799+
imageTransform.localPosition = new Vector3(.064f, 0.54444444444f / 2.6f, -0.58f / 2.6f);
1800+
1801+
imageTransform.rotation = Quaternion.Euler(new Vector3(180f, 90f, 90f));
1802+
1803+
if (outlineText)
1804+
OutlineCanvasObject(searchImage, 0);
1805+
}
1806+
17101807
private static void AddReturnButton(bool offcenteredPosition)
17111808
{
17121809
GameObject buttonObject = GameObject.CreatePrimitive(PrimitiveType.Cube);
@@ -2326,6 +2423,9 @@ public static void Draw()
23262423
if (!disableReturnButton && currentCategoryName != "Main")
23272424
AddReturnButton(false);
23282425
}
2426+
2427+
if (enableDebugButton)
2428+
AddDebugButton();
23292429

23302430
if (!disablePageButtons)
23312431
AddPageButtons();
@@ -5673,6 +5773,7 @@ public static int buttonsType
56735773
public static bool disableFpsCounter;
56745774
public static bool disableSearchButton;
56755775
public static bool disableReturnButton;
5776+
public static bool enableDebugButton;
56765777

56775778
public static bool ghostException;
56785779
public static bool disableGhostview;
@@ -5831,6 +5932,7 @@ public static int buttonsType
58315932
public static Material CrystalMaterial;
58325933
public static Material searchMat;
58335934
public static Material returnMat;
5935+
public static Material debugMat;
58345936

58355937
public static Font AgencyFB = Font.CreateDynamicFontFromOSFont("Agency FB", 24);
58365938
public static Font Arial = Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font;
@@ -5882,6 +5984,7 @@ public static int buttonsType
58825984
public static Texture2D gay;
58835985
public static Texture2D searchIcon;
58845986
public static Texture2D returnIcon;
5987+
public static Texture2D debugIcon;
58855988
public static Texture2D fixTexture;
58865989
public static Texture2D customMenuBackgroundImage;
58875990

Mods/Settings.cs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,59 @@ public static void GlobalReturn()
167167
Toggle(Buttons.buttons[currentCategoryIndex][0].buttonText, true);
168168
}
169169

170+
public static void ShowDebug()
171+
{
172+
int category = GetCategory("Temporary Category");
173+
174+
string version = PluginInfo.Version;
175+
if (PluginInfo.BetaBuild) version = "<color=blue>Beta</color> " + version;
176+
AddButton(category, new ButtonInfo { buttonText = "DebugMenuName", overlapText = "<color=grey><b>ii's Stupid Menu </b></color>" + version, label = true });
177+
AddButton(category, new ButtonInfo { buttonText = "DebugColor", overlapText = "Loading...", label = true });
178+
AddButton(category, new ButtonInfo { buttonText = "DebugName", overlapText = "Loading...", label = true });
179+
AddButton(category, new ButtonInfo { buttonText = "DebugId", overlapText = "Loading...", label = true });
180+
AddButton(category, new ButtonInfo { buttonText = "DebugClip", overlapText = "Loading...", label = true });
181+
AddButton(category, new ButtonInfo { buttonText = "DebugFps", overlapText = "Loading...", label = true });
182+
AddButton(category, new ButtonInfo { buttonText = "DebugRoomA", overlapText = "Loading...", label = true });
183+
AddButton(category, new ButtonInfo { buttonText = "DebugRoomB", overlapText = "Loading...", label = true });
184+
185+
Debug();
186+
currentCategoryName = "Temporary Category";
187+
}
188+
189+
public static bool hideId;
190+
public static void Debug()
191+
{
192+
string red = "<color=red>" + MathF.Floor(PlayerPrefs.GetFloat("redValue") * 255f).ToString() + "</color>";
193+
string green = ", <color=green>" + MathF.Floor(PlayerPrefs.GetFloat("greenValue") * 255f).ToString() + "</color>";
194+
string blue = ", <color=blue>" + MathF.Floor(PlayerPrefs.GetFloat("blueValue") * 255f).ToString() + "</color>";
195+
GetIndex("DebugColor").overlapText = "Color: " + red + green + blue;
196+
197+
string master = PhotonNetwork.InRoom && PhotonNetwork.IsMasterClient ? "<color=red> [Master]</color>" : "";
198+
GetIndex("DebugName").overlapText = PhotonNetwork.LocalPlayer.NickName + master;
199+
200+
GetIndex("DebugId").overlapText = "<color=green>ID: </color>" + (hideId ? "Hidden" : PhotonNetwork.LocalPlayer.UserId);
201+
GetIndex("DebugClip").overlapText = "<color=green>Clip: </color>" + (GUIUtility.systemCopyBuffer.Length > 25 ? GUIUtility.systemCopyBuffer[..25] : GUIUtility.systemCopyBuffer);
202+
GetIndex("DebugFps").overlapText = "<b>" + lastDeltaTime.ToString() + "</b> FPS <b>" + PhotonNetwork.GetPing().ToString() + "</b> Ping";
203+
GetIndex("DebugRoomA").overlapText = "<color=blue>" + NetworkSystem.Instance.regionNames[NetworkSystem.Instance.currentRegionIndex].ToUpper() + "</color> " + PhotonNetwork.PlayerList.Length.ToString() + " Players";
204+
205+
string priv = PhotonNetwork.InRoom ? (NetworkSystem.Instance.SessionIsPrivate ? "Private" : "Public") : "";
206+
GetIndex("DebugRoomB").overlapText = "<color=blue>" + priv + "</color> " + (PhotonNetwork.InRoom ? PhotonNetwork.CurrentRoom.Name : "Not in room");
207+
}
208+
public static void HideDebug()
209+
{
210+
currentCategoryName = "Main";
211+
int category = GetCategory("Temporary Category");
212+
213+
RemoveButton(category, "DebugMenuName");
214+
RemoveButton(category, "DebugColor");
215+
RemoveButton(category, "DebugName");
216+
RemoveButton(category, "DebugId");
217+
RemoveButton(category, "DebugClip");
218+
RemoveButton(category, "DebugFps");
219+
RemoveButton(category, "DebugRoomA");
220+
RemoveButton(category, "DebugRoomB");
221+
}
222+
170223
public static Dictionary<string, Assembly> LoadedPlugins = new Dictionary<string, Assembly> { };
171224
public static List<string> disabledPlugins = new List<string> { };
172225
public static void LoadPlugins()

Resources/info.png

947 Bytes
Loading

iiMenu.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<AssemblyName>ii's Stupid Menu</AssemblyName>
44
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
@@ -22,6 +22,7 @@
2222
<None Remove="Resources\pride.png" />
2323
<None Remove="Resources\return.png" />
2424
<None Remove="Resources\search.png" />
25+
<None Remove="Resources\info.png" />
2526
<None Remove="Resources\speak.png" />
2627
<None Remove="Resources\star.png" />
2728
<None Remove="Resources\trans.png" />
@@ -35,6 +36,7 @@
3536
<EmbeddedResource Include="Resources\pride.png" />
3637
<EmbeddedResource Include="Resources\return.png" />
3738
<EmbeddedResource Include="Resources\search.png" />
39+
<EmbeddedResource Include="Resources\info.png" />
3840
<EmbeddedResource Include="Resources\speak.png" />
3941
<EmbeddedResource Include="Resources\star.png" />
4042
<EmbeddedResource Include="Resources\trans.png" />
@@ -645,4 +647,4 @@
645647
<HintPath>$(ProjectDir)References\Managed\ZString.dll</HintPath>
646648
</Reference>
647649
</ItemGroup>
648-
</Project>
650+
</Project>

0 commit comments

Comments
 (0)