mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-09 03:33:29 +08:00
WIP
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
## Changlog
|
||||
|
||||
* 1.2.5
|
||||
+ `Drag building power poles in maximum connection range`: Add a new config option to enable `Build Tesla Tower and Wireless Power Tower alternately`
|
||||
+ `Drag building power poles in maximum connection range`: Add a new config option `Build Tesla Tower and Wireless Power Tower alternately`
|
||||
* 1.2.4
|
||||
+ `Sunlight at night`:
|
||||
- Fix flickering issue while mecha is sailing.
|
||||
|
||||
@@ -64,7 +64,10 @@ public static class WinApi
|
||||
public const int WM_ENABLE = 0x000A;
|
||||
public const int WM_CLOSE = 0x0010;
|
||||
public const int WM_QUIT = 0x0012;
|
||||
public const int WM_SYSCOMMAND = 0x0112;
|
||||
public const int WM_SIZING = 0x0214;
|
||||
public const int WM_MOVING = 0x0216;
|
||||
public const long SC_MOVE = 0xF010L;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -84,6 +87,8 @@ public static class WinApi
|
||||
|
||||
#endregion
|
||||
|
||||
#region Functions
|
||||
|
||||
public delegate IntPtr WndProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);
|
||||
|
||||
[DllImport("user32", CharSet = CharSet.Unicode)]
|
||||
@@ -129,6 +134,8 @@ public static class WinApi
|
||||
[DllImport("user32", CharSet = CharSet.Unicode)]
|
||||
public static extern IntPtr CallWindowProc(IntPtr lpPrevWndFunc, IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam);
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetLogicalProcessorInformation
|
||||
|
||||
[Flags]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
using UXAssist.Common;
|
||||
|
||||
namespace UXAssist.Functions;
|
||||
@@ -16,14 +16,18 @@ public static class WindowFunctions
|
||||
private static IntPtr _oldWndProc = IntPtr.Zero;
|
||||
private static IntPtr _gameWindowHandle = IntPtr.Zero;
|
||||
|
||||
private static bool _gameLoaded;
|
||||
|
||||
public static void Start()
|
||||
{
|
||||
GameLogic.OnDataLoaded += () => { _gameLoaded = true; };
|
||||
var wndProc = new WinApi.WndProc(GameWndProc);
|
||||
var gameWnd = FindGameWindow();
|
||||
if (gameWnd != IntPtr.Zero)
|
||||
{
|
||||
_oldWndProc = WinApi.SetWindowLongPtr(gameWnd, WinApi.GWLP_WNDPROC, Marshal.GetFunctionPointerForDelegate(wndProc));
|
||||
}
|
||||
Patches.GamePatch.LoadLastWindowRect.MoveWindowPosition(true);
|
||||
}
|
||||
|
||||
private static IntPtr GameWndProc(IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam)
|
||||
@@ -40,6 +44,40 @@ public static class WindowFunctions
|
||||
WinApi.SetWindowLongPtr(_gameWindowHandle, WinApi.GWLP_WNDPROC, _oldWndProc);
|
||||
}
|
||||
break;
|
||||
case WinApi.WM_SYSCOMMAND:
|
||||
switch ((long)wParam & 0xFFF0L)
|
||||
{
|
||||
case WinApi.SC_MOVE:
|
||||
if (!_gameLoaded) return (IntPtr)1L;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case WinApi.WM_MOVING:
|
||||
if (_gameLoaded) break;
|
||||
var rect = Patches.GamePatch.LastWindowRect.Value;
|
||||
if (rect is { z: 0f, w: 0f }) break;
|
||||
var x = Mathf.RoundToInt(rect.x);
|
||||
var y = Mathf.RoundToInt(rect.y);
|
||||
var rect2 = Marshal.PtrToStructure<WinApi.Rect>(lParam);
|
||||
rect2.Left = x;
|
||||
rect2.Top = y;
|
||||
Marshal.StructureToPtr(rect2, lParam, false);
|
||||
break;
|
||||
case WinApi.WM_SIZING:
|
||||
if (_gameLoaded) break;
|
||||
rect = Patches.GamePatch.LastWindowRect.Value;
|
||||
if (rect is { z: 0f, w: 0f }) break;
|
||||
x = Mathf.RoundToInt(rect.x);
|
||||
y = Mathf.RoundToInt(rect.y);
|
||||
var w = Mathf.RoundToInt(rect.z);
|
||||
var h = Mathf.RoundToInt(rect.w);
|
||||
rect2 = Marshal.PtrToStructure<WinApi.Rect>(lParam);
|
||||
rect2.Left = x;
|
||||
rect2.Top = y;
|
||||
rect2.Right = x + w;
|
||||
rect2.Bottom = y + h;
|
||||
Marshal.StructureToPtr(rect2, lParam, false);
|
||||
break;
|
||||
}
|
||||
return WinApi.CallWindowProc(_oldWndProc, hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
||||
public static ConfigEntry<bool> ProtectVeinsFromExhaustionEnabled;
|
||||
public static ConfigEntry<bool> DoNotRenderEntitiesEnabled;
|
||||
public static ConfigEntry<bool> DragBuildPowerPolesEnabled;
|
||||
public static ConfigEntry<bool> DragBuildPowerPolesAlternatelyEnabled;
|
||||
public static ConfigEntry<bool> BeltSignalsForBuyOutEnabled;
|
||||
private static PressKeyBind _doNotRenderEntitiesKey;
|
||||
private static PressKeyBind _offgridfForPathsKey;
|
||||
@@ -68,6 +69,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
||||
ProtectVeinsFromExhaustionEnabled.SettingChanged += (_, _) => ProtectVeinsFromExhaustion.Enable(ProtectVeinsFromExhaustionEnabled.Value);
|
||||
DoNotRenderEntitiesEnabled.SettingChanged += (_, _) => DoNotRenderEntities.Enable(DoNotRenderEntitiesEnabled.Value);
|
||||
DragBuildPowerPolesEnabled.SettingChanged += (_, _) => DragBuildPowerPoles.Enable(DragBuildPowerPolesEnabled.Value);
|
||||
DragBuildPowerPolesAlternatelyEnabled.SettingChanged += (_, _) => DragBuildPowerPoles.AlternatelyChanged();
|
||||
BeltSignalsForBuyOutEnabled.SettingChanged += (_, _) => BeltSignalsForBuyOut.Enable(BeltSignalsForBuyOutEnabled.Value);
|
||||
}
|
||||
|
||||
@@ -1291,6 +1293,12 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
||||
GameLogic.OnGameBegin -= GameMain_Begin_Postfix;
|
||||
}
|
||||
|
||||
public static void AlternatelyChanged()
|
||||
{
|
||||
UnfixProto();
|
||||
FixProto();
|
||||
}
|
||||
|
||||
private static bool IsPowerPole(int id)
|
||||
{
|
||||
return PowerPoleIds.Contains(id);
|
||||
@@ -1308,7 +1316,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
||||
OldDragBuild.Add(powerPole.prefabDesc.dragBuild);
|
||||
OldDragBuildDist.Add(powerPole.prefabDesc.dragBuildDist);
|
||||
powerPole.prefabDesc.dragBuild = true;
|
||||
var distance = (id == 2201 ? LDB.items.Select(2202) : powerPole).prefabDesc.powerConnectDistance - 0.72f;
|
||||
var distance = (id == 2201 && DragBuildPowerPolesAlternatelyEnabled.Value ? LDB.items.Select(2202) : powerPole).prefabDesc.powerConnectDistance - 0.72f;
|
||||
powerPole.prefabDesc.dragBuildDist = new Vector2(distance, distance);
|
||||
}
|
||||
}
|
||||
@@ -1422,13 +1430,13 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
||||
new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(BuildPreview), nameof(BuildPreview.desc)))
|
||||
).Advance(2).InsertAndAdvance(new CodeInstruction(OpCodes.Ldloc_S, 6)).SetInstructionAndAdvance(Transpilers.EmitDelegate((BuildTool_Click click, int i) =>
|
||||
{
|
||||
if ((i & 1) == 0) return click.handItem;
|
||||
if (!DragBuildPowerPolesAlternatelyEnabled.Value || (i & 1) == 0) return click.handItem;
|
||||
var id = click.handItem.ID;
|
||||
if (id != 2201 && id != 2202) return click.handItem;
|
||||
return LDB.items.Select(id ^ 3);
|
||||
})).Advance(3).InsertAndAdvance(new CodeInstruction(OpCodes.Ldloc_S, 6)).SetInstructionAndAdvance(Transpilers.EmitDelegate((BuildTool_Click click, int i) =>
|
||||
{
|
||||
if ((i & 1) == 0) return click.handPrefabDesc;
|
||||
if (!DragBuildPowerPolesAlternatelyEnabled.Value || (i & 1) == 0) return click.handPrefabDesc;
|
||||
var id = click.handItem.ID;
|
||||
if (id != 2201 && id != 2202) return click.handPrefabDesc;
|
||||
return LDB.items.Select(id ^ 3).prefabDesc;
|
||||
|
||||
@@ -213,7 +213,7 @@ public class GamePatch: PatchImpl<GamePatch>
|
||||
}
|
||||
}
|
||||
|
||||
private class LoadLastWindowRect: PatchImpl<LoadLastWindowRect>
|
||||
public class LoadLastWindowRect: PatchImpl<LoadLastWindowRect>
|
||||
{
|
||||
private static bool _loaded;
|
||||
|
||||
@@ -273,7 +273,7 @@ public class GamePatch: PatchImpl<GamePatch>
|
||||
GameLogic.OnDataLoaded -= VFPreload_InvokeOnLoadWorkEnded_Postfix;
|
||||
}
|
||||
|
||||
private static void MoveWindowPosition()
|
||||
public static void MoveWindowPosition(bool setResolution = false)
|
||||
{
|
||||
if (Screen.fullScreenMode is FullScreenMode.ExclusiveFullScreen or FullScreenMode.FullScreenWindow or FullScreenMode.MaximizedWindow || GameMain.isRunning) return;
|
||||
var wnd = Functions.WindowFunctions.FindGameWindow();
|
||||
@@ -282,6 +282,12 @@ public class GamePatch: PatchImpl<GamePatch>
|
||||
if (rect is { z: 0f, w: 0f }) return;
|
||||
var x = Mathf.RoundToInt(rect.x);
|
||||
var y = Mathf.RoundToInt(rect.y);
|
||||
if (setResolution)
|
||||
{
|
||||
var w = Mathf.RoundToInt(rect.z);
|
||||
var h = Mathf.RoundToInt(rect.w);
|
||||
Screen.SetResolution(w, h, false);
|
||||
}
|
||||
WinApi.SetWindowPos(wnd, IntPtr.Zero, x, y, 0, 0, 0x0235);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,14 +8,19 @@ namespace UXAssist.UI;
|
||||
// MyCheckBox modified from LSTM: https://github.com/hetima/DSP_LSTM/blob/main/LSTM/MyCheckBox.cs
|
||||
public class MyCheckBox : MonoBehaviour
|
||||
{
|
||||
public UIButton uiButton;
|
||||
public Image checkImage;
|
||||
public RectTransform rectTrans;
|
||||
public UIButton uiButton;
|
||||
public Image boxImage;
|
||||
public Image checkImage;
|
||||
public Text labelText;
|
||||
public event Action OnChecked;
|
||||
protected event Action OnFree;
|
||||
private bool _checked;
|
||||
|
||||
private static readonly Color BoxColor = new Color(1f, 1f, 1f, 100f / 255f);
|
||||
private static readonly Color CheckColor = new Color(1f, 1f, 1f, 1f);
|
||||
private static readonly Color TextColor = new Color(178f / 255f, 178f / 255f, 178f / 255f, 168f / 255f);
|
||||
|
||||
protected void OnDestroy()
|
||||
{
|
||||
OnFree?.Invoke();
|
||||
@@ -31,6 +36,23 @@ public class MyCheckBox : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void SetEnable(bool on)
|
||||
{
|
||||
if (uiButton) uiButton.enabled = on;
|
||||
if (on)
|
||||
{
|
||||
if (boxImage) boxImage.color = BoxColor;
|
||||
if (checkImage) checkImage.color = CheckColor;
|
||||
if (labelText) labelText.color = TextColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (boxImage) boxImage.color = BoxColor.RGBMultiplied(0.5f);
|
||||
if (checkImage) checkImage.color = CheckColor.RGBMultiplied(0.5f);
|
||||
if (labelText) labelText.color = TextColor.RGBMultiplied(0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
public static MyCheckBox CreateCheckBox(float x, float y, RectTransform parent, ConfigEntry<bool> config, string label = "", int fontSize = 15)
|
||||
{
|
||||
var cb = CreateCheckBox(x, y, parent, config.Value, label, fontSize);
|
||||
@@ -54,6 +76,7 @@ public class MyCheckBox : MonoBehaviour
|
||||
|
||||
cb.rectTrans = rect;
|
||||
cb.uiButton = go.GetComponent<UIButton>();
|
||||
cb.boxImage = go.transform.GetComponent<Image>();
|
||||
cb.checkImage = go.transform.Find("checked")?.GetComponent<Image>();
|
||||
|
||||
var child = go.transform.Find("text");
|
||||
|
||||
@@ -8,12 +8,31 @@ namespace UXAssist.UI;
|
||||
|
||||
public class MySlider : MonoBehaviour
|
||||
{
|
||||
public Slider slider;
|
||||
public RectTransform rectTrans;
|
||||
public Slider slider;
|
||||
public RectTransform handleSlideArea;
|
||||
public Text labelText;
|
||||
public string labelFormat;
|
||||
public event Action OnValueChanged;
|
||||
private float _value;
|
||||
|
||||
public void SetEnable(bool on)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
if (slider) slider.interactable = on;
|
||||
}
|
||||
}
|
||||
|
||||
public MySlider MakeHandleSmaller(float deltaX = 10f, float deltaY = 0f)
|
||||
{
|
||||
var oldSize = slider.handleRect.sizeDelta;
|
||||
slider.handleRect.sizeDelta = new Vector2(oldSize.x - deltaX, oldSize.y - deltaY);
|
||||
handleSlideArea.offsetMin = new Vector2(handleSlideArea.offsetMin.x - deltaX / 2, handleSlideArea.offsetMin.y);
|
||||
handleSlideArea.offsetMax = new Vector2(handleSlideArea.offsetMax.x + deltaX / 2, handleSlideArea.offsetMax.y);
|
||||
return this;
|
||||
}
|
||||
|
||||
public float Value
|
||||
{
|
||||
get => _value;
|
||||
@@ -48,7 +67,7 @@ public class MySlider : MonoBehaviour
|
||||
sl.slider.onValueChanged.RemoveAllListeners();
|
||||
sl.slider.onValueChanged.AddListener(sl.SliderChanged);
|
||||
sl.labelText = sl.slider.handleRect.Find("Text")?.GetComponent<Text>();
|
||||
if (sl.labelText != null)
|
||||
if (sl.labelText)
|
||||
{
|
||||
sl.labelText.fontSize = 14;
|
||||
if (sl.labelText.transform is RectTransform rectTrans)
|
||||
@@ -58,6 +77,8 @@ public class MySlider : MonoBehaviour
|
||||
}
|
||||
sl.labelFormat = format;
|
||||
|
||||
sl.handleSlideArea = sl.transform.Find("Handle Slide Area")?.GetComponent<RectTransform>();
|
||||
|
||||
var bg = sl.slider.transform.Find("Background")?.GetComponent<Image>();
|
||||
if (bg != null)
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ public class MyWindow : ManualBehaviour
|
||||
protected const float TabHeight = 27f;
|
||||
protected const float Margin = 30f;
|
||||
protected const float Spacing = 10f;
|
||||
protected event Action OnFree;
|
||||
public event Action OnFree;
|
||||
|
||||
public override void _OnFree()
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UXAssist.UI;
|
||||
using UXAssist.Common;
|
||||
using UXAssist.Functions;
|
||||
@@ -57,6 +59,7 @@ public static class UIConfigWindow
|
||||
"默认矿脉数量保护于剩余100,采油速保护于速度1.0/s,你可以在配置文件中自行设置。\n当达到保护值时,矿脉和油井将不再被开采。\n关闭此功能以恢复开采,一般是当你在`矿物利用`上有足够的等级时。\n");
|
||||
I18N.Add("Do not render factory entities", "Do not render factory entities (except belts and sorters)", "不渲染工厂建筑实体(除了传送带和分拣器)");
|
||||
I18N.Add("Drag building power poles in maximum connection range", "Drag building power poles in maximum connection range", "拖动建造电线杆时自动使用最大连接距离间隔");
|
||||
I18N.Add("Build Tesla Tower and Wireless Power Tower alternately", "Build Tesla Tower and Wireless Power Tower alternately", "交替建造电力感应塔和无线输电塔");
|
||||
I18N.Add("Allow overflow for Logistic Stations and Advanced Mining Machines", "Allow overflow for Logistic Stations and Advanced Mining Machines", "允许物流站和大型采矿机物品溢出");
|
||||
I18N.Add("Belt signals for buy out dark fog items automatically", "Belt signals for buy out dark fog items automatically", "用于自动购买黑雾物品的传送带信号");
|
||||
I18N.Add("Logistics Control Panel Improvement", "Logistics Control Panel Improvement", "物流控制面板改进");
|
||||
@@ -131,8 +134,6 @@ public static class UIConfigWindow
|
||||
|
||||
private static void CreateUI(MyConfigWindow wnd, RectTransform trans)
|
||||
{
|
||||
MyCheckBox checkBoxForMeasureTipsPos;
|
||||
|
||||
_windowTrans = trans;
|
||||
wnd.AddTabGroup(trans, "UXAssist", "tab-group-uxassist");
|
||||
var tab1 = wnd.AddTab(trans, "General");
|
||||
@@ -143,9 +144,7 @@ public static class UIConfigWindow
|
||||
wnd.AddCheckBox(x, y, tab1, GamePatch.LoadLastWindowRectEnabled, "Remeber window position and size on last exit");
|
||||
y += 36f;
|
||||
var txt = wnd.AddText2(x + 2f, y, tab1, "Scale up mouse cursor", 15, "text-scale-up-mouse-cursor");
|
||||
x += txt.preferredWidth + 5f;
|
||||
wnd.AddSlider(x + 2f, y + 6f, tab1, GamePatch.MouseCursorScaleUpMultiplier, [1, 2, 3, 4], "0x", 100f);
|
||||
x = 0f;
|
||||
wnd.AddSlider(x + txt.preferredWidth + 7f, y + 6f, tab1, GamePatch.MouseCursorScaleUpMultiplier, [1, 2, 3, 4], "0x", 100f);
|
||||
/*
|
||||
y += 30f;
|
||||
wnd.AddCheckBox(x, y, tab1, GamePatch.AutoSaveOptEnabled, "Better auto-save mechanism");
|
||||
@@ -156,15 +155,15 @@ public static class UIConfigWindow
|
||||
*/
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab1, GamePatch.ConvertSavesFromPeaceEnabled, "Convert old saves to Combat Mode on loading");
|
||||
|
||||
MyCheckBox checkBoxForMeasureTextWidth;
|
||||
if (WindowFunctions.ProfileName != null)
|
||||
{
|
||||
y += 36f;
|
||||
checkBoxForMeasureTipsPos = wnd.AddCheckBox(x, y, tab1, GamePatch.ProfileBasedSaveFolderEnabled, "Profile-based save folder");
|
||||
x += checkBoxForMeasureTipsPos.Width + 5f;
|
||||
y += 6f;
|
||||
wnd.AddTipsButton2(x, y, tab1, "Profile-based save folder", "Profile-based save folder tips", "btn-profile-based-save-folder-tips");
|
||||
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab1, GamePatch.ProfileBasedSaveFolderEnabled, "Profile-based save folder");
|
||||
wnd.AddTipsButton2(checkBoxForMeasureTextWidth.Width + 5f, y + 6f, tab1, "Profile-based save folder", "Profile-based save folder tips", "btn-profile-based-save-folder-tips");
|
||||
x = 0;
|
||||
y += 24f;
|
||||
y += 30f;
|
||||
wnd.AddText2(x, y, tab1, "Default profile name", 15, "text-default-profile-name");
|
||||
y += 24f;
|
||||
wnd.AddInputField(x, y, 200f, tab1, GamePatch.DefaultProfileName, 15, "input-profile-save-folder");
|
||||
@@ -179,9 +178,9 @@ public static class UIConfigWindow
|
||||
{
|
||||
y += 36f;
|
||||
txt = wnd.AddText2(x + 2f, y, tab1, "Logical Frame Rate", 15, "game-frame-rate");
|
||||
x += txt.preferredWidth + 5f;
|
||||
wnd.AddSlider(x + 2f, y + 6f, tab1, GamePatch.GameUpsFactor, new UpsMapper(), "0.0x", 200f);
|
||||
var btn = wnd.AddFlatButton(x + 204f, y + 6f, tab1, "Reset", 13, "reset-game-frame-rate", () => GamePatch.GameUpsFactor.Value = 1.0f);
|
||||
x += txt.preferredWidth + 7f;
|
||||
wnd.AddSlider(x, y + 6f, tab1, GamePatch.GameUpsFactor, new UpsMapper(), "0.0x", 100f).MakeHandleSmaller();
|
||||
var btn = wnd.AddFlatButton(x + 104f, y + 6f, tab1, "Reset", 13, "reset-game-frame-rate", () => GamePatch.GameUpsFactor.Value = 1.0f);
|
||||
((RectTransform)btn.transform).sizeDelta = new Vector2(40f, 20f);
|
||||
}
|
||||
|
||||
@@ -192,15 +191,14 @@ public static class UIConfigWindow
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.RemoveBuildRangeLimitEnabled, "Remove build range limit");
|
||||
y += 36f;
|
||||
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");
|
||||
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab2, FactoryPatch.NightLightEnabled, "Night Light");
|
||||
x += checkBoxForMeasureTextWidth.Width + 5f + 10f;
|
||||
txt = wnd.AddText2(x, y + 2f, 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);
|
||||
wnd.AddSlider(x, y + 7f, tab2, FactoryPatch.NightLightAngleX, new AngleMapper(), "0", 60f).MakeHandleSmaller();
|
||||
x += 70f;
|
||||
txt = wnd.AddText2(x, y + 2f, tab2, "Y:", 13, "text-nightlight-angle-y");
|
||||
wnd.AddSlider(x + txt.preferredWidth + 5f, y + 7f, tab2, FactoryPatch.NightLightAngleY, new AngleMapper(), "0", 60f).MakeHandleSmaller();
|
||||
x = 0;
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.LargerAreaForUpgradeAndDismantleEnabled, "Larger area for upgrade and dismantle");
|
||||
@@ -209,21 +207,22 @@ public static class UIConfigWindow
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.OffGridBuildingEnabled, "Off-grid building and stepped rotation");
|
||||
y += 36f;
|
||||
checkBoxForMeasureTipsPos = wnd.AddCheckBox(x, y, tab2, FactoryPatch.TreatStackingAsSingleEnabled, "Treat stack items as single in monitor components");
|
||||
x += checkBoxForMeasureTipsPos.Width + 5f;
|
||||
y += 6f;
|
||||
wnd.AddTipsButton2(x, y, tab2, "Enhance control for logistic storage limits", "Enhance control for logistic storage limits tips", "enhanced-logistic-limit-tips");
|
||||
x = 0f;
|
||||
y += 30f;
|
||||
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab2, FactoryPatch.TreatStackingAsSingleEnabled, "Treat stack items as single in monitor components");
|
||||
wnd.AddTipsButton2(x + checkBoxForMeasureTextWidth.Width + 5f, y + 6f, tab2, "Enhance control for logistic storage limits", "Enhance control for logistic storage limits tips", "enhanced-logistic-limit-tips");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.QuickBuildAndDismantleLabsEnabled, "Quick build and dismantle stacking labs");
|
||||
y += 36f;
|
||||
checkBoxForMeasureTipsPos = wnd.AddCheckBox(x, y, tab2, FactoryPatch.ProtectVeinsFromExhaustionEnabled, "Protect veins from exhaustion");
|
||||
x += checkBoxForMeasureTipsPos.Width + 5f;
|
||||
y += 6f;
|
||||
wnd.AddTipsButton2(x, y, tab2, "Protect veins from exhaustion", "Protect veins from exhaustion tips", "protect-veins-tips");
|
||||
x = 0f;
|
||||
y += 30f;
|
||||
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab2, FactoryPatch.ProtectVeinsFromExhaustionEnabled, "Protect veins from exhaustion");
|
||||
wnd.AddTipsButton2(x + checkBoxForMeasureTextWidth.Width + 5f, y + 6f, tab2, "Protect veins from exhaustion", "Protect veins from exhaustion tips", "protect-veins-tips");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.DragBuildPowerPolesEnabled, "Drag building power poles in maximum connection range");
|
||||
y += 36f;
|
||||
var alternatelyCheckBox = wnd.AddCheckBox(x + 20f, y, tab2, FactoryPatch.DragBuildPowerPolesAlternatelyEnabled, "Build Tesla Tower and Wireless Power Tower alternately", 13);
|
||||
EventHandler alternatelyCheckBoxChanged = (_, _) => { alternatelyCheckBox.SetEnable(FactoryPatch.DragBuildPowerPolesEnabled.Value); };
|
||||
FactoryPatch.DragBuildPowerPolesEnabled.SettingChanged += alternatelyCheckBoxChanged;
|
||||
wnd.OnFree += () => { FactoryPatch.DragBuildPowerPolesEnabled.SettingChanged -= alternatelyCheckBoxChanged; };
|
||||
alternatelyCheckBoxChanged(null, null);
|
||||
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.DoNotRenderEntitiesEnabled, "Do not render factory entities");
|
||||
y += 36f;
|
||||
@@ -241,27 +240,47 @@ public static class UIConfigWindow
|
||||
);
|
||||
y += 72f;
|
||||
wnd.AddButton(x, y, 200, tab2, "Quick build Orbital Collectors", 16, "button-init-planet", PlanetFunctions.BuildOrbitalCollectors);
|
||||
x += 10f;
|
||||
y += 30f;
|
||||
wnd.AddText2(x, y, tab2, "Maximum count to build", 15, "text-oc-build-count");
|
||||
wnd.AddText2(x + 10f, y, tab2, "Maximum count to build", 15, "text-oc-build-count");
|
||||
y += 24f;
|
||||
wnd.AddSlider(x, y, tab2, PlanetFunctions.OrbitalCollectorMaxBuildCount, new OcMapper(), "G", 200f);
|
||||
wnd.AddSlider(x + 10f, y, tab2, PlanetFunctions.OrbitalCollectorMaxBuildCount, new OcMapper(), "G", 200f);
|
||||
x = 400f;
|
||||
y += 54f;
|
||||
wnd.AddCheckBox(x, y, tab2, LogisticsPatch.LogisticsCapacityTweaksEnabled, "Enhance control for logistic storage limits");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, LogisticsPatch.AllowOverflowInLogisticsEnabled, "Allow overflow for Logistic Stations and Advanced Mining Machines");
|
||||
y += 36f;
|
||||
checkBoxForMeasureTipsPos = wnd.AddCheckBox(x, y, tab2, LogisticsPatch.LogisticsConstrolPanelImprovementEnabled, "Logistics Control Panel Improvement");
|
||||
wnd.AddTipsButton2(x + checkBoxForMeasureTipsPos.Width + 5f, y + 6f, tab2, "Logistics Control Panel Improvement", "Logistics Control Panel Improvement tips", "lcp-improvement-tips");
|
||||
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab2, LogisticsPatch.LogisticsConstrolPanelImprovementEnabled, "Logistics Control Panel Improvement");
|
||||
wnd.AddTipsButton2(x + checkBoxForMeasureTextWidth.Width + 5f, y + 6f, tab2, "Logistics Control Panel Improvement", "Logistics Control Panel Improvement tips", "lcp-improvement-tips");
|
||||
y += 36f;
|
||||
var cb0 = wnd.AddCheckBox(x, y, tab2, LogisticsPatch.RealtimeLogisticsInfoPanelEnabled, "Real-time logistic stations info panel");
|
||||
var cb1 = wnd.AddCheckBox(x + 26f, y + 26f, tab2, LogisticsPatch.RealtimeLogisticsInfoPanelBarsEnabled, "Show status bars for storage items", 13);
|
||||
y += 36f;
|
||||
var cb1 = wnd.AddCheckBox(x + 20f, y, tab2, LogisticsPatch.RealtimeLogisticsInfoPanelBarsEnabled, "Show status bars for storage items", 13);
|
||||
EventHandler anySettingsChanged = (_, _) =>
|
||||
{
|
||||
if (ModsCompat.AuxilaryfunctionWrapper.ShowStationInfo == null)
|
||||
{
|
||||
cb0.SetEnable(true);
|
||||
cb1.SetEnable(LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.Value);
|
||||
return;
|
||||
}
|
||||
|
||||
var on = !ModsCompat.AuxilaryfunctionWrapper.ShowStationInfo.Value;
|
||||
cb0.SetEnable(on);
|
||||
cb1.SetEnable(on & LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.Value);
|
||||
if (!on)
|
||||
{
|
||||
LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.Value = false;
|
||||
}
|
||||
};
|
||||
if (ModsCompat.AuxilaryfunctionWrapper.ShowStationInfo != null)
|
||||
{
|
||||
ModsCompat.AuxilaryfunctionWrapper.ShowStationInfo.SettingChanged += (_, _) => { OnAuxilaryInfoPanelChanged(); };
|
||||
OnAuxilaryInfoPanelChanged();
|
||||
ModsCompat.AuxilaryfunctionWrapper.ShowStationInfo.SettingChanged += anySettingsChanged;
|
||||
wnd.OnFree += () => { ModsCompat.AuxilaryfunctionWrapper.ShowStationInfo.SettingChanged -= anySettingsChanged; };
|
||||
}
|
||||
LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.SettingChanged += anySettingsChanged;
|
||||
wnd.OnFree += () => { LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.SettingChanged -= anySettingsChanged; };
|
||||
anySettingsChanged(null, null);
|
||||
|
||||
var tab3 = wnd.AddTab(trans, "Player/Mecha");
|
||||
x = 0f;
|
||||
@@ -272,23 +291,26 @@ public static class UIConfigWindow
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab3, PlayerPatch.HideTipsForSandsChangesEnabled, "Hide tips for soil piles changes");
|
||||
y += 36f;
|
||||
checkBoxForMeasureTipsPos = wnd.AddCheckBox(x, y, tab3, PlayerPatch.EnhancedMechaForgeCountControlEnabled, "Enhanced count control for hand-make");
|
||||
x += checkBoxForMeasureTipsPos.Width + 5f;
|
||||
y += 6f;
|
||||
wnd.AddTipsButton2(x, y, tab3, "Enhanced count control for hand-make", "Enhanced count control for hand-make tips", "enhanced-count-control-tips");
|
||||
x = 0f;
|
||||
y += 30f;
|
||||
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab3, PlayerPatch.EnhancedMechaForgeCountControlEnabled, "Enhanced count control for hand-make");
|
||||
wnd.AddTipsButton2(x + checkBoxForMeasureTextWidth.Width + 5f, y + 6f, tab3, "Enhanced count control for hand-make", "Enhanced count control for hand-make tips", "enhanced-count-control-tips");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab3, PlayerPatch.AutoNavigationEnabled, "Auto navigation on sailings");
|
||||
x = 20f;
|
||||
y += 26f;
|
||||
wnd.AddCheckBox(x, y, tab3, PlayerPatch.AutoCruiseEnabled, "Enable auto-cruise", 13);
|
||||
x = 10f;
|
||||
var navcb1 = wnd.AddCheckBox(x + 20f, y, tab3, PlayerPatch.AutoCruiseEnabled, "Enable auto-cruise", 13);
|
||||
y += 26f;
|
||||
wnd.AddCheckBox(x, y, tab3, PlayerPatch.AutoBoostEnabled, "Auto boost", 13);
|
||||
var navcb2 = wnd.AddCheckBox(x + 20f, y, tab3, PlayerPatch.AutoBoostEnabled, "Auto boost", 13);
|
||||
y += 32f;
|
||||
wnd.AddText2(x, y, tab3, "Distance to use warp", 15, "text-distance-to-warp");
|
||||
y += 24f;
|
||||
wnd.AddSlider(x, y, tab3, PlayerPatch.DistanceToWarp, new DistanceMapper(), "0.0", 200f);
|
||||
txt = wnd.AddText2(x + 20f, y, tab3, "Distance to use warp", 15, "text-distance-to-warp");
|
||||
var navSlider = wnd.AddSlider(x + 20f + txt.preferredWidth + 5f, y + 6f, tab3, PlayerPatch.DistanceToWarp, new DistanceMapper(), "0.0", 100f);
|
||||
EventHandler navSettingChanged = (_, _) =>
|
||||
{
|
||||
navcb1.SetEnable(PlayerPatch.AutoNavigationEnabled.Value);
|
||||
navcb2.SetEnable(PlayerPatch.AutoNavigationEnabled.Value);
|
||||
navSlider.SetEnable(PlayerPatch.AutoNavigationEnabled.Value);
|
||||
};
|
||||
PlayerPatch.AutoNavigationEnabled.SettingChanged += navSettingChanged;
|
||||
wnd.OnFree += () => { PlayerPatch.AutoNavigationEnabled.SettingChanged -= navSettingChanged; };
|
||||
navSettingChanged(null, null);
|
||||
|
||||
var tab4 = wnd.AddTab(trans, "Dyson Sphere");
|
||||
x = 0f;
|
||||
@@ -364,24 +386,6 @@ public static class UIConfigWindow
|
||||
uiGame.OpenCommunicatorWindow(5);
|
||||
});
|
||||
return;
|
||||
|
||||
void OnAuxilaryInfoPanelChanged()
|
||||
{
|
||||
if (ModsCompat.AuxilaryfunctionWrapper.ShowStationInfo == null)
|
||||
{
|
||||
cb0.gameObject.SetActive(true);
|
||||
cb1.gameObject.SetActive(true);
|
||||
return;
|
||||
}
|
||||
|
||||
var on = !ModsCompat.AuxilaryfunctionWrapper.ShowStationInfo.Value;
|
||||
cb0.gameObject.SetActive(on);
|
||||
cb1.gameObject.SetActive(on);
|
||||
if (!on)
|
||||
{
|
||||
LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.Value = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void UpdateUI()
|
||||
|
||||
@@ -116,6 +116,8 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
||||
"Do not render factory entities");
|
||||
FactoryPatch.DragBuildPowerPolesEnabled = Config.Bind("Factory", "DragBuildPowerPoles", false,
|
||||
"Drag building power poles in maximum connection range");
|
||||
FactoryPatch.DragBuildPowerPolesAlternatelyEnabled = Config.Bind("Factory", "DragBuildPowerPolesAlternately", true,
|
||||
"Build Tesla Tower and Wireless Power Tower alternately");
|
||||
FactoryPatch.BeltSignalsForBuyOutEnabled = Config.Bind("Factory", "BeltSignalsForBuyOut", false,
|
||||
"Belt signals for buy out dark fog items automatically");
|
||||
LogisticsPatch.LogisticsCapacityTweaksEnabled = Config.Bind("Factory", "LogisticsCapacityTweaks", true,
|
||||
|
||||
Reference in New Issue
Block a user