diff --git a/.gitmodules b/.gitmodules
index 8691e72..14a7677 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -4,6 +4,24 @@
[submodule "The Scroll OfTaiwu/ScriptTrainer/UnityGameUI"]
path = The Scroll OfTaiwu/ScriptTrainer/UnityGameUI
url = https://github.com/GlossMod/UnityGameUI.git
+[submodule "MiChangSheng/ScriptTrainer/UnityGameUI"]
+ path = MiChangSheng/ScriptTrainer/UnityGameUI
+ url = https://github.com/GlossMod/UnityGameUI.git
+[submodule "Warm Snow/ScriptTrainer/UnityGameUI"]
+ path = Warm Snow/ScriptTrainer/UnityGameUI
+ url = https://github.com/GlossMod/UnityGameUI.git
+[submodule "Warm Snow/UnityGameUI"]
+ path = Warm Snow/UnityGameUI
+ url = https://github.com/GlossMod/UnityGameUI.git
[submodule "Dyson Sphere Program/ScriptTrainer/UnityGameUI"]
path = Dyson Sphere Program/ScriptTrainer/UnityGameUI
url = https://github.com/GlossMod/UnityGameUI.git
+[submodule "The Scroll Of Taiwu/ScriptTrainer/UnityGameUI"]
+ path = The Scroll Of Taiwu/ScriptTrainer/UnityGameUI
+ url = https://github.com/GlossMod/UnityGameUI.git
+[submodule "Yog-Sothoth's Yard/ScriptTrainer/UnityGameUI"]
+ path = Yog-Sothoth's Yard/ScriptTrainer/UnityGameUI
+ url = https://github.com/GlossMod/UnityGameUI.git
+[submodule "Cluckmech Oasis/ScriptTrainer/UnityGameUI"]
+ path = Cluckmech Oasis/ScriptTrainer/UnityGameUI
+ url = https://github.com/GlossMod/UnityGameUI.git
diff --git a/Cluckmech Oasis/ScriptTrainer/NuGet.Config b/Cluckmech Oasis/ScriptTrainer/NuGet.Config
new file mode 100644
index 0000000..1864ded
--- /dev/null
+++ b/Cluckmech Oasis/ScriptTrainer/NuGet.Config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Cluckmech Oasis/ScriptTrainer/Plugin.cs b/Cluckmech Oasis/ScriptTrainer/Plugin.cs
new file mode 100644
index 0000000..5880743
--- /dev/null
+++ b/Cluckmech Oasis/ScriptTrainer/Plugin.cs
@@ -0,0 +1,65 @@
+using BepInEx;
+using BepInEx.Configuration;
+using HarmonyLib;
+using UnityEngine;
+
+namespace ScriptTrainer
+{
+ [BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
+ public class Plugin : BaseUnityPlugin
+ {
+ #region 全局配置
+ MainWindow mw;
+ private static BepInEx.Logging.ManualLogSource log;
+
+ // 启动按键
+ private ConfigEntry ShowCounter { get; set; }
+
+ #endregion
+
+
+
+
+ private void Awake()
+ {
+ // Plugin startup logic
+
+ #region[注入游戏补丁]
+ Harmony.CreateAndPatchAll(typeof(ScriptPatch), null);
+ // Harmony.CreateAndPatchAll(typeof(UnityGameUI.WindowDragHandler), null);
+ #endregion
+
+ ShowCounter = Config.Bind("修改器快捷键", "Key", new KeyboardShortcut(KeyCode.Home));
+ Logger.LogInfo("脚本已启动");
+ mw = new MainWindow();
+ }
+
+ private void Update()
+ {
+ if (!MainWindow.initialized)
+ {
+ Logger.LogInfo("初始化窗口");
+ MainWindow.Initialize();
+ }
+
+ if (ShowCounter.Value.IsDown())
+ {
+ // Logger.LogInfo("启动键按下");
+ MainWindow.optionToggle = !MainWindow.optionToggle;
+ Logger.LogInfo("窗口开关状态: " + MainWindow.optionToggle.ToString());
+ // MessageMag.Instance.Send("窗口开关状态", null);
+ MainWindow.canvas.SetActive(MainWindow.optionToggle);
+ Event.current.Use();
+ }
+ }
+ public void OnDestroy()
+ {
+ // 移除 MainWindow.testAssetBundle 加载时的资源
+ //AssetBundle.UnloadAllAssetBundles(true);
+
+ // 销毁
+ MainWindow.canvas.SetActive(false);
+ MainWindow.canvas = null;
+ }
+ }
+}
diff --git a/Cluckmech Oasis/ScriptTrainer/ScriptPatch.cs b/Cluckmech Oasis/ScriptTrainer/ScriptPatch.cs
new file mode 100644
index 0000000..cffe3ea
--- /dev/null
+++ b/Cluckmech Oasis/ScriptTrainer/ScriptPatch.cs
@@ -0,0 +1,37 @@
+using HarmonyLib;
+using UnityEngine;
+
+namespace ScriptTrainer;
+
+internal class ScriptPatch
+{
+ // 无限CD
+ public static bool settingsNoCD = false;
+ // 无需动力
+ public static bool settingsNoMotivation = false;
+
+ // 模块_玩家_建造.背包cd初始化
+ [HarmonyPostfix]
+ [HarmonyPatch(typeof(模块_玩家_建造), "Update")]
+ public static void AddMotivation(模块_玩家_建造 __instance)
+ {
+ // 无限CD
+ if (settingsNoCD)
+ {
+ foreach (var item in __instance.背包cd剩余时间)
+ {
+ item.cd时间 = 0f;
+ }
+ }
+
+ // 无需动力
+ if (settingsNoMotivation)
+ {
+ GameObject 当前选中炮台 = Traverse.Create(__instance).Field("当前选中炮台").GetValue();
+ 模块_基本属性 模块_基本属性 = 当前选中炮台.GetComponent<模块_基本属性>();
+ 模块_基本属性.花费 = 0;
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/Cluckmech Oasis/ScriptTrainer/ScriptTrainer.csproj b/Cluckmech Oasis/ScriptTrainer/ScriptTrainer.csproj
new file mode 100644
index 0000000..c195b9c
--- /dev/null
+++ b/Cluckmech Oasis/ScriptTrainer/ScriptTrainer.csproj
@@ -0,0 +1,39 @@
+
+
+
+ net46
+ ScriptTrainer
+ ScriptTrainer
+ 1.0.0
+ true
+ latest
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ F:\steam\steamapps\common\鸡械绿洲 Demo
+ Cluckmech Oasis_Data
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Mad Games Tycoon 2/ScriptTrainer.sln b/Cluckmech Oasis/ScriptTrainer/ScriptTrainer.sln
similarity index 55%
rename from Mad Games Tycoon 2/ScriptTrainer.sln
rename to Cluckmech Oasis/ScriptTrainer/ScriptTrainer.sln
index 3c32473..000cef5 100644
--- a/Mad Games Tycoon 2/ScriptTrainer.sln
+++ b/Cluckmech Oasis/ScriptTrainer/ScriptTrainer.sln
@@ -1,9 +1,9 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
-VisualStudioVersion = 17.2.32602.215
+VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptTrainer", "ScriptTrainer\ScriptTrainer.csproj", "{56B71F4D-F911-4369-87C0-F13AD81535C2}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScriptTrainer", "ScriptTrainer.csproj", "{91140550-3D8B-4B54-B37C-D707CE3A20DF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -11,15 +11,15 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {56B71F4D-F911-4369-87C0-F13AD81535C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {56B71F4D-F911-4369-87C0-F13AD81535C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {56B71F4D-F911-4369-87C0-F13AD81535C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {56B71F4D-F911-4369-87C0-F13AD81535C2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {91140550-3D8B-4B54-B37C-D707CE3A20DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {91140550-3D8B-4B54-B37C-D707CE3A20DF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {91140550-3D8B-4B54-B37C-D707CE3A20DF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {91140550-3D8B-4B54-B37C-D707CE3A20DF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {DF11F9A6-5955-4B29-8D1A-BD80EF1C6103}
+ SolutionGuid = {049F2B51-569C-4C08-ADCA-2A4D6266017A}
EndGlobalSection
EndGlobal
diff --git a/Cluckmech Oasis/ScriptTrainer/UI/BasicScripts.cs b/Cluckmech Oasis/ScriptTrainer/UI/BasicScripts.cs
new file mode 100644
index 0000000..a240779
--- /dev/null
+++ b/Cluckmech Oasis/ScriptTrainer/UI/BasicScripts.cs
@@ -0,0 +1,64 @@
+using System;
+using UnityEngine;
+using 函数库;
+
+namespace ScriptTrainer;
+public class BasicScripts
+{
+
+ private 总结脚本 SummaryScript => GameObject.Find("总结")?.GetComponent<总结脚本>();
+ // private 模块_玩家_建造 建造脚本 => GameObject.Find("玩家")?.GetComponent<模块_玩家_建造>();
+ public static 模块_玩家_动力 玩家动力
+ {
+ get
+ {
+ try
+ {
+ return 常用函数.搜索物体并返回物体内组件<模块_玩家_动力>("玩家");
+
+ }
+ catch (System.Exception e)
+ {
+ Debug.LogError(e.Message);
+
+ return null;
+ }
+ }
+ }
+
+
+ public BasicScripts(GameObject panel)
+ {
+ #region[添加功能按钮]
+ Components.AddH3("常用功能", panel);
+ {
+ Components.AddInputField("现金", 150, SummaryScript.当前金钱数.ToString(), panel, (string value) =>
+ {
+ SummaryScript.当前金钱数 = int.Parse(value);
+ });
+
+ if (玩家动力)
+ {
+ Components.AddInputField("动力", 150, 玩家动力.当前动力.ToString(), panel, (string value) =>
+ {
+ 玩家动力.当前动力 = int.Parse(value);
+ });
+ }
+
+
+
+ Components.AddInputField("基地血量", 150, SummaryScript.当前基地血量.ToString(), panel, (string value) =>
+ {
+ SummaryScript.当前基地血量 = int.Parse(value);
+ });
+ }
+
+ Components.Hr();
+ Components.AddToggle("无限CD", 150, panel, (bool value) => ScriptPatch.settingsNoCD = value);
+ Components.AddToggle("无需动力", 150, panel, (bool value) => ScriptPatch.settingsNoMotivation = value);
+
+ #endregion
+
+ }
+
+}
diff --git a/Cluckmech Oasis/ScriptTrainer/UI/Components.cs b/Cluckmech Oasis/ScriptTrainer/UI/Components.cs
new file mode 100644
index 0000000..8ea2dc2
--- /dev/null
+++ b/Cluckmech Oasis/ScriptTrainer/UI/Components.cs
@@ -0,0 +1,180 @@
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.Events;
+using UnityEngine.UI;
+using UnityGameUI;
+// using Object = UnityEngine.Object;
+
+namespace ScriptTrainer;
+public static class Components
+{
+ #region[添加组件]
+
+ // 添加标题
+ public static GameObject AddTitle(string Title, GameObject panel)
+ {
+ GameObject TitleBackground = UIControls.createUIPanel(panel, "30", (MainWindow.width - 20).ToString(), null);
+ TitleBackground.GetComponent().color = UIControls.HTMLString2Color("#2D2D30FF");
+ TitleBackground.GetComponent().localPosition = new Vector3(0, MainWindow.height / 2 - 30, 0);
+
+ Sprite txtBgSprite = UIControls.createSpriteFrmTexture(UIControls.createDefaultTexture("#7AB900FF"));
+ GameObject uiText = UIControls.createUIText(TitleBackground, txtBgSprite, "#FFFFFFFF");
+ uiText.GetComponent().sizeDelta = new Vector2(MainWindow.width - 10, 30);
+ uiText.GetComponent().localPosition = new Vector3(0, 0, 0);
+ Text text = uiText.GetComponent();
+ text.text = Title;
+ text.alignment = TextAnchor.MiddleCenter;
+ text.fontSize = 16;
+
+ return uiText;
+ }
+
+ public static GameObject AddButton(string Text, GameObject panel, UnityAction action)
+ {
+ string backgroundColor = "#8C9EFFFF";
+ Vector3 localPosition = new Vector3(MainWindow.ElementX, MainWindow.ElementY, 0);
+ MainWindow.ElementX += 90;
+
+ GameObject button = UIControls.createUIButton(panel, backgroundColor, Text, action, localPosition);
+
+ // 按钮样式
+ button.AddComponent().effectColor = UIControls.HTMLString2Color("#000000FF"); // 添加阴影
+ button.GetComponent().effectDistance = new Vector2(2, -2); // 设置阴影偏移
+ button.GetComponentInChildren().fontSize = 14; // 设置字体大小
+ button.GetComponent().sizeDelta = new Vector2(80, 30); // 设置按钮大小
+
+
+ return button;
+ }
+
+ // 添加复选框
+ public static GameObject AddToggle(string Text, int width, GameObject panel, UnityAction action)
+ {
+ // 计算x轴偏移
+ MainWindow.ElementX += width / 2 - 30;
+
+ Sprite toggleBgSprite = UIControls.createSpriteFrmTexture(UIControls.createDefaultTexture("#3E3E42FF"));
+ Sprite toggleSprite = UIControls.createSpriteFrmTexture(UIControls.createDefaultTexture("#18FFFFFF"));
+ GameObject uiToggle = UIControls.createUIToggle(panel, toggleBgSprite, toggleSprite);
+ uiToggle.GetComponentInChildren().color = Color.white;
+ uiToggle.GetComponentInChildren().isOn = false;
+ uiToggle.GetComponent().localPosition = new Vector3(MainWindow.ElementX, MainWindow.ElementY, 0);
+
+ uiToggle.GetComponentInChildren().text = Text;
+ uiToggle.GetComponentInChildren().onValueChanged.AddListener(action);
+
+
+ MainWindow.ElementX += width / 2 + 10;
+
+ return uiToggle;
+ }
+
+ // 添加输入框
+ public static GameObject AddInputField(string Text, int width, string defaultText, GameObject panel, UnityAction action)
+ {
+ // 计算x轴偏移
+ MainWindow.ElementX += width / 2 - 30;
+
+ // label
+ Sprite txtBgSprite = UIControls.createSpriteFrmTexture(UIControls.createDefaultTexture("#7AB900FF"));
+ GameObject uiText = UIControls.createUIText(panel, txtBgSprite, "#FFFFFFFF");
+ uiText.GetComponent().text = Text;
+ uiText.GetComponent().localPosition = new Vector3(MainWindow.ElementX, MainWindow.ElementY, 0);
+ //uiText.GetComponent().sizeDelta = new Vector2(60, 30);
+ uiText.GetComponent().alignment = TextAnchor.MiddleLeft;
+
+
+ // 坐标偏移
+ MainWindow.ElementX += 10;
+
+ // 输入框
+ Sprite inputFieldSprite = UIControls.createSpriteFrmTexture(UIControls.createDefaultTexture("#212121FF"));
+ GameObject uiInputField = UIControls.createUIInputField(panel, inputFieldSprite, "#FFFFFFFF");
+ uiInputField.GetComponent().text = defaultText;
+ uiInputField.GetComponent().localPosition = new Vector3(MainWindow.ElementX, MainWindow.ElementY, 0);
+ uiInputField.GetComponent().sizeDelta = new Vector2(width - 60, 30);
+
+ // 文本框失去焦点时触发方法
+ uiInputField.GetComponent().onEndEdit.AddListener(action);
+
+ MainWindow.ElementX += width / 2 + 10;
+ return uiInputField;
+ }
+
+ // 添加下拉框
+ public static GameObject AddDropdown(string Text, int width, List options, GameObject panel, UnityAction action)
+ {
+ // 计算x轴偏移
+ MainWindow.ElementX += width / 2 - 30;
+
+ // label
+ Sprite txtBgSprite = UIControls.createSpriteFrmTexture(UIControls.createDefaultTexture("#7AB900FF"));
+ GameObject uiText = UIControls.createUIText(panel, txtBgSprite, "#FFFFFFFF");
+ uiText.GetComponent().text = Text;
+ uiText.GetComponent().localPosition = new Vector3(MainWindow.ElementX, MainWindow.ElementY, 0);
+ //uiText.GetComponent().sizeDelta = new Vector2(60, 30);
+ uiText.GetComponent().alignment = TextAnchor.MiddleLeft;
+
+ // 坐标偏移
+ MainWindow.ElementX += 60;
+
+ // 创建下拉框
+ Sprite dropdownBgSprite = UIControls.createSpriteFrmTexture(UIControls.createDefaultTexture("#212121FF")); // 背景颜色
+ Sprite dropdownScrollbarSprite = UIControls.createSpriteFrmTexture(UIControls.createDefaultTexture("#8C9EFFFF")); // 滚动条颜色 (如果有的话
+ Sprite dropdownDropDownSprite = UIControls.createSpriteFrmTexture(UIControls.createDefaultTexture("#212121FF")); // 框右侧小点的颜色
+ Sprite dropdownCheckmarkSprite = UIControls.createSpriteFrmTexture(UIControls.createDefaultTexture("#8C9EFFFF")); // 选中时的颜色
+ Sprite dropdownMaskSprite = UIControls.createSpriteFrmTexture(UIControls.createDefaultTexture("#E65100FF")); // 不知道是哪的颜色
+ Color LabelColor = UIControls.HTMLString2Color("#EFEBE9FF");
+ GameObject uiDropDown = UIControls.createUIDropDown(panel, dropdownBgSprite, dropdownScrollbarSprite, dropdownDropDownSprite, dropdownCheckmarkSprite, dropdownMaskSprite, options, LabelColor);
+ Object.DontDestroyOnLoad(uiDropDown);
+ uiDropDown.GetComponent().localPosition = new Vector3(MainWindow.ElementX, MainWindow.ElementY, 0);
+
+ // 下拉框选中时触发方法
+ uiDropDown.GetComponent().onValueChanged.AddListener(action);
+
+ MainWindow.ElementX += width / 2 + 60;
+ return uiDropDown;
+ }
+
+ // 添加小标题
+ public static GameObject AddH3(string text, GameObject panel, Color color = default(Color))
+ {
+ MainWindow.ElementX += 40;
+
+ Sprite txtBgSprite = UIControls.createSpriteFrmTexture(UIControls.createDefaultTexture("#7AB900FF"));
+ GameObject uiText = UIControls.createUIText(panel, txtBgSprite, "#FFFFFFFF");
+ uiText.GetComponent().text = text;
+ uiText.GetComponent().localPosition = new Vector3(MainWindow.ElementX, MainWindow.ElementY, 0);
+ //uiText.GetComponent().sizeDelta = new Vector2(200, 30); // 设置宽度
+
+ // 设置字体样式为h3小标题
+ uiText.GetComponent().fontSize = 14;
+ uiText.GetComponent().fontStyle = FontStyle.Bold;
+
+ // 设置字体颜色
+ if (color != default(Color)) uiText.GetComponent().color = color;
+
+ Hr();
+ MainWindow.ElementY += 20;
+ MainWindow.ElementX += 10;
+ return uiText;
+ }
+
+ // 换行
+ public static void Hr(int offsetX = 0, int offsetY = 0)
+ {
+ ResetCoordinates(true);
+ MainWindow.ElementX += offsetX;
+ MainWindow.ElementY -= 50 + offsetY;
+
+ }
+ // 重置坐标
+ public static void ResetCoordinates(bool x, bool y = false)
+ {
+ if (x) MainWindow.ElementX = MainWindow.InitialX;
+ if (y) MainWindow.ElementY = MainWindow.InitialY;
+ }
+
+ #endregion
+
+}
diff --git a/Cluckmech Oasis/ScriptTrainer/UI/MainWindow.cs b/Cluckmech Oasis/ScriptTrainer/UI/MainWindow.cs
new file mode 100644
index 0000000..539e271
--- /dev/null
+++ b/Cluckmech Oasis/ScriptTrainer/UI/MainWindow.cs
@@ -0,0 +1,196 @@
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.Events;
+using UnityEngine.EventSystems;
+using UnityEngine.UI;
+using UnityGameUI;
+using Navigation = UnityGameUI.Navigation;
+
+namespace ScriptTrainer;
+
+internal class MainWindow : MonoBehaviour
+{
+ #region[声明]
+ public static GameObject obj = null;
+ public static MainWindow instance;
+ public static bool initialized = false;
+ public static bool _optionToggle = false;
+ // private static TooltipGUI toolTipComp = null;
+
+ // UI
+ public static GameObject canvas = null;
+ private static bool isVisible = false;
+ private static GameObject uiPanel = null;
+ public static readonly int width = Mathf.Min(Screen.width, 740);
+ public static readonly int height = (Screen.height < 400) ? Screen.height : (450);
+
+ // 窗口开关
+ public static bool optionToggle
+ {
+ get => _optionToggle;
+ set
+ {
+ _optionToggle = value;
+
+ // player = PlayerAnimControl.instance; // 获取玩家
+ // NpcWindow.RefreshNpcData(); // 刷新获取Npc
+
+ if (!initialized)
+ {
+ instance.CreateUI();
+ }
+ }
+ }
+
+ // 按钮位置
+ public static int InitialX
+ {
+ get
+ {
+ return -width / 2 + 120;
+ }
+ }
+ public static int InitialY
+ {
+ get
+ {
+ return height / 2 - 60;
+ }
+ }
+
+ public static int ElementX = InitialX;
+ public static int ElementY = InitialY;
+
+ #endregion
+
+ #region[初始化]
+ // public static PlayerAnimControl player
+ // {
+ // get
+ // {
+ // return PlayerAnimControl.instance;
+ // }
+ // }
+ #endregion
+
+ public MainWindow()
+ {
+ instance = this;
+ }
+
+ public static void Initialize()
+ {
+ initialized = true;
+ instance.CreateUI();
+ }
+
+ #region [创建UI]
+
+ private void CreateUI()
+ {
+
+ if (canvas == null)
+ {
+ Debug.Log("创建 UI 元素");
+ canvas = UIControls.createUICanvas();
+ Object.DontDestroyOnLoad(canvas);
+ canvas.name = "ScriptTrainer";
+
+
+ // 创建背景
+ GameObject background = UIControls.createUIPanel(canvas, (height + 40).ToString(), (width + 40).ToString(), null);
+ background.gameObject.name = "background";
+ background.gameObject.layer = 5; // UI层
+
+ // 将面板添加到画布, 请参阅 createUIPanel 了解我们将高度/宽度作为字符串传递的原因
+ uiPanel = UIControls.createUIPanel(background, height.ToString(), width.ToString(), null);
+ // 设置背景颜色
+ uiPanel.GetComponent().color = UIControls.HTMLString2Color("#424242FF");
+
+ // 设置背景
+ background.GetComponent().color = UIControls.HTMLString2Color("#2D2D30FF");
+ // 这就是我们将如何挂钩鼠标事件以进行窗口拖动
+ background.AddComponent();
+
+
+
+ #region[面板元素]
+ Components.AddTitle("【鸡械绿洲】内置修改器 By:小莫", background);
+ GameObject closeButton = UIControls.createUIButton(background, "#B71C1CFF", "X", () =>
+ {
+ optionToggle = false;
+ canvas.SetActive(optionToggle);
+ }, new Vector3(width / 2 + 10, height / 2 + 10, 0));
+ closeButton.GetComponent().sizeDelta = new Vector2(20, 20);
+ // 字体颜色为白色
+ closeButton.GetComponentInChildren().color = UIControls.HTMLString2Color("#FFFFFFFF");
+ #endregion
+
+ #region [基础功能]
+ GameObject basicScripts = UIControls.createUIPanel(background, "410", "600", null);
+ basicScripts.GetComponent().color = UIControls.HTMLString2Color("#424242FF");
+ basicScripts.GetComponent().anchoredPosition = new Vector2(-70, -20);
+ new BasicScripts(basicScripts);
+
+ Components.ResetCoordinates(true, true);
+
+ GameObject settingsScripts = UIControls.createUIPanel(background, "410", "600", null);
+ settingsScripts.GetComponent().color = UIControls.HTMLString2Color("#424242FF");
+ settingsScripts.GetComponent().anchoredPosition = new Vector2(-70, -20);
+ new SettingsScripts(settingsScripts);
+
+ // Components.ResetCoordinates(true, true);
+
+ // GameObject weaponScripts = UIControls.createUIPanel(background, "410", "600", null);
+ // weaponScripts.GetComponent().color = UIControls.HTMLString2Color("#424242FF");
+ // weaponScripts.GetComponent().anchoredPosition = new Vector2(-70, -20);
+ // // new WeaponScript(weaponScripts);
+
+ #endregion
+
+ #region[创建导航栏]
+ // 分割线
+ GameObject DividingLine = UIControls.createUIPanel(uiPanel, (height - 40).ToString(), "10", null);
+ DividingLine.GetComponent().color = UIControls.HTMLString2Color("#2D2D30FF");
+ DividingLine.GetComponent().anchoredPosition = new Vector3(width / 2 - 200 + 80, -20, 0);
+
+ //// 按钮
+ GameObject NavPanel = UIControls.createUIPanel(uiPanel, (height - 40).ToString(), "40", null);
+ NavPanel.GetComponent().color = UIControls.HTMLString2Color("#424242FF");
+ NavPanel.GetComponent().anchoredPosition = new Vector3(width / 2 - 100, -20, 0);
+
+ Navigation[] nav = new Navigation[]
+ {
+ new Navigation("BasicScripts","基础功能", basicScripts, true),
+ new Navigation("ItemScripts","游戏设置", settingsScripts, false),
+ // new Navigation("ItemScripts","获取武器", weaponScripts, false),
+ // new Navigation("MenPaiScripts","宗门修改", MenPaiScripts, false),
+ // new Navigation("WuDaoScripts", "悟道修改", WuDaoScripts, false),
+ // new Navigation("NpcScripts", "NPC修改", NpcScripts, false),
+ // new Navigation("ItemScripts", "获取物品", ItemScripts, false),
+
+ };
+
+ UINavigation.Initialize(nav, NavPanel);
+
+ #endregion
+
+ isVisible = true;
+ canvas.SetActive(optionToggle);
+ Debug.Log("修改器初始化完成!");
+ Debug.Log("按Home可开关修改器菜单");
+
+ }
+ else
+ {
+ // Debug.Log("玩家未加载!");
+ initialized = false;
+ }
+
+ }
+
+ #endregion
+
+
+
+}
\ No newline at end of file
diff --git a/Cluckmech Oasis/ScriptTrainer/UI/SettingsScripts.cs b/Cluckmech Oasis/ScriptTrainer/UI/SettingsScripts.cs
new file mode 100644
index 0000000..5e0eda2
--- /dev/null
+++ b/Cluckmech Oasis/ScriptTrainer/UI/SettingsScripts.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace ScriptTrainer;
+public class SettingsScripts
+{
+
+
+ public SettingsScripts(GameObject panel)
+ {
+ #region[添加功能按钮]
+ Components.AddH3("设置", panel);
+ {
+ Components.AddInputField("音量", 150, AudioListener.volume.ToString(), panel, (string value) =>
+ {
+ AudioListener.volume = float.Parse(value);
+ });
+
+ List options = new List(){
+ "1920x1080", "1280x720", "960x540", "640x360"
+ };
+
+ // 下拉框 选择分辨率
+ Components.AddDropdown("分辨率", 150, options, panel, (int value) =>
+ {
+ switch (value)
+ {
+ case 0:
+ Screen.SetResolution(1920, 1080, false);
+ break;
+ case 1:
+ Screen.SetResolution(1280, 720, false);
+ break;
+ case 2:
+ Screen.SetResolution(960, 540, false);
+ break;
+ case 3:
+ Screen.SetResolution(640, 360, false);
+ break;
+ default:
+ break;
+ }
+ });
+ }
+
+ #endregion
+
+ }
+
+}
diff --git a/Cluckmech Oasis/ScriptTrainer/UnityGameUI b/Cluckmech Oasis/ScriptTrainer/UnityGameUI
new file mode 160000
index 0000000..b3718f6
--- /dev/null
+++ b/Cluckmech Oasis/ScriptTrainer/UnityGameUI
@@ -0,0 +1 @@
+Subproject commit b3718f63e7dcd39b1c5da4d4e97cecaa242200cb
diff --git a/Cluckmech Oasis/package.json b/Cluckmech Oasis/package.json
new file mode 100644
index 0000000..00ba3d7
--- /dev/null
+++ b/Cluckmech Oasis/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "yog-sothoths-yard",
+ "version": "1.0.0",
+ "description": "",
+ "main": "index.js",
+ "scripts": {
+ "build scripts": "dotnet build -o \"F:\\steam\\steamapps\\common\\鸡械绿洲 Demo\\BepInEx\\scripts\" ScriptTrainer",
+ "build plugins": "dotnet build -o \"F:\\steam\\steamapps\\common\\鸡械绿洲 Demo\\BepInEx\\plugins\" ScriptTrainer",
+ "run": "dotnet run -c release ScriptTrainer",
+ ".": "dotnet build"
+ },
+ "author": "小莫",
+ "license": "ISC"
+}
\ No newline at end of file
diff --git a/Dyson Sphere Program/Dyson Sphere Program.sln b/Dyson Sphere Program/Dyson Sphere Program.sln
new file mode 100644
index 0000000..ce3128b
--- /dev/null
+++ b/Dyson Sphere Program/Dyson Sphere Program.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.5.002.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScriptTrainer", "ScriptTrainer\ScriptTrainer.csproj", "{B94FE33D-F09E-4954-869C-A195BA1F71C0}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B94FE33D-F09E-4954-869C-A195BA1F71C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B94FE33D-F09E-4954-869C-A195BA1F71C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B94FE33D-F09E-4954-869C-A195BA1F71C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B94FE33D-F09E-4954-869C-A195BA1F71C0}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {75806EBA-0584-4C7A-8452-DEDD6C23D623}
+ EndGlobalSection
+EndGlobal
diff --git a/Dyson Sphere Program/ScriptTrainer/DSUI/Components.cs b/Dyson Sphere Program/ScriptTrainer/DSUI/Components.cs
new file mode 100644
index 0000000..385db56
--- /dev/null
+++ b/Dyson Sphere Program/ScriptTrainer/DSUI/Components.cs
@@ -0,0 +1,176 @@
+
+using UnityEngine;
+using UnityEngine.UI;
+using UnityGameUI;
+
+namespace ScriptTrainer
+{
+ public static class Components
+ {
+ #region[声明]
+ private const float kWidth = 160f;
+ private const float kThickHeight = 30f;
+ private const float kThinHeight = 20f;
+ private static Vector2 s_ThickElementSize = new Vector2(160f, 30f);
+ private static Vector2 s_ThinElementSize = new Vector2(160f, 20f);
+ private static Vector2 s_ImageElementSize = new Vector2(100f, 100f);
+ private static Color s_DefaultSelectableColor = new Color(1f, 1f, 1f, 1f);
+ private static Color s_PanelColor = new Color(1f, 1f, 1f, 0.392f);
+ private static Color s_TextColor = new Color(0.19607843f, 0.19607843f, 0.19607843f, 1f);
+
+ public struct Resources
+ {
+ public Sprite standard;
+ public Sprite background;
+ public Sprite inputField;
+ public Sprite knob;
+ public Sprite checkmark;
+ public Sprite dropdown;
+ public Sprite mask;
+ }
+ #endregion
+
+
+ // 创建背景 复制的游戏中物品清单样式
+ public static UIInventoryWindow createUIPanel(GameObject canvas, string title, float width, float height)
+ {
+ UIInventoryWindow background = Object.Instantiate(UIRoot.instance.uiGame.inventoryWindow, canvas.transform);
+
+ //background._Create();
+ //background._Init(null);
+ //background._Open();
+
+ // 设置宽高
+ RectTransform rectTransform = background.GetComponent();
+ rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, height);
+ rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, width);
+
+ Transform panel_bg = background.transform.Find("panel-bg"); // 背景
+
+ // 删除多余的内容
+ Object.Destroy(background.transform.Find("storage-grid").gameObject);
+ Object.Destroy(background.transform.Find("delivery-panel").gameObject);
+ Object.Destroy(panel_bg.transform.Find("glass").gameObject);
+ Object.Destroy(panel_bg.transform.Find("deco").gameObject);
+ Object.Destroy(panel_bg.transform.Find("deco (1)").gameObject);
+ Object.Destroy(panel_bg.transform.Find("deco (2)").gameObject);
+ Object.Destroy(panel_bg.transform.Find("deco (3)").gameObject);
+ Object.Destroy(panel_bg.transform.Find("tip-text").gameObject);
+ //Object.Destroy(panel_bg.transform.Find("btn-box").gameObject);
+
+ // 设置标题
+ var title_text = panel_bg.transform.Find("title-text");
+ Object.Destroy(title_text.GetComponentInChildren());
+ title_text.GetComponentInChildren().text = title;
+
+ // 显示背景
+ background.gameObject.SetActive(true);
+ return background;
+ }
+
+ public static Transform createUIButton(GameObject canvas)
+ {
+ //UIEscMenu escMenu = Object.Instantiate(UIRoot.instance.uiGame.escMenu);
+ //Transform button = escMenu.transform.Find("button (1)");
+
+ Transform button = Object.Instantiate(UIRoot.instance.uiGame.escMenu.transform.Find("button-group/button (1)"));
+ button.SetParent(canvas.transform);
+ button.GetComponentInChildren().fontSize = 14; // 设置字体大小
+
+ Object.Destroy(button.GetComponentInChildren());
+
+ button.name = "button";
+ return button;
+ }
+
+ //// 创建文本框
+ //public static Transform createInputField(GameObject canvas)
+ //{
+ // UIMechaEditor mechaEditor = Object.Instantiate(UIRoot.instance.uiMechaEditor);
+
+ // // 获取一个输入框
+ // Transform input = mechaEditor.transform.Find("Left Panel/scroll-view/Viewport/Left Panel Content/save-group/fold-group-0/input-name");
+ // input.SetParent(canvas.transform);
+
+ // Object.Destroy(input.GetComponentInChildren());
+
+
+ // input.name = "input";
+
+ // return input;
+ //}
+
+ // 创建 加减框
+ public static Transform createCount(GameObject canvas)
+ {
+ // Replicator Window
+
+ //UIReplicatorWindow uIReplicatorWindow = Object.Instantiate(UIRoot.instance.uiGame.replicator);
+ //Transform count = uIReplicatorWindow.transform.Find("recipe-tree/count");
+
+ Transform count = Object.Instantiate(UIRoot.instance.uiGame.replicator.transform.Find("recipe-tree/count"));
+
+
+ count.SetParent(canvas.transform);
+
+ return count;
+
+ }
+
+ // 创建 滚动条
+ //public static Transform createItemScrollbar(GameObject canvas)
+ //{
+ // UIPerformancePanel performancePanelUI = Object.Instantiate(UIRoot.instance.uiGame.statWindow.performancePanelUI);
+
+ // //performancePanelUI._Init(null);
+ // performancePanelUI._Create();
+ // performancePanelUI._Init(null);
+ // performancePanelUI._Open();
+
+ // ScrollRect cpuScrollRect = performancePanelUI.cpuScrollRect;
+
+ // cpuScrollRect.transform.SetParent(canvas.transform);
+ // cpuScrollRect.gameObject.name = "Scroll View";
+
+ // RectTransform rt = cpuScrollRect.GetComponent();
+ // rt.localPosition = new Vector3(0, 0, 0);
+
+ // Transform Viewport = cpuScrollRect.transform.Find("Viewport");
+ // Transform Content = Viewport.transform.Find("Content");
+ // Transform Scrollbar_Horizontal = cpuScrollRect.transform.Find("Scrollbar Horizontal");
+ // Transform Scrollbar_Vertical = cpuScrollRect.transform.Find("Scrollbar Vertical");
+
+ // //Object.Destroy(cpuScrollRect.transform.Find("Scrollbar Horizontal").gameObject);
+ // Object.Destroy(Content.transform.Find("label").gameObject);
+ // Object.Destroy(Content.transform.Find("value-1").gameObject);
+ // Object.Destroy(Content.transform.Find("value-2").gameObject);
+
+
+ // RectTransform rt_Viewport = Viewport.GetComponent();
+ // rt_Viewport.anchorMin = Vector2.zero;
+ // rt_Viewport.anchorMax = Vector2.one;
+ // rt_Viewport.sizeDelta = Vector2.zero;
+ // rt_Viewport.pivot = Vector2.up;
+
+ // RectTransform rt_Content = Content.GetComponent();
+ // rt_Content.anchorMin = Vector2.up;
+ // rt_Content.anchorMax = Vector2.one;
+ // //rt_Content.sizeDelta = new Vector2(0f, 300f);
+ // rt_Content.pivot = Vector2.up;
+
+ // // 设定滚动条
+ // ScrollRect sr = cpuScrollRect.GetComponent();
+ // sr.content = rt_Content;
+ // sr.viewport = rt_Viewport;
+ // sr.horizontalScrollbar = Scrollbar_Horizontal.GetComponent();
+ // sr.verticalScrollbar = Scrollbar_Vertical.GetComponent();
+ // sr.horizontalScrollbarVisibility = ScrollRect.ScrollbarVisibility.AutoHideAndExpandViewport;
+ // sr.verticalScrollbarVisibility = ScrollRect.ScrollbarVisibility.AutoHideAndExpandViewport;
+ // sr.horizontalScrollbarSpacing = -3f;
+ // sr.verticalScrollbarSpacing = -3f;
+
+
+ // return cpuScrollRect.transform;
+ //}
+ }
+}
diff --git a/Dyson Sphere Program/ScriptTrainer/DSUI/DSNavigation.cs b/Dyson Sphere Program/ScriptTrainer/DSUI/DSNavigation.cs
new file mode 100644
index 0000000..67cc303
--- /dev/null
+++ b/Dyson Sphere Program/ScriptTrainer/DSUI/DSNavigation.cs
@@ -0,0 +1,143 @@
+
+using System;
+using System.Collections.Generic;
+using System.Xml.Linq;
+using UnityEngine;
+using UnityEngine.UI;
+using UnityGameUI;
+using WinAPI;
+using Object = UnityEngine.Object;
+
+namespace ScriptTrainer
+{
+ internal class DSNavigation
+ {
+ #region[全局参数]
+ private Transform horizontal_tab;
+ private Vector3 localPosition = new Vector3(16, -57, 0);
+ private Vector2 sizeDelta = new Vector2(100, 250);
+
+ private int elementY = 0;
+
+ public static List tabs = new List();
+
+ #endregion
+
+ public DSNavigation(GameObject canvas)
+ {
+ //UIStatisticsWindow statWindow = Object.Instantiate(UIRoot.instance.uiGame.statWindow);
+ //horizontal_tab = statWindow.transform.Find("panel-bg/horizontal-tab");
+
+ horizontal_tab = Object.Instantiate(UIRoot.instance.uiGame.statWindow.transform.Find("panel-bg/horizontal-tab"));
+ horizontal_tab.SetParent(canvas.transform);
+
+ // 删除多余的内容
+ Object.Destroy(horizontal_tab.transform.Find("milestone-btn").gameObject);
+ Object.Destroy(horizontal_tab.transform.Find("production-btn").gameObject);
+ Object.Destroy(horizontal_tab.transform.Find("power-btn").gameObject);
+ Object.Destroy(horizontal_tab.transform.Find("research-btn").gameObject);
+ Object.Destroy(horizontal_tab.transform.Find("dyson-btn").gameObject);
+ Object.Destroy(horizontal_tab.transform.Find("performance-btn").gameObject);
+ Object.Destroy(horizontal_tab.transform.Find("achievement-btn").gameObject);
+ Object.Destroy(horizontal_tab.transform.Find("property-btn").gameObject);
+ Object.Destroy(horizontal_tab.transform.Find("kill-btn").gameObject);
+
+ RectTransform rt = horizontal_tab.GetComponent();
+ rt.localPosition = localPosition;
+ rt.sizeDelta = sizeDelta;
+ //Create();
+ }
+
+
+
+
+ public void AddTab(string text, GameObject module, bool show = false)
+ {
+ tabs.Add(new ITabs(text, module, show));
+
+ //createButton(text, horizontal_tab.gameObject);
+ }
+
+ public void Create()
+ {
+
+ foreach (var item in tabs)
+ {
+ Transform button = createButton(item.text, horizontal_tab.gameObject);
+
+ button.GetComponent().onClick += (int i) =>
+ {
+ item.SetActive();
+ };
+
+ item.module.SetActive(item.show);
+ }
+
+ }
+
+
+ public Transform createButton(string text, GameObject canvas)
+ {
+ UIStatisticsWindow statWindow = Object.Instantiate(UIRoot.instance.uiGame.statWindow);
+ Transform button = statWindow.transform.Find("panel-bg/horizontal-tab/milestone-btn");
+
+ //var a = UIRoot.instance.uiGame.statWindow.transform.Find("panel-bg/horizontal-tab/milestone-btn");
+ //Console.WriteLine("a:" + a);
+ //Transform button = Object.Instantiate(a);
+
+ button.SetParent(canvas.transform);
+ button.name = "tab-button";
+
+ RectTransform rt = button.GetComponent();
+ rt.localPosition = new Vector3(-50, elementY, 0);
+
+ Object.Destroy(button.GetComponentInChildren());
+
+ button.GetComponentInChildren().text = text;
+
+ elementY -= 50;
+
+ return button;
+ }
+
+
+ }
+
+ public class ITabs
+ {
+ public string text { get; set; }
+ public GameObject module { get; set; }
+ public bool show { get; set; }
+
+ public ITabs(string text, GameObject module, bool show)
+ {
+ this.text = text;
+ this.module = module;
+ this.show = show;
+ }
+ internal void SetActive(bool v)
+ {
+ show = v;
+ module.SetActive(v);
+ }
+ }
+
+ public static class Extensions
+ {
+ public static void SetActive(this ITabs nav)
+ {
+ foreach (ITabs n in DSNavigation.tabs)
+ {
+ if (n == nav)
+ {
+ n.SetActive(true);
+ }
+ else
+ {
+ n.SetActive(false);
+ }
+ }
+
+ }
+ }
+}
diff --git a/Dyson Sphere Program/ScriptTrainer/MainWindow.cs b/Dyson Sphere Program/ScriptTrainer/MainWindow.cs
deleted file mode 100644
index 663bf9c..0000000
--- a/Dyson Sphere Program/ScriptTrainer/MainWindow.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using UnityEngine;
-using UnityEngine.Events;
-using UnityEngine.EventSystems;
-using UnityEngine.UI;
-using UnityGameUI;
-using Navigation = UnityGameUI.Navigation;
-using Object = UnityEngine.Object;
-
-namespace ScriptTrainer
-{
- internal class MainWindow: MonoBehaviour
- {
- #region[声明]
- // Trainer Base
- public static GameObject obj = null;
- public static MainWindow instance;
- public static bool initialized = false;
- public static bool _optionToggle = false;
- private static TooltipGUI toolTipComp = null;
-
- // UI
- public static AssetBundle testAssetBundle = null;
- public static GameObject canvas = null;
- private static bool isVisible = false;
- private static GameObject uiPanel = null;
- private static readonly int width = Mathf.Min(Screen.width, 740);
- private static readonly int height = (Screen.height < 400) ? Screen.height : (450);
-
- // 窗口开关
- public static bool optionToggle
- {
- get => _optionToggle;
- set
- {
- _optionToggle = value;
-
-
- if (!initialized)
- {
- instance.CreateUI();
- }
- }
- }
-
- // 按钮位置
- private static int initialX
- {
- get
- {
- return -width / 2 + 120;
- }
- }
- private static int initialY
- {
- get
- {
- return height / 2 - 60;
- }
- }
-
- private static int elementX = initialX;
- private static int elementY = initialY;
- #endregion
-
- public MainWindow()
- {
- instance = this;
- }
-
- public void Initialize()
- {
- initialized = true;
- instance.CreateUI();
- }
-
- public void CreateUI()
- {
-
- }
- }
-}
diff --git a/Dyson Sphere Program/ScriptTrainer/ScriptPatch.cs b/Dyson Sphere Program/ScriptTrainer/ScriptPatch.cs
new file mode 100644
index 0000000..5a85516
--- /dev/null
+++ b/Dyson Sphere Program/ScriptTrainer/ScriptPatch.cs
@@ -0,0 +1,36 @@
+using BepInEx.Configuration;
+using HarmonyLib;
+
+namespace ScriptTrainer
+{
+ internal class ScriptPatch
+ {
+ #region[全局参数]
+ public static ConfigEntry userCount { get; set; } // 物品叠加倍率
+
+ #endregion
+
+ [HarmonyPostfix]
+ [HarmonyPatch(typeof(StorageComponent), "LoadStatic")]
+
+ public static void LoadStatic_Postfix()
+ {
+ ItemTweaks(userCount.Value);
+ }
+
+
+ // 物品叠加
+ public static void ItemTweaks(int count)
+ {
+ ItemProto[] dataArray = LDB.items.dataArray;
+
+ foreach (var item in dataArray)
+ {
+ StorageComponent.itemStackCount[item.ID] = item.StackSize * count;
+ }
+ userCount.Value = count;
+
+ userCount.SetSerializedValue(count.ToString());
+ }
+ }
+}
diff --git a/Dyson Sphere Program/ScriptTrainer/ScriptTrainer.cs b/Dyson Sphere Program/ScriptTrainer/ScriptTrainer.cs
index d781423..2333e78 100644
--- a/Dyson Sphere Program/ScriptTrainer/ScriptTrainer.cs
+++ b/Dyson Sphere Program/ScriptTrainer/ScriptTrainer.cs
@@ -1,45 +1,133 @@
using System;
-using System.Collections.Generic;
-using System.IO;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;
-using System.Collections;
-using ConfigurationManager;
-using UnityEngine.Experimental.Rendering;
-using System.Reflection;
-using BepInEx.Logging;
-using System.Text.RegularExpressions;
namespace ScriptTrainer
{
- [BepInPlugin("aoe.top.ScriptTrainer", "[戴森球计划] 内置修改器 By:小莫", "2.0")]
+ [BepInPlugin("aoe.top.DysonScriptTrainer", "Dyson Script Trainer By:小莫", "3.2")]
+
+
public class ScriptTrainer : BaseUnityPlugin
{
- // 启动按键
- private ConfigEntry ShowCounter { get; set; }
- private static ConfigEntry userCount;
+ #region[初始化参数]
+ public static ConfigEntry ShowCounter { get; set; } // 启动按键
+
+ #region 配方修改配置
+
+
+
+
+ public static ConfigEntry AssemblerSpeed { get; set; } // 组装机速度
+ public static ConfigEntry AssemblerOutRate { get; set; } // 组装机产出倍率
+
+ public static ConfigEntry SmelterSpeed { get; set; } // 熔炉速度
+ public static ConfigEntry SmelterOutRate { get; set; } // 熔炉产出倍率
+
+ public static ConfigEntry RefinerySpeed { get; set; } // 精炼厂速度
+ public static ConfigEntry RefineryOutRate { get; set; } // 精炼厂产出倍率
+
+ public static ConfigEntry ChemicalPlantSpeed { get; set; } // 化工厂速度
+ public static ConfigEntry ChemicalPlantOutRate { get; set; } // 化工厂产出倍率
+
+ public static ConfigEntry ParticleColliderSpeed { get; set; } // 粒子对撞机速度
+ public static ConfigEntry ParticleColliderOutRate { get; set; } // 粒子对撞机产出倍率
+
+ public static ConfigEntry ExchangeSpeed { get; set; } // 交易站速度
+ public static ConfigEntry ExchangeOutRate { get; set; } // 交易站产出倍率
+
+ public static ConfigEntry PhotonStoreSpeed { get; set; } // 光子储存速度
+ public static ConfigEntry PhotonStoreOutRate { get; set; } // 光子储存产出倍率
+
+ public static ConfigEntry FractionateSpeed { get; set; } // 分馏塔速度
+ public static ConfigEntry FractionateOutRate { get; set; } // 分馏塔产出倍率
+
+ public static ConfigEntry ResearchSpeed { get; set; } // 研究速度
+ public static ConfigEntry ResearchOutRate { get; set; } // 研究产出倍率
+
+
+ #endregion
+ private MainWindow window;
+
+ #endregion
+
+ public void InitRecipeConfig()
+ {
+ AssemblerSpeed = Config.Bind("配方修改", "AssemblerSpeed", 1);
+ AssemblerOutRate = Config.Bind("配方修改", "AssemblerOutRate", 1);
+ SmelterSpeed = Config.Bind("配方修改", "SmelterSpeed", 1);
+ SmelterOutRate = Config.Bind("配方修改", "SmelterOutRate", 1);
+ RefinerySpeed = Config.Bind("配方修改", "RefinerySpeed", 1);
+ RefineryOutRate = Config.Bind("配方修改", "RefineryOutRate", 1);
+ ChemicalPlantSpeed = Config.Bind("配方修改", "ChemicalPlantSpeed", 1);
+ ChemicalPlantOutRate = Config.Bind("配方修改", "ChemicalPlantOutRate", 1);
+ ParticleColliderSpeed = Config.Bind("配方修改", "ParticleColliderSpeed", 1);
+ ParticleColliderOutRate = Config.Bind("配方修改", "ParticleColliderOutRate", 1);
+ ExchangeSpeed = Config.Bind("配方修改", "ExchangeSpeed", 1);
+ ExchangeOutRate = Config.Bind("配方修改", "ExchangeOutRate", 1);
+ PhotonStoreSpeed = Config.Bind("配方修改", "PhotonStoreSpeed", 1);
+ PhotonStoreOutRate = Config.Bind("配方修改", "PhotonStoreOutRate", 1);
+ FractionateSpeed = Config.Bind("配方修改", "FractionateSpeed", 1);
+ FractionateOutRate = Config.Bind("配方修改", "FractionateOutRate", 1);
+ ResearchSpeed = Config.Bind("配方修改", "ResearchSpeed", 1);
+ ResearchOutRate = Config.Bind("配方修改", "ResearchOutRate", 1);
+
+
+ }
// 注入脚本时会自动调用Start()方法 执行在Awake()方法后面
public void Start()
{
// 允许用户自定义启动快捷键
- ShowCounter = Config.Bind("修改器快捷键", "Key", new BepInEx.Configuration.KeyboardShortcut(KeyCode.F9));
+ ShowCounter = Config.Bind("修改器快捷键", "Key", new KeyboardShortcut(KeyCode.Home));
+
+ // 默认物品叠加倍率
+ ScriptPatch.userCount = Config.Bind("叠加倍率", "count", 1);
+ //ScriptPatch.ItemTweaks(ScriptPatch.userCount.Value);
+
+ InitRecipeConfig();
+ #region[注入游戏补丁]
+ Harmony.CreateAndPatchAll(typeof(ScriptPatch), null);
+ #endregion
+
+
+ window = new MainWindow();
// 日志输出
- Debug.Log("脚本已启动");
+ Debug.Log("修改器启动");
}
public void Update()
{
-
+ // 按下快捷键
+ if (ShowCounter.Value.IsDown())
+ {
+ // 打开修改器
+ MainWindow.optionToggle = !MainWindow.optionToggle;
+ //MainWindow.canvas.SetActive(MainWindow.optionToggle);
+
+ Console.WriteLine("修改器:" + MainWindow.optionToggle);
+ }
}
- }
+ public void OnDestroy()
+ {
+ // 移除 MainWindow.testAssetBundle 加载时的资源
+ //AssetBundle.UnloadAllAssetBundles(true);
+
+ // 销毁
+ if (MainWindow.canvas)
+ {
+ MainWindow.canvas.SetActive(false);
+ Destroy(MainWindow.canvas);
+ MainWindow.canvas = null;
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/Dyson Sphere Program/ScriptTrainer/ScriptTrainer.csproj b/Dyson Sphere Program/ScriptTrainer/ScriptTrainer.csproj
index a0a9c04..034f8a7 100644
--- a/Dyson Sphere Program/ScriptTrainer/ScriptTrainer.csproj
+++ b/Dyson Sphere Program/ScriptTrainer/ScriptTrainer.csproj
@@ -1,112 +1,50 @@
-
-
-
-
- Debug
- AnyCPU
- {6F168460-3C1C-45C2-8A21-6600C8B3CFE4}
- Library
- Properties
- ScriptTrainer
- ScriptTrainer
- v4.5
- 512
- true
-
-
- true
- full
- false
- F:\steam\steamapps\common\Dyson Sphere Program\BepInEx\scripts\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
- ..\..\..\BepInEx\Dyson Sphere Program\Libs\0Harmony.dll
- False
-
-
- ..\..\..\BepInEx\Dyson Sphere Program\Libs\Assembly-CSharp.dll
- False
-
-
- ..\..\..\BepInEx\Dyson Sphere Program\Libs\BepInEx.dll
- False
-
-
- ..\..\..\BepInEx\Dyson Sphere Program\Libs\BepInEx.Harmony.dll
- False
-
-
- ..\..\..\BepInEx\Dyson Sphere Program\Libs\ConfigurationManager.dll
- False
-
-
- False
- ..\..\Libs\netstandard.dll
- False
-
-
-
-
-
-
-
-
-
-
- ..\..\..\BepInEx\Dyson Sphere Program\Libs\UnityEngine.dll
- False
-
-
- ..\..\..\BepInEx\Dyson Sphere Program\Libs\UnityEngine.AssetBundleModule.dll
- False
-
-
- ..\..\..\BepInEx\Dyson Sphere Program\Libs\UnityEngine.CoreModule.dll
- False
-
-
- ..\..\..\BepInEx\Dyson Sphere Program\Libs\UnityEngine.IMGUIModule.dll
- False
-
-
- ..\..\..\BepInEx\Dyson Sphere Program\Libs\UnityEngine.TextRenderingModule.dll
- False
-
-
- ..\..\..\BepInEx\Dyson Sphere Program\Libs\UnityEngine.UI.dll
- False
-
-
- ..\..\..\BepInEx\Dyson Sphere Program\Libs\UnityEngine.UIModule.dll
- False
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ net472
+ ScriptTrainer
+ Script Trainer
+ 2.0.0
+ true
+ latest
+
+ https://api.nuget.org/v3/index.json;
+ https://nuget.bepinex.dev/v3/index.json;
+ https://nuget.samboy.dev/v3/index.json
+
+ ScriptTrainer
+
+
+ prompt
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+ D:\SteamLibrary\steamapps\common\Dyson Sphere Program
+ DSPGAME_Data
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Dyson Sphere Program/ScriptTrainer/UnityGameUI b/Dyson Sphere Program/ScriptTrainer/UnityGameUI
index 3a62dd9..c2ba11a 160000
--- a/Dyson Sphere Program/ScriptTrainer/UnityGameUI
+++ b/Dyson Sphere Program/ScriptTrainer/UnityGameUI
@@ -1 +1 @@
-Subproject commit 3a62dd98a5fdcf9ab6f8c6a2e096e14da0da9634
+Subproject commit c2ba11a988ca0456f52801dd2423131a1afd48f2
diff --git a/Dyson Sphere Program/ScriptTrainer/window/ByWindow.cs b/Dyson Sphere Program/ScriptTrainer/window/ByWindow.cs
new file mode 100644
index 0000000..e8949c3
--- /dev/null
+++ b/Dyson Sphere Program/ScriptTrainer/window/ByWindow.cs
@@ -0,0 +1,62 @@
+using UnityEngine;
+using UnityEngine.UI;
+using UnityGameUI;
+
+namespace ScriptTrainer
+{
+
+
+ internal class ByWindow
+ {
+ #region[UI]
+ // 组件位置
+ private static int initialX { get => 0; }
+ private static int initialY { get => 0; }
+
+ private static int elementX = initialX;
+ private static int elementY = initialY;
+ #endregion
+
+
+
+ // ReSharper disable Unity.PerformanceAnalysis
+ public void init(GameObject canvas)
+ {
+ GameObject By = UIControls.createUIPanel(canvas, "40", "250", null);
+ By.name = "dst-by";
+ By.GetComponent().localPosition = new Vector3(550, -415, 0);
+ By.GetComponent().color = UIControls.HTMLString2Color("#00000000");
+
+ // 作者名称
+ Sprite txtBgSprite = UIControls.createSpriteFrmTexture(UIControls.createDefaultTexture("#7AB900FF"));
+ GameObject uiText = UIControls.createUIText(By, txtBgSprite, "#FFFFFFFF");
+ //uiText.GetComponent().sizeDelta = new Vector2(100, 30);
+ uiText.GetComponent().localPosition = new Vector3(-35, 0, 0);
+ Text text = uiText.GetComponent();
+ text.text = "作者;小莫";
+ text.alignment = TextAnchor.MiddleLeft;
+ text.fontSize = 14;
+
+ // 相关按钮
+ Transform button = Components.createUIButton(By);
+ RectTransform rt = button.GetComponent();
+ rt.localPosition = new Vector3(elementX, elementY + 15, 0);
+ rt.sizeDelta = new Vector2(80, 30); // 设置按钮大小
+ button.GetComponentInChildren().text = "获取更新";
+ button.GetComponent().onClick += (int a) =>
+ {
+ System.Diagnostics.Process.Start("https://mod.3dmgame.com/mod/173023");
+ };
+ Transform button2 = Components.createUIButton(By);
+ RectTransform rt2 = button2.GetComponent();
+ rt2.localPosition = new Vector3(elementX + 90, elementY + 15, 0);
+ rt2.sizeDelta = new Vector2(80, 30); // 设置按钮大小
+ button2.GetComponentInChildren().text = "投喂小莫";
+ button2.GetComponent().onClick += (int a) =>
+ {
+ System.Diagnostics.Process.Start("https://www.aoe.top/donate");
+ };
+
+ }
+ }
+}
diff --git a/Dyson Sphere Program/ScriptTrainer/window/ItemWindow.cs b/Dyson Sphere Program/ScriptTrainer/window/ItemWindow.cs
new file mode 100644
index 0000000..51eaa18
--- /dev/null
+++ b/Dyson Sphere Program/ScriptTrainer/window/ItemWindow.cs
@@ -0,0 +1,250 @@
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.Events;
+using UnityEngine.UI;
+using UnityGameUI;
+
+namespace ScriptTrainer
+{
+ public class ItemWindow
+ {
+ #region[全局参数]
+ public static ItemProto[] dataArray = LDB.items.dataArray; // 物品列表
+ private static List ItemButtons = new List();
+
+
+ // 组件位置
+ private static int initialX { get => -MainWindow.width / 2 + 100 + 60; }
+ private static int initialY { get => MainWindow.height / 2 - 85 - 10; }
+
+ private static int elementX = initialX;
+ private static int elementY = initialY;
+
+ #endregion
+
+ #region[分页相关]
+ private static int page = 1; // 当前页数
+ private static int conunt = 18; // 每页多少个
+ private static int maxPage = 1; // 最大页数
+ private static string search = ""; // 搜索
+
+ private static string uiText_text // 显示文本
+ {
+ get
+ {
+ return $"{page} / {maxPage}";
+ }
+ }
+
+ private static Transform times_value;
+ private static GameObject itemWindow;
+ #endregion
+
+ public ItemWindow(GameObject canvas)
+ {
+
+ itemWindow = UIControls.createUIPanel(canvas, "330", "630");
+ itemWindow.GetComponent().color = UIControls.HTMLString2Color("#00000000");
+ itemWindow.name = "itemWindow";
+
+ AddItem(itemWindow);
+ pageBar(canvas);
+ SearchItem(canvas);
+ }
+
+ // 物品列表
+ public static void AddItem(GameObject canvas)
+ {
+ // 先清空旧的 ItemPanel
+ foreach (var item in ItemButtons)
+ {
+ UnityEngine.Object.Destroy(item);
+ }
+ ItemButtons.Clear();
+
+ ResetCoordinates(true, true);
+
+ int i = 0;
+
+ foreach (var item in GetItemList(search))
+ {
+ i++;
+
+ GameObject btn = createItemButton(canvas, item, () =>
+ {
+ UIWindows.SpawnInputDialog($"您想获取多少个{item.Name}?", "添加", "100", (string count) =>
+ {
+ GameMain.mainPlayer.package.AddItemStacked(item.ID, int.Parse(count), 0, out int remainInc);
+ UIItemup.Up(item.ID, int.Parse(count));
+
+ //KBEngine.Avatar player = Tools.instance.getPlayer(); // 获取玩家
+ //player.addItem(item.itemID, Tools.CreateItemSeid(item.itemID), count.ConvertToIntDef(1));
+ //Singleton.inventory.AddItem(item.itemID);
+ });
+
+
+ });
+
+ ItemButtons.Add(btn);
+
+ // 一行10个
+ if (i % 3 == 0) hr();
+
+ }
+ }
+
+ // 分页按钮
+ public static void pageBar(GameObject canvas)
+ {
+ // 加减按钮
+ Transform count = Components.createCount(canvas);
+ RectTransform rt = count.GetComponent();
+ rt.localPosition = new Vector3(0, -190, 0);
+
+ // times-value 显示值
+ times_value = count.Find("times-value");
+ times_value.GetComponent().text = uiText_text;
+
+ // - 按钮
+ Transform minus = count.Find("-");
+ minus.GetComponent().onClick += (int a) =>
+ {
+ page--;
+ if (page <= 1) page = 1;
+
+ AddItem(itemWindow);
+
+ times_value.GetComponent().text = uiText_text;
+ };
+
+ // + 按钮
+ Transform plus = count.Find("+");
+ plus.GetComponent().onClick += (int a) =>
+ {
+ page++;
+
+ if (page >= maxPage) page = maxPage;
+
+ AddItem(itemWindow);
+
+ times_value.GetComponent().text = uiText_text;
+ };
+
+ }
+
+ // 搜索框
+ public static void SearchItem(GameObject canvas)
+ {
+ // label
+ Sprite txtBgSprite = UIControls.createSpriteFrmTexture(UIControls.createDefaultTexture("#7AB900FF"));
+ GameObject uiText = UIControls.createUIText(canvas, txtBgSprite, "#FFFFFFFF");
+ uiText.GetComponent().text = "搜索";
+ uiText.GetComponent().localPosition = new Vector3(-230, -190, 0);
+ uiText.GetComponent().alignment = TextAnchor.MiddleLeft;
+
+ // 输入框
+ Sprite inputFieldSprite = UIControls.createSpriteFrmTexture(UIControls.createDefaultTexture("#84FFFF06"));
+ GameObject uiInputField = UIControls.createUIInputField(canvas, inputFieldSprite, "#FFFFFFFF");
+ uiInputField.GetComponent().text = search;
+ uiInputField.GetComponent().localPosition = new Vector3(-230 + 30, -190, 0);
+ uiInputField.GetComponent().sizeDelta = new Vector2(150, 30);
+ // 设置输入框边框颜色
+
+
+
+
+ // 文本框失去焦点时触发方法
+ uiInputField.GetComponent().onEndEdit.AddListener((string text) =>
+ {
+ Console.WriteLine(text);
+ page = 1;
+ search = text;
+ AddItem(itemWindow);
+ times_value.GetComponent().text = uiText_text;
+ //Destroy(ItemPanel);
+ });
+ }
+
+
+ // 按钮
+ private static GameObject createItemButton(GameObject canvas, ItemProto item, UnityAction action)
+ {
+ // 创建一个背景
+ GameObject background = UIControls.createUIButton(canvas, "#00000633", "", action);
+ background.GetComponent().localPosition = new Vector3(elementX, elementY, 0);
+ background.GetComponent().sizeDelta = new Vector2(200, 45);
+ background.name = "background";
+
+ // 名称
+ Sprite txtBgSprite = UIControls.createSpriteFrmTexture(UIControls.createDefaultTexture("#7AB900FF"));
+ GameObject uiText = UIControls.createUIText(background, txtBgSprite, "#FFFFFFFF");
+ uiText.GetComponent().text = item.name;
+ uiText.GetComponent().localPosition = new Vector3(0, -10, 0);
+
+ // 图标
+ Sprite BgSprite = item.iconSprite;
+ GameObject button = UIControls.createUIButton(background, "#00000033", "", action);
+ button.GetComponent().sprite = BgSprite;
+ RectTransform rt = button.GetComponent();
+ rt.localPosition = new Vector3(60, 0, 0);
+ rt.sizeDelta = new Vector2(40, 40);
+
+ elementX += 210;
+
+ return background;
+ }
+
+ // 获取物品列表
+ public static List GetItemList(string name = "")
+ {
+ List list = new List();
+
+ foreach (var item in dataArray)
+ {
+ if (name == "")
+ {
+ list.Add(item);
+ }
+ else
+ {
+ // 判断 item.name 是否包含 name
+ if (item.name.Contains(name))
+ {
+ list.Add(item);
+ }
+
+ }
+ }
+
+ // 根据 list 长度 和 conunt 计算页数 并向下取整
+ maxPage = (int)Math.Ceiling((double)list.Count / conunt);
+
+ // 根据 page 和 conunt 进行分页返回
+ int start = (page - 1) * conunt;
+ int end = start + conunt;
+ if (end > list.Count) end = list.Count;
+
+ return list.GetRange(start, end - start);
+
+ }
+
+
+ // 重置坐标
+ public static void ResetCoordinates(bool x, bool y = false)
+ {
+ if (x) elementX = initialX;
+ if (y) elementY = initialY;
+ }
+
+ // 换行
+ public static void hr(int offsetX = 0, int offsetY = 0)
+ {
+ ResetCoordinates(true);
+ elementX += offsetX;
+ elementY -= 50 + offsetY;
+
+ }
+
+ }
+}
diff --git a/Dyson Sphere Program/ScriptTrainer/window/MainWindow.cs b/Dyson Sphere Program/ScriptTrainer/window/MainWindow.cs
new file mode 100644
index 0000000..5b78138
--- /dev/null
+++ b/Dyson Sphere Program/ScriptTrainer/window/MainWindow.cs
@@ -0,0 +1,389 @@
+using System;
+using UnityEngine;
+using UnityEngine.Events;
+using UnityEngine.UI;
+using UnityGameUI;
+using Object = UnityEngine.Object;
+
+namespace ScriptTrainer
+{
+
+ // MonoBehaviour
+ // ManualBehaviour
+ internal class MainWindow : ManualBehaviour
+ {
+ #region 声明变量
+
+ // Trainer Base
+ public static bool initialized = false;
+ public static bool _optionToggle = false;
+
+ // UI
+ public static GameObject canvas = null;
+ public static readonly int width = Mathf.Min(Screen.width, 740);
+ public static readonly int height = (Screen.height < 400) ? Screen.height : (450);
+
+
+
+ // 变量
+ public static Player player = GameMain.mainPlayer;
+ public static GameData gameData;
+
+ // 窗口开关
+ public static bool optionToggle
+ {
+ get => _optionToggle;
+ set
+ {
+ _optionToggle = value;
+
+ gameData = GameMain.data;
+ player = GameMain.mainPlayer;
+
+ if (initialized) canvas.SetActive(optionToggle);
+ else Init();
+ }
+ }
+
+ // 组件位置
+ private static int initialX { get => -width / 2 + 110; }
+ private static int initialY { get => height / 2 - 85; }
+
+ private static int elementX = initialX;
+ private static int elementY = initialY;
+
+ #endregion
+
+ public MainWindow()
+ {
+ Init();
+ }
+
+ private static void Init()
+ {
+ if (initialized)
+ {
+ return;
+ }
+
+ if (!GameMain.instance)
+ {
+ Debug.Log("等待游戏初始化完成");
+ return;
+ }
+
+ Console.WriteLine((bool)GameMain.instance);
+
+
+
+ CreateUI();
+
+ canvas.SetActive(optionToggle);
+ initialized = true;
+ }
+
+
+ // 创建UI
+ // ReSharper disable Unity.PerformanceAnalysis
+ private static void CreateUI()
+ {
+ if (canvas == null)
+ {
+ Debug.Log("开始创建UI");
+
+ canvas = UIControls.createUICanvas();
+ Object.DontDestroyOnLoad(canvas);
+ canvas.name = "ScriptTrainer";
+
+ // 创建背景
+ UIInventoryWindow background = Components.createUIPanel(canvas, "内置修改器", width, height);
+ background.gameObject.name = "background";
+
+ // 关闭按钮 panel-bg/btn-box/close-wnd-btn
+ Transform close_btn = background.transform.Find("panel-bg/btn-box/close-wnd-btn");
+
+ close_btn.GetComponent().onClick += (int i) =>
+ {
+ optionToggle = false;
+ canvas.SetActive(optionToggle);
+ };
+
+
+ #region[基础功能]
+
+ GameObject BasicScripts = UIControls.createUIPanel(background.gameObject, "330", "630", null);
+ BasicScripts.GetComponent().color = UIControls.HTMLString2Color("#00000033");
+ BasicScripts.name = "BasicScripts";
+
+ // ==================== 数值功能 ====================
+ AddCount(BasicScripts, "物品堆叠倍率", ScriptPatch.userCount.Value, (int num) =>
+ {
+ ScriptPatch.ItemTweaks(num);
+ }, 1, 1);
+
+ // AddCount(BasicScripts, "无人机数量", player.mecha.droneCount, (int num) =>
+ // {
+ // player.mecha.droneCount = num;
+
+ // }, 1, 1, 256);
+
+ // AddCount(BasicScripts, "无人机速度", (int)player.mecha.droneSpeed, (int num) =>
+ // {
+ // player.mecha.droneSpeed = num;
+
+ // }, 1, 1, 256);
+
+ hr();
+ AddCount(BasicScripts, "跳跃高度", (int)player.mecha.jumpSpeed, (int num) =>
+ {
+ player.mecha.jumpSpeed = num;
+
+ }, 10, 10);
+ AddCount(BasicScripts, "移动速度", (int)player.mecha.walkSpeed, (int num) =>
+ {
+ player.mecha.walkSpeed = num;
+
+ }, 10, 10);
+
+ AddCount(BasicScripts, "机甲采矿速度", (int)player.mecha.miningSpeed, (int num) =>
+ {
+ player.mecha.miningSpeed = num;
+ }, 1, 1);
+ hr();
+ AddCount(BasicScripts, "机甲制作速度", (int)player.mecha.replicateSpeed, (int num) =>
+ {
+ player.mecha.replicateSpeed = num;
+ }, 1, 1);
+ hr();
+
+ AddCount(BasicScripts, "研究速度", (int)player.mecha.researchPower, (int num) =>
+ {
+ player.mecha.researchPower = num;
+ });
+
+ // ==================== 按钮功能 ====================
+ hr();
+ AddButton(BasicScripts, "解锁所有科技", () =>
+ {
+ TechProto[] techs = LDB.techs.dataArray;
+
+ foreach (var item in techs)
+ {
+ GameMain.history.UnlockTech(item.ID);
+ }
+
+ }, 100);
+
+ AddButton(BasicScripts, "解锁成就", () =>
+ {
+ var a = LDB.achievements.dataArray;
+
+
+ foreach (var item in LDB.achievements.dataArray)
+ {
+ DSPGame.achievementSystem.UnlockAchievement(item.ID);
+ }
+ });
+
+ AddButton(BasicScripts, "解锁里程碑", () =>
+ {
+
+ foreach (var item in LDB.milestones.dataArray)
+ {
+ GameMain.data.milestoneSystem.UnlockMilestone(item.ID, GameMain.gameTick);
+ }
+ });
+
+ #endregion
+
+
+ #region[添加物品]
+ ResetCoordinates(true, true);
+
+ GameObject ItemScripts = UIControls.createUIPanel(background.gameObject, "330", "630", null);
+ ItemScripts.GetComponent().color = UIControls.HTMLString2Color("#00000033");
+ ItemScripts.name = "ItemScripts";
+
+ new ItemWindow(ItemScripts);
+
+
+
+ #endregion
+ #region[修改配方]
+ ResetCoordinates(true, true);
+
+ GameObject RecipeScripts = UIControls.createUIPanel(background.gameObject, "330", "630", null);
+ RecipeScripts.GetComponent().color = UIControls.HTMLString2Color("#00000033");
+ RecipeScripts.name = "RecipeScripts";
+
+ new RecipeWindow(RecipeScripts);
+
+
+
+ #endregion
+
+ #region[创建导航栏]
+
+ DSNavigation dSNavigation = new DSNavigation(background.gameObject);
+ dSNavigation.AddTab("基础功能", BasicScripts, true);
+ dSNavigation.AddTab("添加物品", ItemScripts);
+ dSNavigation.AddTab("配方修改", RecipeScripts);
+ dSNavigation.Create();
+
+ #endregion
+
+ #region[著名]
+ ByWindow by = new ByWindow();
+ by.init(background.gameObject);
+
+
+
+ #endregion
+
+
+ Debug.Log("修改器UI初始化完成");
+ Debug.Log($"使用{ScriptTrainer.ShowCounter.Value}键打开修改器");
+
+ canvas.SetActive(optionToggle);
+ }
+ }
+
+
+
+
+
+
+
+ #region[添加组件]
+ // 创建标题
+ public static GameObject AddTitle(GameObject panel, string Title)
+ {
+
+ Sprite txtBgSprite = UIControls.createSpriteFrmTexture(UIControls.createDefaultTexture("#7AB900FF"));
+ GameObject uiText = UIControls.createUIText(panel, txtBgSprite, "#FFFFFFFF");
+ //uiText.GetComponent().sizeDelta = new Vector2(width - 10, 30);
+ uiText.GetComponent().localPosition = new Vector3(110, -30, 0);
+ Text text = uiText.GetComponent();
+ text.text = Title;
+ text.alignment = TextAnchor.MiddleCenter;
+ text.fontSize = 16;
+ uiText.name = "title-text";
+ return uiText;
+ }
+
+ // 创建按钮
+ public static Transform AddButton(GameObject panel, string text, UnityAction action, int width = 80, int height = 30)
+ {
+ Transform button = Components.createUIButton(panel);
+ RectTransform rt = button.GetComponent();
+
+ rt.localPosition = new Vector3(elementX, elementY, 0);
+ rt.sizeDelta = new Vector2(width, height); // 设置按钮大小
+
+ elementX += width + 10;
+
+
+ button.GetComponentInChildren().text = text;
+ button.GetComponent