From 237830fc917f4fa403fcf7b4a392b69d2b2653b8 Mon Sep 17 00:00:00 2001 From: Soar Qin Date: Tue, 24 Sep 2024 00:33:41 +0800 Subject: [PATCH] UXAssist 1.2.4 --- UXAssist/CHANGELOG.md | 16 ++++++++++ UXAssist/Common/PatchImpl.cs | 27 +++++++++++++--- UXAssist/Functions/WindowFunctions.cs | 32 ++----------------- UXAssist/Patches/FactoryPatch.cs | 20 ++++++++---- UXAssist/Patches/GamePatch.cs | 46 +++++++++++++++++++++------ UXAssist/UI/MyCheckbox.cs | 12 +++++-- UXAssist/UI/MyConfigWindow.cs | 15 ++------- UXAssist/UI/MyKeyBinder.cs | 12 +++++-- UXAssist/UI/MyWindow.cs | 10 +++++- UXAssist/UIConfigWindow.cs | 24 ++++++++++++-- UXAssist/UXAssist.cs | 4 ++- UXAssist/UXAssist.csproj | 2 +- UXAssist/package/manifest.json | 2 +- 13 files changed, 149 insertions(+), 73 deletions(-) diff --git a/UXAssist/CHANGELOG.md b/UXAssist/CHANGELOG.md index ef93076..e242a7f 100644 --- a/UXAssist/CHANGELOG.md +++ b/UXAssist/CHANGELOG.md @@ -1,5 +1,13 @@ ## Changlog +* 1.2.4 + + `Sunlight at night`: + - Fix flickering issue while mecha is sailing. + - Can configure the light angles now. + + `Scale up mouse cursor`: Fix known issues. + + `Buy out techs with their prerequisites`: Fix a bug that warning popup from invalid data. + + Does not patch `BulletTime`'s speed control now, as `BulletTime` has been updated to support configurable maximum speed. + + Some minor fixes and tweaks. * 1.2.3 + `Real-time logistic stations info panel`: Fix bar length not match with item amount when item amount is more than capacity. + `Sunlight at night`: Fix not working. @@ -190,6 +198,14 @@ ## 更新日志 +* 1.2.4 + + `夜间日光灯`: + - 修复了航行时闪烁的问题 + - 现在可以配置入射光线角度了 + + `放大鼠标指针`:修复已知问题 + + `买断科技也同时买断所有前置科技`:修复了数据错误警告弹窗的问题 + + 不再对`BulletTime`的速度控制打补丁,因为`BulletTime`已更新支持可配置最大速度 + + 一些小修复和调整 * 1.2.3 + `物流运输站实时信息面板`:修复了物品数量超过容量限制时条长度不匹配的问题 + `夜间日光灯`:修复了不起作用的问题 diff --git a/UXAssist/Common/PatchImpl.cs b/UXAssist/Common/PatchImpl.cs index 34a6c21..b43f5a0 100644 --- a/UXAssist/Common/PatchImpl.cs +++ b/UXAssist/Common/PatchImpl.cs @@ -1,15 +1,30 @@ using System; +using System.Linq; using System.Reflection; using HarmonyLib; namespace UXAssist.Common; [AttributeUsage(AttributeTargets.Class, Inherited = false)] -public class PatchImplGuidAttribute(string guid) : Attribute +public class PatchGuidAttribute(string guid) : Attribute { public string Guid { get; } = guid; } +public enum PatchCallbackFlag +{ + // OnEnable() is called After patch is applied by default, set this flag to call it before patch is applied + CallOnEnableBeforePatch, + // OnDisable() is called Before patch is removed by default, set this flag to call it after patch is removed + CallOnDisableAfterUnpatch, +} + +[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)] +public class PatchSetCallbackFlagAttribute(PatchCallbackFlag flag) : Attribute +{ + public PatchCallbackFlag Flag { get; } = flag; +} + public class PatchImpl where T : PatchImpl, new() { private static T Instance { get; } = new(); @@ -21,14 +36,18 @@ public class PatchImpl where T : PatchImpl, new() var thisInstance = Instance; if (enable) { - var guid = typeof(T).GetCustomAttribute()?.Guid ?? $"PatchImpl.{typeof(T).FullName ?? typeof(T).ToString()}"; + var guid = typeof(T).GetCustomAttribute()?.Guid ?? $"PatchImpl.{typeof(T).FullName ?? typeof(T).ToString()}"; + var callOnEnableBefore = typeof(T).GetCustomAttributes().Any(n => n.Flag == PatchCallbackFlag.CallOnEnableBeforePatch); + if (callOnEnableBefore) thisInstance.OnEnable(); thisInstance._patch ??= Harmony.CreateAndPatchAll(typeof(T), guid); - thisInstance.OnEnable(); + if (!callOnEnableBefore) thisInstance.OnEnable(); return; } - thisInstance.OnDisable(); + var callOnDisableAfter = typeof(T).GetCustomAttributes().Any(n => n.Flag == PatchCallbackFlag.CallOnDisableAfterUnpatch); + if (!callOnDisableAfter) thisInstance.OnDisable(); thisInstance._patch?.UnpatchSelf(); thisInstance._patch = null; + if (callOnDisableAfter) thisInstance.OnDisable(); } public static Harmony GetHarmony() => Instance._patch; diff --git a/UXAssist/Functions/WindowFunctions.cs b/UXAssist/Functions/WindowFunctions.cs index ad14b40..0d494d5 100644 --- a/UXAssist/Functions/WindowFunctions.cs +++ b/UXAssist/Functions/WindowFunctions.cs @@ -31,7 +31,7 @@ public static class WindowFunctions switch (uMsg) { case WinApi.WM_ACTIVATE: - UXAssist.Logger.LogDebug($"Activate: {wParam.ToInt32()}, {lParam.ToInt32()}"); + // UXAssist.Logger.LogDebug($"Activate: {wParam.ToInt32()}, {lParam.ToInt32()}"); // TODO: Set Priority like: WinApi.SetPriorityClass(WinApi.GetCurrentProcess(), 0x00000080); break; case WinApi.WM_DESTROY: @@ -41,9 +41,9 @@ public static class WindowFunctions } break; } - return WinApi.CallWindowProc(_oldWndProc, hWnd, uMsg, wParam, lParam); } + public static void ShowCPUInfo() { var details = WinApi.GetLogicalProcessorDetails(); @@ -51,7 +51,7 @@ public static class WindowFunctions var hybrid = details.HybridArchitecture; if (hybrid) { - msg += "\nP-Cores: {details.PerformanceCoreCount}\nE-Cores: {details.EfficiencyCoreCount}"; + msg += $"\nP-Cores: {details.PerformanceCoreCount}\nE-Cores: {details.EfficiencyCoreCount}"; } var handle = WinApi.GetCurrentProcess(); @@ -114,32 +114,6 @@ public static class WindowFunctions } } - public static void RefreshSavePath() - { - if (ProfileName == null) return; - - if (UIRoot.instance.loadGameWindow.gameObject.activeSelf) - { - UIRoot.instance.loadGameWindow._Close(); - } - if (UIRoot.instance.saveGameWindow.gameObject.activeSelf) - { - UIRoot.instance.saveGameWindow._Close(); - } - - string gameSavePath; - if (Patches.GamePatch.ProfileBasedSaveFolderEnabled.Value && string.Compare(Patches.GamePatch.DefaultProfileName.Value, ProfileName, StringComparison.OrdinalIgnoreCase) != 0) - gameSavePath = $"{GameConfig.overrideDocumentFolder}{GameConfig.gameName}/Save/{ProfileName}/"; - else - gameSavePath = $"{GameConfig.overrideDocumentFolder}{GameConfig.gameName}/Save/"; - if (string.Compare(GameConfig.gameSavePath, gameSavePath, StringComparison.OrdinalIgnoreCase) == 0) return; - GameConfig.gameSavePath = gameSavePath; - if (!Directory.Exists(GameConfig.gameSavePath)) - { - Directory.CreateDirectory(GameConfig.gameSavePath); - } - } - public static IntPtr FindGameWindow() { if (_gameWindowHandle == IntPtr.Zero) diff --git a/UXAssist/Patches/FactoryPatch.cs b/UXAssist/Patches/FactoryPatch.cs index f0c9f81..de0fa7c 100644 --- a/UXAssist/Patches/FactoryPatch.cs +++ b/UXAssist/Patches/FactoryPatch.cs @@ -17,6 +17,8 @@ public class FactoryPatch : PatchImpl public static ConfigEntry UnlimitInteractiveEnabled; public static ConfigEntry RemoveSomeConditionEnabled; public static ConfigEntry NightLightEnabled; + public static ConfigEntry NightLightAngleX; + public static ConfigEntry NightLightAngleY; public static ConfigEntry RemoveBuildRangeLimitEnabled; public static ConfigEntry LargerAreaForUpgradeAndDismantleEnabled; public static ConfigEntry LargerAreaForTerraformEnabled; @@ -55,6 +57,8 @@ public class FactoryPatch : PatchImpl UnlimitInteractiveEnabled.SettingChanged += (_, _) => UnlimitInteractive.Enable(UnlimitInteractiveEnabled.Value); RemoveSomeConditionEnabled.SettingChanged += (_, _) => RemoveSomeConditionBuild.Enable(RemoveSomeConditionEnabled.Value); NightLightEnabled.SettingChanged += (_, _) => NightLight.Enable(NightLightEnabled.Value); + NightLightAngleX.SettingChanged += (_, _) => NightLight.UpdateSunlightAngle(); + NightLightAngleY.SettingChanged += (_, _) => NightLight.UpdateSunlightAngle(); RemoveBuildRangeLimitEnabled.SettingChanged += (_, _) => RemoveBuildRangeLimit.Enable(RemoveBuildRangeLimitEnabled.Value); LargerAreaForUpgradeAndDismantleEnabled.SettingChanged += (_, _) => LargerAreaForUpgradeAndDismantle.Enable(LargerAreaForUpgradeAndDismantleEnabled.Value); LargerAreaForTerraformEnabled.SettingChanged += (_, _) => LargerAreaForTerraform.Enable(LargerAreaForTerraformEnabled.Value); @@ -175,8 +179,6 @@ public class FactoryPatch : PatchImpl public class NightLight : PatchImpl { - private const float NightLightAngleX = -8; - private const float NightLightAngleY = -2; private static bool _nightlightInitialized; private static bool _mechaOnEarth; private static AnimationState _sail; @@ -188,6 +190,13 @@ public class FactoryPatch : PatchImpl _sunlight.transform.localEulerAngles = new Vector3(0f, 180f); } + public static void UpdateSunlightAngle() + { + if (!_sunlight) return; + _sunlight.transform.rotation = Quaternion.LookRotation(-GameMain.mainPlayer.transform.up + GameMain.mainPlayer.transform.forward * NightLightAngleX.Value / 10f + + GameMain.mainPlayer.transform.right * NightLightAngleY.Value / 10f); + } + [HarmonyPostfix] [HarmonyPatch(typeof(GameMain), nameof(GameMain.LateUpdate))] public static void GameMain_LateUpdate_Postfix(GameMain __instance) @@ -217,12 +226,13 @@ public class FactoryPatch : PatchImpl if (!_sail || !_sail.enabled) return; _mechaOnEarth = false; - if (!_sunlight || !_sunlight.transform) return; + if (!_sunlight) return; _sunlight.transform.localEulerAngles = new Vector3(0f, 180f); _sunlight = null; return; } + if (_sail && _sail.enabled) return; if (!_sunlight) { var simu = GameMain.universeSimulator; @@ -231,9 +241,7 @@ public class FactoryPatch : PatchImpl } _mechaOnEarth = true; - if (_sunlight) - _sunlight.transform.rotation = Quaternion.LookRotation(-GameMain.mainPlayer.transform.up + GameMain.mainPlayer.transform.forward * NightLightAngleX / 10f + - GameMain.mainPlayer.transform.right * NightLightAngleY / 10f); + UpdateSunlightAngle(); } [HarmonyTranspiler] diff --git a/UXAssist/Patches/GamePatch.cs b/UXAssist/Patches/GamePatch.cs index 5bb8c2c..42510ad 100644 --- a/UXAssist/Patches/GamePatch.cs +++ b/UXAssist/Patches/GamePatch.cs @@ -76,13 +76,13 @@ public class GamePatch: PatchImpl LoadLastWindowRectEnabled.SettingChanged += (_, _) => LoadLastWindowRect.Enable(LoadLastWindowRectEnabled.Value); MouseCursorScaleUpMultiplier.SettingChanged += (_, _) => { - MouseCursorScaleUp.reload = true; + MouseCursorScaleUp.NeedReloadCursors = true; MouseCursorScaleUp.Enable(MouseCursorScaleUpMultiplier.Value > 1); }; // AutoSaveOptEnabled.SettingChanged += (_, _) => AutoSaveOpt.Enable(AutoSaveOptEnabled.Value); ConvertSavesFromPeaceEnabled.SettingChanged += (_, _) => ConvertSavesFromPeace.Enable(ConvertSavesFromPeaceEnabled.Value); - ProfileBasedSaveFolderEnabled.SettingChanged += (_, _) => Functions.WindowFunctions.RefreshSavePath(); - DefaultProfileName.SettingChanged += (_, _) => Functions.WindowFunctions.RefreshSavePath(); + ProfileBasedSaveFolderEnabled.SettingChanged += (_, _) => RefreshSavePath(); + DefaultProfileName.SettingChanged += (_, _) => RefreshSavePath(); GameUpsFactor.SettingChanged += (_, _) => { if (!EnableGameUpsFactor || GameUpsFactor.Value == 0.0) return; @@ -99,7 +99,7 @@ public class GamePatch: PatchImpl { EnableWindowResize.Enable(EnableWindowResizeEnabled.Value); LoadLastWindowRect.Enable(LoadLastWindowRectEnabled.Value); - MouseCursorScaleUp.reload = false; + MouseCursorScaleUp.NeedReloadCursors = false; MouseCursorScaleUp.Enable(MouseCursorScaleUpMultiplier.Value > 1); // AutoSaveOpt.Enable(AutoSaveOptEnabled.Value); ConvertSavesFromPeace.Enable(ConvertSavesFromPeaceEnabled.Value); @@ -111,7 +111,7 @@ public class GamePatch: PatchImpl Enable(false); LoadLastWindowRect.Enable(false); EnableWindowResize.Enable(false); - MouseCursorScaleUp.reload = false; + MouseCursorScaleUp.NeedReloadCursors = false; MouseCursorScaleUp.Enable(false); // AutoSaveOpt.Enable(false); ConvertSavesFromPeace.Enable(false); @@ -132,6 +132,33 @@ public class GamePatch: PatchImpl } } + private static void RefreshSavePath() + { + var profileName = Functions.WindowFunctions.ProfileName; + if (profileName == null) return; + + if (UIRoot.instance.loadGameWindow.gameObject.activeSelf) + { + UIRoot.instance.loadGameWindow._Close(); + } + if (UIRoot.instance.saveGameWindow.gameObject.activeSelf) + { + UIRoot.instance.saveGameWindow._Close(); + } + + string gameSavePath; + if (ProfileBasedSaveFolderEnabled.Value && string.Compare(DefaultProfileName.Value, profileName, StringComparison.OrdinalIgnoreCase) != 0) + gameSavePath = $"{GameConfig.overrideDocumentFolder}{GameConfig.gameName}/Save/{profileName}/"; + else + gameSavePath = $"{GameConfig.overrideDocumentFolder}{GameConfig.gameName}/Save/"; + if (string.Compare(GameConfig.gameSavePath, gameSavePath, StringComparison.OrdinalIgnoreCase) == 0) return; + GameConfig.gameSavePath = gameSavePath; + if (!Directory.Exists(GameConfig.gameSavePath)) + { + Directory.CreateDirectory(GameConfig.gameSavePath); + } + } + [HarmonyPrefix, HarmonyPatch(typeof(GameMain), nameof(GameMain.HandleApplicationQuit))] private static void GameMain_HandleApplicationQuit_Prefix() { @@ -487,7 +514,7 @@ public class GamePatch: PatchImpl ); matcher.Advance(2).Opcode = OpCodes.Brfalse; matcher.Insert( - new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(ConvertSavesFromPeace), nameof(ConvertSavesFromPeace._needConvert))) + new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(ConvertSavesFromPeace), nameof(_needConvert))) ); return matcher.InstructionEnumeration(); } @@ -500,13 +527,14 @@ public class GamePatch: PatchImpl } } + [PatchSetCallbackFlag(PatchCallbackFlag.CallOnDisableAfterUnpatch)] private class MouseCursorScaleUp: PatchImpl { - public static bool reload; + public static bool NeedReloadCursors; protected override void OnEnable() { - if (!reload) return; + if (!NeedReloadCursors) return; if (!UICursor.loaded) return; UICursor.loaded = false; UICursor.LoadCursors(); @@ -514,7 +542,7 @@ public class GamePatch: PatchImpl protected override void OnDisable() { - if (!reload) return; + if (!NeedReloadCursors) return; if (!UICursor.loaded) return; UICursor.loaded = false; UICursor.LoadCursors(); diff --git a/UXAssist/UI/MyCheckbox.cs b/UXAssist/UI/MyCheckbox.cs index 974e786..6d5af6f 100644 --- a/UXAssist/UI/MyCheckbox.cs +++ b/UXAssist/UI/MyCheckbox.cs @@ -13,8 +13,13 @@ public class MyCheckBox : MonoBehaviour public RectTransform rectTrans; public Text labelText; public event Action OnChecked; + protected event Action OnFree; private bool _checked; - private ConfigEntry _configAssigned; + + protected void OnDestroy() + { + OnFree?.Invoke(); + } public bool Checked { @@ -29,9 +34,10 @@ public class MyCheckBox : MonoBehaviour public static MyCheckBox CreateCheckBox(float x, float y, RectTransform parent, ConfigEntry config, string label = "", int fontSize = 15) { var cb = CreateCheckBox(x, y, parent, config.Value, label, fontSize); - cb._configAssigned = config; cb.OnChecked += () => config.Value = !config.Value; - config.SettingChanged += (_, _) => cb.Checked = config.Value; + EventHandler func = (_, _) => cb.Checked = config.Value; + config.SettingChanged += func; + cb.OnFree += () => config.SettingChanged -= func; return cb; } diff --git a/UXAssist/UI/MyConfigWindow.cs b/UXAssist/UI/MyConfigWindow.cs index b20c3bd..08925c4 100644 --- a/UXAssist/UI/MyConfigWindow.cs +++ b/UXAssist/UI/MyConfigWindow.cs @@ -22,6 +22,7 @@ public class MyConfigWindow : MyWindowWithTabs public override void _OnCreate() { + base._OnCreate(); _windowTrans = GetComponent(); OnUICreated?.Invoke(this, _windowTrans); AutoFitWindowSize(); @@ -32,26 +33,16 @@ public class MyConfigWindow : MyWindowWithTabs public override void _OnDestroy() { _windowTrans = null; + base._OnDestroy(); } public override bool _OnInit() { + if (!base._OnInit()) return false; _windowTrans.anchoredPosition = new Vector2(0, 0); return true; } - public override void _OnFree() - { - } - - public override void _OnOpen() - { - } - - public override void _OnClose() - { - } - public override void _OnUpdate() { base._OnUpdate(); diff --git a/UXAssist/UI/MyKeyBinder.cs b/UXAssist/UI/MyKeyBinder.cs index 652dd1b..0a60282 100644 --- a/UXAssist/UI/MyKeyBinder.cs +++ b/UXAssist/UI/MyKeyBinder.cs @@ -10,6 +10,7 @@ namespace UXAssist.UI; public class MyKeyBinder : MonoBehaviour { private ConfigEntry _config; + protected event Action OnFree; [SerializeField] public Text functionText; @@ -42,6 +43,11 @@ public class MyKeyBinder : MonoBehaviour public UIButton setNoneKeyUIButton; private bool _nextNotOn; + + protected void OnDestroy() + { + OnFree?.Invoke(); + } public static RectTransform CreateKeyBinder(float x, float y, RectTransform parent, ConfigEntry config, string label = "", int fontSize = 17) { @@ -82,10 +88,10 @@ public class MyKeyBinder : MonoBehaviour Destroy(uikeyEntry); kb.setNoneKeyUIButton.gameObject.SetActive(false); + EventHandler func = (_, _) => kb.SettingChanged(); kb.SettingChanged(); - config.SettingChanged += (_, _) => { - kb.SettingChanged(); - }; + config.SettingChanged += func; + kb.OnFree += () => config.SettingChanged -= func; kb.inputUIButton.onClick += kb.OnInputUIButtonClick; kb.setDefaultUIButton.onClick += kb.OnSetDefaultKeyClick; //kb.setNoneKeyUIButton.onClick += kb.OnSetNoneKeyClick; diff --git a/UXAssist/UI/MyWindow.cs b/UXAssist/UI/MyWindow.cs index 89e0c24..8be28f9 100644 --- a/UXAssist/UI/MyWindow.cs +++ b/UXAssist/UI/MyWindow.cs @@ -22,6 +22,12 @@ public class MyWindow : ManualBehaviour protected const float TabHeight = 27f; protected const float Margin = 30f; protected const float Spacing = 10f; + protected event Action OnFree; + + public override void _OnFree() + { + OnFree?.Invoke(); + } public virtual void TryClose() { @@ -222,12 +228,14 @@ public class MyWindow : ManualBehaviour { var slider = MySlider.CreateSlider(x, y, parent, OnConfigValueChanged(config), valueMapper.Min, valueMapper.Max, format, width); slider.SetLabelText(valueMapper.FormatValue(format, config.Value)); - config.SettingChanged += (sender, args) => + EventHandler func = (_, _) => { var index = OnConfigValueChanged(config); slider.Value = index; slider.SetLabelText(valueMapper.FormatValue(format, config.Value)); }; + config.SettingChanged += func; + OnFree += () => config.SettingChanged -= func; slider.OnValueChanged += () => { var index = Mathf.RoundToInt(slider.Value); diff --git a/UXAssist/UIConfigWindow.cs b/UXAssist/UIConfigWindow.cs index 16b3bc0..b0427fa 100644 --- a/UXAssist/UIConfigWindow.cs +++ b/UXAssist/UIConfigWindow.cs @@ -36,6 +36,7 @@ public static class UIConfigWindow I18N.Add("Reset", "Reset", "重置"); I18N.Add("Unlimited interactive range", "Unlimited interactive range", "无限交互距离"); I18N.Add("Night Light", "Sunlight at night", "夜间日光灯"); + I18N.Add("Angle X:", "Angle X:", "入射角度X:"); I18N.Add("Remove some build conditions", "Remove some build conditions", "移除部分不影响游戏逻辑的建造条件"); I18N.Add("Remove build range limit", "Remove build count and range limit", "移除建造数量和距离限制"); I18N.Add("Larger area for upgrade and dismantle", "Larger area for upgrade and dismantle", "范围升级和拆除的最大区域扩大"); @@ -104,6 +105,14 @@ public static class UIConfigWindow } } + private class AngleMapper : MyWindow.ValueMapper + { + public override int Min => 0; + public override int Max => 20; + public override float IndexToValue(int index) => index - 10f; + public override int ValueToIndex(float value) => Mathf.RoundToInt(value + 10f); + } + private class DistanceMapper : MyWindow.ValueMapper { public override int Min => 1; @@ -161,11 +170,11 @@ public static class UIConfigWindow wnd.AddInputField(x, y, 200f, tab1, GamePatch.DefaultProfileName, 15, "input-profile-save-folder"); y += 18f; } - + /* x = 400f; y = 10f; wnd.AddButton(x, y, tab1, "Show CPU Info", 16, "button-show-cpu-info", WindowFunctions.ShowCPUInfo); - + */ if (!ModsCompat.BulletTimeWrapper.HasBulletTime) { y += 36f; @@ -183,7 +192,16 @@ public static class UIConfigWindow y += 36f; wnd.AddCheckBox(x, y, tab2, FactoryPatch.RemoveBuildRangeLimitEnabled, "Remove build range limit"); y += 36f; - wnd.AddCheckBox(x, y, tab2, FactoryPatch.NightLightEnabled, "Night Light"); + var cb = wnd.AddCheckBox(x, y, tab2, FactoryPatch.NightLightEnabled, "Night Light"); + x += cb.Width + 5f + 10f; + txt = wnd.AddText2(x, y + 2, tab2, "Angle X:", 13, "text-nightlight-angle-x"); + x += txt.preferredWidth + 5f; + wnd.AddSlider(x, y + 7, tab2, FactoryPatch.NightLightAngleX, new AngleMapper(), "0", 80f); + x += 90f; + txt = wnd.AddText2(x, y + 2, tab2, "Y:", 13, "text-nightlight-angle-y"); + x += txt.preferredWidth + 5f; + wnd.AddSlider(x, y + 7, tab2, FactoryPatch.NightLightAngleY, new AngleMapper(), "0", 80f); + x = 0; y += 36f; wnd.AddCheckBox(x, y, tab2, FactoryPatch.LargerAreaForUpgradeAndDismantleEnabled, "Larger area for upgrade and dismantle"); y += 36f; diff --git a/UXAssist/UXAssist.cs b/UXAssist/UXAssist.cs index 460568b..9ccb389 100644 --- a/UXAssist/UXAssist.cs +++ b/UXAssist/UXAssist.cs @@ -92,6 +92,8 @@ public class UXAssist : BaseUnityPlugin, IModCanSave "Remove part of build condition checks that does not affect game logic"); FactoryPatch.NightLightEnabled = Config.Bind("Factory", "NightLight", false, "Night light"); + FactoryPatch.NightLightAngleX = Config.Bind("Factory", "NightLightAngleX", -8f, "Night light angle X"); + FactoryPatch.NightLightAngleY = Config.Bind("Factory", "NightLightAngleY", -2f, "Night light angle Y"); PlanetPatch.PlayerActionsInGlobeViewEnabled = Config.Bind("Planet", "PlayerActionsInGlobeView", false, "Enable player actions in globe view"); FactoryPatch.RemoveBuildRangeLimitEnabled = Config.Bind("Factory", "RemoveBuildRangeLimit", false, @@ -234,7 +236,7 @@ public class UXAssist : BaseUnityPlugin, IModCanSave if (wasActive) ToggleConfigWindow(); } - [PatchImplGuid(PluginInfo.PLUGIN_GUID)] + [PatchGuid(PluginInfo.PLUGIN_GUID)] private class UIPatch: PatchImpl { private static GameObject _buttonOnPlanetGlobe; diff --git a/UXAssist/UXAssist.csproj b/UXAssist/UXAssist.csproj index 4e1f44c..0b98895 100644 --- a/UXAssist/UXAssist.csproj +++ b/UXAssist/UXAssist.csproj @@ -4,7 +4,7 @@ net472 org.soardev.uxassist DSP MOD - UXAssist - 1.2.3 + 1.2.4 true latest UXAssist diff --git a/UXAssist/package/manifest.json b/UXAssist/package/manifest.json index e7cf1ea..e761ba5 100644 --- a/UXAssist/package/manifest.json +++ b/UXAssist/package/manifest.json @@ -1,6 +1,6 @@ { "name": "UXAssist", - "version_number": "1.2.3", + "version_number": "1.2.4", "website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist", "description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁", "dependencies": [