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

UXAssist 1.2.3

This commit is contained in:
2024-09-21 19:57:33 +08:00
parent 177c74d6e9
commit 1ab57eb7ca
9 changed files with 133 additions and 120 deletions

View File

@@ -8,6 +8,10 @@
+ New feature: `Enable warp without space warpers` + New feature: `Enable warp without space warpers`
+ New feature: `Wind Turbines do global power coverage` + New feature: `Wind Turbines do global power coverage`
+ Fix an issue that `Complete Dyson Sphere Shells instantly` does not generate production records for solar sails. + Fix an issue that `Complete Dyson Sphere Shells instantly` does not generate production records for solar sails.
<details>
<summary>Older versions</summary>
* 2.3.24 * 2.3.24
+ `Complete Dyson Sphere Shells instantly`: Fix a bug that may cause negative power in some cases + `Complete Dyson Sphere Shells instantly`: Fix a bug that may cause negative power in some cases
* 2.3.23 * 2.3.23
@@ -133,6 +137,8 @@
* 1.0.0 * 1.0.0
+ Initial release + Initial release
</details>
## 更新日志 ## 更新日志
* 2.3.26 * 2.3.26
@@ -143,7 +149,11 @@
+ 新功能:`无需空间翘曲器即可曲速飞行` + 新功能:`无需空间翘曲器即可曲速飞行`
+ 新功能:`风力涡轮机供电覆盖全球` + 新功能:`风力涡轮机供电覆盖全球`
+ 修复了`立即完成戴森壳建造`未生成太阳帆生产记录的问题 + 修复了`立即完成戴森壳建造`未生成太阳帆生产记录的问题
* 2.3.24
<details>
<summary>更早的版本</summary>
2.3.24
+ `立即完成戴森壳建造`:修复了在某些情况下可能导致发电为负的问题 + `立即完成戴森壳建造`:修复了在某些情况下可能导致发电为负的问题
* 2.3.23 * 2.3.23
+ 新功能:`立即完成戴森壳建造` + 新功能:`立即完成戴森壳建造`
@@ -267,3 +277,5 @@
+ 添加了很多功能 + 添加了很多功能
* 1.0.0 * 1.0.0
+ 初始版本 + 初始版本
</details>

View File

@@ -1,5 +1,11 @@
## Changlog ## Changlog
* 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.
* 1.2.2
+ `Real-time logistic stations info panel`: Fix text color mismatch sometimes
+ `Logical Frame Rate`: Set default shortcut key to `Ctrl`+`-/+` to avoid conflict with other shortcut keys
* 1.2.1 * 1.2.1
+ `Off-grid building and stepped rotation`: + `Off-grid building and stepped rotation`:
- Fix off-grid building's default shortcut key for belts - Fix off-grid building's default shortcut key for belts
@@ -17,6 +23,10 @@
+ `Real-time logistic stations info panel`: Fix a crash issue. + `Real-time logistic stations info panel`: Fix a crash issue.
+ `Dyson Sphere "Auto Fast Build"`: Fix possible wrong production records. + `Dyson Sphere "Auto Fast Build"`: Fix possible wrong production records.
+ Codes refactored, for better maintainability. + Codes refactored, for better maintainability.
<details>
<summary>Older versions</summary>
* 1.1.6 * 1.1.6
+ New feature: `Scale up mouse cursor` + New feature: `Scale up mouse cursor`
- Note: This will enable software cursor mode, which may cause mouse movement lag on heavy load. - Note: This will enable software cursor mode, which may cause mouse movement lag on heavy load.
@@ -31,7 +41,7 @@
+ New feature: `Dyson Sphere "Auto Fast Build" speed multiplier` + New feature: `Dyson Sphere "Auto Fast Build" speed multiplier`
- Note: this only applies to `Dyson Sphere "Auto Fast Build"` in sandbox mode - Note: this only applies to `Dyson Sphere "Auto Fast Build"` in sandbox mode
+ New feature: `Mod manager profile based save folder` + New feature: `Mod manager profile based save folder`
- Save files are stored in `Save\<ProfileName>` folder. - Save files are stored in `Save\&lt;ProfileName&gt;` folder.
- Will use original save location if matching default profile name. - Will use original save location if matching default profile name.
+ `Quick build and dismantle stacking labs`: works for storages and tanks now + `Quick build and dismantle stacking labs`: works for storages and tanks now
+ `Enable game window resize`: Keep window resizable on applying game options. + `Enable game window resize`: Keep window resizable on applying game options.
@@ -176,8 +186,16 @@
+ Initial release + Initial release
+ Functions moved from [MechaDronesTweaks](https://dsp.thunderstore.io/package/soarqin/MechaDronesTweaks/) and [CheatEnabler](https://dsp.thunderstore.io/package/soarqin/CheatEnabler/) + Functions moved from [MechaDronesTweaks](https://dsp.thunderstore.io/package/soarqin/MechaDronesTweaks/) and [CheatEnabler](https://dsp.thunderstore.io/package/soarqin/CheatEnabler/)
</details>
## 更新日志 ## 更新日志
* 1.2.3
+ `物流运输站实时信息面板`:修复了物品数量超过容量限制时条长度不匹配的问题
+ `夜间日光灯`:修复了不起作用的问题
* 1.2.2
+ `物流运输站实时信息面板`:修复了文本颜色不匹配的问题
+ `逻辑帧倍率`:将默认快捷键设置为`Ctrl`+`-/+`,以避免与其他快捷键冲突
* 1.2.1 * 1.2.1
+ `脱离网格建造和小角度旋转` + `脱离网格建造和小角度旋转`
- 修复了传送带脱离网格建造的默认快捷键 - 修复了传送带脱离网格建造的默认快捷键
@@ -195,6 +213,10 @@
+ `物流运输站实时信息面板`:修复了一个崩溃问题 + `物流运输站实时信息面板`:修复了一个崩溃问题
+ `戴森球自动快速建造`:修复了可能出现的错误生产记录 + `戴森球自动快速建造`:修复了可能出现的错误生产记录
+ 代码重构,以获得更好的可维护性 + 代码重构,以获得更好的可维护性
<details>
<summary>更早的版本</summary>
* 1.1.6 * 1.1.6
+ 新功能:`放大鼠标指针` + 新功能:`放大鼠标指针`
- 注意这将启用软件指针模式可能会在CPU负载较重时导致鼠标移动延迟 - 注意这将启用软件指针模式可能会在CPU负载较重时导致鼠标移动延迟
@@ -209,7 +231,7 @@
+ 新功能:`戴森球自动快速建造速度倍率` + 新功能:`戴森球自动快速建造速度倍率`
- 注意:这仅适用于沙盒模式下的`戴森球自动快速建造`功能 - 注意:这仅适用于沙盒模式下的`戴森球自动快速建造`功能
+ 新功能:`基于mod管理器配置档案名的存档文件夹` + 新功能:`基于mod管理器配置档案名的存档文件夹`
- 存档文件会存储在`Save\<ProfileName>`文件夹中 - 存档文件会存储在`Save\&lt;ProfileName&gt;`文件夹中
- 如果匹配默认配置档案名则使用原始存档位置 - 如果匹配默认配置档案名则使用原始存档位置
+ `快速建造和拆除堆叠研究站`:现在也支持储物仓和储液罐 + `快速建造和拆除堆叠研究站`:现在也支持储物仓和储液罐
+ `允许调整游戏窗口大小`:在应用游戏选项时保持窗口可调整大小 + `允许调整游戏窗口大小`:在应用游戏选项时保持窗口可调整大小
@@ -353,3 +375,5 @@
* 1.0.0 * 1.0.0
+ 初始版本 + 初始版本
+ 从[MechaDronesTweaks](https://dsp.thunderstore.io/package/soarqin/MechaDronesTweaks/)和[CheatEnabler](https://dsp.thunderstore.io/package/soarqin/CheatEnabler/)移动了部分功能过来 + 从[MechaDronesTweaks](https://dsp.thunderstore.io/package/soarqin/MechaDronesTweaks/)和[CheatEnabler](https://dsp.thunderstore.io/package/soarqin/CheatEnabler/)移动了部分功能过来
</details>

View File

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

View File

@@ -12,7 +12,7 @@ using UXAssist.Common;
namespace UXAssist.Patches; namespace UXAssist.Patches;
public class FactoryPatch: PatchImpl<FactoryPatch> public class FactoryPatch : PatchImpl<FactoryPatch>
{ {
public static ConfigEntry<bool> UnlimitInteractiveEnabled; public static ConfigEntry<bool> UnlimitInteractiveEnabled;
public static ConfigEntry<bool> RemoveSomeConditionEnabled; public static ConfigEntry<bool> RemoveSomeConditionEnabled;
@@ -173,98 +173,37 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
public class NightLight: PatchImpl<NightLight> public class NightLight : PatchImpl<NightLight>
{ {
private const float NightLightAngleX = -8; private const float NightLightAngleX = -8;
private const float NightLightAngleY = -2; private const float NightLightAngleY = -2;
public static bool Enabled;
private static bool _nightlightInitialized; private static bool _nightlightInitialized;
private static bool _mechaOnEarth; private static bool _mechaOnEarth;
private static AnimationState _sail; private static AnimationState _sail;
private static Light _sunlight; private static Light _sunlight;
protected override void OnEnable()
{
Enabled = _mechaOnEarth;
}
protected override void OnDisable() protected override void OnDisable()
{ {
Enabled = false; if (!_sunlight) return;
if (_sunlight == null) return;
_sunlight.transform.localEulerAngles = new Vector3(0f, 180f); _sunlight.transform.localEulerAngles = new Vector3(0f, 180f);
} }
public static void LateUpdate() [HarmonyPostfix]
[HarmonyPatch(typeof(GameMain), nameof(GameMain.LateUpdate))]
public static void GameMain_LateUpdate_Postfix(GameMain __instance)
{ {
if (!Enabled) return; if (!_nightlightInitialized)
switch (_nightlightInitialized)
{ {
case false: if (__instance.isMenuDemo || !__instance._running || !GameMain.mainPlayer.controller.model.gameObject.activeInHierarchy) return;
Ready(); if (_sail == null) _sail = GameMain.mainPlayer.animator.sails[GameMain.mainPlayer.animator.sailAnimIndex];
break;
case true:
Go();
break;
}
}
private static void Ready()
{
if (!GameMain.isRunning || !GameMain.mainPlayer.controller.model.gameObject.activeInHierarchy) return;
if (_sail == null)
{
_sail = GameMain.mainPlayer.animator.sails[GameMain.mainPlayer.animator.sailAnimIndex];
}
_nightlightInitialized = true; _nightlightInitialized = true;
} }
private static void Go() if (_mechaOnEarth)
{ {
if (!GameMain.isRunning) if (__instance.isMenuDemo || !GameMain.isRunning)
{
End();
return;
}
if (_sail && _sail.enabled)
{ {
_mechaOnEarth = false; _mechaOnEarth = false;
Enabled = false;
if (!_sunlight || !_sunlight.transform) return;
_sunlight.transform.localEulerAngles = new Vector3(0f, 180f);
_sunlight = null;
return;
}
if (!_mechaOnEarth)
{
if (!_sunlight)
{
var simu = GameMain.universeSimulator;
if (simu)
_sunlight = simu.LocalStarSimulator()?.sunLight;
if (!_sunlight) return;
}
_mechaOnEarth = true;
Enabled = NightLightEnabled.Value;
}
if (Enabled && _sunlight)
{
_sunlight.transform.rotation =
Quaternion.LookRotation(-GameMain.mainPlayer.transform.up + GameMain.mainPlayer.transform.forward * NightLightAngleX / 10f +
GameMain.mainPlayer.transform.right * NightLightAngleY / 10f);
}
}
private static void End()
{
_mechaOnEarth = false;
Enabled = false;
if (_sunlight != null) if (_sunlight != null)
{ {
_sunlight.transform.localEulerAngles = new Vector3(0f, 180f); _sunlight.transform.localEulerAngles = new Vector3(0f, 180f);
@@ -273,13 +212,34 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
_sail = null; _sail = null;
_nightlightInitialized = false; _nightlightInitialized = false;
return;
}
if (!_sail || !_sail.enabled) return;
_mechaOnEarth = false;
if (!_sunlight || !_sunlight.transform) return;
_sunlight.transform.localEulerAngles = new Vector3(0f, 180f);
_sunlight = null;
return;
}
if (!_sunlight)
{
var simu = GameMain.universeSimulator;
if (simu) _sunlight = simu.LocalStarSimulator()?.sunLight;
if (!_sunlight) return;
}
_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);
} }
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(StarSimulator), "LateUpdate")] [HarmonyPatch(typeof(StarSimulator), "LateUpdate")]
private static IEnumerable<CodeInstruction> StarSimulator_LateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> StarSimulator_LateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{ {
// var vec = NightlightEnabled ? GameMain.mainPlayer.transform.up : __instance.transform.forward;
var matcher = new CodeMatcher(instructions, generator); var matcher = new CodeMatcher(instructions, generator);
var label1 = generator.DefineLabel(); var label1 = generator.DefineLabel();
var label2 = generator.DefineLabel(); var label2 = generator.DefineLabel();
@@ -287,7 +247,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
new CodeMatch(OpCodes.Ldarg_0), new CodeMatch(OpCodes.Ldarg_0),
new CodeMatch(OpCodes.Call, AccessTools.PropertyGetter(typeof(Component), nameof(Component.transform))) new CodeMatch(OpCodes.Call, AccessTools.PropertyGetter(typeof(Component), nameof(Component.transform)))
).InsertAndAdvance( ).InsertAndAdvance(
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(NightLight), nameof(Enabled))), new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(NightLight), nameof(_mechaOnEarth))),
new CodeInstruction(OpCodes.Brfalse_S, label1), new CodeInstruction(OpCodes.Brfalse_S, label1),
new CodeInstruction(OpCodes.Call, AccessTools.PropertyGetter(typeof(GameMain), nameof(GameMain.mainPlayer))), new CodeInstruction(OpCodes.Call, AccessTools.PropertyGetter(typeof(GameMain), nameof(GameMain.mainPlayer))),
new CodeInstruction(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Player), nameof(Player.transform))), new CodeInstruction(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Player), nameof(Player.transform))),
@@ -313,7 +273,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
matcher.MatchForward(false, matcher.MatchForward(false,
new CodeMatch(OpCodes.Stloc_1) new CodeMatch(OpCodes.Stloc_1)
).Advance(1).InsertAndAdvance( ).Advance(1).InsertAndAdvance(
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(NightLight), nameof(Enabled))), new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(NightLight), nameof(_mechaOnEarth))),
new CodeInstruction(OpCodes.Brfalse_S, label1), new CodeInstruction(OpCodes.Brfalse_S, label1),
new CodeInstruction(OpCodes.Call, AccessTools.PropertyGetter(typeof(GameMain), nameof(GameMain.mainPlayer))), new CodeInstruction(OpCodes.Call, AccessTools.PropertyGetter(typeof(GameMain), nameof(GameMain.mainPlayer))),
new CodeInstruction(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Player), nameof(Player.transform))), new CodeInstruction(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Player), nameof(Player.transform))),
@@ -329,7 +289,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
} }
} }
private class UnlimitInteractive: PatchImpl<UnlimitInteractive> private class UnlimitInteractive : PatchImpl<UnlimitInteractive>
{ {
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(PlayerAction_Inspect), nameof(PlayerAction_Inspect.GetObjectSelectDistance))] [HarmonyPatch(typeof(PlayerAction_Inspect), nameof(PlayerAction_Inspect.GetObjectSelectDistance))]
@@ -340,7 +300,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
} }
} }
private class RemoveSomeConditionBuild: PatchImpl<RemoveSomeConditionBuild> private class RemoveSomeConditionBuild : PatchImpl<RemoveSomeConditionBuild>
{ {
[HarmonyTranspiler, HarmonyPriority(Priority.First)] [HarmonyTranspiler, HarmonyPriority(Priority.First)]
[HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CheckBuildConditions))] [HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CheckBuildConditions))]
@@ -415,7 +375,9 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
*/ */
matcher.Start().MatchForward(false, matcher.Start().MatchForward(false,
new CodeMatch(instr => instr.opcode == OpCodes.Ldloc_S || instr.opcode == OpCodes.Ldloc), new CodeMatch(instr => instr.opcode == OpCodes.Ldloc_S || instr.opcode == OpCodes.Ldloc),
new CodeMatch(instr => (instr.opcode == OpCodes.Ldc_I4_S || instr.opcode == OpCodes.Ldc_I4) && Convert.ToInt64(instr.operand) is >= (int)EBuildCondition.TooSteep and <= (int)EBuildCondition.InputConflict), new CodeMatch(instr =>
(instr.opcode == OpCodes.Ldc_I4_S || instr.opcode == OpCodes.Ldc_I4) &&
Convert.ToInt64(instr.operand) is >= (int)EBuildCondition.TooSteep and <= (int)EBuildCondition.InputConflict),
new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(BuildPreview), nameof(BuildPreview.condition))) new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(BuildPreview), nameof(BuildPreview.condition)))
); );
if (matcher.IsValid) if (matcher.IsValid)
@@ -437,7 +399,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
} }
} }
private class RemoveBuildRangeLimit: PatchImpl<RemoveBuildRangeLimit> private class RemoveBuildRangeLimit : PatchImpl<RemoveBuildRangeLimit>
{ {
protected override void OnEnable() protected override void OnEnable()
{ {
@@ -488,7 +450,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
} }
} }
private class LargerAreaForUpgradeAndDismantle: PatchImpl<LargerAreaForUpgradeAndDismantle> private class LargerAreaForUpgradeAndDismantle : PatchImpl<LargerAreaForUpgradeAndDismantle>
{ {
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(BuildTool_Dismantle), nameof(BuildTool_Dismantle.DeterminePreviews))] [HarmonyPatch(typeof(BuildTool_Dismantle), nameof(BuildTool_Dismantle.DeterminePreviews))]
@@ -504,7 +466,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
} }
} }
private class LargerAreaForTerraform: PatchImpl<LargerAreaForTerraform> private class LargerAreaForTerraform : PatchImpl<LargerAreaForTerraform>
{ {
[HarmonyTranspiler, HarmonyPatch(typeof(BuildTool_Reform), nameof(BuildTool_Reform.ReformAction))] [HarmonyTranspiler, HarmonyPatch(typeof(BuildTool_Reform), nameof(BuildTool_Reform.ReformAction))]
private static IEnumerable<CodeInstruction> BuildTool_Reform_ReformAction_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> BuildTool_Reform_ReformAction_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -524,7 +486,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
} }
} }
public class OffGridBuilding: PatchImpl<OffGridBuilding> public class OffGridBuilding : PatchImpl<OffGridBuilding>
{ {
// private const float SteppedRotationDegrees = 15f; // private const float SteppedRotationDegrees = 15f;
@@ -795,7 +757,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
*/ */
} }
public class TreatStackingAsSingle: PatchImpl<TreatStackingAsSingle> public class TreatStackingAsSingle : PatchImpl<TreatStackingAsSingle>
{ {
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(MonitorComponent), nameof(MonitorComponent.InternalUpdate))] [HarmonyPatch(typeof(MonitorComponent), nameof(MonitorComponent.InternalUpdate))]
@@ -816,7 +778,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
} }
} }
private class QuickBuildAndDismantleLab: PatchImpl<QuickBuildAndDismantleLab> private class QuickBuildAndDismantleLab : PatchImpl<QuickBuildAndDismantleLab>
{ {
private static bool DetermineMoreLabsForDismantle(BuildTool dismantle, int id) private static bool DetermineMoreLabsForDismantle(BuildTool dismantle, int id)
{ {
@@ -864,6 +826,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
factory.ReadObjectConn(nextId, 13, out _, out nextId2, out _); factory.ReadObjectConn(nextId, 13, out _, out nextId2, out _);
if (nextId2 <= 0) break; if (nextId2 <= 0) break;
} }
nextId = nextId2; nextId = nextId2;
var itemProto = dismantle.GetItemProto(nextId); var itemProto = dismantle.GetItemProto(nextId);
var desc = itemProto.prefabDesc; var desc = itemProto.prefabDesc;
@@ -962,7 +925,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
} }
} }
public class ProtectVeinsFromExhaustion: PatchImpl<ProtectVeinsFromExhaustion> public class ProtectVeinsFromExhaustion : PatchImpl<ProtectVeinsFromExhaustion>
{ {
public static int KeepVeinAmount = 100; public static int KeepVeinAmount = 100;
public static float KeepOilSpeed = 1f; public static float KeepOilSpeed = 1f;
@@ -1242,7 +1205,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
} }
} }
private class DoNotRenderEntities: PatchImpl<DoNotRenderEntities> private class DoNotRenderEntities : PatchImpl<DoNotRenderEntities>
{ {
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch(typeof(ObjectRenderer), nameof(ObjectRenderer.Render))] [HarmonyPatch(typeof(ObjectRenderer), nameof(ObjectRenderer.Render))]
@@ -1300,7 +1263,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
} }
} }
private class DragBuildPowerPoles: PatchImpl<DragBuildPowerPoles> private class DragBuildPowerPoles : PatchImpl<DragBuildPowerPoles>
{ {
private static readonly List<bool> OldDragBuild = []; private static readonly List<bool> OldDragBuild = [];
private static readonly List<Vector2> OldDragBuildDist = []; private static readonly List<Vector2> OldDragBuildDist = [];
@@ -1466,7 +1429,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
} }
} }
private class BeltSignalsForBuyOut: PatchImpl<BeltSignalsForBuyOut> private class BeltSignalsForBuyOut : PatchImpl<BeltSignalsForBuyOut>
{ {
private static bool _initialized; private static bool _initialized;
private static bool _loaded; private static bool _loaded;
@@ -1654,7 +1617,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
SignalBeltFactoryIndices.Remove(factory); SignalBeltFactoryIndices.Remove(factory);
} }
private class Persist: PatchImpl<Persist> private class Persist : PatchImpl<Persist>
{ {
protected override void OnEnable() protected override void OnEnable()
{ {
@@ -1767,6 +1730,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
mainPlayer.mecha.AddProductionStat(itemId, count, mainPlayer.nearestFactory); mainPlayer.mecha.AddProductionStat(itemId, count, mainPlayer.nearestFactory);
} }
} }
if (consume > 0 && cargoPath.TryInsertItem(belt.segIndex + belt.segPivotOffset, itemId, consume, 0)) if (consume > 0 && cargoPath.TryInsertItem(belt.segIndex + belt.segPivotOffset, itemId, consume, 0))
DarkFogItemsInVoid[itemIdx] -= consume; DarkFogItemsInVoid[itemIdx] -= consume;
} }

View File

@@ -57,7 +57,7 @@ public class GamePatch: PatchImpl<GamePatch>
{ {
_speedDownKey = KeyBindings.RegisterKeyBinding(new BuiltinKey _speedDownKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
{ {
key = new CombineKey((int)KeyCode.KeypadMinus, 0, ECombineKeyAction.OnceClick, false), key = new CombineKey((int)KeyCode.Minus, CombineKey.CTRL_COMB, ECombineKeyAction.OnceClick, false),
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND, conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
name = "UPSSpeedDown", name = "UPSSpeedDown",
canOverride = true canOverride = true
@@ -66,7 +66,7 @@ public class GamePatch: PatchImpl<GamePatch>
I18N.Add("KEYUPSSpeedDown", "Decrease logical frame rate", "降低逻辑帧率"); I18N.Add("KEYUPSSpeedDown", "Decrease logical frame rate", "降低逻辑帧率");
_speedUpKey = KeyBindings.RegisterKeyBinding(new BuiltinKey _speedUpKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
{ {
key = new CombineKey((int)KeyCode.KeypadPlus, 0, ECombineKeyAction.OnceClick, false), key = new CombineKey((int)KeyCode.Equals, CombineKey.CTRL_COMB, ECombineKeyAction.OnceClick, false),
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.UI | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND, conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.UI | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
name = "UPSSpeedUp", name = "UPSSpeedUp",
canOverride = true canOverride = true

View File

@@ -460,8 +460,10 @@ public static class LogisticsPatch
private static int _remoteStorageMax = 10000; private static int _remoteStorageMax = 10000;
private static int _localStorageExtra; private static int _localStorageExtra;
private static int _remoteStorageExtra; private static int _remoteStorageExtra;
private static float _localStoragePixelPerItem = StorageSliderWidth / (_localStorageMax + _localStorageExtra); private static int _localStorageMaxTotal = _localStorageMax;
private static float _remoteStoragePixelPerItem = StorageSliderWidth / (_remoteStorageMax + _remoteStorageExtra); private static int _remoteStorageMaxTotal = _remoteStorageMax;
private static float _localStoragePixelPerItem = StorageSliderWidth / _localStorageMaxTotal;
private static float _remoteStoragePixelPerItem = StorageSliderWidth / _remoteStorageMaxTotal;
private const int StorageSlotCount = 5; private const int StorageSlotCount = 5;
private const int CarrierSlotCount = 3; private const int CarrierSlotCount = 3;
@@ -475,8 +477,10 @@ public static class LogisticsPatch
if (_remoteStorageExtra == history.remoteStationExtraStorage) return false; if (_remoteStorageExtra == history.remoteStationExtraStorage) return false;
_localStorageExtra = history.localStationExtraStorage; _localStorageExtra = history.localStationExtraStorage;
_remoteStorageExtra = history.remoteStationExtraStorage; _remoteStorageExtra = history.remoteStationExtraStorage;
_localStoragePixelPerItem = StorageSliderWidth / (_localStorageMax + _localStorageExtra); _localStorageMaxTotal = _localStorageMax + _localStorageExtra;
_remoteStoragePixelPerItem = StorageSliderWidth / (_remoteStorageMax + _remoteStorageExtra); _remoteStorageMaxTotal = _remoteStorageMax + _remoteStorageExtra;
_localStoragePixelPerItem = StorageSliderWidth / _localStorageMaxTotal;
_remoteStoragePixelPerItem = StorageSliderWidth / _remoteStorageMaxTotal;
return true; return true;
} }
@@ -1043,17 +1047,35 @@ public static class LogisticsPatch
_iconRemotes[i].gameObject.SetActive(CarrierEnabled[(int)_layout][1]); _iconRemotes[i].gameObject.SetActive(CarrierEnabled[(int)_layout][1]);
_iconRemotesImage[i].sprite = StateSprite[(int)storageState.RemoteState]; _iconRemotesImage[i].sprite = StateSprite[(int)storageState.RemoteState];
_sliderBg[i].gameObject.SetActive(RealtimeLogisticsInfoPanelBarsEnabled.Value); _sliderBg[i].gameObject.SetActive(RealtimeLogisticsInfoPanelBarsEnabled.Value);
switch (_layout)
{
case EStationTipLayout.InterstellarLogistics:
{
countUIText.color = _iconRemotesImage[i].color = StateColor[(int)storageState.RemoteState];
break;
}
case EStationTipLayout.VeinCollector:
case EStationTipLayout.PlanetaryLogistics:
{
countUIText.color = _iconLocalsImage[i].color = StateColor[(int)storageState.LocalState];
break;
}
case EStationTipLayout.None:
case EStationTipLayout.Collector:
default:
break;
}
} }
else if (itemId <= 0) return; else if (itemId <= 0) return;
var barEnabled = RealtimeLogisticsInfoPanelBarsEnabled.Value; var barEnabled = RealtimeLogisticsInfoPanelBarsEnabled.Value;
var itemCount = storage.count; var itemCount = storage.count;
var itemMax = storage.max; var itemLimit = _layout == EStationTipLayout.InterstellarLogistics ? _remoteStorageMaxTotal : _localStorageMaxTotal;
if (storageState.ItemCount != itemCount) if (storageState.ItemCount != itemCount)
{ {
storageState.ItemCount = itemCount; storageState.ItemCount = itemCount;
countUIText.text = itemCount.ToString(); countUIText.text = itemCount.ToString();
if (itemCount > itemMax) itemCount = itemMax; if (itemCount > itemLimit) itemCount = itemLimit;
if (barEnabled) if (barEnabled)
{ {
if (itemCount == 0) if (itemCount == 0)
@@ -1080,7 +1102,7 @@ public static class LogisticsPatch
switch (itemOrdered) switch (itemOrdered)
{ {
case > 0: case > 0:
if (itemOrdered + itemCount > itemMax) itemOrdered = itemMax - itemCount; if (itemOrdered + itemCount > itemLimit) itemOrdered = itemLimit - itemCount;
_sliderOrderedImage[i].color = OrderInColor; _sliderOrderedImage[i].color = OrderInColor;
var rectTrans = (RectTransform)_sliderOrdered[i].transform; var rectTrans = (RectTransform)_sliderOrdered[i].transform;
rectTrans.localPosition = new Vector3( rectTrans.localPosition = new Vector3(
@@ -1111,6 +1133,7 @@ public static class LogisticsPatch
_sliderOrdered[i].gameObject.SetActive(itemOrdered != 0); _sliderOrdered[i].gameObject.SetActive(itemOrdered != 0);
} }
var itemMax = storage.max;
if (storageState.ItemMax != itemMax) if (storageState.ItemMax != itemMax)
{ {
storageState.ItemMax = itemMax; storageState.ItemMax = itemMax;
@@ -1140,8 +1163,7 @@ public static class LogisticsPatch
storageState.RemoteState = remoteLogic; storageState.RemoteState = remoteLogic;
var iconRemoteImage = _iconRemotesImage[i]; var iconRemoteImage = _iconRemotesImage[i];
iconRemoteImage.sprite = StateSprite[(int)remoteLogic]; iconRemoteImage.sprite = StateSprite[(int)remoteLogic];
iconRemoteImage.color = StateColor[(int)remoteLogic]; countUIText.color = iconRemoteImage.color = StateColor[(int)remoteLogic];
countUIText.color = iconRemoteImage.color;
} }
break; break;
@@ -1155,8 +1177,7 @@ public static class LogisticsPatch
storageState.LocalState = localLogic; storageState.LocalState = localLogic;
var iconLocalImage = _iconLocalsImage[i]; var iconLocalImage = _iconLocalsImage[i];
iconLocalImage.sprite = StateSprite[(int)localLogic]; iconLocalImage.sprite = StateSprite[(int)localLogic];
iconLocalImage.color = StateColor[(int)localLogic]; countUIText.color = iconLocalImage.color = StateColor[(int)localLogic];
countUIText.color = iconLocalImage.color;
} }
break; break;
} }

View File

@@ -1,8 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using System.Reflection.Emit;
using BepInEx; using BepInEx;
using BepInEx.Configuration; using BepInEx.Configuration;
using CommonAPI; using CommonAPI;
@@ -204,11 +202,6 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
LogisticsPatch.OnUpdate(); LogisticsPatch.OnUpdate();
} }
private void LateUpdate()
{
FactoryPatch.NightLight.LateUpdate();
}
private static void ToggleConfigWindow() private static void ToggleConfigWindow()
{ {
if (!_configWinInitialized) if (!_configWinInitialized)

View File

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

View File

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