mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-09 04:13:32 +08:00
UXAssist: some fixes
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
* `Build Tesla Tower and Wireless Power Tower alternately`:
|
||||
* Fix wrong implementation for latest game patch.
|
||||
* Cannot use Tesla Tower as start Power Tower now, due to new rectangular area build mechanism.
|
||||
* `Planet Vein Untilization`: Support mods that add new vein types.
|
||||
* `Real-time logistic stations info panel`: Try to fix possible crash.
|
||||
* 1.4.2
|
||||
* Fixed a crash issue.
|
||||
* 1.4.1
|
||||
@@ -348,6 +350,8 @@
|
||||
* `交替建造电力感应塔和无线输电塔`:
|
||||
* 修复了在最新游戏补丁中的错误实现
|
||||
* 由于新的矩形建造机制,现在无法使用电力感应塔作为起始电塔
|
||||
* `宇宙视图矿脉数量显示`:兼容添加矿脉类型的mod
|
||||
* `物流站实时信息面板`:尝试修复可能的崩溃问题
|
||||
* 1.4.2
|
||||
* 修复了一个崩溃问题
|
||||
* 1.4.1
|
||||
|
||||
@@ -719,6 +719,7 @@ public static class LogisticsPatch
|
||||
{
|
||||
private static StationTip[] _stationTips = new StationTip[16];
|
||||
private static readonly StationTip[] StationTipsRecycle = new StationTip[128];
|
||||
private static readonly Sprite[] StateSprite = [null, null, null];
|
||||
private static int _stationTipsRecycleCount;
|
||||
private static GameObject _stationTipsRoot;
|
||||
private static GameObject _tipPrefab;
|
||||
@@ -1003,6 +1004,10 @@ public static class LogisticsPatch
|
||||
tipIconPrefab.gameObject.SetActive(false);
|
||||
_tipPrefab.SetActive(false);
|
||||
_stationTipsRoot.SetActive(false);
|
||||
|
||||
StateSprite[0] = Util.LoadEmbeddedSprite("assets/icon/keep.png");
|
||||
StateSprite[1] = Util.LoadEmbeddedSprite("assets/icon/out.png");
|
||||
StateSprite[2] = Util.LoadEmbeddedSprite("assets/icon/in.png");
|
||||
}
|
||||
|
||||
private static void RecycleStationTips()
|
||||
@@ -1187,7 +1192,6 @@ public static class LogisticsPatch
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class StationTip : MonoBehaviour
|
||||
{
|
||||
[FormerlySerializedAs("RectTransform")]
|
||||
@@ -1231,13 +1235,6 @@ public static class LogisticsPatch
|
||||
public ELogisticStorage RemoteState;
|
||||
}
|
||||
|
||||
private static readonly Sprite[] StateSprite =
|
||||
[
|
||||
Util.LoadEmbeddedSprite("assets/icon/keep.png"),
|
||||
Util.LoadEmbeddedSprite("assets/icon/out.png"),
|
||||
Util.LoadEmbeddedSprite("assets/icon/in.png")
|
||||
];
|
||||
|
||||
private enum EStationTipLayout
|
||||
{
|
||||
None,
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
namespace UXAssist.Patches;
|
||||
|
||||
using Common;
|
||||
using System.Linq;
|
||||
using HarmonyLib;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using BepInEx.Configuration;
|
||||
using Common;
|
||||
using GameLogicProc = Common.GameLogic;
|
||||
|
||||
[PatchGuid(PluginInfo.PLUGIN_GUID)]
|
||||
public class UIPatch : PatchImpl<UIPatch>
|
||||
@@ -19,6 +21,7 @@ public class UIPatch : PatchImpl<UIPatch>
|
||||
|
||||
public static void Start()
|
||||
{
|
||||
GameLogicProc.OnGameBegin += PlanetVeinUtilization.OnGameBegin;
|
||||
Enable(true);
|
||||
Functions.UIFunctions.InitMenuButtons();
|
||||
PlanetVeinUtilization.Enable(PlanetVeinUtilizationEnabled.Value);
|
||||
@@ -28,30 +31,66 @@ public class UIPatch : PatchImpl<UIPatch>
|
||||
{
|
||||
PlanetVeinUtilization.Enable(false);
|
||||
Enable(false);
|
||||
GameLogicProc.OnGameBegin -= PlanetVeinUtilization.OnGameBegin;
|
||||
}
|
||||
|
||||
private class PlanetVeinUtilization : PatchImpl<PlanetVeinUtilization>
|
||||
{
|
||||
private static readonly VeinTypeInfo[] planetVeinCount = new VeinTypeInfo[(int)EVeinType.Max];
|
||||
private static readonly VeinTypeInfo[] starVeinCount = new VeinTypeInfo[(int)EVeinType.Max];
|
||||
private static VeinTypeInfo[] planetVeinCount = null;
|
||||
private static VeinTypeInfo[] starVeinCount = null;
|
||||
private static readonly Dictionary<int, bool> tmpGroups = [];
|
||||
|
||||
public static void OnGameBegin()
|
||||
{
|
||||
if (planetVeinCount != null)
|
||||
{
|
||||
foreach (VeinTypeInfo vti in planetVeinCount)
|
||||
{
|
||||
if (vti.textCtrl != null)
|
||||
{
|
||||
Object.Destroy(vti.textCtrl.gameObject);
|
||||
}
|
||||
}
|
||||
planetVeinCount = null;
|
||||
}
|
||||
if (starVeinCount != null)
|
||||
{
|
||||
foreach (VeinTypeInfo vti in starVeinCount)
|
||||
{
|
||||
if (vti.textCtrl != null)
|
||||
{
|
||||
Object.Destroy(vti.textCtrl.gameObject);
|
||||
}
|
||||
}
|
||||
starVeinCount = null;
|
||||
}
|
||||
var maxVeinId = LDB.veins.dataArray.Max(vein => vein.ID);
|
||||
planetVeinCount = new VeinTypeInfo[maxVeinId + 1];
|
||||
starVeinCount = new VeinTypeInfo[maxVeinId + 1];
|
||||
InitializeVeinCountArray(planetVeinCount);
|
||||
InitializeVeinCountArray(starVeinCount);
|
||||
}
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
InitializeVeinCountArray(planetVeinCount);
|
||||
InitializeVeinCountArray(starVeinCount);
|
||||
foreach (VeinTypeInfo vti in planetVeinCount)
|
||||
if (planetVeinCount != null)
|
||||
{
|
||||
vti.Reset();
|
||||
vti.textCtrl?.gameObject.SetActive(true);
|
||||
foreach (VeinTypeInfo vti in planetVeinCount)
|
||||
{
|
||||
vti.Reset();
|
||||
vti.textCtrl?.gameObject.SetActive(true);
|
||||
}
|
||||
UIPlanetDetail_RefreshDynamicProperties_Postfix(UIRoot.instance.uiGame.planetDetail);
|
||||
}
|
||||
UIPlanetDetail_RefreshDynamicProperties_Postfix(UIRoot.instance.uiGame.planetDetail);
|
||||
foreach (VeinTypeInfo vti in starVeinCount)
|
||||
if (starVeinCount != null)
|
||||
{
|
||||
vti.Reset();
|
||||
vti.textCtrl?.gameObject.SetActive(true);
|
||||
foreach (VeinTypeInfo vti in starVeinCount)
|
||||
{
|
||||
vti.Reset();
|
||||
vti.textCtrl?.gameObject.SetActive(true);
|
||||
}
|
||||
UIStarDetail_RefreshDynamicProperties_Postfix(UIRoot.instance.uiGame.starDetail);
|
||||
}
|
||||
UIStarDetail_RefreshDynamicProperties_Postfix(UIRoot.instance.uiGame.starDetail);
|
||||
}
|
||||
|
||||
private static Vector2 GetAdjustedSizeDelta(Vector2 origSizeDelta)
|
||||
@@ -61,15 +100,21 @@ public class UIPatch : PatchImpl<UIPatch>
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
foreach (VeinTypeInfo vti in planetVeinCount)
|
||||
if (planetVeinCount != null)
|
||||
{
|
||||
vti.Reset();
|
||||
vti.textCtrl?.gameObject.SetActive(false);
|
||||
foreach (VeinTypeInfo vti in planetVeinCount)
|
||||
{
|
||||
vti.Reset();
|
||||
vti.textCtrl?.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
foreach (VeinTypeInfo vti in starVeinCount)
|
||||
if (starVeinCount != null)
|
||||
{
|
||||
vti.Reset();
|
||||
vti.textCtrl?.gameObject.SetActive(false);
|
||||
foreach (VeinTypeInfo vti in starVeinCount)
|
||||
{
|
||||
vti.Reset();
|
||||
vti.textCtrl?.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
4using System;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UXAssist.Common;
|
||||
|
||||
Reference in New Issue
Block a user