From 2c469d16a4691ed0ddcacb3a8a63518bff8ecda2 Mon Sep 17 00:00:00 2001 From: Moe Kotoki Date: Wed, 6 Apr 2022 23:44:10 +0800 Subject: [PATCH] Recode Menu, Add title --- Sinmai-Internal-Damage/Functions/AutoPlay.cs | 16 +- Sinmai-Internal-Damage/Functions/Skins.cs | 83 +++----- Sinmai-Internal-Damage/Functions/Version.cs | 12 ++ .../Sinmai-Internal-Damage-Csharp.csproj | 1 + Sinmai-Internal-Damage/UI/Menu.cs | 185 ++++++++++-------- Sinmai-Internal-Damage/UI/Settings.cs | 9 + 6 files changed, 166 insertions(+), 140 deletions(-) create mode 100644 Sinmai-Internal-Damage/Functions/Version.cs diff --git a/Sinmai-Internal-Damage/Functions/AutoPlay.cs b/Sinmai-Internal-Damage/Functions/AutoPlay.cs index 0ce9151..becc0cf 100644 --- a/Sinmai-Internal-Damage/Functions/AutoPlay.cs +++ b/Sinmai-Internal-Damage/Functions/AutoPlay.cs @@ -1,7 +1,5 @@ -using System; -using Manager; +using Manager; using Sinmai.Helper; -using UnityEngine; using Random = System.Random; namespace Sinmai.Functions @@ -28,12 +26,12 @@ namespace Sinmai.Functions { return rand.Next(0, 4); } - + // Opposite 按顺序随机概率 public static void Opposite() { float cent = CalcCent(); - + /*Render.DrawString(new Vector2(200, 260), GameManager.AutoPlay.ToString(), false); Render.DrawString(new Vector2(200, 280), Settings.CriticalValue.ToString(), false); Render.DrawString(new Vector2(200, 290), Settings.PerfectValue.ToString(), false); @@ -85,7 +83,7 @@ namespace Sinmai.Functions } } - + // Random Cycle 随机迴圈 public static void RandomCycle() { @@ -104,7 +102,7 @@ namespace Sinmai.Functions GameManager.AutoPlay = GameManager.AutoPlayMode.Critical; } break; - case 1: + case 1: if (Settings.PerfectValue != 0.0f && cent <= Settings.PerfectValue) { GameManager.AutoPlay = GameManager.AutoPlayMode.Perfect; @@ -116,7 +114,7 @@ namespace Sinmai.Functions GameManager.AutoPlay = GameManager.AutoPlayMode.Great; } break; - case 3: + case 3: if (Settings.GoodValue != 0.0f && cent <= Settings.GoodValue) { GameManager.AutoPlay = GameManager.AutoPlayMode.Good; @@ -134,7 +132,7 @@ namespace Sinmai.Functions } } } - + // 无概率强制随机 public static void Force() { diff --git a/Sinmai-Internal-Damage/Functions/Skins.cs b/Sinmai-Internal-Damage/Functions/Skins.cs index 065f335..4fe6f8b 100644 --- a/Sinmai-Internal-Damage/Functions/Skins.cs +++ b/Sinmai-Internal-Damage/Functions/Skins.cs @@ -1,8 +1,9 @@ -using System; +using MAI2.Util; +using Manager; +using Manager.MaiStudio; +using Sinmai.Helper; using System.Globalization; using System.Reflection; -using Manager; -using Sinmai.Helper; using UnityEngine; namespace Sinmai.Functions @@ -13,55 +14,9 @@ namespace Sinmai.Functions private const BindingFlags iBindFlags = BindingFlags.Instance; private const BindingFlags sBindFlags = BindingFlags.Static; - /*public static void GetTimer() - { - if (!Settings.CheckBox) return; - Render.DrawString(new Vector2(200, 210), "CheckBox Checked", false); + public static TitleData title = GetTitle(int.Parse(Settings.TitleValueOriginal)); - // CommonTimer (Unity.GameObject) - var lCommonTimer = GameObject - .Find("LeftMonitor/GenericProcess(Clone)/Canvas/Main/UI_Timer/CommonTimer(Clone)") - .GetComponent(); - - if (lCommonTimer != null) - { - var commonTimerType = typeof(TimerController); - var countDownSecond = commonTimerType.GetField("_countDownSecond", pBindFlags | iBindFlags); - Render.DrawString(new Vector2(200, 240), countDownSecond.GetValue(commonTimerType).ToString(), - false); - - - /#1#/ 获取左屏幕的GenericProcess - var lGenericProcess = GameObject.Find("LeftMonitor/GenericProcess(Clone)").GetComponent(); - // 定义GenericProcess的type - Type genericProcessType = typeof(GenericProcess); - // 从GenericProcess里获取private field timerController - FieldInfo _timerController = genericProcessType.GetField("_timerController", BindFlags); - // 获取timerController的值 (array) - TimerController timerController = _timerController?.GetValue(lGenericProcess) as TimerController; - // 定义TimerController的Type - Type leftMonitorTimerControllerType = typeof(TimerController); - // 从TimerController类里拿private field countDownSecond - FieldInfo leftMonitorTimerControllerFi = leftMonitorTimerControllerType.GetField("_countDownSecond", BindFlags); - // 修改 TimerController array 的值 - leftMonitorTimerControllerFi.SetValue(timerController, 99U); - - // 操你妈 没几把用 - - - _timerController.SetValue(lGenericProcess, timerController);#1# - } - else - { - Render.DrawString(new Vector2(200, 240), "CommonTimer = null", false); - } - - /* - if(Timer) - Render.DrawString(new Vector2(200, 210), Timer.ToString(), false); - else - Render.DrawString(new Vector2(200, 210), "null object", false);#1# - }*/ + public static Sprite titleBg = Resources.Load("Process/Common/Sprites/UpperMonitor/UI_CMN_Shougou_" + Settings.TitleType); private static UserInformationController getUserInformationController() { UserInformationController UserInformationController = GameObject @@ -71,7 +26,6 @@ namespace Sinmai.Functions return UserInformationController; } - public static void PlayerOneOnly() { } @@ -98,7 +52,7 @@ namespace Sinmai.Functions int udemaeId = int.Parse(Settings.UdemaeValue); - var udemae = (UdemaeID) udemaeId; + var udemae = (UdemaeID)udemaeId; if (UserInformationController != null) { @@ -106,9 +60,30 @@ namespace Sinmai.Functions } } - public static void ModifyVersionNum() + public static void TitleChanger() { + if (!Settings.TitleCheckBox) return; + UserInformationController UserInformationController = getUserInformationController(); + + if (UserInformationController != null) + { + //TitleData title = GetTitle(int.Parse(Settings.TitleValueOriginal)); + if (Settings.TitleMethodInt == 0) + { + UserInformationController.SetTitle(title.name.str, titleBg); + } + else if (Settings.TitleMethodInt == 1) + { + UserInformationController.SetTitle(Settings.TitleValueCustom, titleBg); + } + + } + } + + public static TitleData GetTitle(int id) + { + return Singleton.Instance.GetTitle(id); } } } \ No newline at end of file diff --git a/Sinmai-Internal-Damage/Functions/Version.cs b/Sinmai-Internal-Damage/Functions/Version.cs new file mode 100644 index 0000000..f896f04 --- /dev/null +++ b/Sinmai-Internal-Damage/Functions/Version.cs @@ -0,0 +1,12 @@ +using MAI2System; + +namespace Sinmai.Functions +{ + public class Version + { + public static string CheckClientVersion() + { + return ConstParameter.GameIDStr + " " + ConstParameter.NowGameVersion; + } + } +} diff --git a/Sinmai-Internal-Damage/Sinmai-Internal-Damage-Csharp.csproj b/Sinmai-Internal-Damage/Sinmai-Internal-Damage-Csharp.csproj index 112de4f..b7505c4 100644 --- a/Sinmai-Internal-Damage/Sinmai-Internal-Damage-Csharp.csproj +++ b/Sinmai-Internal-Damage/Sinmai-Internal-Damage-Csharp.csproj @@ -281,6 +281,7 @@ + diff --git a/Sinmai-Internal-Damage/UI/Menu.cs b/Sinmai-Internal-Damage/UI/Menu.cs index abfc927..85ed96c 100644 --- a/Sinmai-Internal-Damage/UI/Menu.cs +++ b/Sinmai-Internal-Damage/UI/Menu.cs @@ -1,5 +1,4 @@ -using PartyLink; -using Sinmai.Functions; +using Sinmai.Functions; using Sinmai.Helper; using UnityEngine; @@ -13,7 +12,7 @@ namespace Sinmai.UI private void Start() { - Window = new Rect(20f, 60f, 600f, 400f); + Window = new Rect(350, 100f, 300, 400); } private void Update() @@ -27,17 +26,19 @@ namespace Sinmai.UI // Draw ur epic hek here if (MenuToggle) Window = GUILayout.Window(0, Window, RenderMenu, "Internal Damage for Sinmai"); - Render.DrawString(new Vector2(200, 185), "Sinmai-Internal-Damage"); - Render.DrawString(new Vector2(200, 200), "Build: b20220405-A"); + Render.DrawString(new Vector2(100, 170), "Sinmai-Internal-Damage"); + Render.DrawString(new Vector2(100, 185), "Local Client: " + Functions.Version.CheckClientVersion()); + Render.DrawString(new Vector2(100, 200), "Build: b20220406-C"); // Call Functions in Functions // what the fuck is this named Skins.RateChanger(); Skins.UdemaeChanger(); + Skins.TitleChanger(); Timer.InfinityFreedomTime(); Timer.InfinityPrepareTime(); - + AutoPlay.Opposite(); AutoPlay.RandomCycle(); AutoPlay.Force(); @@ -49,80 +50,110 @@ namespace Sinmai.UI { // Menu case 0: - GUILayout.BeginHorizontal("Main"); - - GUILayout.BeginVertical("Legit"); - // Legit - GUILayout.Label("Legit"); - Settings.LegitAutoPlayCheckBox = GUILayout.Toggle(Settings.LegitAutoPlayCheckBox, "Legit AutoPlay"); - if (Settings.LegitAutoPlayCheckBox) + GUILayout.BeginVertical("MainToolbar", GUILayout.Height(20)); + Settings.MainToolbarInt = GUILayout.Toolbar(Settings.MainToolbarInt, Settings.MainToolbarStrings, GUILayout.Width(300), GUILayout.Height(20)); + GUILayout.EndVertical(); + + switch (Settings.MainToolbarInt) { - Settings.LegitMethodInt = - GUILayout.SelectionGrid(Settings.LegitMethodInt, Settings.LegitMethod, 1); - switch (Settings.LegitMethodInt) - { - case 0: - case 1: - GUILayout.Label("Critical Value"); - Settings.CriticalValue = GUILayout.HorizontalScrollbar(Settings.CriticalValue, 1.0f, 0.0f, 100.0f); - GUILayout.Label("Perfect Value"); - Settings.PerfectValue = GUILayout.HorizontalScrollbar(Settings.PerfectValue, 1.0f, 0.0f, 100.0f); - GUILayout.Label("Great Value"); - Settings.GreatValue = GUILayout.HorizontalScrollbar(Settings.GreatValue, 1.0f, 0.0f, 100.0f); - GUILayout.Label("Good Value"); - Settings.GoodValue = GUILayout.HorizontalScrollbar(Settings.GoodValue, 1.0f, 0.0f, 100.0f); - GUILayout.Label("Miss Value"); - Settings.MissValue = GUILayout.HorizontalScrollbar(Settings.MissValue, 1.0f, 0.0f, 100.0f); - break; - case 2: - Settings.CriticalToggle = GUILayout.Toggle(Settings.CriticalToggle, "Critical"); - Settings.PerfectToggle = GUILayout.Toggle(Settings.PerfectToggle, "Perfect"); - Settings.GreatToggle = GUILayout.Toggle(Settings.GreatToggle, "Great"); - Settings.GoodToggle = GUILayout.Toggle(Settings.GoodToggle, "Good"); - Settings.MissToggle = GUILayout.Toggle(Settings.MissToggle, "Miss"); - break; - default: - break; - } + case 0: + GUILayout.BeginVertical("Legit"); + // Legit + GUILayout.Label("Legit"); + Settings.LegitAutoPlayCheckBox = GUILayout.Toggle(Settings.LegitAutoPlayCheckBox, "Legit AutoPlay"); + if (Settings.LegitAutoPlayCheckBox) + { + Settings.LegitMethodInt = + GUILayout.SelectionGrid(Settings.LegitMethodInt, Settings.LegitMethod, 1); + switch (Settings.LegitMethodInt) + { + case 0: + case 1: + GUILayout.Label("Critical Value"); + Settings.CriticalValue = GUILayout.HorizontalScrollbar(Settings.CriticalValue, 1.0f, 0.0f, 100.0f); + GUILayout.Label("Perfect Value"); + Settings.PerfectValue = GUILayout.HorizontalScrollbar(Settings.PerfectValue, 1.0f, 0.0f, 100.0f); + GUILayout.Label("Great Value"); + Settings.GreatValue = GUILayout.HorizontalScrollbar(Settings.GreatValue, 1.0f, 0.0f, 100.0f); + GUILayout.Label("Good Value"); + Settings.GoodValue = GUILayout.HorizontalScrollbar(Settings.GoodValue, 1.0f, 0.0f, 100.0f); + GUILayout.Label("Miss Value"); + Settings.MissValue = GUILayout.HorizontalScrollbar(Settings.MissValue, 1.0f, 0.0f, 100.0f); + break; + case 2: + Settings.CriticalToggle = GUILayout.Toggle(Settings.CriticalToggle, "Critical"); + Settings.PerfectToggle = GUILayout.Toggle(Settings.PerfectToggle, "Perfect"); + Settings.GreatToggle = GUILayout.Toggle(Settings.GreatToggle, "Great"); + Settings.GoodToggle = GUILayout.Toggle(Settings.GoodToggle, "Good"); + Settings.MissToggle = GUILayout.Toggle(Settings.MissToggle, "Miss"); + break; + default: + break; + } + } + GUILayout.EndVertical(); + break; + case 1: + GUILayout.BeginVertical("Skins"); + // Skin Changer + GUILayout.Label("Skin Changer"); + Settings.RateCheckBox = GUILayout.Toggle(Settings.RateCheckBox, "でらっくす Rating"); + if (Settings.RateCheckBox) + { + GUILayout.Label("Rating:"); + Settings.RatingValue = GUILayout.TextField(Settings.RatingValue, 5); + } + Settings.UdemaeCheckBox = GUILayout.Toggle(Settings.UdemaeCheckBox, "段位認定"); + if (Settings.UdemaeCheckBox) + { + GUILayout.Label("Index:"); + Settings.UdemaeValue = GUILayout.TextField(Settings.UdemaeValue, 2); + } + Settings.PlateCheckBox = GUILayout.Toggle(Settings.PlateCheckBox, "Plate"); + Settings.FrameCheckBox = GUILayout.Toggle(Settings.FrameCheckBox, "Frame"); + Settings.TitleCheckBox = GUILayout.Toggle(Settings.TitleCheckBox, "Title"); + if (Settings.TitleCheckBox) + { + Settings.TitleMethodInt = + GUILayout.SelectionGrid(Settings.TitleMethodInt, Settings.TitleMethod, 1); + switch (Settings.TitleMethodInt) + { + case 0: + GUILayout.Label("Title index:"); + Settings.TitleValueOriginal = GUILayout.TextField(Settings.TitleValueOriginal, 255); + GUILayout.Label("Title type:"); + Settings.TitleType = GUILayout.TextField(Settings.TitleType, 7); + break; + case 1: + GUILayout.Label("Title name:"); + Settings.TitleValueCustom = GUILayout.TextField(Settings.TitleValueCustom, 255); + GUILayout.Label("Title type:"); + Settings.TitleType = GUILayout.TextField(Settings.TitleType, 7); + break; + default: + break; + } + } + + Settings.DXPassCheckBox = GUILayout.Toggle(Settings.DXPassCheckBox, "DX Pass"); + GUILayout.EndVertical(); + break; + case 2: + GUILayout.BeginVertical("Misc"); + // Misc + GUILayout.Label("Misc"); + Settings.InfinityFreedomTimeCheckBox = GUILayout.Toggle(Settings.InfinityFreedomTimeCheckBox, "Infinity FreedomTime"); + Settings.InfinityPrepareTimeCheckBox = GUILayout.Toggle(Settings.InfinityPrepareTimeCheckBox, "Infinity PrepareTime"); + if (GUILayout.Button("Force Track Skip")) + ; + if (GUILayout.Button("Unload")) + Loader.Unload(); + GUILayout.EndVertical(); + break; + default: + break; } - { - - } - GUILayout.EndVertical(); - - // Rage - - // Some cool part idk - - GUILayout.BeginVertical("Skins"); - // Skin Changer - GUILayout.Label("Skin Changer"); - Settings.RateCheckBox = GUILayout.Toggle(Settings.RateCheckBox, "でらっくす Rating"); - if (Settings.RateCheckBox) - Settings.RatingValue = GUILayout.TextArea(Settings.RatingValue, 5); - Settings.UdemaeCheckBox = GUILayout.Toggle(Settings.UdemaeCheckBox, "段位認定"); - if (Settings.UdemaeCheckBox) - Settings.UdemaeValue = GUILayout.TextArea(Settings.UdemaeValue, 2); - Settings.PlateCheckBox = GUILayout.Toggle(Settings.PlateCheckBox, "Plate"); - Settings.FrameCheckBox = GUILayout.Toggle(Settings.FrameCheckBox, "Frame"); - Settings.TitleCheckBox = GUILayout.Toggle(Settings.TitleCheckBox, "Title"); - Settings.DXPassCheckBox= GUILayout.Toggle(Settings.DXPassCheckBox, "DX Pass"); - GUILayout.EndVertical(); - - GUILayout.BeginVertical("Misc"); - // Misc - GUILayout.Label("Misc"); - Settings.InfinityFreedomTimeCheckBox = GUILayout.Toggle(Settings.InfinityFreedomTimeCheckBox, "Infinity FreedomTime"); - Settings.InfinityPrepareTimeCheckBox = GUILayout.Toggle(Settings.InfinityPrepareTimeCheckBox, "Infinity PrepareTime"); - if (GUILayout.Button("Force Track Skip")) - ; - if (GUILayout.Button("Unload")) - Loader.Unload(); - GUILayout.EndVertical(); - - GUILayout.EndHorizontal(); - // A cute break break; } diff --git a/Sinmai-Internal-Damage/UI/Settings.cs b/Sinmai-Internal-Damage/UI/Settings.cs index 40c6b95..dae1c77 100644 --- a/Sinmai-Internal-Damage/UI/Settings.cs +++ b/Sinmai-Internal-Damage/UI/Settings.cs @@ -2,6 +2,10 @@ { class Settings { + public static int MainToolbarInt = 0; + public static string[] MainToolbarStrings = { "Legit", "Skins", "Misc" }; + + // Legit Autoplay public static bool LegitAutoPlayCheckBox = false; public static int LegitMethodInt = 0; @@ -31,6 +35,11 @@ public static bool PlateCheckBox = false; public static bool FrameCheckBox = false; public static bool TitleCheckBox = false; + public static int TitleMethodInt = 0; + public static string[] TitleMethod = { "Original", "Custom" }; + public static string TitleValueOriginal = "1"; + public static string TitleValueCustom = "skeet.cc"; + public static string TitleType = "Rainbow"; public static bool DXPassCheckBox = false; // Misc