mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-02-04 17:02:17 +08:00
UXAssist v1.0.2, UniverseGenTweaks v1.2.1, CheatEnabler v2.3.4
This commit is contained in:
76
UXAssist/Common/WinApi.cs
Normal file
76
UXAssist/Common/WinApi.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace UXAssist.Common;
|
||||
|
||||
[Flags]
|
||||
public enum WindowStyles: int
|
||||
{
|
||||
WS_BORDER = 0x00800000,
|
||||
WS_CAPTION = 0x00C00000,
|
||||
WS_CHILD = 0x40000000,
|
||||
WS_CHILDWINDOW = 0x40000000,
|
||||
WS_CLIPCHILDREN = 0x02000000,
|
||||
WS_CLIPSIBLINGS = 0x04000000,
|
||||
WS_DISABLED = 0x08000000,
|
||||
WS_DLGFRAME = 0x00400000,
|
||||
WS_GROUP = 0x00020000,
|
||||
WS_HSCROLL = 0x00100000,
|
||||
WS_ICONIC = 0x20000000,
|
||||
WS_MAXIMIZE = 0x01000000,
|
||||
WS_MAXIMIZEBOX = 0x00010000,
|
||||
WS_MINIMIZE = 0x20000000,
|
||||
WS_MINIMIZEBOX = 0x00020000,
|
||||
WS_OVERLAPPED = 0x00000000,
|
||||
WS_OVERLAPPEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX,
|
||||
WS_POPUP = unchecked((int)0x80000000),
|
||||
WS_POPUPWINDOW = WS_POPUP | WS_BORDER | WS_SYSMENU,
|
||||
WS_SIZEBOX = 0x00040000,
|
||||
WS_SYSMENU = 0x00080000,
|
||||
WS_TABSTOP = 0x00010000,
|
||||
WS_THICKFRAME = 0x00040000,
|
||||
WS_TILED = 0x00000000,
|
||||
WS_TILEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX,
|
||||
WS_VISIBLE = 0x10000000,
|
||||
WS_VSCROLL = 0x00200000
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum WindowLongFlags: int
|
||||
{
|
||||
GWL_EXSTYLE = -20,
|
||||
GWLP_HINSTANCE = -6,
|
||||
GWLP_HWNDPARENT = -8,
|
||||
GWLP_ID = -12,
|
||||
GWL_STYLE = -16,
|
||||
GWLP_USERDATA = -21,
|
||||
GWLP_WNDPROC = -4,
|
||||
DWLP_DLGPROC = 0x4,
|
||||
DWLP_MSGRESULT = 0,
|
||||
DWLP_USER = 0x8
|
||||
}
|
||||
|
||||
public static class WinApi
|
||||
{
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Rect
|
||||
{
|
||||
public int Left, Top, Right, Bottom;
|
||||
}
|
||||
|
||||
[DllImport("user32", CharSet = CharSet.Unicode)]
|
||||
public static extern int GetWindowLong(IntPtr hwnd, int nIndex);
|
||||
|
||||
[DllImport("user32", CharSet = CharSet.Unicode)]
|
||||
public static extern int SetWindowLong(IntPtr hwnd, int nIndex, int dwNewLong);
|
||||
|
||||
[DllImport("user32", CharSet = CharSet.Unicode)]
|
||||
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
|
||||
|
||||
[DllImport("user32", ExactSpelling = true)]
|
||||
public static extern bool GetWindowRect(IntPtr hwnd, out Rect lpRect);
|
||||
|
||||
[DllImport("user32", ExactSpelling = true)]
|
||||
public static extern bool SetWindowPos(IntPtr hwnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, int flags);
|
||||
}
|
||||
103
UXAssist/GamePatch.cs
Normal file
103
UXAssist/GamePatch.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using BepInEx.Configuration;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
using UXAssist.Common;
|
||||
|
||||
namespace UXAssist;
|
||||
|
||||
public static class GamePatch
|
||||
{
|
||||
private const string GameWindowClass = "UnityWndClass";
|
||||
private const string GameWindowTitle = "Dyson Sphere Program";
|
||||
|
||||
public static ConfigEntry<bool> EnableWindowResizeEnabled;
|
||||
public static ConfigEntry<bool> LoadLastWindowRectEnabled;
|
||||
public static ConfigEntry<Vector4> LastWindowRect;
|
||||
private static Harmony _gamePatch;
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
EnableWindowResizeEnabled.SettingChanged += (_, _) => EnableWindowResize.Enable(EnableWindowResizeEnabled.Value);
|
||||
LoadLastWindowRectEnabled.SettingChanged += (_, _) => LoadLastWindowRect.Enable(LoadLastWindowRectEnabled.Value);
|
||||
EnableWindowResize.Enable(EnableWindowResizeEnabled.Value);
|
||||
LoadLastWindowRect.Enable(LoadLastWindowRectEnabled.Value);
|
||||
_gamePatch ??= Harmony.CreateAndPatchAll(typeof(GamePatch));
|
||||
}
|
||||
|
||||
public static void Uninit()
|
||||
{
|
||||
LoadLastWindowRect.Enable(false);
|
||||
EnableWindowResize.Enable(false);
|
||||
_gamePatch?.UnpatchSelf();
|
||||
_gamePatch = null;
|
||||
}
|
||||
|
||||
[HarmonyPrefix, HarmonyPatch(typeof(Application), nameof(Application.Quit), new Type[]{})]
|
||||
private static void Application_Quit_Prefix()
|
||||
{
|
||||
var wnd = WinApi.FindWindow(GameWindowClass, GameWindowTitle);
|
||||
if (wnd == IntPtr.Zero) return;
|
||||
WinApi.GetWindowRect(wnd, out var rect);
|
||||
LastWindowRect.Value = new Vector4(rect.Left, rect.Top, Screen.width, Screen.height);
|
||||
}
|
||||
|
||||
private static class EnableWindowResize
|
||||
{
|
||||
public static void Enable(bool on)
|
||||
{
|
||||
var wnd = WinApi.FindWindow(GameWindowClass, GameWindowTitle);
|
||||
if (wnd == IntPtr.Zero) return;
|
||||
if (on)
|
||||
WinApi.SetWindowLong(wnd, (int)WindowLongFlags.GWL_STYLE,
|
||||
WinApi.GetWindowLong(wnd, (int)WindowLongFlags.GWL_STYLE) | (int)WindowStyles.WS_THICKFRAME | (int)WindowStyles.WS_MAXIMIZEBOX);
|
||||
else
|
||||
WinApi.SetWindowLong(wnd, (int)WindowLongFlags.GWL_STYLE,
|
||||
WinApi.GetWindowLong(wnd, (int)WindowLongFlags.GWL_STYLE) & ~((int)WindowStyles.WS_THICKFRAME | (int)WindowStyles.WS_MAXIMIZEBOX));
|
||||
}
|
||||
}
|
||||
|
||||
private static class LoadLastWindowRect
|
||||
{
|
||||
private static Harmony _patch;
|
||||
public static void Enable(bool on)
|
||||
{
|
||||
if (on)
|
||||
{
|
||||
_patch ??= Harmony.CreateAndPatchAll(typeof(LoadLastWindowRect));
|
||||
return;
|
||||
}
|
||||
_patch?.UnpatchSelf();
|
||||
_patch = null;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(Screen), nameof(Screen.SetResolution), typeof(int), typeof(int), typeof(FullScreenMode), typeof(int))]
|
||||
private static void Screen_SetResolution_Prefix(ref int width, ref int height, FullScreenMode fullscreenMode)
|
||||
{
|
||||
if (fullscreenMode is FullScreenMode.ExclusiveFullScreen or FullScreenMode.FullScreenWindow or FullScreenMode.MaximizedWindow || GameMain.isRunning) return;
|
||||
var rect = LastWindowRect.Value;
|
||||
if (rect.z == 0f && rect.w == 0f) return;
|
||||
var w = Mathf.RoundToInt(rect.z);
|
||||
var h = Mathf.RoundToInt(rect.w);
|
||||
width = w;
|
||||
height = h;
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(Screen), nameof(Screen.SetResolution), typeof(int), typeof(int), typeof(FullScreenMode), typeof(int))]
|
||||
private static void Screen_SetResolution_Postfix()
|
||||
{
|
||||
var wnd = WinApi.FindWindow(GameWindowClass, GameWindowTitle);
|
||||
if (wnd == IntPtr.Zero) return;
|
||||
var rect = LastWindowRect.Value;
|
||||
if (rect.z == 0f && rect.w == 0f) return;
|
||||
var x = Mathf.RoundToInt(rect.x);
|
||||
var y = Mathf.RoundToInt(rect.y);
|
||||
WinApi.SetWindowPos(wnd, IntPtr.Zero, x, y, 0, 0, 0x0235);
|
||||
if (EnableWindowResizeEnabled.Value)
|
||||
WinApi.SetWindowLong(wnd, (int)WindowLongFlags.GWL_STYLE,
|
||||
WinApi.GetWindowLong(wnd, (int)WindowLongFlags.GWL_STYLE) | (int)WindowStyles.WS_THICKFRAME | (int)WindowStyles.WS_MAXIMIZEBOX);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,11 @@
|
||||
#### 一些提升用户体验的功能和补丁
|
||||
|
||||
## Changlog
|
||||
* 1.0.2
|
||||
+ Redesign config tabs, for clearer layout.
|
||||
+ Add 2 new options:
|
||||
- Enable game window resize.
|
||||
- Remember window position and size on last exit.
|
||||
* 1.0.1
|
||||
+ Fix config button text and tips while returning to title menu.
|
||||
+ Fix that error occurs while returning to title menu, with `Stop ejectors when available nodes are all filled up` enabled.
|
||||
@@ -20,20 +25,25 @@
|
||||
+ 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
|
||||
+ Sunlight at night
|
||||
+ Remove some build conditions
|
||||
+ Remove build count and range limit
|
||||
+ Larger area for upgrade and dismantle(30x30 at max)
|
||||
+ Larger area for terraform(30x30 at max)
|
||||
+ Enable player actions in globe view
|
||||
+ Enhanced count control for hand-make
|
||||
+ Re-intialize planet (without reseting veins)
|
||||
+ Quick dismantle all buildings (without drops)
|
||||
+ Stop ejectors when available nodes are all filled up
|
||||
+ Construct only nodes but frames
|
||||
+ Re-initialize Dyson Spheres
|
||||
+ Quick dismantle Dyson Shells
|
||||
+ General
|
||||
- Enable game window resize
|
||||
- Remember window position and size on last exit
|
||||
+ Planet/Factory
|
||||
- Unlimited interactive range
|
||||
- Sunlight at night
|
||||
- Remove some build conditions
|
||||
- Remove build count and range limit
|
||||
- Larger area for upgrade and dismantle(30x30 at max)
|
||||
- Larger area for terraform(30x30 at max)
|
||||
- Enable player actions in globe view
|
||||
- Enhanced count control for hand-make
|
||||
- Re-intialize planet (without reseting veins)
|
||||
- Quick dismantle all buildings (without drops)
|
||||
+ Dyson Sphere
|
||||
- Stop ejectors when available nodes are all filled up
|
||||
- Construct only nodes but frames
|
||||
- Re-initialize Dyson Spheres
|
||||
- Quick dismantle Dyson Shells
|
||||
|
||||
## Notes
|
||||
* Please upgrade `BepInEx` 5.4.21 or later if using with [BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/) to avoid possible conflicts.
|
||||
@@ -46,6 +56,11 @@
|
||||
* [LSTM](https://github.com/hetima/DSP_LSTM) & [PlanetFinder](https://github.com/hetima/DSP_PlanetFinder): UI implementations
|
||||
|
||||
## 更新日志
|
||||
* 1.0.2
|
||||
+ 重新设计了配置面板,使布局更清晰
|
||||
+ 添加了两个新选项:
|
||||
- 可调整游戏窗口大小(可最大化和拖动边框)
|
||||
- 记住上次退出时的窗口位置和大小
|
||||
* 1.0.1
|
||||
+ 修复了返回标题界面后设置按钮文本和提示信息不正确的问题
|
||||
+ 修复了`当可用节点全部造完时停止弹射`选项启用时返回标题界面可能导致崩溃的问题
|
||||
@@ -62,20 +77,25 @@
|
||||
+ 更严格的建造菜单热键检测,因此在按住Ctrl/Alt/Shift时不再会触发建造热键(0~9, F1~F10, X, U)
|
||||
+ 修复了`矿物利用`升级到8000级以上时弹出警告的bug
|
||||
* 功能:
|
||||
+ 无限交互距离
|
||||
+ 夜间日光灯
|
||||
+ 移除部分不影响游戏逻辑的建造条件
|
||||
+ 移除建造数量和范围限制
|
||||
+ 范围升级和拆除的最大区域扩大(最大30x30)
|
||||
+ 范围铺设地基的最大区域扩大(最大30x30)
|
||||
+ 在行星视图中允许玩家操作
|
||||
+ 手动制造物品的数量控制改进
|
||||
+ 初始化本行星(不重置矿脉)
|
||||
+ 快速拆除所有建筑(不掉落)
|
||||
+ 可用节点全部造完时停止弹射
|
||||
+ 只建造节点不建造框架
|
||||
+ 初始化戴森球
|
||||
+ 快速拆除戴森壳
|
||||
+ 通用
|
||||
-可调整游戏窗口大小(可最大化和拖动边框)
|
||||
- 记住上次退出时的窗口位置和大小
|
||||
+ 行星/工厂
|
||||
- 无限交互距离
|
||||
- 夜间日光灯
|
||||
- 移除部分不影响游戏逻辑的建造条件
|
||||
- 移除建造数量和范围限制
|
||||
- 范围升级和拆除的最大区域扩大(最大30x30)
|
||||
- 范围铺设地基的最大区域扩大(最大30x30)
|
||||
- 在行星视图中允许玩家操作
|
||||
- 手动制造物品的数量控制改进
|
||||
- 初始化本行星(不重置矿脉)
|
||||
- 快速拆除所有建筑(不掉落)
|
||||
+ 戴森球
|
||||
- 可用节点全部造完时停止弹射
|
||||
- 只建造节点不建造框架
|
||||
- 初始化戴森球
|
||||
- 快速拆除戴森壳
|
||||
|
||||
## 注意事项
|
||||
* 如果和[BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/)一起使用,请升级`BepInEx`到5.4.21或更高版本,以避免可能的冲突。
|
||||
|
||||
@@ -18,7 +18,7 @@ public class MyConfigWindow : MyWindowWithTabs
|
||||
public override void _OnCreate()
|
||||
{
|
||||
_windowTrans = GetComponent<RectTransform>();
|
||||
_windowTrans.sizeDelta = new Vector2(700f, 472f);
|
||||
_windowTrans.sizeDelta = new Vector2(810f, 440f);
|
||||
|
||||
OnUICreated?.Invoke(this, _windowTrans);
|
||||
SetCurrentTab(0);
|
||||
|
||||
@@ -211,7 +211,7 @@ public class MyWindow: ManualBehaviour
|
||||
public class MyWindowWithTabs : MyWindow
|
||||
{
|
||||
private readonly List<Tuple<RectTransform, UIButton>> _tabs = new();
|
||||
private float _tabX = 36f;
|
||||
private float _tabY = 54f;
|
||||
public override void TryClose()
|
||||
{
|
||||
_Close();
|
||||
@@ -222,18 +222,18 @@ public class MyWindowWithTabs : MyWindow
|
||||
return true;
|
||||
}
|
||||
|
||||
private RectTransform AddTabInternal(float x, int index, RectTransform parent, string label)
|
||||
private RectTransform AddTabInternal(float y, int index, RectTransform parent, string label)
|
||||
{
|
||||
var tab = new GameObject();
|
||||
var tabRect = tab.AddComponent<RectTransform>();
|
||||
Util.NormalizeRectWithMargin(tabRect, 54f + 28f, 36f, 0f, 0f, parent);
|
||||
Util.NormalizeRectWithMargin(tabRect, 48f, 145f, 0f, 0f, parent);
|
||||
tab.name = "tab-" + index;
|
||||
var swarmPanel = UIRoot.instance.uiGame.dysonEditor.controlPanel.hierarchy.swarmPanel;
|
||||
var src = swarmPanel.orbitButtons[0];
|
||||
var btn = Instantiate(src);
|
||||
var btnRect = Util.NormalizeRectWithTopLeft(btn, x, 54f, parent);
|
||||
var btnRect = Util.NormalizeRectWithTopLeft(btn, 30, y, parent);
|
||||
btn.name = "tab-btn-" + index;
|
||||
btnRect.sizeDelta = new Vector2(105f, 24f);
|
||||
btnRect.sizeDelta = new Vector2(105f, 27f);
|
||||
btn.transform.Find("frame").gameObject.SetActive(false);
|
||||
if (btn.transitions.Length >= 3)
|
||||
{
|
||||
@@ -258,11 +258,27 @@ public class MyWindowWithTabs : MyWindow
|
||||
|
||||
public RectTransform AddTab(RectTransform parent, string label)
|
||||
{
|
||||
var result = AddTabInternal(_tabX, _tabs.Count, parent, label);
|
||||
_tabX += 105f;
|
||||
var result = AddTabInternal(_tabY, _tabs.Count, parent, label);
|
||||
_tabY += 28f;
|
||||
return result;
|
||||
}
|
||||
|
||||
public void AddSplitter(RectTransform parent, float spacing)
|
||||
{
|
||||
var img = Instantiate(UIRoot.instance.optionWindow.transform.Find("tab-line").Find("bar"));
|
||||
Destroy(img.Find("tri").gameObject);
|
||||
_tabY += spacing;
|
||||
var rect = Util.NormalizeRectWithTopLeft(img, 28, _tabY, parent);
|
||||
rect.sizeDelta = new Vector2(107, 2);
|
||||
_tabY += 2;
|
||||
}
|
||||
|
||||
public void AddTabGroup(RectTransform parent, string label, string objName = "tabl-group-label")
|
||||
{
|
||||
AddText(28, _tabY - 2, parent, label, 16, objName);
|
||||
_tabY += 28f;
|
||||
}
|
||||
|
||||
public override void _OnRegEvent()
|
||||
{
|
||||
if (!EventRegistered)
|
||||
|
||||
@@ -7,12 +7,17 @@ namespace UXAssist;
|
||||
public static class UIConfigWindow
|
||||
{
|
||||
private static RectTransform _windowTrans;
|
||||
private static RectTransform _tab;
|
||||
private static RectTransform _dysonTab;
|
||||
private static readonly UIButton[] DysonLayerBtn = new UIButton[10];
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
I18N.Add("UXAssist", "UXAssist", "UX助手");
|
||||
I18N.Add("General", "General", "常规");
|
||||
I18N.Add("Planet/Factory", "Planet/Factory", "行星/工厂");
|
||||
I18N.Add("Dyson Sphere", "Dyson Sphere", "戴森球");
|
||||
I18N.Add("Enable game window resize", "Enable game window resize (maximum box and thick frame)", "可调整游戏窗口大小(可最大化和拖动边框)");
|
||||
I18N.Add("Remeber window position and size on last exit", "Remeber window position and size on last exit", "记住上次退出时的窗口位置和大小");
|
||||
I18N.Add("Unlimited interactive range", "Unlimited interactive range", "无限交互距离");
|
||||
I18N.Add("Night Light", "Sunlight at night", "夜间日光灯");
|
||||
I18N.Add("Remove some build conditions", "Remove some build conditions", "移除部分不影响游戏逻辑的建造条件");
|
||||
@@ -36,47 +41,59 @@ public static class UIConfigWindow
|
||||
private static void CreateUI(MyConfigWindow wnd, RectTransform trans)
|
||||
{
|
||||
_windowTrans = trans;
|
||||
var tab1 = wnd.AddTab(_windowTrans, "UXAssist");
|
||||
wnd.AddTabGroup(trans, "UXAssist", "tab-group-uxassist");
|
||||
var tab1 = wnd.AddTab(trans, "General");
|
||||
var x = 0f;
|
||||
var y = 10f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab1, FactoryPatch.UnlimitInteractiveEnabled, "Unlimited interactive range");
|
||||
MyCheckBox.CreateCheckBox(x, y, tab1, GamePatch.EnableWindowResizeEnabled, "Enable game window resize");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab1, FactoryPatch.NightLightEnabled, "Night Light");
|
||||
MyCheckBox.CreateCheckBox(x, y, tab1, GamePatch.LoadLastWindowRectEnabled, "Remeber window position and size on last exit");
|
||||
x += 10f;
|
||||
y = 278f;
|
||||
MyKeyBinder.CreateKeyBinder(x, y, tab1, UXAssist.Hotkey, "Hotkey");
|
||||
var tab2 = wnd.AddTab(trans, "Planet/Factory");
|
||||
x = 0f;
|
||||
y = 10f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.UnlimitInteractiveEnabled, "Unlimited interactive range");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab1, FactoryPatch.RemoveSomeConditionEnabled, "Remove some build conditions");
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.RemoveSomeConditionEnabled, "Remove some build conditions");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab1, FactoryPatch.RemoveBuildRangeLimitEnabled, "Remove build range limit");
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.RemoveBuildRangeLimitEnabled, "Remove build range limit");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab1, FactoryPatch.LargerAreaForUpgradeAndDismantleEnabled, "Larger area for upgrade and dismantle");
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.NightLightEnabled, "Night Light");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab1, FactoryPatch.LargerAreaForTerraformEnabled, "Larger area for terraform");
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.LargerAreaForUpgradeAndDismantleEnabled, "Larger area for upgrade and dismantle");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab1, PlanetPatch.PlayerActionsInGlobeViewEnabled, "Enable player actions in globe view");
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, FactoryPatch.LargerAreaForTerraformEnabled, "Larger area for terraform");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab1, PlayerPatch.EnhancedMechaForgeCountControlEnabled, "Enhanced count control for hand-make");
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, PlanetPatch.PlayerActionsInGlobeViewEnabled, "Enable player actions in globe view");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab2, PlayerPatch.EnhancedMechaForgeCountControlEnabled, "Enhanced count control for hand-make");
|
||||
x = 240f;
|
||||
y += 6f;
|
||||
MyWindow.AddTipsButton(x, y, tab1, "Enhanced count control for hand-make", "Enhanced count control for hand-make tips", "enhanced-count-control-tips");
|
||||
x = 0f;
|
||||
y += 30f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab1, DysonSpherePatch.StopEjectOnNodeCompleteEnabled, "Stop ejectors when available nodes are all filled up");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab1, DysonSpherePatch.OnlyConstructNodesEnabled, "Construct only nodes but frames");
|
||||
MyWindow.AddTipsButton(x, y, tab2, "Enhanced count control for hand-make", "Enhanced count control for hand-make tips", "enhanced-count-control-tips");
|
||||
x = 400f;
|
||||
y = 10f;
|
||||
wnd.AddButton(x, y, tab1, "Initialize This Planet", 16, "button-init-planet", () => { PlanetFunctions.RecreatePlanet(true); });
|
||||
wnd.AddButton(x, y, tab2, "Initialize This Planet", 16, "button-init-planet", () => { PlanetFunctions.RecreatePlanet(true); });
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, tab1, "Dismantle All Buildings", 16, "button-dismantle-all", () => { PlanetFunctions.DismantleAll(false); });
|
||||
wnd.AddButton(x, y, tab2, "Dismantle All Buildings", 16, "button-dismantle-all", () => { PlanetFunctions.DismantleAll(false); });
|
||||
|
||||
var tab3 = wnd.AddTab(trans, "Dyson Sphere");
|
||||
x = 0f;
|
||||
y = 10f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab3, DysonSpherePatch.StopEjectOnNodeCompleteEnabled, "Stop ejectors when available nodes are all filled up");
|
||||
y += 36f;
|
||||
MyCheckBox.CreateCheckBox(x, y, tab3, DysonSpherePatch.OnlyConstructNodesEnabled, "Construct only nodes but frames");
|
||||
x = 400f;
|
||||
y = 10f;
|
||||
wnd.AddButton(x, y, tab3, "Initialize Dyson Sphere", 16, "init-dyson-sphere", () => { DysonSpherePatch.InitCurrentDysonSphere(-1); });
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, tab1, "Initialize Dyson Sphere", 16, "init-dyson-sphere", () => { DysonSpherePatch.InitCurrentDysonSphere(-1); });
|
||||
y += 36f;
|
||||
MyWindow.AddText(x, y, tab1, "Click to dismantle selected layer", 16, "text-dismantle-layer");
|
||||
MyWindow.AddText(x, y, tab3, "Click to dismantle selected layer", 16, "text-dismantle-layer");
|
||||
y += 26f;
|
||||
for (var i = 0; i < 10; i++)
|
||||
{
|
||||
var id = i + 1;
|
||||
var btn = wnd.AddFlatButton(x, y, tab1, id.ToString(), 12, "dismantle-layer-" + id, () => { DysonSpherePatch.InitCurrentDysonSphere(id); });
|
||||
var btn = wnd.AddFlatButton(x, y, tab3, id.ToString(), 12, "dismantle-layer-" + id, () => { DysonSpherePatch.InitCurrentDysonSphere(id); });
|
||||
((RectTransform)btn.transform).sizeDelta = new Vector2(40f, 20f);
|
||||
DysonLayerBtn[i] = btn;
|
||||
if (i == 4)
|
||||
@@ -89,11 +106,7 @@ public static class UIConfigWindow
|
||||
x += 40f;
|
||||
}
|
||||
}
|
||||
x = 400f;
|
||||
y += 72f;
|
||||
MyKeyBinder.CreateKeyBinder(x, y, tab1, UXAssist.Hotkey, "Hotkey");
|
||||
|
||||
_tab = tab1;
|
||||
_dysonTab = tab3;
|
||||
}
|
||||
|
||||
private static void UpdateUI()
|
||||
@@ -103,7 +116,7 @@ public static class UIConfigWindow
|
||||
|
||||
private static void UpdateDysonShells()
|
||||
{
|
||||
if (!_tab.gameObject.activeSelf) return;
|
||||
if (!_dysonTab.gameObject.activeSelf) return;
|
||||
var star = GameMain.localStar;
|
||||
if (star != null)
|
||||
{
|
||||
|
||||
@@ -25,6 +25,12 @@ public class UXAssist : BaseUnityPlugin
|
||||
private void Awake()
|
||||
{
|
||||
Hotkey = Config.Bind("General", "Shortcut", KeyboardShortcut.Deserialize("BackQuote + LeftAlt"), "Shortcut to open config window");
|
||||
GamePatch.EnableWindowResizeEnabled = Config.Bind("Game", "EnableWindowResize", false,
|
||||
"Enable game window resize (maximum box and thick frame)");
|
||||
GamePatch.LoadLastWindowRectEnabled = Config.Bind("Game", "LoadLastWindowRect", false,
|
||||
"Load last window position and size when game starts");
|
||||
GamePatch.LastWindowRect = Config.Bind("Game", "LastWindowRect", new Vector4(0f, 0f, 0f, 0f),
|
||||
"Last window position and size");
|
||||
FactoryPatch.UnlimitInteractiveEnabled = Config.Bind("Factory", "UnlimitInteractive", false,
|
||||
"Unlimit interactive range");
|
||||
FactoryPatch.RemoveSomeConditionEnabled = Config.Bind("Factory", "RemoveSomeBuildConditionCheck", false,
|
||||
@@ -55,6 +61,7 @@ public class UXAssist : BaseUnityPlugin
|
||||
|
||||
MyWindowManager.Init();
|
||||
UIConfigWindow.Init();
|
||||
GamePatch.Init();
|
||||
FactoryPatch.Init();
|
||||
PlanetPatch.Init();
|
||||
PlayerPatch.Init();
|
||||
@@ -67,6 +74,7 @@ public class UXAssist : BaseUnityPlugin
|
||||
PlayerPatch.Uninit();
|
||||
PlanetPatch.Uninit();
|
||||
FactoryPatch.Uninit();
|
||||
GamePatch.Uninit();
|
||||
MyWindowManager.Uninit();
|
||||
|
||||
_patch?.UnpatchSelf();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<BepInExPluginGuid>org.soardev.uxassist</BepInExPluginGuid>
|
||||
<Description>DSP MOD - UXAssist</Description>
|
||||
<Version>1.0.1</Version>
|
||||
<Version>1.0.2</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<PackageId>UXAssist</PackageId>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "UXAssist",
|
||||
"version_number": "1.0.1",
|
||||
"version_number": "1.0.2",
|
||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist",
|
||||
"description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁",
|
||||
"dependencies": [
|
||||
|
||||
Reference in New Issue
Block a user