From 029e478ed8cad5c9568d95e9810f9437b3c96561 Mon Sep 17 00:00:00 2001 From: Noah Ma <37620986+llNoahll@users.noreply.github.com> Date: Sat, 8 Oct 2022 21:31:27 +0800 Subject: [PATCH 01/31] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A1=80=E9=87=8F?= =?UTF-8?q?=EF=BC=88=E5=81=A5=E5=BA=B7=EF=BC=89=E5=92=8C=E5=A5=BD=E6=84=9F?= =?UTF-8?q?=E5=BA=A6=E7=9A=84=E9=BB=98=E8=AE=A4=E5=80=BC=EF=BC=88100?= =?UTF-8?q?=E5=B2=81=E3=80=81=E4=B8=8D=E6=B8=9D=EF=BC=89=EF=BC=8C=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E4=BF=AE=E6=94=B9=E5=A4=AA=E5=90=BE=E5=92=8CNPC?= =?UTF-8?q?=E7=9A=84=E5=8F=8C=E5=90=91=E5=85=B3=E7=B3=BB=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- The Scroll OfTaiwu/ScriptTrainer/Scripts.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/The Scroll OfTaiwu/ScriptTrainer/Scripts.cs b/The Scroll OfTaiwu/ScriptTrainer/Scripts.cs index f0b036d..182b4bf 100644 --- a/The Scroll OfTaiwu/ScriptTrainer/Scripts.cs +++ b/The Scroll OfTaiwu/ScriptTrainer/Scripts.cs @@ -200,9 +200,9 @@ public static void ChangeAge(int charid = 0) public static void ChangeHp() { - UIWindows.SpawnInputDialog("您想将血量设置为多少?", "设置", "200", (string count) => + UIWindows.SpawnInputDialog("您想将血量设置为多少?", "设置", "1200", (string count) => { - short value = (short) count.ConvertToIntDef(200); + short value = (short) count.ConvertToIntDef(1200); GameDataBridge.AddDataModification(4, 0, (ulong)playerId, 19U, (short)value); GameDataBridge.AddDataModification(4, 0, (ulong)playerId, 20U, (short)value); @@ -322,9 +322,9 @@ public static void GetItem(sbyte itemType, int itemId, int count) // 修改好感度 public static void ChangeFavor(int charId1, int charId2) { - UIWindows.SpawnInputDialog("您想修改好感为多少?", "设置", "6000", (string count) => + UIWindows.SpawnInputDialog("您想修改好感为多少?", "设置", "10000", (string count) => { - GameDataBridge.AddMethodCall(-1, DomainHelper.DomainIds.Character, CharacterDomainHelper.MethodIds.GmCmd_ChangeFavorability, charId1, charId2, (short)count.ConvertToIntDef(6000)); + GameDataBridge.AddMethodCall(-1, DomainHelper.DomainIds.Character, CharacterDomainHelper.MethodIds.GmCmd_ChangeFavorability, charId1, charId2, (short)count.ConvertToIntDef(10000)); //GMFunc.ChangeFavorability(charId1, charId2, (short)count.ConvertToIntDef(18)); }); @@ -364,7 +364,10 @@ public static void Relationship(int charIdA, int charIdB) { GameDataBridge.AddMethodCall(-1, DomainHelper.DomainIds.Character, CharacterDomainHelper.MethodIds.GmCmd_AddRelation, charIdA, charIdB, o_type[call]); }); - + UIWindows.SpawnDropdownDialog($"你想让你成为{charIdB}的什么?", "修改", options, (int call) => + { + GameDataBridge.AddMethodCall(-1, DomainHelper.DomainIds.Character, CharacterDomainHelper.MethodIds.GmCmd_AddRelation, charIdB, charIdA, o_type[call]); + }); } From ab11b96670f87d0ff0d860bdd0a6a2afdda60c0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=8E=AB?= Date: Wed, 15 Feb 2023 10:46:26 +0800 Subject: [PATCH 02/31] =?UTF-8?q?=E5=A4=AA=E5=90=BE=E7=BB=98=E5=8D=B7?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=201.5.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- The Scroll OfTaiwu/README.md | 44 ++++++++++++++++--- .../ScriptTrainer/MainWindow.cs | 4 +- .../ScriptTrainer/ScriptTrainer.cs | 2 +- 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/The Scroll OfTaiwu/README.md b/The Scroll OfTaiwu/README.md index 3d46bf6..5c0620b 100644 --- a/The Scroll OfTaiwu/README.md +++ b/The Scroll OfTaiwu/README.md @@ -5,11 +5,14 @@ 开源地址: https://github.com/GlossMod/UnityScriptTrainer 使用 [UnityGameUI](https://github.com/GlossMod/UnityGameUI) 构建修改器界面。 +现在可以直接到创意工坊订阅安装:https://steamcommunity.com/sharedfiles/filedetails/?id=2871716599 + ### 使用方法 - 将 ScriptTrainer 文件夹解压到游戏目录中的“Mod”文件夹中 +- 目录样子为“Mod/ScriptTrainer/XXX” - 在游戏中启用Mod -- 在游戏中按F9 即可打开修改器菜单 +- 在游戏中按 Home 即可打开修改器菜单 ### 自定义启动按键 在启动Mod的时候,下面有个设置启动快捷键选项,填入正确的键,然后保存即可修改启动快捷键 @@ -26,6 +29,8 @@ | 全部地图全部解锁 - 解锁驻站 | 解锁所有驻站 + - 解锁技艺 + | 一键解锁所有技艺 - 添加资源 | 根据自己的需求添加对应的资源 (会受到资源上限的限制) - 玩家功能 @@ -43,24 +48,53 @@ - 设置NPC与你的关系 - 可邀为同道 | 将NPC的门派设置为太吾村,就不需要好感度也可以直接邀请为同道了 + | 对BOSS用了会爆红,不要对BOSS使用! - 绑架他/她 | 直接将对方绑起来(在你自己身上 - - 与其做爱 + | 可以绑架BOSS,但过月或进行一些互动的时候会报红,不要对BOSS使用 + - 共度春宵 | 有概率让NPC怀孕,如果没结为夫妻的话,孩子不能跟你姓 - - 强迫做爱 - | 有概率让NPC怀孕,并且有概率添加其他负面buff,即使结为夫妻孩子也不能跟你姓 + - 出手重伤 + | 让对方的内伤和外伤全部最高 并给所有毒添加 1000 的中毒效果 + - 治病解读 + | 为对方治疗所有外伤内伤 并 解除所有毒 - 获取物品 - 将物品添加到背包 - 修改地区恩义 - 修改对应地区的恩义(设置100 = 10% 地区恩义,1000 就是100%) +### 常见问题 +问:网盘打开一片空白是怎么回事? +> 网盘前端用vue3写的,不兼容IE等版本过低的浏览器,建议更换[Google Chrome](https://www.google.cn/intl/zh-CN/chrome/)浏览器 + +问:下载不了文件是为什么? +> 把迅雷删了!用浏览器本身下载 + +问:F9打不开修改器怎么回事? +> 可能是跟其他按键冲突了,在Mod设置里面修改一个快捷键再试试 + +问:修改快捷键没反应怎么回事? +> 请输入正确的键值,具体键值可在 [UnityEngine.KeyCode](https://docs.unity3d.com/cn/current/ScriptReference/KeyCode.html) 查看 + +问:修改器的某个功能爆红了怎么办? +> 这个一般是由游戏更新造成的,请将具体是哪个功能爆红了告诉我,我会在看到之后修复。 + +问:有交流群吗? +> 我懒得专门建个群,很久以前倒是有一个,你要是有兴趣可以加进来 558461751 验证问题答案:小莫 + + ### 更新日志 +v1.5.3 +- 很多玩家反应F9会按键冲突, 现已将默认启动键改为 Home +- 修复由于游戏更新导致的部分功能报错问题 + v1.5.2 - 修复游戏更新导致修改器不能用的问题 v1.5.1 -- 修复更改NPC好感度报错的问题 +- 修复了修改NPC好感度报错的问题 +- 修复直接放到mod文件夹无法读取的问题 v1.5 - 上传到Steam创意工坊 方便玩家使用 diff --git a/The Scroll OfTaiwu/ScriptTrainer/MainWindow.cs b/The Scroll OfTaiwu/ScriptTrainer/MainWindow.cs index 21c9096..59b9ab0 100644 --- a/The Scroll OfTaiwu/ScriptTrainer/MainWindow.cs +++ b/The Scroll OfTaiwu/ScriptTrainer/MainWindow.cs @@ -27,7 +27,7 @@ internal class MainWindow : MonoBehaviour public bool initialized = false; public bool _optionToggle = false; private TooltipGUI toolTipComp = null; - public static KeyCode Hot_Key = KeyCode.F9; + public static KeyCode Hot_Key = KeyCode.Home; // UI public AssetBundle testAssetBundle = null; @@ -168,7 +168,7 @@ private void CreateUI() #region[创建标题 和 关闭按钮] - AddTitle("【太吾绘卷】内置修改器 By:小莫 1.5.2"); + AddTitle("【太吾绘卷】内置修改器 By:小莫 1.5.3"); GameObject closeButton = UIControls.createUIButton(uiPanel, "#B71C1CFF", "X", () => { diff --git a/The Scroll OfTaiwu/ScriptTrainer/ScriptTrainer.cs b/The Scroll OfTaiwu/ScriptTrainer/ScriptTrainer.cs index 745f1ce..f651365 100644 --- a/The Scroll OfTaiwu/ScriptTrainer/ScriptTrainer.cs +++ b/The Scroll OfTaiwu/ScriptTrainer/ScriptTrainer.cs @@ -11,7 +11,7 @@ namespace ScriptTrainer { - [PluginConfig("ScriptTrainer", "小莫", "1.0.0")] + [PluginConfig("ScriptTrainer", "小莫", "1.5.3")] public class ScriptTrainer : TaiwuRemakePlugin { //MainWindow mw; From 2635749cfd366f6ec7892cc41b9d2b8f5af7443d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=8E=AB?= Date: Mon, 3 Apr 2023 14:10:48 +0800 Subject: [PATCH 03/31] 1 --- .gitmodules | 9 + MiChangSheng/ScriptTrainer/MainWindow.cs | 91 +- MiChangSheng/ScriptTrainer/ScriptTrainer.cs | 2 +- .../ScriptTrainer/ScriptTrainer.csproj | 2 +- MiChangSheng/ScriptTrainer/Scripts.cs | 19 + .../README.md | 0 .../ScriptTrainer.sln | 0 .../ScriptTrainer/Debug.cs | 0 .../ScriptTrainer/GameDataScript.cs | 0 .../ScriptTrainer/MainWindow.cs | 0 .../ScriptTrainer/MessageBox.cs | 0 .../ScriptTrainer/Properties/AssemblyInfo.cs | 0 .../ScriptTrainer/ScriptPatch.cs | 0 .../ScriptTrainer/ScriptTrainer.cs | 0 .../ScriptTrainer/ScriptTrainer.csproj | 0 .../ScriptWindow/FeatureWindow.cs | 0 .../ScriptTrainer/ScriptWindow/ItemWindow.cs | 0 .../ScriptWindow/MapAreaWindow.cs | 0 .../ScriptTrainer/ScriptWindow/NpcWindow.cs | 0 .../ScriptTrainer/Scripts.cs | 0 .../ScriptTrainer/UnityGameUI/Extensions.cs | 45 + .../ScriptTrainer/UnityGameUI/README.md | 44 + .../ScriptTrainer/UnityGameUI/TooltipGUI.cs | 46 + .../ScriptTrainer/UnityGameUI/UIControls.cs | 825 ++++++++++++++++++ .../ScriptTrainer/UnityGameUI/UINavigation.cs | 95 ++ .../ScriptTrainer/UnityGameUI/UIWindows.cs | 119 +++ .../UnityGameUI/WindowDragHandler.cs | 71 ++ .../ScriptTrainer/main.cs | 0 .../ScriptTrainer/type.cs | 0 The Scroll OfTaiwu/ScriptTrainer/UnityGameUI | 1 - Warm Snow/Debug.cs | 16 + Warm Snow/Main.cs | 74 ++ Warm Snow/MainWindow.cs | 374 ++++++++ Warm Snow/ScriptPatch.cs | 8 + Warm Snow/ScriptTrainer.csproj | 46 + Warm Snow/ScriptTrainer.sln | 25 - .../ScriptTrainer/Properties/AssemblyInfo.cs | 36 - Warm Snow/ScriptTrainer/Script.cs | 82 -- Warm Snow/ScriptTrainer/ScriptTrainer.cs | 473 ---------- Warm Snow/ScriptTrainer/ScriptTrainer.csproj | 110 --- Warm Snow/ScriptTrainer/UI/RayBlocker.cs | 59 -- Warm Snow/ScriptTrainer/UI/XmGUI.cs | 346 -------- Warm Snow/ScriptTrainer/UI/XmUIStyle.cs | 86 -- Warm Snow/ScriptTrainer/UI/window.cs | 110 --- Warm Snow/ScriptTrainer/UI/windowsStat.cs | 76 -- Warm Snow/UnityGameUI | 1 + 46 files changed, 1836 insertions(+), 1455 deletions(-) rename {The Scroll OfTaiwu => The Scroll Of Taiwu}/README.md (100%) rename {The Scroll OfTaiwu => The Scroll Of Taiwu}/ScriptTrainer.sln (100%) rename {The Scroll OfTaiwu => The Scroll Of Taiwu}/ScriptTrainer/Debug.cs (100%) rename {The Scroll OfTaiwu => The Scroll Of Taiwu}/ScriptTrainer/GameDataScript.cs (100%) rename {The Scroll OfTaiwu => The Scroll Of Taiwu}/ScriptTrainer/MainWindow.cs (100%) rename {The Scroll OfTaiwu => The Scroll Of Taiwu}/ScriptTrainer/MessageBox.cs (100%) rename {The Scroll OfTaiwu => The Scroll Of Taiwu}/ScriptTrainer/Properties/AssemblyInfo.cs (100%) rename {The Scroll OfTaiwu => The Scroll Of Taiwu}/ScriptTrainer/ScriptPatch.cs (100%) rename {The Scroll OfTaiwu => The Scroll Of Taiwu}/ScriptTrainer/ScriptTrainer.cs (100%) rename {The Scroll OfTaiwu => The Scroll Of Taiwu}/ScriptTrainer/ScriptTrainer.csproj (100%) rename {The Scroll OfTaiwu => The Scroll Of Taiwu}/ScriptTrainer/ScriptWindow/FeatureWindow.cs (100%) rename {The Scroll OfTaiwu => The Scroll Of Taiwu}/ScriptTrainer/ScriptWindow/ItemWindow.cs (100%) rename {The Scroll OfTaiwu => The Scroll Of Taiwu}/ScriptTrainer/ScriptWindow/MapAreaWindow.cs (100%) rename {The Scroll OfTaiwu => The Scroll Of Taiwu}/ScriptTrainer/ScriptWindow/NpcWindow.cs (100%) rename {The Scroll OfTaiwu => The Scroll Of Taiwu}/ScriptTrainer/Scripts.cs (100%) create mode 100644 The Scroll Of Taiwu/ScriptTrainer/UnityGameUI/Extensions.cs create mode 100644 The Scroll Of Taiwu/ScriptTrainer/UnityGameUI/README.md create mode 100644 The Scroll Of Taiwu/ScriptTrainer/UnityGameUI/TooltipGUI.cs create mode 100644 The Scroll Of Taiwu/ScriptTrainer/UnityGameUI/UIControls.cs create mode 100644 The Scroll Of Taiwu/ScriptTrainer/UnityGameUI/UINavigation.cs create mode 100644 The Scroll Of Taiwu/ScriptTrainer/UnityGameUI/UIWindows.cs create mode 100644 The Scroll Of Taiwu/ScriptTrainer/UnityGameUI/WindowDragHandler.cs rename {The Scroll OfTaiwu => The Scroll Of Taiwu}/ScriptTrainer/main.cs (100%) rename {The Scroll OfTaiwu => The Scroll Of Taiwu}/ScriptTrainer/type.cs (100%) delete mode 160000 The Scroll OfTaiwu/ScriptTrainer/UnityGameUI create mode 100644 Warm Snow/Debug.cs create mode 100644 Warm Snow/Main.cs create mode 100644 Warm Snow/MainWindow.cs create mode 100644 Warm Snow/ScriptPatch.cs create mode 100644 Warm Snow/ScriptTrainer.csproj delete mode 100644 Warm Snow/ScriptTrainer.sln delete mode 100644 Warm Snow/ScriptTrainer/Properties/AssemblyInfo.cs delete mode 100644 Warm Snow/ScriptTrainer/Script.cs delete mode 100644 Warm Snow/ScriptTrainer/ScriptTrainer.cs delete mode 100644 Warm Snow/ScriptTrainer/ScriptTrainer.csproj delete mode 100644 Warm Snow/ScriptTrainer/UI/RayBlocker.cs delete mode 100644 Warm Snow/ScriptTrainer/UI/XmGUI.cs delete mode 100644 Warm Snow/ScriptTrainer/UI/XmUIStyle.cs delete mode 100644 Warm Snow/ScriptTrainer/UI/window.cs delete mode 100644 Warm Snow/ScriptTrainer/UI/windowsStat.cs create mode 160000 Warm Snow/UnityGameUI diff --git a/.gitmodules b/.gitmodules index 8691e72..a5df54a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,12 @@ [submodule "Dyson Sphere Program/ScriptTrainer/UnityGameUI"] path = Dyson Sphere Program/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 diff --git a/MiChangSheng/ScriptTrainer/MainWindow.cs b/MiChangSheng/ScriptTrainer/MainWindow.cs index d76afac..2755c42 100644 --- a/MiChangSheng/ScriptTrainer/MainWindow.cs +++ b/MiChangSheng/ScriptTrainer/MainWindow.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using Steamworks; using UnityEngine; using UnityEngine.Events; using UnityEngine.EventSystems; @@ -11,7 +12,7 @@ namespace ScriptTrainer { - internal class MainWindow: MonoBehaviour + internal class MainWindow : MonoBehaviour { #region[声明] // Trainer Base @@ -21,7 +22,7 @@ internal class MainWindow: MonoBehaviour public static bool _optionToggle = false; private static TooltipGUI toolTipComp = null; public static KBEngine.Avatar player; //获取玩家 - + // UI public static AssetBundle testAssetBundle = null; public static GameObject canvas = null; @@ -37,7 +38,7 @@ public static bool optionToggle set { _optionToggle = value; - + player = Tools.instance.getPlayer(); // 获取玩家 NpcWindow.RefreshNpcData(); // 刷新获取Npc @@ -63,12 +64,12 @@ private static int initialY return height / 2 - 60; } } - + private static int elementX = initialX; private static int elementY = initialY; #endregion - + public MainWindow() { @@ -80,27 +81,11 @@ public static void Initialize() #region[初始化资源] if (testAssetBundle == null) { - // if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\AssetBundles\\testassetbundle")) - // { - // testAssetBundle = AssetBundle.LoadFromFile(AppDomain.CurrentDomain.BaseDirectory + "\\AssetBundles\\testassetbundle"); - // if (testAssetBundle == null) - // { - // Debug.Log("AssetBundle 加载失败"); - // return; - // } - // // 输出 资源名称 - // foreach (var asset in testAssetBundle.GetAllAssetNames()) - // { - // Debug.Log(" Asset Name: " + asset.ToString()); - // } - - // Debug.Log("完成"); - // } - // else - // { - // Debug.LogWarning("跳过 AssetBundle 加载 - testassetBundle 不存在于:" + AppDomain.CurrentDomain.BaseDirectory + "\\AssetBundles\\testassetbundle"); - // Debug.LogWarning("请确保“AssetBundles”文件夹已放入游戏根目录"); - // } + + // 获取当前steam登录的用户 + // CSteamID steamID = SteamUser.GetSteamID(); + + } #endregion @@ -122,8 +107,8 @@ private void CreateUI() initialized = false; return; } - - + + if (canvas == null && player != null) { @@ -149,7 +134,7 @@ private void CreateUI() //entry1.eventID = EventTriggerType.Drag; ////entry1.callback.AddListener((data) => { OnDrag((PointerEventData)data); }); //comp1.triggers.Add(entry1); - + //EventTrigger comp1 = background.AddComponent(); //WindowDragHandler comp2 = background.AddComponent(); @@ -195,6 +180,14 @@ private void CreateUI() { Scripts.AddSeaShengWang(); }); + //AddButton("龙族声望", BasicScripts, () => + //{ + // 无效 + // Scripts.AddDragonShengWang(); + //}); + } + hr(10); + { AddButton("添加修为", BasicScripts, () => { Scripts.AddExp(); @@ -213,12 +206,12 @@ private void CreateUI() { AddButton("抽1张卡", BasicScripts, () => { - + RoundManager.instance.DrawCard(player); }); AddButton("抽3张卡", BasicScripts, () => { - + for (int i = 0; i < 3; i++) { RoundManager.instance.DrawCard(player); @@ -226,7 +219,7 @@ private void CreateUI() }); AddButton("3张相同卡", BasicScripts, () => { - + int a = UnityEngine.Random.Range(0, 4); for (int i = 0; i < 3; i++) { @@ -252,10 +245,10 @@ private void CreateUI() { RoundManager.instance.DrawCard(player, item.CardID); } - }); + }); } } - + #endregion #region[玩家属性] @@ -266,7 +259,7 @@ private void CreateUI() AddH3("玩家属性:", PlayerAttributes); { - + AddInputField("年龄", 150, player.age.ToString(), PlayerAttributes, (string text) => { player.age = (uint)text.ConvertToIntDef(16); @@ -290,7 +283,7 @@ private void CreateUI() } hr(10); { - + AddInputField("悟性", 150, player.wuXin.ToString(), PlayerAttributes, (string text) => { player.wuXin = (uint)text.ConvertToIntDef(100); @@ -329,10 +322,10 @@ private void CreateUI() player.HP_Max = text.ConvertToIntDef(1000); player.HP = player.HP_Max; Debug.Log("最大生命值已修改为" + player.HP_Max); - }); + }); } hr(); - AddH3("灵根属性:",PlayerAttributes); + AddH3("灵根属性:", PlayerAttributes); { //string[] LingGengList = { "金", "木", "水", "火", "土" }; LingGeng[] LingGengList = @@ -358,7 +351,7 @@ private void CreateUI() } } - hr(); + hr(); #endregion @@ -391,7 +384,7 @@ private void CreateUI() }); } { - List ChengHao = new List { "无"}; + List ChengHao = new List { "无" }; foreach (var item in jsonData.instance.ChengHaoJsonData.list) { ChengHao.Add(item["Name"].Str); @@ -410,7 +403,7 @@ private void CreateUI() */ PlayerEx.SetShiLiChengHaoLevel(1, chengHaoLevel); // 设置ID后会自动修改宗门每月俸禄 - player.SetChengHaoId(chengHaoLevel); + player.SetChengHaoId(chengHaoLevel); Debug.Log("职位已修改为" + PlayerEx.GetMenPaiChengHao()); }); @@ -453,7 +446,7 @@ private void CreateUI() num++; // 一行4个 - if (num%4 == 0) + if (num % 4 == 0) { hr(10); } @@ -486,7 +479,7 @@ private void CreateUI() Debug.Pop($"已设置{item["name"].Str}悟道为最高"); }); num++; - if(num%6 == 0) + if (num % 6 == 0) { hr(10); } @@ -512,7 +505,7 @@ private void CreateUI() GameObject NpcScripts = UIControls.createUIPanel(uiPanel, "410", "600", null); NpcScripts.GetComponent().color = UIControls.HTMLString2Color("#424242FF"); NpcScripts.GetComponent().anchoredPosition = new Vector2(-70, -20); - + NpcWindow npcWindow = new NpcWindow(NpcScripts, elementX, elementY); #endregion @@ -521,7 +514,7 @@ private void CreateUI() // 分割线 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); + DividingLine.GetComponent().anchoredPosition = new Vector3(width / 2 - 200 + 80, -20, 0); //// 按钮 GameObject NavPanel = UIControls.createUIPanel(uiPanel, (height - 40).ToString(), "40", null); @@ -579,8 +572,8 @@ public static GameObject AddTitle(string Title) return uiText; } - - public static GameObject AddButton(string Text,GameObject panel, UnityAction action) + + public static GameObject AddButton(string Text, GameObject panel, UnityAction action) { string backgroundColor = "#8C9EFFFF"; Vector3 localPosition = new Vector3(elementX, elementY, 0); @@ -675,7 +668,7 @@ public GameObject AddDropdown(string Text, int width, List options, Game 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"); + 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(elementX, elementY, 0); @@ -712,7 +705,7 @@ public void hr(int offsetX = 0, int offsetY = 0) ResetCoordinates(true); elementX += offsetX; elementY -= 50 + offsetY; - + } // 重置坐标 public void ResetCoordinates(bool x, bool y = false) diff --git a/MiChangSheng/ScriptTrainer/ScriptTrainer.cs b/MiChangSheng/ScriptTrainer/ScriptTrainer.cs index 17763e0..83b73ff 100644 --- a/MiChangSheng/ScriptTrainer/ScriptTrainer.cs +++ b/MiChangSheng/ScriptTrainer/ScriptTrainer.cs @@ -28,7 +28,7 @@ public void Start() //Harmony.CreateAndPatchAll(typeof(UnityGameUI.WindowDragHandler), null); #endregion - ShowCounter = Config.Bind("修改器快捷键", "Key", new KeyboardShortcut(KeyCode.F9)); + ShowCounter = Config.Bind("修改器快捷键", "Key", new KeyboardShortcut(KeyCode.Home)); log.LogMessage("脚本已启动"); } diff --git a/MiChangSheng/ScriptTrainer/ScriptTrainer.csproj b/MiChangSheng/ScriptTrainer/ScriptTrainer.csproj index ce933be..c1df994 100644 --- a/MiChangSheng/ScriptTrainer/ScriptTrainer.csproj +++ b/MiChangSheng/ScriptTrainer/ScriptTrainer.csproj @@ -17,7 +17,7 @@ true full false - F:\steam\steamapps\common\觅长生\本地Mod测试\ScriptTrainer\plugins\ + F:\steam\steamapps\workshop\content\1189490\2824349934\BepInEx\scripts\ DEBUG;TRACE prompt 4 diff --git a/MiChangSheng/ScriptTrainer/Scripts.cs b/MiChangSheng/ScriptTrainer/Scripts.cs index 3a3f06b..8e4ea13 100644 --- a/MiChangSheng/ScriptTrainer/Scripts.cs +++ b/MiChangSheng/ScriptTrainer/Scripts.cs @@ -67,6 +67,25 @@ public static void AddSeaShengWang() } }); } + public static void AddDragonShengWang() + { + UIWindows.SpawnInputDialog("您想添加多少龙族声望?", "添加", "100", (string money) => + { + KBEngine.Avatar player = Tools.instance.getPlayer(); + if (player != null) + { + int n = money.ConvertToIntDef(100); + //PlayerEx.AddSeaShengWang(n); + PlayerEx.AddNingZhouShengWang(n); // 修改无效 + + UIPopTip.Inst.Pop(string.Format("龙族声望{0}了{1}", n > 0 ? "增加" : "减少", money), n > 0 ? PopTipIconType.上箭头 : PopTipIconType.下箭头); + } + else + { + Debug.Log("玩家不存在"); + } + }); + } public static void AddExp() { diff --git a/The Scroll OfTaiwu/README.md b/The Scroll Of Taiwu/README.md similarity index 100% rename from The Scroll OfTaiwu/README.md rename to The Scroll Of Taiwu/README.md diff --git a/The Scroll OfTaiwu/ScriptTrainer.sln b/The Scroll Of Taiwu/ScriptTrainer.sln similarity index 100% rename from The Scroll OfTaiwu/ScriptTrainer.sln rename to The Scroll Of Taiwu/ScriptTrainer.sln diff --git a/The Scroll OfTaiwu/ScriptTrainer/Debug.cs b/The Scroll Of Taiwu/ScriptTrainer/Debug.cs similarity index 100% rename from The Scroll OfTaiwu/ScriptTrainer/Debug.cs rename to The Scroll Of Taiwu/ScriptTrainer/Debug.cs diff --git a/The Scroll OfTaiwu/ScriptTrainer/GameDataScript.cs b/The Scroll Of Taiwu/ScriptTrainer/GameDataScript.cs similarity index 100% rename from The Scroll OfTaiwu/ScriptTrainer/GameDataScript.cs rename to The Scroll Of Taiwu/ScriptTrainer/GameDataScript.cs diff --git a/The Scroll OfTaiwu/ScriptTrainer/MainWindow.cs b/The Scroll Of Taiwu/ScriptTrainer/MainWindow.cs similarity index 100% rename from The Scroll OfTaiwu/ScriptTrainer/MainWindow.cs rename to The Scroll Of Taiwu/ScriptTrainer/MainWindow.cs diff --git a/The Scroll OfTaiwu/ScriptTrainer/MessageBox.cs b/The Scroll Of Taiwu/ScriptTrainer/MessageBox.cs similarity index 100% rename from The Scroll OfTaiwu/ScriptTrainer/MessageBox.cs rename to The Scroll Of Taiwu/ScriptTrainer/MessageBox.cs diff --git a/The Scroll OfTaiwu/ScriptTrainer/Properties/AssemblyInfo.cs b/The Scroll Of Taiwu/ScriptTrainer/Properties/AssemblyInfo.cs similarity index 100% rename from The Scroll OfTaiwu/ScriptTrainer/Properties/AssemblyInfo.cs rename to The Scroll Of Taiwu/ScriptTrainer/Properties/AssemblyInfo.cs diff --git a/The Scroll OfTaiwu/ScriptTrainer/ScriptPatch.cs b/The Scroll Of Taiwu/ScriptTrainer/ScriptPatch.cs similarity index 100% rename from The Scroll OfTaiwu/ScriptTrainer/ScriptPatch.cs rename to The Scroll Of Taiwu/ScriptTrainer/ScriptPatch.cs diff --git a/The Scroll OfTaiwu/ScriptTrainer/ScriptTrainer.cs b/The Scroll Of Taiwu/ScriptTrainer/ScriptTrainer.cs similarity index 100% rename from The Scroll OfTaiwu/ScriptTrainer/ScriptTrainer.cs rename to The Scroll Of Taiwu/ScriptTrainer/ScriptTrainer.cs diff --git a/The Scroll OfTaiwu/ScriptTrainer/ScriptTrainer.csproj b/The Scroll Of Taiwu/ScriptTrainer/ScriptTrainer.csproj similarity index 100% rename from The Scroll OfTaiwu/ScriptTrainer/ScriptTrainer.csproj rename to The Scroll Of Taiwu/ScriptTrainer/ScriptTrainer.csproj diff --git a/The Scroll OfTaiwu/ScriptTrainer/ScriptWindow/FeatureWindow.cs b/The Scroll Of Taiwu/ScriptTrainer/ScriptWindow/FeatureWindow.cs similarity index 100% rename from The Scroll OfTaiwu/ScriptTrainer/ScriptWindow/FeatureWindow.cs rename to The Scroll Of Taiwu/ScriptTrainer/ScriptWindow/FeatureWindow.cs diff --git a/The Scroll OfTaiwu/ScriptTrainer/ScriptWindow/ItemWindow.cs b/The Scroll Of Taiwu/ScriptTrainer/ScriptWindow/ItemWindow.cs similarity index 100% rename from The Scroll OfTaiwu/ScriptTrainer/ScriptWindow/ItemWindow.cs rename to The Scroll Of Taiwu/ScriptTrainer/ScriptWindow/ItemWindow.cs diff --git a/The Scroll OfTaiwu/ScriptTrainer/ScriptWindow/MapAreaWindow.cs b/The Scroll Of Taiwu/ScriptTrainer/ScriptWindow/MapAreaWindow.cs similarity index 100% rename from The Scroll OfTaiwu/ScriptTrainer/ScriptWindow/MapAreaWindow.cs rename to The Scroll Of Taiwu/ScriptTrainer/ScriptWindow/MapAreaWindow.cs diff --git a/The Scroll OfTaiwu/ScriptTrainer/ScriptWindow/NpcWindow.cs b/The Scroll Of Taiwu/ScriptTrainer/ScriptWindow/NpcWindow.cs similarity index 100% rename from The Scroll OfTaiwu/ScriptTrainer/ScriptWindow/NpcWindow.cs rename to The Scroll Of Taiwu/ScriptTrainer/ScriptWindow/NpcWindow.cs diff --git a/The Scroll OfTaiwu/ScriptTrainer/Scripts.cs b/The Scroll Of Taiwu/ScriptTrainer/Scripts.cs similarity index 100% rename from The Scroll OfTaiwu/ScriptTrainer/Scripts.cs rename to The Scroll Of Taiwu/ScriptTrainer/Scripts.cs diff --git a/The Scroll Of Taiwu/ScriptTrainer/UnityGameUI/Extensions.cs b/The Scroll Of Taiwu/ScriptTrainer/UnityGameUI/Extensions.cs new file mode 100644 index 0000000..7bd6cbd --- /dev/null +++ b/The Scroll Of Taiwu/ScriptTrainer/UnityGameUI/Extensions.cs @@ -0,0 +1,45 @@ +using System; +using UnityEngine; +using UnityEngine.UI; +using Object = UnityEngine.Object; + +namespace UnityGameUI +{ + internal delegate bool d_LoadImage(IntPtr tex, IntPtr data, bool markNonReadable); + internal delegate bool parseHTMLString(IntPtr HTMLString, IntPtr result); + + internal static class Extensions + { + // Load Image ICall + + // Convert Hex string to Color32 + public static Color32 HexToColor(this string hexString) + { + string tmp = hexString; + + if (tmp.IndexOf('#') != -1) + tmp = tmp.Replace("#", ""); + + byte r = 0, g = 0, b = 0, a = 0; + + r = Convert.ToByte(tmp.Substring(0, 2), 16); + g = Convert.ToByte(tmp.Substring(2, 2), 16); + b = Convert.ToByte(tmp.Substring(4, 2), 16); + if (tmp.Length == 8) + a = Convert.ToByte(tmp.Substring(6, 2), 16); + + return new Color32(r, g, b, a); + } + + public static int ConvertToIntDef(this string input, int defaultValue) + { + int result; + if (int.TryParse(input, out result)) + { + return result; + } + return defaultValue; + } + + } +} diff --git a/The Scroll Of Taiwu/ScriptTrainer/UnityGameUI/README.md b/The Scroll Of Taiwu/ScriptTrainer/UnityGameUI/README.md new file mode 100644 index 0000000..9a37830 --- /dev/null +++ b/The Scroll Of Taiwu/ScriptTrainer/UnityGameUI/README.md @@ -0,0 +1,44 @@ +# UnityGameUI + +使用 GameObject 构建的一个开源UI库 + +目前还有些不完善的第一方还请见谅 + +### 使用方法: +将本项目以子模块的形式添加到您的项目 +然后 `using UnityGameUI` + +### 例子: +```csharp +private void CreateUI() +{ + int width = Mathf.Min(Screen.width, 740); + int height = (Screen.height < 400) ? Screen.height : (450); + // 以父级画布中心点为0, 0 + // 让按钮放在左上角则需要设置为 -width / 2, height / 2 + // 再根据按钮的宽度和高度进行偏移 + int elementX = -width / 2 + 120; + int elementY = height / 2 - 60; + + GameObject canvas = UIControls.createUICanvas(); + GameObject uiPanel = UIControls.createUIPanel(canvas, height.ToString(), width.ToString(), null); // 宽高以字符串的新式传入 + uiPanel.GetComponent().color = UIControls.HTMLString2Color("#424242FF"); // 设置背景颜色 + + // 创建按钮 + string backgroundColor = "#8C9EFFFF"; + Vector3 localPosition = new Vector3(elementX, elementY, 0); + GameObject button = UIControls.createUIButton(uiPanel, backgroundColor, "按钮1", btn1OnClick, 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); // 设置按钮大小 +} + +private void btn1OnClick() +{ + Debug.Log("按钮1点击"); +} +``` + +更多例子可以查看 https://github.com/GlossMod/UnityScriptTrainer \ No newline at end of file diff --git a/The Scroll Of Taiwu/ScriptTrainer/UnityGameUI/TooltipGUI.cs b/The Scroll Of Taiwu/ScriptTrainer/UnityGameUI/TooltipGUI.cs new file mode 100644 index 0000000..f177b72 --- /dev/null +++ b/The Scroll Of Taiwu/ScriptTrainer/UnityGameUI/TooltipGUI.cs @@ -0,0 +1,46 @@ + +using System; +using UnityEngine; + +namespace UnityGameUI +{ + internal class TooltipGUI : MonoBehaviour + { + public static TooltipGUI instance = null; + public static bool EnableTooltip = true; + public static string Tooltip = ""; + private static GUIStyle tooltipStyle; + private static bool fired = false; // 调试信息 + + public TooltipGUI() + { + //BepInExLoader.log.LogMessage("TooltipGUI Loaded"); + instance = this; + } + + public void OnGUI() + { + if (!fired) + { + Debug.Log("TooltipGUI OnGUI Fired"); + fired = true; + } + + if (Tooltip != "" && EnableTooltip == true) + { + GUI.backgroundColor = Color.black; + GUIContent content = new GUIContent(Tooltip); + + tooltipStyle = new GUIStyle(GUI.skin.box); + tooltipStyle.normal.textColor = Color.white; + + float width = tooltipStyle.CalcSize(content).x; + float height = tooltipStyle.CalcSize(content).y; + + var mousepos = UnityEngine.Input.mousePosition; + //var mousepos = EventSystem.current.currentInputModule.input.mousePosition; // Instead of Input.mousePosition + GUI.Box(new Rect(mousepos.x + 15, Screen.height - mousepos.y + 15, width, 25), content, tooltipStyle); // The +15 are cursor offsets + } + } + } +} diff --git a/The Scroll Of Taiwu/ScriptTrainer/UnityGameUI/UIControls.cs b/The Scroll Of Taiwu/ScriptTrainer/UnityGameUI/UIControls.cs new file mode 100644 index 0000000..5388250 --- /dev/null +++ b/The Scroll Of Taiwu/ScriptTrainer/UnityGameUI/UIControls.cs @@ -0,0 +1,825 @@ + +using System; +using System.Collections.Generic; +using System.IO; +using UnityEngine; +using UnityEngine.Events; +using UnityEngine.UI; +using Object = UnityEngine.Object; + +namespace UnityGameUI +{ + // UI 控件 + internal class UIControls : MonoBehaviour + { + #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 UIControls() + { + + } + + #region[元素] + + // 创建根元素 + private static GameObject CreateUIElementRoot(string name, Vector2 size) + { + GameObject gameObject = new GameObject(name); + RectTransform rectTransform = gameObject.AddComponent(); + rectTransform.sizeDelta = size; + return gameObject; + } + + // 创建UI对象 + private static GameObject CreateUIObject(string name, GameObject parent) + { + GameObject gameObject = new GameObject(name); + gameObject.AddComponent(); + UIControls.SetParentAndAlign(gameObject, parent); + return gameObject; + } + + // 设置默认文本 + private static void SetDefaultTextValues(Text lbl) + { + lbl.color = UIControls.s_TextColor; + //lbl.AssignDefaultFont(); + //lbl.FontTextureChanged(); + lbl.font = (Font)UnityEngine.Resources.GetBuiltinResource("Arial.ttf"); + // 设置字体为宋体 + //lbl.font = (Font)UnityEngine.Resources.GetBuiltinResource("simkai.ttf"); + } + + // 设置默认颜色过度值 + private static void SetDefaultColorTransitionValues(Selectable slider) + { + ColorBlock colors = slider.colors; + colors.highlightedColor = new Color(0.882f, 0.882f, 0.882f); + colors.pressedColor = new Color(0.698f, 0.698f, 0.698f); + colors.disabledColor = new Color(0.521f, 0.521f, 0.521f); + } + + // 设置父级对其 + private static void SetParentAndAlign(GameObject child, GameObject parent) + { + if (!(parent == null)) + { + child.transform.SetParent(parent.transform, false); + UIControls.SetLayerRecursively(child, parent.layer); + } + } + + // 递归设置层 + private static void SetLayerRecursively(GameObject go, int layer) + { + go.layer = layer; + Transform transform = go.transform; + for (int i = 0; i < transform.childCount; i++) + { + UIControls.SetLayerRecursively(transform.GetChild(i).gameObject, layer); + } + } + + // 创建面板 + public static GameObject CreatePanel(UIControls.Resources resources) + { + GameObject gameObject = UIControls.CreateUIElementRoot("Panel", UIControls.s_ThickElementSize); + RectTransform component = gameObject.GetComponent(); + component.anchorMin = Vector2.zero; + component.anchorMax = Vector2.one; + component.anchoredPosition = Vector2.zero; + component.sizeDelta = Vector2.zero; + Image image = gameObject.AddComponent(); + image.sprite = resources.background; + image.type = Image.Type.Sliced; + image.color = UIControls.s_PanelColor; + return gameObject; + } + + // 创建按钮 + public static GameObject CreateButton(UIControls.Resources resources, string Text) + { + GameObject gameObject = UIControls.CreateUIElementRoot("Button", UIControls.s_ThickElementSize); + GameObject gameObject2 = new GameObject("Text"); + gameObject2.AddComponent(); + UIControls.SetParentAndAlign(gameObject2, gameObject); + Image image = gameObject.AddComponent(); + image.sprite = resources.standard; + image.type = Image.Type.Sliced; + image.color = UIControls.s_DefaultSelectableColor; + Button defaultColorTransitionValues = gameObject.AddComponent