mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-08 22:13:30 +08:00
WIP
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using BepInEx.Configuration;
|
||||
using UnityEngine;
|
||||
using UXAssist.Common;
|
||||
using UXAssist.Patches;
|
||||
|
||||
namespace UXAssist.Functions;
|
||||
|
||||
@@ -33,6 +33,11 @@ public static class WindowFunctions
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
I18N.Add("Cores: {0}\nThreads: {1}", "Cores: {0}\nThreads: {1}", "内核数: {0}\n线程数: {1}");
|
||||
I18N.Add("\nP-Cores: {0}\nE-Cores: {1}", "\nP-Cores: {0}\nE-Cores: {1}", "\n性能核心: {0}\n能效核心: {1}");
|
||||
I18N.Add("\nPriority: {0}", "\nProcess priority: {0}", "\n进程优先级: {0}");
|
||||
I18N.Add("\nEnabled CPUs: ", "\nEnabled CPUs: ", "\n使用的CPU: ");
|
||||
I18N.Add("Unknown", "Unknown", "未知");
|
||||
ProcessorDetails = WinApi.GetLogicalProcessorDetails();
|
||||
}
|
||||
|
||||
@@ -45,7 +50,7 @@ public static class WindowFunctions
|
||||
{
|
||||
_oldWndProc = WinApi.SetWindowLongPtr(gameWnd, WinApi.GWLP_WNDPROC, Marshal.GetFunctionPointerForDelegate(wndProc));
|
||||
}
|
||||
Patches.GamePatch.LoadLastWindowRect.MoveWindowPosition(true);
|
||||
GamePatch.LoadLastWindowRect.MoveWindowPosition(true);
|
||||
|
||||
ProcessPriority.SettingChanged += (_, _) => WinApi.SetPriorityClass(WinApi.GetCurrentProcess(), ProrityFlags[ProcessPriority.Value]);
|
||||
WinApi.SetPriorityClass(WinApi.GetCurrentProcess(), ProrityFlags[ProcessPriority.Value]);
|
||||
@@ -104,7 +109,7 @@ public static class WindowFunctions
|
||||
break;
|
||||
case WinApi.WM_MOVING:
|
||||
if (_gameLoaded) break;
|
||||
var rect = Patches.GamePatch.LastWindowRect.Value;
|
||||
var rect = GamePatch.LastWindowRect.Value;
|
||||
if (rect is { z: 0f, w: 0f }) break;
|
||||
var x = Mathf.RoundToInt(rect.x);
|
||||
var y = Mathf.RoundToInt(rect.y);
|
||||
@@ -115,7 +120,7 @@ public static class WindowFunctions
|
||||
break;
|
||||
case WinApi.WM_SIZING:
|
||||
if (_gameLoaded) break;
|
||||
rect = Patches.GamePatch.LastWindowRect.Value;
|
||||
rect = GamePatch.LastWindowRect.Value;
|
||||
if (rect is { z: 0f, w: 0f }) break;
|
||||
x = Mathf.RoundToInt(rect.x);
|
||||
y = Mathf.RoundToInt(rect.y);
|
||||
@@ -132,25 +137,38 @@ public static class WindowFunctions
|
||||
return WinApi.CallWindowProc(_oldWndProc, hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
private static string GetPriorityName(int priority)
|
||||
{
|
||||
return priority switch
|
||||
{
|
||||
WinApi.HIGH_PRIORITY_CLASS => "High".Translate(),
|
||||
WinApi.ABOVE_NORMAL_PRIORITY_CLASS => "Above Normal".Translate(),
|
||||
WinApi.NORMAL_PRIORITY_CLASS => "Normal".Translate(),
|
||||
WinApi.BELOW_NORMAL_PRIORITY_CLASS => "Below Normal".Translate(),
|
||||
WinApi.IDLE_PRIORITY_CLASS => "Idle".Translate(),
|
||||
_ => "Unknown".Translate()
|
||||
};
|
||||
}
|
||||
|
||||
public static void ShowCPUInfo()
|
||||
{
|
||||
var details = WinApi.GetLogicalProcessorDetails();
|
||||
var msg = $"Cores: {details.CoreCount}\nThreads: {details.ThreadCount}";
|
||||
var details = ProcessorDetails;
|
||||
var msg = string.Format("Cores: {0}\nThreads: {1}".Translate(), details.CoreCount, details.ThreadCount);
|
||||
var hybrid = details.HybridArchitecture;
|
||||
if (hybrid)
|
||||
{
|
||||
msg += $"\nP-Cores: {details.PerformanceCoreCount}\nE-Cores: {details.EfficiencyCoreCount}";
|
||||
msg += string.Format("\nP-Cores: {0}\nE-Cores: {1}".Translate(), details.PerformanceCoreCount, details.EfficiencyCoreCount);
|
||||
}
|
||||
|
||||
var handle = WinApi.GetCurrentProcess();
|
||||
var prio = (ProcessPriorityClass)WinApi.GetPriorityClass(handle);
|
||||
msg += $"\nPriority: {prio}";
|
||||
var prio = GetPriorityName(WinApi.GetPriorityClass(handle));
|
||||
msg += string.Format("\nPriority: {0}".Translate(), prio);
|
||||
|
||||
var aff = 0UL;
|
||||
if (WinApi.GetProcessAffinityMask(handle, out var processMask, out var systemMask))
|
||||
aff = (ulong)processMask & (ulong)systemMask;
|
||||
aff = processMask & systemMask;
|
||||
|
||||
msg += $"\nEnabled CPUs: ";
|
||||
msg += "\nEnabled CPUs: ".Translate();
|
||||
var first = true;
|
||||
for (var i = 0; aff != 0UL; i++)
|
||||
{
|
||||
@@ -173,7 +191,7 @@ public static class WindowFunctions
|
||||
aff >>= 1;
|
||||
}
|
||||
|
||||
UIMessageBox.Show("CPU Info".Translate(), msg, "OK".Translate(), -1);
|
||||
UIMessageBox.Show("CPU Info".Translate(), msg, "确定".Translate(), -1);
|
||||
}
|
||||
|
||||
public static void SetWindowTitle()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using BepInEx.Bootstrap;
|
||||
using BepInEx.Configuration;
|
||||
using HarmonyLib;
|
||||
using UXAssist.Patches;
|
||||
@@ -12,7 +13,7 @@ public static class AuxilaryfunctionWrapper
|
||||
|
||||
public static void Start(Harmony harmony)
|
||||
{
|
||||
if (!BepInEx.Bootstrap.Chainloader.PluginInfos.TryGetValue(AuxilaryfunctionGuid, out var pluginInfo)) return;
|
||||
if (!Chainloader.PluginInfos.TryGetValue(AuxilaryfunctionGuid, out var pluginInfo)) return;
|
||||
var assembly = pluginInfo.Instance.GetType().Assembly;
|
||||
try
|
||||
{
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection.Emit;
|
||||
using BepInEx.Bootstrap;
|
||||
using HarmonyLib;
|
||||
using UXAssist.Common;
|
||||
|
||||
namespace UXAssist.ModsCompat;
|
||||
|
||||
@@ -12,6 +10,6 @@ public static class BulletTimeWrapper
|
||||
|
||||
public static void Start(Harmony _)
|
||||
{
|
||||
HasBulletTime = BepInEx.Bootstrap.Chainloader.PluginInfos.TryGetValue(BulletTimeGuid, out var _);
|
||||
HasBulletTime = Chainloader.PluginInfos.TryGetValue(BulletTimeGuid, out var _);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using BepInEx.Configuration;
|
||||
using HarmonyLib;
|
||||
using UnityEngine.UI;
|
||||
using UXAssist.Common;
|
||||
|
||||
namespace UXAssist.Patches;
|
||||
@@ -428,7 +429,7 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
new CodeInstruction(OpCodes.Ldarg_2),
|
||||
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(DysonSwarm), nameof(DysonSwarm.starData))),
|
||||
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(StarData), nameof(StarData.index))),
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(StopEjectOnNodeComplete), nameof(StopEjectOnNodeComplete.AnyNodeForAbsorb))),
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(StopEjectOnNodeComplete), nameof(AnyNodeForAbsorb))),
|
||||
new CodeInstruction(OpCodes.And)
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
@@ -446,7 +447,7 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
matcher.Labels = [];
|
||||
matcher.Insert(
|
||||
new CodeInstruction(OpCodes.Ldarg_0).WithLabels(labels),
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(StopEjectOnNodeComplete), nameof(StopEjectOnNodeComplete.UpdateNodeForAbsorbOnSpChange)))
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(StopEjectOnNodeComplete), nameof(UpdateNodeForAbsorbOnSpChange)))
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
@@ -467,7 +468,7 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(DysonNode), nameof(DysonNode._cpReq)))
|
||||
).Advance(6).Insert(
|
||||
new CodeInstruction(OpCodes.Ldarg_0),
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(StopEjectOnNodeComplete), nameof(StopEjectOnNodeComplete.UpdateNodeForAbsorbOnCpChange)))
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(StopEjectOnNodeComplete), nameof(UpdateNodeForAbsorbOnCpChange)))
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
@@ -483,7 +484,7 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
// this.stateText.text = "轨道未设置".Translate();
|
||||
new CodeMatch(OpCodes.Ldstr, "待机"),
|
||||
new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(Localization), nameof(Localization.Translate))),
|
||||
new CodeMatch(OpCodes.Callvirt, AccessTools.PropertySetter(typeof(UnityEngine.UI.Text), nameof(UnityEngine.UI.Text.text)))
|
||||
new CodeMatch(OpCodes.Callvirt, AccessTools.PropertySetter(typeof(Text), nameof(Text.text)))
|
||||
).InsertAndAdvance(
|
||||
// if (StopEjectOnNodeComplete.AnyNodeForAbsorb(this.starData.index))
|
||||
new CodeInstruction(OpCodes.Ldarg_0),
|
||||
@@ -491,7 +492,7 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(FactorySystem), nameof(FactorySystem.planet))),
|
||||
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(PlanetData), nameof(PlanetData.star))),
|
||||
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(StarData), nameof(StarData.index))),
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(StopEjectOnNodeComplete), nameof(StopEjectOnNodeComplete.AnyNodeForAbsorb))),
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(StopEjectOnNodeComplete), nameof(AnyNodeForAbsorb))),
|
||||
new CodeInstruction(OpCodes.Brfalse, label1)
|
||||
).Advance(1).InsertAndAdvance(
|
||||
new CodeInstruction(OpCodes.Br, label2),
|
||||
|
||||
@@ -8,6 +8,7 @@ using BepInEx.Configuration;
|
||||
using CommonAPI.Systems;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UXAssist.Common;
|
||||
|
||||
namespace UXAssist.Patches;
|
||||
@@ -566,7 +567,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(UIEntityBriefInfo), nameof(UIEntityBriefInfo.entityNameText))),
|
||||
new CodeMatch(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(UnityEngine.UI.Text), nameof(UnityEngine.UI.Text.preferredWidth)))
|
||||
new CodeMatch(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Text), nameof(Text.preferredWidth)))
|
||||
);
|
||||
matcher.InsertAndAdvance(
|
||||
new CodeInstruction(OpCodes.Ldarg_0),
|
||||
@@ -1479,7 +1480,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
||||
Name = "存储单元",
|
||||
GridIndex = 3601,
|
||||
IconPath = "assets/signal/memory.png",
|
||||
_iconSprite = Util.LoadEmbeddedSprite($"assets/signal/memory.png", assembly),
|
||||
_iconSprite = Util.LoadEmbeddedSprite("assets/signal/memory.png", assembly),
|
||||
SID = ""
|
||||
},
|
||||
new SignalProto
|
||||
@@ -1488,7 +1489,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
||||
Name = "能量碎片",
|
||||
GridIndex = 3602,
|
||||
IconPath = "assets/signal/energy-fragment.png",
|
||||
_iconSprite = Util.LoadEmbeddedSprite($"assets/signal/energy-fragment.png", assembly),
|
||||
_iconSprite = Util.LoadEmbeddedSprite("assets/signal/energy-fragment.png", assembly),
|
||||
SID = ""
|
||||
},
|
||||
new SignalProto
|
||||
@@ -1497,7 +1498,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
||||
Name = "硅基神经元",
|
||||
GridIndex = 3603,
|
||||
IconPath = "assets/signal/silicon-neuron.png",
|
||||
_iconSprite = Util.LoadEmbeddedSprite($"assets/signal/silicon-neuron.png", assembly),
|
||||
_iconSprite = Util.LoadEmbeddedSprite("assets/signal/silicon-neuron.png", assembly),
|
||||
SID = ""
|
||||
},
|
||||
new SignalProto
|
||||
@@ -1506,7 +1507,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
||||
Name = "负熵奇点",
|
||||
GridIndex = 3604,
|
||||
IconPath = "assets/signal/negentropy.png",
|
||||
_iconSprite = Util.LoadEmbeddedSprite($"assets/signal/negentropy.png", assembly),
|
||||
_iconSprite = Util.LoadEmbeddedSprite("assets/signal/negentropy.png", assembly),
|
||||
SID = ""
|
||||
},
|
||||
new SignalProto
|
||||
@@ -1515,7 +1516,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
||||
Name = "物质重组器",
|
||||
GridIndex = 3605,
|
||||
IconPath = "assets/signal/reassembler.png",
|
||||
_iconSprite = Util.LoadEmbeddedSprite($"assets/signal/reassembler.png", assembly),
|
||||
_iconSprite = Util.LoadEmbeddedSprite("assets/signal/reassembler.png", assembly),
|
||||
SID = ""
|
||||
},
|
||||
new SignalProto
|
||||
@@ -1524,7 +1525,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
||||
Name = "虚粒子",
|
||||
GridIndex = 3606,
|
||||
IconPath = "assets/signal/virtual-particle.png",
|
||||
_iconSprite = Util.LoadEmbeddedSprite($"assets/signal/virtual-particle.png", assembly),
|
||||
_iconSprite = Util.LoadEmbeddedSprite("assets/signal/virtual-particle.png", assembly),
|
||||
SID = ""
|
||||
},
|
||||
];
|
||||
|
||||
@@ -7,6 +7,7 @@ using CommonAPI.Systems;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
using UXAssist.Common;
|
||||
using UXAssist.Functions;
|
||||
|
||||
namespace UXAssist.Patches;
|
||||
|
||||
@@ -70,7 +71,7 @@ public class GamePatch: PatchImpl<GamePatch>
|
||||
I18N.Add("KEYUPSSpeedUp", "Increase logical frame rate", "提升逻辑帧率");
|
||||
I18N.Add("Logical frame rate: {0}x", "Logical frame rate: {0}x", "逻辑帧速率: {0}x");
|
||||
|
||||
Functions.WindowFunctions.SetWindowTitle();
|
||||
WindowFunctions.SetWindowTitle();
|
||||
|
||||
EnableWindowResizeEnabled.SettingChanged += (_, _) => EnableWindowResize.Enable(EnableWindowResizeEnabled.Value);
|
||||
LoadLastWindowRectEnabled.SettingChanged += (_, _) => LoadLastWindowRect.Enable(LoadLastWindowRectEnabled.Value);
|
||||
@@ -134,7 +135,7 @@ public class GamePatch: PatchImpl<GamePatch>
|
||||
|
||||
private static void RefreshSavePath()
|
||||
{
|
||||
var profileName = Functions.WindowFunctions.ProfileName;
|
||||
var profileName = WindowFunctions.ProfileName;
|
||||
if (profileName == null) return;
|
||||
|
||||
if (UIRoot.instance.loadGameWindow.gameObject.activeSelf)
|
||||
@@ -162,7 +163,7 @@ public class GamePatch: PatchImpl<GamePatch>
|
||||
[HarmonyPrefix, HarmonyPatch(typeof(GameMain), nameof(GameMain.HandleApplicationQuit))]
|
||||
private static void GameMain_HandleApplicationQuit_Prefix()
|
||||
{
|
||||
var wnd = Functions.WindowFunctions.FindGameWindow();
|
||||
var wnd = WindowFunctions.FindGameWindow();
|
||||
if (wnd == IntPtr.Zero) return;
|
||||
WinApi.GetWindowRect(wnd, out var rect);
|
||||
LastWindowRect.Value = new Vector4(rect.Left, rect.Top, Screen.width, Screen.height);
|
||||
@@ -175,7 +176,7 @@ public class GamePatch: PatchImpl<GamePatch>
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
var wnd = Functions.WindowFunctions.FindGameWindow();
|
||||
var wnd = WindowFunctions.FindGameWindow();
|
||||
if (wnd == IntPtr.Zero)
|
||||
{
|
||||
Enable(false);
|
||||
@@ -189,7 +190,7 @@ public class GamePatch: PatchImpl<GamePatch>
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
var wnd = Functions.WindowFunctions.FindGameWindow();
|
||||
var wnd = WindowFunctions.FindGameWindow();
|
||||
if (wnd == IntPtr.Zero)
|
||||
return;
|
||||
|
||||
@@ -202,7 +203,7 @@ public class GamePatch: PatchImpl<GamePatch>
|
||||
[HarmonyPatch(typeof(UIOptionWindow), nameof(UIOptionWindow.ApplyOptions))]
|
||||
private static void UIOptionWindow_ApplyOptions_Postfix()
|
||||
{
|
||||
var wnd = Functions.WindowFunctions.FindGameWindow();
|
||||
var wnd = WindowFunctions.FindGameWindow();
|
||||
if (wnd == IntPtr.Zero) return;
|
||||
if (_enabled)
|
||||
WinApi.SetWindowLong(wnd, WinApi.GWL_STYLE,
|
||||
@@ -276,7 +277,7 @@ public class GamePatch: PatchImpl<GamePatch>
|
||||
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();
|
||||
var wnd = WindowFunctions.FindGameWindow();
|
||||
if (wnd == IntPtr.Zero) return;
|
||||
var rect = LastWindowRect.Value;
|
||||
if (rect is { z: 0f, w: 0f }) return;
|
||||
@@ -315,7 +316,7 @@ public class GamePatch: PatchImpl<GamePatch>
|
||||
{
|
||||
if (_loaded || Screen.fullScreenMode is FullScreenMode.ExclusiveFullScreen or FullScreenMode.FullScreenWindow or FullScreenMode.MaximizedWindow) return;
|
||||
_loaded = true;
|
||||
var wnd = Functions.WindowFunctions.FindGameWindow();
|
||||
var wnd = WindowFunctions.FindGameWindow();
|
||||
if (wnd == IntPtr.Zero) return;
|
||||
var rect = LastWindowRect.Value;
|
||||
if (rect is { z: 0f, w: 0f }) return;
|
||||
|
||||
@@ -9,6 +9,7 @@ using UnityEngine.EventSystems;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
using UXAssist.Common;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace UXAssist.Patches;
|
||||
|
||||
@@ -524,11 +525,11 @@ public static class LogisticsPatch
|
||||
|
||||
public static void InitGUI()
|
||||
{
|
||||
_stationTipRoot = UnityEngine.Object.Instantiate(GameObject.Find("UI Root/Overlay Canvas/In Game/Scene UIs/Vein Marks"),
|
||||
_stationTipRoot = Object.Instantiate(GameObject.Find("UI Root/Overlay Canvas/In Game/Scene UIs/Vein Marks"),
|
||||
GameObject.Find("UI Root/Overlay Canvas/In Game/Scene UIs").transform);
|
||||
_stationTipRoot.name = "stationTip";
|
||||
UnityEngine.Object.Destroy(_stationTipRoot.GetComponent<UIVeinDetail>());
|
||||
_tipPrefab = UnityEngine.Object.Instantiate(GameObject.Find("UI Root/Overlay Canvas/In Game/Scene UIs/Vein Marks/vein-tip-prefab"), _stationTipRoot.transform);
|
||||
Object.Destroy(_stationTipRoot.GetComponent<UIVeinDetail>());
|
||||
_tipPrefab = Object.Instantiate(GameObject.Find("UI Root/Overlay Canvas/In Game/Scene UIs/Vein Marks/vein-tip-prefab"), _stationTipRoot.transform);
|
||||
_tipPrefab.name = "tipPrefab";
|
||||
var sliderBgPrefab = GameObject.Find("UI Root/Overlay Canvas/In Game/Windows/Station Window/storage-box-0/slider-bg");
|
||||
var image = _tipPrefab.GetComponent<Image>();
|
||||
@@ -539,14 +540,14 @@ public static class LogisticsPatch
|
||||
rectTrans.localPosition = new Vector3(200f, 800f, 0);
|
||||
rectTrans.sizeDelta = new Vector2(150f, 160f);
|
||||
rectTrans.pivot = new Vector2(0.5f, 0.5f);
|
||||
UnityEngine.Object.Destroy(_tipPrefab.GetComponent<UIVeinDetailNode>());
|
||||
Object.Destroy(_tipPrefab.GetComponent<UIVeinDetailNode>());
|
||||
var infoText = _tipPrefab.transform.Find("info-text").gameObject;
|
||||
|
||||
for (var index = 0; index < StorageSlotCount; ++index)
|
||||
{
|
||||
var y = -5f - 35f * index;
|
||||
var iconTrans = _tipPrefab.transform.Find("icon");
|
||||
var itemIcon = UnityEngine.Object.Instantiate(iconTrans.gameObject, new Vector3(0, 0, 0), Quaternion.identity, _tipPrefab.transform);
|
||||
var itemIcon = Object.Instantiate(iconTrans.gameObject, new Vector3(0, 0, 0), Quaternion.identity, _tipPrefab.transform);
|
||||
itemIcon.name = "icon" + index;
|
||||
rectTrans = (RectTransform)itemIcon.transform;
|
||||
rectTrans.sizeDelta = new Vector2(30f, 30f);
|
||||
@@ -555,7 +556,7 @@ public static class LogisticsPatch
|
||||
rectTrans.pivot = new Vector2(0f, 1f);
|
||||
rectTrans.anchoredPosition3D = new Vector3(0, y, 0);
|
||||
|
||||
var sliderBg = UnityEngine.Object.Instantiate(sliderBgPrefab.gameObject, new Vector3(0, 0, 0), Quaternion.identity, _tipPrefab.transform);
|
||||
var sliderBg = Object.Instantiate(sliderBgPrefab.gameObject, new Vector3(0, 0, 0), Quaternion.identity, _tipPrefab.transform);
|
||||
sliderBg.name = "sliderBg" + index;
|
||||
rectTrans = (RectTransform)sliderBg.transform;
|
||||
rectTrans.sizeDelta = new Vector2(StorageSliderWidth, StorageSliderHeight);
|
||||
@@ -583,12 +584,12 @@ public static class LogisticsPatch
|
||||
rectTrans.localPosition = new Vector3(0f, 0f, 0f);
|
||||
image = rectTrans.GetComponent<Image>();
|
||||
image.color = new Color(image.color.r, image.color.g, image.color.b, 0.15f);
|
||||
UnityEngine.Object.Destroy(sliderBg.GetComponent<Slider>());
|
||||
UnityEngine.Object.Destroy(sliderBg.transform.Find("thumb").gameObject);
|
||||
UnityEngine.Object.Destroy(sliderBg.transform.Find("speed-text").gameObject);
|
||||
Object.Destroy(sliderBg.GetComponent<Slider>());
|
||||
Object.Destroy(sliderBg.transform.Find("thumb").gameObject);
|
||||
Object.Destroy(sliderBg.transform.Find("speed-text").gameObject);
|
||||
sliderBg.gameObject.SetActive(false);
|
||||
|
||||
var countText = UnityEngine.Object.Instantiate(infoText, Vector3.zero, Quaternion.identity, _tipPrefab.transform);
|
||||
var countText = Object.Instantiate(infoText, Vector3.zero, Quaternion.identity, _tipPrefab.transform);
|
||||
countText.name = "countText" + index;
|
||||
var text = countText.GetComponent<Text>();
|
||||
text.fontSize = 18;
|
||||
@@ -600,9 +601,9 @@ public static class LogisticsPatch
|
||||
rectTrans.anchorMin = new Vector2(0f, 1f);
|
||||
rectTrans.pivot = new Vector2(0f, 1f);
|
||||
rectTrans.anchoredPosition3D = new Vector3(30f, y, 0);
|
||||
UnityEngine.Object.Destroy(countText.GetComponent<Shadow>());
|
||||
Object.Destroy(countText.GetComponent<Shadow>());
|
||||
|
||||
var stateLocal = UnityEngine.Object.Instantiate(iconTrans.gameObject, new Vector3(0, 0, 0), Quaternion.identity, _tipPrefab.transform);
|
||||
var stateLocal = Object.Instantiate(iconTrans.gameObject, new Vector3(0, 0, 0), Quaternion.identity, _tipPrefab.transform);
|
||||
stateLocal.name = "iconLocal" + index;
|
||||
stateLocal.GetComponent<Image>().material = null;
|
||||
rectTrans = (RectTransform)stateLocal.transform;
|
||||
@@ -611,7 +612,7 @@ public static class LogisticsPatch
|
||||
rectTrans.anchorMin = new Vector2(0f, 1f);
|
||||
rectTrans.pivot = new Vector2(0f, 1f);
|
||||
rectTrans.anchoredPosition3D = new Vector3(102f, y, 0);
|
||||
var stateRemote = UnityEngine.Object.Instantiate(iconTrans.gameObject, new Vector3(0, 0, 0), Quaternion.identity, _tipPrefab.transform);
|
||||
var stateRemote = Object.Instantiate(iconTrans.gameObject, new Vector3(0, 0, 0), Quaternion.identity, _tipPrefab.transform);
|
||||
stateRemote.name = "iconRemote" + index;
|
||||
stateRemote.GetComponent<Image>().material = null;
|
||||
rectTrans = (RectTransform)stateRemote.transform;
|
||||
@@ -624,12 +625,12 @@ public static class LogisticsPatch
|
||||
|
||||
for (var i = 0; i < CarrierSlotCount; i++)
|
||||
{
|
||||
var iconObj = UnityEngine.Object.Instantiate(GameObject.Find("UI Root/Overlay Canvas/In Game/Top Tips/Entity Briefs/brief-info-top/brief-info/content/icons/icon"),
|
||||
var iconObj = Object.Instantiate(GameObject.Find("UI Root/Overlay Canvas/In Game/Top Tips/Entity Briefs/brief-info-top/brief-info/content/icons/icon"),
|
||||
new Vector3(0, 0, 0), Quaternion.identity, _tipPrefab.transform);
|
||||
UnityEngine.Object.Destroy(iconObj.transform.Find("count-text").gameObject);
|
||||
UnityEngine.Object.Destroy(iconObj.transform.Find("bg").gameObject);
|
||||
UnityEngine.Object.Destroy(iconObj.transform.Find("inc").gameObject);
|
||||
UnityEngine.Object.Destroy(iconObj.GetComponent<UIIconCountInc>());
|
||||
Object.Destroy(iconObj.transform.Find("count-text").gameObject);
|
||||
Object.Destroy(iconObj.transform.Find("bg").gameObject);
|
||||
Object.Destroy(iconObj.transform.Find("inc").gameObject);
|
||||
Object.Destroy(iconObj.GetComponent<UIIconCountInc>());
|
||||
|
||||
iconObj.name = "carrierIcon" + i;
|
||||
iconObj.GetComponent<Image>().sprite = LogisticsExtraItemSprites[i];
|
||||
@@ -640,8 +641,8 @@ public static class LogisticsPatch
|
||||
rectTrans.pivot = new Vector2(0f, 1f);
|
||||
rectTrans.anchoredPosition3D = new Vector3(0f, -180f, 0);
|
||||
|
||||
var countText = UnityEngine.Object.Instantiate(infoText, Vector3.zero, Quaternion.identity, iconObj.transform);
|
||||
UnityEngine.Object.Destroy(countText.GetComponent<Shadow>());
|
||||
var countText = Object.Instantiate(infoText, Vector3.zero, Quaternion.identity, iconObj.transform);
|
||||
Object.Destroy(countText.GetComponent<Shadow>());
|
||||
countText.name = "carrierTotalCountText";
|
||||
var text = countText.GetComponent<Text>();
|
||||
text.fontSize = 22;
|
||||
@@ -657,8 +658,8 @@ public static class LogisticsPatch
|
||||
|
||||
if (i >= CarrierSlotCount - 1) continue;
|
||||
|
||||
countText = UnityEngine.Object.Instantiate(infoText, Vector3.zero, Quaternion.identity, iconObj.transform);
|
||||
UnityEngine.Object.Destroy(countText.GetComponent<Shadow>());
|
||||
countText = Object.Instantiate(infoText, Vector3.zero, Quaternion.identity, iconObj.transform);
|
||||
Object.Destroy(countText.GetComponent<Shadow>());
|
||||
|
||||
countText.name = "carrierIdleCountText";
|
||||
text = countText.GetComponent<Text>();
|
||||
@@ -691,7 +692,7 @@ public static class LogisticsPatch
|
||||
}
|
||||
else
|
||||
{
|
||||
UnityEngine.Object.Destroy(stationTip);
|
||||
Object.Destroy(stationTip);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -707,7 +708,7 @@ public static class LogisticsPatch
|
||||
return result;
|
||||
}
|
||||
|
||||
var tempTip = UnityEngine.Object.Instantiate(_tipPrefab, _stationTipRoot.transform);
|
||||
var tempTip = Object.Instantiate(_tipPrefab, _stationTipRoot.transform);
|
||||
var stationTip = tempTip.AddComponent<StationTip>();
|
||||
stationTip.InitStationTip();
|
||||
return stationTip;
|
||||
|
||||
@@ -312,7 +312,7 @@ public static class TechPatch
|
||||
}
|
||||
if (!enough)
|
||||
{
|
||||
UIRealtimeTip.Popup("元数据不足".Translate(), true, 0);
|
||||
UIRealtimeTip.Popup("元数据不足".Translate());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using BepInEx.Configuration;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@@ -112,7 +112,7 @@ public class MyKeyBinder : MonoBehaviour
|
||||
setTheKeyToggle.isOn = false;
|
||||
Reset();
|
||||
}
|
||||
else if (!this.inputUIButton.highlighted)
|
||||
else if (!inputUIButton.highlighted)
|
||||
{
|
||||
setTheKeyToggle.isOn = false;
|
||||
Reset();
|
||||
@@ -173,7 +173,7 @@ public class MyKeyBinder : MonoBehaviour
|
||||
{
|
||||
if (Input.GetKey(modKey))
|
||||
{
|
||||
mod += "+" + modKey.ToString();
|
||||
mod += "+" + modKey;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using HarmonyLib;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using BepInEx.Configuration;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UXAssist.UI;
|
||||
using UXAssist.Common;
|
||||
using UXAssist.Functions;
|
||||
using UXAssist.ModsCompat;
|
||||
using UXAssist.Patches;
|
||||
using UXAssist.UI;
|
||||
|
||||
namespace UXAssist;
|
||||
|
||||
@@ -47,7 +48,8 @@ public static class UIConfigWindow
|
||||
I18N.Add("First 8 CPUs", "First 8 CPUs", "前8个CPU");
|
||||
I18N.Add("First CPU only", "First CPU only", "仅第一个CPU");
|
||||
I18N.Add("All P-Cores", "All P-Cores", "所有性能(P)核心");
|
||||
I18N.Add("All E-Cores", "All E-Cores", "所有效率(E)核心");
|
||||
I18N.Add("All E-Cores", "All E-Cores", "所有能效(E)核心");
|
||||
I18N.Add("CPU Info", "CPU Info", "CPU信息");
|
||||
I18N.Add("Unlimited interactive range", "Unlimited interactive range", "无限交互距离");
|
||||
I18N.Add("Night Light", "Sunlight at night", "夜间日光灯");
|
||||
I18N.Add("Angle X:", "Angle X:", "入射角度X:");
|
||||
@@ -179,12 +181,7 @@ public static class UIConfigWindow
|
||||
wnd.AddInputField(x + 2f, 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)
|
||||
if (!BulletTimeWrapper.HasBulletTime)
|
||||
{
|
||||
y += 36f;
|
||||
txt = wnd.AddText2(x + 2f, y, tab1, "Logical Frame Rate", 15, "game-frame-rate");
|
||||
@@ -213,6 +210,8 @@ public static class UIConfigWindow
|
||||
affinities[2] = details.ThreadCount > 16 ? "First 8 CPUs" : "First CPU only";
|
||||
y += 36f;
|
||||
wnd.AddComboBox(x + 2f, y, tab1, "Enabled CPUs").WithItems(affinities).WithSize(200f, 0f).WithConfigEntry(WindowFunctions.ProcessAffinity);
|
||||
y += 36f;
|
||||
((RectTransform)wnd.AddButton(x, y, tab1, "CPU Info", 16, "button-show-cpu-info", WindowFunctions.ShowCPUInfo).transform).sizeDelta = new Vector2(100f, 25f);
|
||||
|
||||
var tab2 = wnd.AddTab(trans, "Planet/Factory");
|
||||
x = 0f;
|
||||
@@ -288,14 +287,14 @@ public static class UIConfigWindow
|
||||
var cb1 = wnd.AddCheckBox(x + 20f, y, tab2, LogisticsPatch.RealtimeLogisticsInfoPanelBarsEnabled, "Show status bars for storage items", 13);
|
||||
EventHandler anySettingsChanged = (_, _) =>
|
||||
{
|
||||
if (ModsCompat.AuxilaryfunctionWrapper.ShowStationInfo == null)
|
||||
if (AuxilaryfunctionWrapper.ShowStationInfo == null)
|
||||
{
|
||||
cb0.SetEnable(true);
|
||||
cb1.SetEnable(LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.Value);
|
||||
return;
|
||||
}
|
||||
|
||||
var on = !ModsCompat.AuxilaryfunctionWrapper.ShowStationInfo.Value;
|
||||
var on = !AuxilaryfunctionWrapper.ShowStationInfo.Value;
|
||||
cb0.SetEnable(on);
|
||||
cb1.SetEnable(on & LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.Value);
|
||||
if (!on)
|
||||
@@ -303,10 +302,10 @@ public static class UIConfigWindow
|
||||
LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.Value = false;
|
||||
}
|
||||
};
|
||||
if (ModsCompat.AuxilaryfunctionWrapper.ShowStationInfo != null)
|
||||
if (AuxilaryfunctionWrapper.ShowStationInfo != null)
|
||||
{
|
||||
ModsCompat.AuxilaryfunctionWrapper.ShowStationInfo.SettingChanged += anySettingsChanged;
|
||||
wnd.OnFree += () => { ModsCompat.AuxilaryfunctionWrapper.ShowStationInfo.SettingChanged -= anySettingsChanged; };
|
||||
AuxilaryfunctionWrapper.ShowStationInfo.SettingChanged += anySettingsChanged;
|
||||
wnd.OnFree += () => { AuxilaryfunctionWrapper.ShowStationInfo.SettingChanged -= anySettingsChanged; };
|
||||
}
|
||||
LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.SettingChanged += anySettingsChanged;
|
||||
wnd.OnFree += () => { LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.SettingChanged -= anySettingsChanged; };
|
||||
@@ -415,7 +414,6 @@ public static class UIConfigWindow
|
||||
uiGame.CloseEnemyBriefInfo();
|
||||
uiGame.OpenCommunicatorWindow(5);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
private static void UpdateUI()
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.IO;
|
||||
using System.Reflection;
|
||||
using BepInEx;
|
||||
using BepInEx.Configuration;
|
||||
using BepInEx.Logging;
|
||||
using CommonAPI;
|
||||
using CommonAPI.Systems;
|
||||
using crecheng.DSPModSave;
|
||||
@@ -13,6 +14,7 @@ using UXAssist.Common;
|
||||
using UXAssist.Functions;
|
||||
using UXAssist.Patches;
|
||||
using UXAssist.UI;
|
||||
using Util = UXAssist.Common.Util;
|
||||
|
||||
namespace UXAssist;
|
||||
|
||||
@@ -22,7 +24,7 @@ namespace UXAssist;
|
||||
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
|
||||
public class UXAssist : BaseUnityPlugin, IModCanSave
|
||||
{
|
||||
public new static readonly BepInEx.Logging.ManualLogSource Logger =
|
||||
public new static readonly ManualLogSource Logger =
|
||||
BepInEx.Logging.Logger.CreateLogSource(PluginInfo.PLUGIN_NAME);
|
||||
|
||||
private static bool _configWinInitialized;
|
||||
@@ -171,10 +173,10 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
||||
|
||||
UIConfigWindow.Init();
|
||||
|
||||
_patches = Common.Util.GetTypesFiltered(Assembly.GetExecutingAssembly(),
|
||||
_patches = Util.GetTypesFiltered(Assembly.GetExecutingAssembly(),
|
||||
t => string.Equals(t.Namespace, "UXAssist.Patches", StringComparison.Ordinal) || string.Equals(t.Namespace, "UXAssist.Functions", StringComparison.Ordinal));
|
||||
_patches?.Do(type => type.GetMethod("Init")?.Invoke(null, null));
|
||||
_compats = Common.Util.GetTypesInNamespace(Assembly.GetExecutingAssembly(), "UXAssist.ModsCompat");
|
||||
_compats = Util.GetTypesInNamespace(Assembly.GetExecutingAssembly(), "UXAssist.ModsCompat");
|
||||
_compats?.Do(type => type.GetMethod("Init")?.Invoke(null, null));
|
||||
|
||||
I18N.Apply();
|
||||
|
||||
Reference in New Issue
Block a user