1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-09 11:33:33 +08:00

some fixes

This commit is contained in:
2023-10-12 17:20:30 +08:00
parent efa50e4bc2
commit 29a6e00417
8 changed files with 81 additions and 37 deletions

View File

@@ -1,5 +1,4 @@
using BepInEx; using BepInEx;
using UXAssist.Common;
namespace CheatEnabler; namespace CheatEnabler;

View File

@@ -9,6 +9,8 @@
* 2.3.0 * 2.3.0
+ Move some functions to an individual mod: [UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist) + Move some functions to an individual mod: [UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist)
+ Depends on [UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist) now, so that config panel is unified with UXAssist. + Depends on [UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist) now, so that config panel is unified with UXAssist.
+ Remove `LCtrl+A` from Dev Shortcuts, to avoid misoperation.
+ Infinite bots/drones/vessels in `Architect mode` now.
* 2.2.7 * 2.2.7
+ New function: `Construct only nodes but frames` + New function: `Construct only nodes but frames`
+ Opening config panel does not close inventory panel now + Opening config panel does not close inventory panel now
@@ -100,6 +102,8 @@
* 2.3.0 * 2.3.0
+ 将部分功能移动到单独的mod[UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist) + 将部分功能移动到单独的mod[UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist)
+ 现在依赖[UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist)因此配置面板与UXAssist合并 + 现在依赖[UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist)因此配置面板与UXAssist合并
+ 从开发模式快捷键中移除`LCtrl+A`,以避免误操作
+ 现在`建筑师模式`中配送机/物流机/物流船也无限了
* 2.2.7 * 2.2.7
+ 新功能:`只建造节点不建造框架` + 新功能:`只建造节点不建造框架`
+ 打开设置面板时不再关闭背包面板 + 打开设置面板时不再关闭背包面板

View File

@@ -1,6 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection.Emit; using System.Reflection.Emit;
using System.Threading;
using BepInEx.Configuration; using BepInEx.Configuration;
using HarmonyLib; using HarmonyLib;

View File

@@ -4,6 +4,9 @@
#### 一些提升用户体验的功能和补丁 #### 一些提升用户体验的功能和补丁
## Changlog ## Changlog
* 1.0.1
+ Fix config button text and tips while returning to title menu.
+ Add a patch to fix the bug that warning popup on `Veins Utilization` upgraded to level 8000+
* 1.0.0 * 1.0.0
+ Initial release + Initial release
+ Functions moved from [MechaDronesTweaks](https://dsp.thunderstore.io/package/soarqin/MechaDronesTweaks/) and [CheatEnabler](https://dsp.thunderstore.io/package/soarqin/CheatEnabler/) + Functions moved from [MechaDronesTweaks](https://dsp.thunderstore.io/package/soarqin/MechaDronesTweaks/) and [CheatEnabler](https://dsp.thunderstore.io/package/soarqin/CheatEnabler/)
@@ -12,8 +15,10 @@
* Press `` LAlt+`(BackQuote) `` to call up the config panel. You can change the shortcut on the panel. * Press `` LAlt+`(BackQuote) `` to call up the config panel. You can change the shortcut on the panel.
* There are also buttons on title screen and planet minimap area to call up the config panel. * There are also buttons on title screen and planet minimap area to call up the config panel.
* Features: * Patches:
+ Strict hotkey dectection for build menu, thus building hotkeys(0~9, F1~F10, X, U) are not triggered while holding Ctrl/Alt/Shift. + Strict hotkey dectection for build menu, thus building hotkeys(0~9, F1~F10, X, U) are not triggered while holding Ctrl/Alt/Shift.
+ Fix a bug that warning popup on `Veins Utilization` upgraded to level 8000+
* Features:
+ Unlimited interactive range + Unlimited interactive range
+ Sunlight at night + Sunlight at night
+ Remove some build conditions + Remove some build conditions
@@ -40,6 +45,8 @@
* [LSTM](https://github.com/hetima/DSP_LSTM) & [PlanetFinder](https://github.com/hetima/DSP_PlanetFinder): UI implementations * [LSTM](https://github.com/hetima/DSP_LSTM) & [PlanetFinder](https://github.com/hetima/DSP_PlanetFinder): UI implementations
## 更新日志 ## 更新日志
* 1.0.1
+ 修复了返回标题界面后设置按钮文本和提示信息不正确的问题
* 1.0.0 * 1.0.0
+ 初始版本 + 初始版本
+ 从[MechaDronesTweaks](https://dsp.thunderstore.io/package/soarqin/MechaDronesTweaks/)和[CheatEnabler](https://dsp.thunderstore.io/package/soarqin/CheatEnabler/)移动了部分功能过来 + 从[MechaDronesTweaks](https://dsp.thunderstore.io/package/soarqin/MechaDronesTweaks/)和[CheatEnabler](https://dsp.thunderstore.io/package/soarqin/CheatEnabler/)移动了部分功能过来
@@ -48,8 +55,10 @@
* 按 `` 左Alt+`(反引号) `` 键呼出主面板,可以在面板上修改快捷键。 * 按 `` 左Alt+`(反引号) `` 键呼出主面板,可以在面板上修改快捷键。
* 标题界面和行星小地图旁也有按钮呼出主面板。 * 标题界面和行星小地图旁也有按钮呼出主面板。
* 功能 * 补丁
+ 更严格的建造菜单热键检测因此在按住Ctrl/Alt/Shift时不再会触发建造热键(0~9, F1~F10, X, U) + 更严格的建造菜单热键检测因此在按住Ctrl/Alt/Shift时不再会触发建造热键(0~9, F1~F10, X, U)
+ 修复了`矿物利用`升级到8000级以上时弹出警告的bug
* 功能:
+ 无限交互距离 + 无限交互距离
+ 夜间日光灯 + 夜间日光灯
+ 移除部分不影响游戏逻辑的建造条件 + 移除部分不影响游戏逻辑的建造条件

View File

@@ -4,7 +4,6 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.Events; using UnityEngine.Events;
using UnityEngine.UI; using UnityEngine.UI;
using Object = UnityEngine.Object;
namespace UXAssist.UI; namespace UXAssist.UI;
@@ -305,15 +304,27 @@ public static class MyWindowManager
{ {
private static readonly List<ManualBehaviour> Windows = new(4); private static readonly List<ManualBehaviour> Windows = new(4);
private static bool _initialized; private static bool _initialized;
private static Harmony _patch;
public static void Init()
{
_patch ??= Harmony.CreateAndPatchAll(typeof(Patch));
}
public static void Uninit()
{
_patch?.UnpatchSelf();
_patch = null;
}
public static T CreateWindow<T>(string name, string title = "") where T : MyWindow public static T CreateWindow<T>(string name, string title = "") where T : MyWindow
{ {
var srcWin = UIRoot.instance.uiGame.tankWindow; var srcWin = UIRoot.instance.uiGame.tankWindow;
var src = srcWin.gameObject; var src = srcWin.gameObject;
var go = Object.Instantiate(src, UIRoot.instance.uiGame.transform.parent); var go = GameObject.Instantiate(src, UIRoot.instance.uiGame.transform.parent);
go.name = name; go.name = name;
go.SetActive(false); go.SetActive(false);
Object.Destroy(go.GetComponent<UITankWindow>()); GameObject.Destroy(go.GetComponent<UITankWindow>());
var win = go.AddComponent<T>() as MyWindow; var win = go.AddComponent<T>() as MyWindow;
if (win == null) if (win == null)
return null; return null;
@@ -332,7 +343,7 @@ public static class MyWindowManager
} }
else if (child.name != "shadow" && child.name != "panel-bg") else if (child.name != "shadow" && child.name != "panel-bg")
{ {
Object.Destroy(child); GameObject.Destroy(child);
} }
} }

View File

@@ -17,12 +17,9 @@ public class UXAssist : BaseUnityPlugin
BepInEx.Logging.Logger.CreateLogSource(PluginInfo.PLUGIN_NAME); BepInEx.Logging.Logger.CreateLogSource(PluginInfo.PLUGIN_NAME);
public static ConfigEntry<KeyboardShortcut> Hotkey; public static ConfigEntry<KeyboardShortcut> Hotkey;
private static bool _configWinInitialized = false; private static bool _configWinInitialized;
private static MyConfigWindow _configWin; private static MyConfigWindow _configWin;
private static Harmony _windowPatch;
private static Harmony _patch; private static Harmony _patch;
private static bool _initialized; private static bool _initialized;
private void Awake() private void Awake()
@@ -54,9 +51,9 @@ public class UXAssist : BaseUnityPlugin
I18N.Apply(); I18N.Apply();
// UI Patch // UI Patch
_windowPatch ??= Harmony.CreateAndPatchAll(typeof(UI.MyWindowManager.Patch));
_patch ??= Harmony.CreateAndPatchAll(typeof(UXAssist)); _patch ??= Harmony.CreateAndPatchAll(typeof(UXAssist));
MyWindowManager.Init();
UIConfigWindow.Init(); UIConfigWindow.Init();
FactoryPatch.Init(); FactoryPatch.Init();
PlanetPatch.Init(); PlanetPatch.Init();
@@ -70,11 +67,10 @@ public class UXAssist : BaseUnityPlugin
PlayerPatch.Uninit(); PlayerPatch.Uninit();
PlanetPatch.Uninit(); PlanetPatch.Uninit();
FactoryPatch.Uninit(); FactoryPatch.Uninit();
MyWindowManager.Uninit();
_patch?.UnpatchSelf(); _patch?.UnpatchSelf();
_patch = null; _patch = null;
_windowPatch?.UnpatchSelf();
_windowPatch = null;
} }
private void Update() private void Update()
@@ -88,6 +84,7 @@ public class UXAssist : BaseUnityPlugin
FactoryPatch.NightLight.LateUpdate(); FactoryPatch.NightLight.LateUpdate();
} }
// Add config button to main menu
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), nameof(UIRoot.OpenMainMenuUI))] [HarmonyPostfix, HarmonyPatch(typeof(UIRoot), nameof(UIRoot.OpenMainMenuUI))]
public static void UIRoot_OpenMainMenuUI_Postfix() public static void UIRoot_OpenMainMenuUI_Postfix()
{ {
@@ -146,6 +143,7 @@ public class UXAssist : BaseUnityPlugin
_initialized = true; _initialized = true;
} }
// Check for noModifier while pressing hotkeys on build bar
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIBuildMenu), nameof(UIBuildMenu._OnUpdate))] [HarmonyPatch(typeof(UIBuildMenu), nameof(UIBuildMenu._OnUpdate))]
private static IEnumerable<CodeInstruction> UIBuildMenu__OnUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> UIBuildMenu__OnUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -165,24 +163,25 @@ public class UXAssist : BaseUnityPlugin
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Patch to fix bug that warning popup on VeinUtil upgraded to level 8000+
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIButton), nameof(UIButton.LateUpdate))] [HarmonyPatch(typeof(ABN_VeinsUtil), nameof(ABN_VeinsUtil.CheckValue))]
private static IEnumerable<CodeInstruction> UIButton_LateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> ABN_VeinsUtil_CheckValue_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{ {
var matcher = new CodeMatcher(instructions, generator); var matcher = new CodeMatcher(instructions, generator);
matcher.MatchForward(false, matcher.MatchForward(false,
new CodeMatch(OpCodes.Ldloc_2), new CodeMatch(OpCodes.Ldelem_R8),
new CodeMatch(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Component), nameof(Component.gameObject))), new CodeMatch(OpCodes.Conv_R4),
new CodeMatch(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(GameObject), nameof(GameObject.activeSelf))) new CodeMatch(OpCodes.Add),
new CodeMatch(OpCodes.Stloc_1)
); );
var labels = matcher.Labels; // loc1 = Mathf.Round(n * 1000f) / 1000f;
matcher.Labels = null; matcher.Advance(3).Insert(
matcher.Insert( new CodeInstruction(OpCodes.Ldc_R4, 1000f),
new CodeInstruction(OpCodes.Ldloc_2).WithLabels(labels), new CodeInstruction(OpCodes.Mul),
new CodeInstruction(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Component), nameof(Component.transform))), new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(Mathf), nameof(Mathf.Round))),
new CodeInstruction(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Transform), nameof(Transform.parent))), new CodeInstruction(OpCodes.Ldc_R4, 1000f),
new CodeInstruction(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Transform), nameof(Transform.parent))), new CodeInstruction(OpCodes.Div)
new CodeInstruction(OpCodes.Callvirt, AccessTools.Method(typeof(Transform), nameof(Transform.SetAsLastSibling)))
); );
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
@@ -205,4 +204,27 @@ public class UXAssist : BaseUnityPlugin
_configWin.Open(); _configWin.Open();
} }
} }
// Bring popup tip window to top layer
[HarmonyTranspiler]
[HarmonyPatch(typeof(UIButton), nameof(UIButton.LateUpdate))]
private static IEnumerable<CodeInstruction> UIButton_LateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
var matcher = new CodeMatcher(instructions, generator);
matcher.MatchForward(false,
new CodeMatch(OpCodes.Ldloc_2),
new CodeMatch(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Component), nameof(Component.gameObject))),
new CodeMatch(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(GameObject), nameof(GameObject.activeSelf)))
);
var labels = matcher.Labels;
matcher.Labels = null;
matcher.Insert(
new CodeInstruction(OpCodes.Ldloc_2).WithLabels(labels),
new CodeInstruction(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Component), nameof(Component.transform))),
new CodeInstruction(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Transform), nameof(Transform.parent))),
new CodeInstruction(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Transform), nameof(Transform.parent))),
new CodeInstruction(OpCodes.Callvirt, AccessTools.Method(typeof(Transform), nameof(Transform.SetAsLastSibling)))
);
return matcher.InstructionEnumeration();
}
} }

View File

@@ -4,7 +4,7 @@
<TargetFramework>net472</TargetFramework> <TargetFramework>net472</TargetFramework>
<BepInExPluginGuid>org.soardev.uxassist</BepInExPluginGuid> <BepInExPluginGuid>org.soardev.uxassist</BepInExPluginGuid>
<Description>DSP MOD - UXAssist</Description> <Description>DSP MOD - UXAssist</Description>
<Version>1.0.0</Version> <Version>1.0.1</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<PackageId>UXAssist</PackageId> <PackageId>UXAssist</PackageId>

View File

@@ -1,6 +1,6 @@
{ {
"name": "UXAssist", "name": "UXAssist",
"version_number": "1.0.0", "version_number": "1.0.1",
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist", "website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist",
"description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁", "description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁",
"dependencies": [ "dependencies": [