mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-08 21:33:28 +08:00
UXAssist and CheatEnabler new release
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
## Changlog
|
||||
|
||||
* 2.3.25
|
||||
+ New feature: `Enable warp without space warpers`
|
||||
+ New feature: `Enable warp without space warpers`
|
||||
+ 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.
|
||||
* 2.3.24
|
||||
+ `Complete Dyson Sphere Shells instantly`: Fix a bug that may cause negative power in some cases
|
||||
* 2.3.23
|
||||
@@ -131,6 +133,8 @@
|
||||
|
||||
* 2.3.25
|
||||
+ 新功能:`无需空间翘曲器即可曲速飞行`
|
||||
+ 新功能:`风力涡轮机供电覆盖全球`
|
||||
+ 修复了`立即完成戴森壳建造`未生成太阳帆生产记录的问题
|
||||
* 2.3.24
|
||||
+ `立即完成戴森壳建造`:修复了在某些情况下可能导致发电为负的问题
|
||||
* 2.3.23
|
||||
|
||||
@@ -44,6 +44,8 @@ public class CheatEnabler : BaseUnityPlugin
|
||||
"Boost fuel power");
|
||||
FactoryPatch.BoostGeothermalPowerEnabled = Config.Bind("Build", "BoostGeothermalPower", false,
|
||||
"Boost geothermal power");
|
||||
FactoryPatch.WindTurbinesPowerGlobalCoverageEnabled = Config.Bind("Build", "PowerGlobalCoverage", false,
|
||||
"Global power coverage");
|
||||
FactoryPatch.GreaterPowerUsageInLogisticsEnabled = Config.Bind("Build", "GreaterPowerUsageInLogistics", false,
|
||||
"Increase maximum power usage in Logistic Stations and Advanced Mining Machines");
|
||||
FactoryPatch.ControlPanelRemoteLogisticsEnabled = Config.Bind("Build", "ControlPanelRemoteLogistics", false,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<BepInExPluginGuid>org.soardev.cheatenabler</BepInExPluginGuid>
|
||||
<Description>DSP MOD - CheatEnabler</Description>
|
||||
<Version>2.3.24</Version>
|
||||
<Version>2.3.25</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<PackageId>CheatEnabler</PackageId>
|
||||
|
||||
@@ -26,6 +26,7 @@ public static class FactoryPatch
|
||||
public static ConfigEntry<bool> BoostSolarPowerEnabled;
|
||||
public static ConfigEntry<bool> BoostFuelPowerEnabled;
|
||||
public static ConfigEntry<bool> BoostGeothermalPowerEnabled;
|
||||
public static ConfigEntry<bool> WindTurbinesPowerGlobalCoverageEnabled;
|
||||
public static ConfigEntry<bool> GreaterPowerUsageInLogisticsEnabled;
|
||||
public static ConfigEntry<bool> ControlPanelRemoteLogisticsEnabled;
|
||||
|
||||
@@ -69,6 +70,7 @@ public static class FactoryPatch
|
||||
BoostSolarPowerEnabled.SettingChanged += (_, _) => BoostSolarPower.Enable(BoostSolarPowerEnabled.Value);
|
||||
BoostFuelPowerEnabled.SettingChanged += (_, _) => BoostFuelPower.Enable(BoostFuelPowerEnabled.Value);
|
||||
BoostGeothermalPowerEnabled.SettingChanged += (_, _) => BoostGeothermalPower.Enable(BoostGeothermalPowerEnabled.Value);
|
||||
WindTurbinesPowerGlobalCoverageEnabled.SettingChanged += (_, _) => WindTurbinesPowerGlobalCoverage.Enable(WindTurbinesPowerGlobalCoverageEnabled.Value);
|
||||
GreaterPowerUsageInLogisticsEnabled.SettingChanged += (_, _) => GreaterPowerUsageInLogistics.Enable(GreaterPowerUsageInLogisticsEnabled.Value);
|
||||
ControlPanelRemoteLogisticsEnabled.SettingChanged += (_, _) => ControlPanelRemoteLogistics.Enable(ControlPanelRemoteLogisticsEnabled.Value);
|
||||
ImmediateBuild.Enable(ImmediateEnabled.Value);
|
||||
@@ -85,6 +87,7 @@ public static class FactoryPatch
|
||||
ControlPanelRemoteLogistics.Enable(ControlPanelRemoteLogisticsEnabled.Value);
|
||||
_factoryPatch = Harmony.CreateAndPatchAll(typeof(FactoryPatch));
|
||||
GameLogic.OnGameBegin += GameMain_Begin_Postfix_For_ImmBuild;
|
||||
GameLogic.OnDataLoaded += () => WindTurbinesPowerGlobalCoverage.Enable(WindTurbinesPowerGlobalCoverageEnabled.Value);
|
||||
}
|
||||
|
||||
public static void Uninit()
|
||||
@@ -101,6 +104,7 @@ public static class FactoryPatch
|
||||
BoostSolarPower.Enable(false);
|
||||
BoostFuelPower.Enable(false);
|
||||
BoostGeothermalPower.Enable(false);
|
||||
WindTurbinesPowerGlobalCoverage.Enable(false);
|
||||
GreaterPowerUsageInLogistics.Enable(false);
|
||||
ControlPanelRemoteLogistics.Enable(false);
|
||||
}
|
||||
@@ -1320,6 +1324,57 @@ public static class FactoryPatch
|
||||
}
|
||||
}
|
||||
|
||||
private static class WindTurbinesPowerGlobalCoverage
|
||||
{
|
||||
private static bool _patched;
|
||||
private static PrefabDesc _prefabdesc;
|
||||
private static float _oldCoverRadius;
|
||||
private static float _oldConnectDistance;
|
||||
|
||||
public static void Enable(bool enable)
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
if (_patched) return;
|
||||
_patched = true;
|
||||
var itemProto = LDB.items.Select(2203);
|
||||
_oldCoverRadius = itemProto.prefabDesc.powerCoverRadius;
|
||||
_oldConnectDistance = itemProto.prefabDesc.powerConnectDistance;
|
||||
itemProto.prefabDesc.powerCoverRadius = 500f;
|
||||
itemProto.prefabDesc.powerConnectDistance = 500f;
|
||||
_prefabdesc = itemProto.prefabDesc;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_patched) return;
|
||||
_patched = false;
|
||||
_prefabdesc.powerCoverRadius = _oldCoverRadius;
|
||||
_prefabdesc.powerConnectDistance = _oldConnectDistance;
|
||||
}
|
||||
|
||||
foreach (var factory in GameMain.data.factories)
|
||||
{
|
||||
var powerSystem = factory?.powerSystem;
|
||||
if (powerSystem == null) continue;
|
||||
for (var i = powerSystem.nodeCursor - 1; i >= 0; i--)
|
||||
{
|
||||
ref var node = ref powerSystem.nodePool[i];
|
||||
if (node.id != i) continue;
|
||||
ref var entity = ref factory.entityPool[node.entityId];
|
||||
if (entity.protoId != 2203) continue;
|
||||
powerSystem.OnNodeRemoving(i);
|
||||
node.connectDistance = _prefabdesc.powerConnectDistance;
|
||||
node.coverRadius = _prefabdesc.powerCoverRadius;
|
||||
powerSystem.OnNodeAdded(i);
|
||||
}
|
||||
if (factory.planet.factoryLoaded)
|
||||
{
|
||||
factory.planet.factoryModel.RefreshPowerNodes();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class GreaterPowerUsageInLogistics
|
||||
{
|
||||
private static Harmony _patch;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
- Advanced Mining Machines: Increased max mining speed to 1000%
|
||||
+ Retrieve/Place items from/to remote planets on logistics control panel
|
||||
+ Remove space limit between wind turbines and solar panels
|
||||
+ Wind Turbines do global power coverage
|
||||
+ Boost power generations for kinds of power generators
|
||||
+ Planet:
|
||||
+ Infinite Natural Resources
|
||||
@@ -90,6 +91,7 @@
|
||||
- 大型采矿机:将最大采矿速度提高到1000%
|
||||
+ 在物流总控面板上可以从非本地行星取放物品
|
||||
+ 风力发电机和太阳能板无间距限制
|
||||
+ 风力涡轮机供电覆盖全球
|
||||
+ 提升各种发电设备发电量
|
||||
+ 行星:
|
||||
+ 自然资源采集不消耗
|
||||
|
||||
@@ -49,6 +49,7 @@ public static class UIConfigWindow
|
||||
I18N.Add("Boost solar power", "Boost solar power(x100,000)", "提升太阳能发电(x100,000)");
|
||||
I18N.Add("Boost fuel power", "Boost fuel power(x50,000)", "提升燃料发电(x50,000)");
|
||||
I18N.Add("Boost fuel power 2", "(x20,000 for deuteron, x10,000 for antimatter)", "(氘核燃料棒x20,000,反物质燃料棒x10,000)");
|
||||
I18N.Add("Wind Turbines do global power coverage", "Wind Turbines do global power coverage", "风力涡轮机供电覆盖全球");
|
||||
I18N.Add("Boost geothermal power", "Boost geothermal power(x50,000)", "提升地热发电(x50,000)");
|
||||
I18N.Add("Increase maximum power usage in Logistic Stations and Advanced Mining Machines", "Increase maximum power usage in Logistic Stations and Advanced Mining Machines", "提升物流塔和大型采矿机的最大功耗");
|
||||
I18N.Add("Retrieve/Place items from/to remote planets on logistics control panel", "Retrieve/Place items from/to remote planets on logistics control panel", "在物流总控面板上可以从非本地行星取放物品");
|
||||
@@ -145,6 +146,8 @@ public static class UIConfigWindow
|
||||
y = 10f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.RemovePowerSpaceLimitEnabled, "Remove power space limit");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.WindTurbinesPowerGlobalCoverageEnabled, "Wind Turbines do global power coverage");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.BoostWindPowerEnabled, "Boost wind power");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.BoostSolarPowerEnabled, "Boost solar power");
|
||||
@@ -152,9 +155,8 @@ public static class UIConfigWindow
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.BoostGeothermalPowerEnabled, "Boost geothermal power");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.BoostFuelPowerEnabled, "Boost fuel power");
|
||||
x += 32f;
|
||||
y += 26f;
|
||||
wnd.AddText2(x, y, tab2, "Boost fuel power 2", 13);
|
||||
wnd.AddText2(x + 32f, y, tab2, "Boost fuel power 2", 13);
|
||||
|
||||
// Planet Tab
|
||||
var tab3 = wnd.AddTab(_windowTrans, "Planet");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "CheatEnabler",
|
||||
"version_number": "2.3.24",
|
||||
"version_number": "2.3.25",
|
||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/CheatEnabler",
|
||||
"description": "Add various cheat functions while disabling abnormal determinants / 添加一些作弊功能,同时屏蔽异常检测",
|
||||
"dependencies": [
|
||||
|
||||
25
UXAssist/AuxilaryfunctionWrapper.cs
Normal file
25
UXAssist/AuxilaryfunctionWrapper.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using BepInEx.Configuration;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace UXAssist;
|
||||
|
||||
public static class AuxilaryfunctionWrapper
|
||||
{
|
||||
private const string AuxilaryfunctionGuid = "cn.blacksnipe.dsp.Auxilaryfunction";
|
||||
public static ConfigEntry<bool> ShowStationInfo;
|
||||
|
||||
public static void Init(Harmony harmony)
|
||||
{
|
||||
if (!BepInEx.Bootstrap.Chainloader.PluginInfos.TryGetValue(AuxilaryfunctionGuid, out var pluginInfo)) return;
|
||||
var assembly = pluginInfo.Instance.GetType().Assembly;
|
||||
try
|
||||
{
|
||||
var classType = assembly.GetType("Auxilaryfunction.Auxilaryfunction");
|
||||
ShowStationInfo = (ConfigEntry<bool>)AccessTools.Field(classType, "ShowStationInfo").GetValue(pluginInfo.Instance);
|
||||
}
|
||||
catch
|
||||
{
|
||||
UXAssist.Logger.LogWarning("Failed to get ShowStationInfo from Auxilaryfunction");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,12 @@
|
||||
## Changlog
|
||||
|
||||
* 1.1.6
|
||||
+ New feature: `Scale up mouse cursor`
|
||||
- Note: This will enable software cursor mode, which may cause mouse movement lag on heavy load.
|
||||
+ New feature: `Real-time logistic stations info panel`
|
||||
- Note: This function will be hidden if you enabled `Show station info` in mod `Auxilaryfunction`.
|
||||
+ Fix an issue that `Dyson Sphere "Auto Fast Build"` does not generate production records for solar sails.
|
||||
+ Remove use of AssetBundle, move all icons into `Assembly Resources`, for better flexibility.
|
||||
* 1.1.5
|
||||
+ New feature: `Logistics Control Panel Improvement`
|
||||
- Auto apply filter with item under mouse cursor while opening the panel
|
||||
@@ -154,6 +161,13 @@
|
||||
|
||||
## 更新日志
|
||||
|
||||
* 1.1.6
|
||||
+ 新功能:`放大鼠标指针`
|
||||
- 注意:这将启用软件指针模式,可能会在CPU负载较重时导致鼠标移动延迟
|
||||
+ 新功能:`物流运输站实时信息面板`
|
||||
- 注意:如果你启用了`Auxilaryfunction`中的`展示物流站信息`,此功能将被隐藏
|
||||
+ 修复了`戴森球自动快速建造`未生成太阳帆生产记录的问题
|
||||
+ 移除了AssetBundle的使用,将所有图标移入`Assembly资源`,以获得更好的灵活性
|
||||
* 1.1.5
|
||||
+ 新功能:`物流控制面板改进`
|
||||
- 打开面板时自动将鼠标指向物品设为筛选条件
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using BepInEx.Configuration;
|
||||
@@ -13,14 +12,13 @@ using UXAssist.Common;
|
||||
|
||||
namespace UXAssist;
|
||||
|
||||
using StorageItemData = (int, int, ELogisticStorage, ELogisticStorage);
|
||||
|
||||
public static class LogisticsPatch
|
||||
{
|
||||
public static ConfigEntry<bool> LogisticsCapacityTweaksEnabled;
|
||||
public static ConfigEntry<bool> AllowOverflowInLogisticsEnabled;
|
||||
public static ConfigEntry<bool> LogisticsConstrolPanelImprovementEnabled;
|
||||
public static ConfigEntry<bool> RealtimeLogisticsInfoPanelEnabled;
|
||||
public static ConfigEntry<bool> RealtimeLogisticsInfoPanelBarsEnabled;
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
@@ -28,15 +26,20 @@ public static class LogisticsPatch
|
||||
AllowOverflowInLogisticsEnabled.SettingChanged += (_, _) => AllowOverflowInLogistics.Enable(AllowOverflowInLogisticsEnabled.Value);
|
||||
LogisticsConstrolPanelImprovementEnabled.SettingChanged += (_, _) => LogisticsConstrolPanelImprovement.Enable(LogisticsConstrolPanelImprovementEnabled.Value);
|
||||
RealtimeLogisticsInfoPanelEnabled.SettingChanged += (_, _) => RealtimeLogisticsInfoPanel.Enable(RealtimeLogisticsInfoPanelEnabled.Value);
|
||||
RealtimeLogisticsInfoPanelBarsEnabled.SettingChanged += (_, _) => RealtimeLogisticsInfoPanel.EnableBars(RealtimeLogisticsInfoPanelBarsEnabled.Value);
|
||||
LogisticsCapacityTweaks.Enable(LogisticsCapacityTweaksEnabled.Value);
|
||||
AllowOverflowInLogistics.Enable(AllowOverflowInLogisticsEnabled.Value);
|
||||
LogisticsConstrolPanelImprovement.Enable(LogisticsConstrolPanelImprovementEnabled.Value);
|
||||
RealtimeLogisticsInfoPanel.Enable(RealtimeLogisticsInfoPanelEnabled.Value);
|
||||
RealtimeLogisticsInfoPanel.EnableBars(RealtimeLogisticsInfoPanelBarsEnabled.Value);
|
||||
|
||||
GameLogic.OnGameBegin += RealtimeLogisticsInfoPanel.OnGameBegin;
|
||||
GameLogic.OnDataLoaded += RealtimeLogisticsInfoPanel.OnDataLoaded;
|
||||
}
|
||||
|
||||
public static void Uninit()
|
||||
{
|
||||
GameLogic.OnDataLoaded -= RealtimeLogisticsInfoPanel.OnDataLoaded;
|
||||
GameLogic.OnGameBegin -= RealtimeLogisticsInfoPanel.OnGameBegin;
|
||||
|
||||
LogisticsCapacityTweaks.Enable(false);
|
||||
@@ -488,11 +491,34 @@ public static class LogisticsPatch
|
||||
private static GameObject _tipPrefab;
|
||||
private static readonly Color DemandColor = new(253f / 255, 150f / 255, 94f / 255);
|
||||
private static readonly Color SupplyColor = new(97f / 255, 216f / 255, 255f / 255);
|
||||
private static readonly Color OrderInColor = new(108f / 255, 187f / 255, 214f / 255);
|
||||
private static readonly Color OrderOutColor = new(255f / 255, 161f / 255, 109.5f / 255);
|
||||
|
||||
private static PlanetData _lastPlanet;
|
||||
|
||||
private static int _localStorageMax = 5000;
|
||||
private static int _remoteStorageMax = 10000;
|
||||
private static int _localStorageExtra;
|
||||
private static int _remoteStorageExtra;
|
||||
private static float _localStoragePixelPerItem = StorageSliderWidth / (_localStorageMax + _localStorageExtra);
|
||||
private static float _remoteStoragePixelPerItem = StorageSliderWidth / (_remoteStorageMax + _remoteStorageExtra);
|
||||
|
||||
private const int StorageSlotCount = 5;
|
||||
private const int CarrierSlotCount = 3;
|
||||
private const float StorageSliderWidth = 70f;
|
||||
private const float StorageSliderHeight = 5f;
|
||||
|
||||
private static bool UpdateStorageMax()
|
||||
{
|
||||
var history = GameMain.history;
|
||||
if (history == null) return false;
|
||||
if (_remoteStorageExtra == history.remoteStationExtraStorage) return false;
|
||||
_localStorageExtra = history.localStationExtraStorage;
|
||||
_remoteStorageExtra = history.remoteStationExtraStorage;
|
||||
_localStoragePixelPerItem = StorageSliderWidth / (_localStorageMax + _localStorageExtra);
|
||||
_remoteStoragePixelPerItem = StorageSliderWidth / (_remoteStorageMax + _remoteStorageExtra);
|
||||
return true;
|
||||
}
|
||||
|
||||
private static readonly Sprite[] LogisticsExtraItemSprites =
|
||||
[
|
||||
@@ -506,11 +532,31 @@ public static class LogisticsPatch
|
||||
_stationTipRoot?.SetActive(on);
|
||||
}
|
||||
|
||||
public static void EnableBars(bool on)
|
||||
{
|
||||
foreach (var stationTip in _stationTips)
|
||||
{
|
||||
if (stationTip == null) continue;
|
||||
stationTip.SetBarsVisible(on);
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnGameBegin()
|
||||
{
|
||||
_lastPlanet = null;
|
||||
}
|
||||
|
||||
public static void OnDataLoaded()
|
||||
{
|
||||
_localStorageMax = LDB.models.Select(49).prefabDesc.stationMaxItemCount;
|
||||
_remoteStorageMax = LDB.models.Select(50).prefabDesc.stationMaxItemCount;
|
||||
_localStorageExtra = -1;
|
||||
_remoteStorageExtra = -1;
|
||||
_localStoragePixelPerItem = 0f;
|
||||
_remoteStoragePixelPerItem = 0f;
|
||||
UpdateStorageMax();
|
||||
}
|
||||
|
||||
public static void InitGUI()
|
||||
{
|
||||
_stationTipRoot = UnityEngine.Object.Instantiate(GameObject.Find("UI Root/Overlay Canvas/In Game/Scene UIs/Vein Marks"),
|
||||
@@ -547,38 +593,40 @@ public static class LogisticsPatch
|
||||
var sliderBg = UnityEngine.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(66f, 6f);
|
||||
rectTrans.sizeDelta = new Vector2(StorageSliderWidth, StorageSliderHeight);
|
||||
rectTrans.anchorMax = new Vector2(0f, 1f);
|
||||
rectTrans.anchorMin = new Vector2(0f, 1f);
|
||||
rectTrans.pivot = new Vector2(0f, 1f);
|
||||
rectTrans.anchoredPosition3D = new Vector3(34f, y - 18f, 0f);
|
||||
rectTrans.anchoredPosition3D = new Vector3(30f, y - 22f, 0f);
|
||||
rectTrans = (RectTransform)sliderBg.transform.Find("current-fg").transform;
|
||||
rectTrans.sizeDelta = new Vector2(32f, 4f);
|
||||
rectTrans.sizeDelta = new Vector2(0f, StorageSliderHeight);
|
||||
rectTrans.anchorMax = new Vector2(0f, 1f);
|
||||
rectTrans.anchorMin = new Vector2(0f, 1f);
|
||||
rectTrans.pivot = new Vector2(0f, 1f);
|
||||
rectTrans.localPosition = new Vector3(1f, -1f, 0f);
|
||||
rectTrans.localPosition = new Vector3(0f, 0f, 0f);
|
||||
rectTrans = (RectTransform)sliderBg.transform.Find("ordered-fg").transform;
|
||||
rectTrans.sizeDelta = new Vector2(32f, 4f);
|
||||
rectTrans.sizeDelta = new Vector2(0f, StorageSliderHeight);
|
||||
rectTrans.anchorMax = new Vector2(0f, 1f);
|
||||
rectTrans.anchorMin = new Vector2(0f, 1f);
|
||||
rectTrans.pivot = new Vector2(0f, 1f);
|
||||
rectTrans.localPosition = new Vector3(33f, -1f, 0f);
|
||||
rectTrans.localPosition = new Vector3(0f, 0f, 0f);
|
||||
rectTrans = (RectTransform)sliderBg.transform.Find("max-fg").transform;
|
||||
rectTrans.sizeDelta = new Vector2(64f, 4f);
|
||||
rectTrans.sizeDelta = new Vector2(StorageSliderWidth, StorageSliderHeight);
|
||||
rectTrans.anchorMax = new Vector2(0f, 1f);
|
||||
rectTrans.anchorMin = new Vector2(0f, 1f);
|
||||
rectTrans.pivot = new Vector2(0f, 1f);
|
||||
rectTrans.localPosition = new Vector3(1f, -1f, 0f);
|
||||
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);
|
||||
sliderBg.gameObject.SetActive(true);
|
||||
sliderBg.gameObject.SetActive(false);
|
||||
|
||||
var countText = UnityEngine.Object.Instantiate(infoText, Vector3.zero, Quaternion.identity, _tipPrefab.transform);
|
||||
countText.name = "countText" + index;
|
||||
var text = countText.GetComponent<Text>();
|
||||
text.fontSize = 16;
|
||||
text.fontSize = 18;
|
||||
text.text = "";
|
||||
text.alignment = TextAnchor.UpperRight;
|
||||
rectTrans = (RectTransform)countText.transform;
|
||||
@@ -593,20 +641,20 @@ public static class LogisticsPatch
|
||||
stateLocal.name = "iconLocal" + index;
|
||||
stateLocal.GetComponent<Image>().material = null;
|
||||
rectTrans = (RectTransform)stateLocal.transform;
|
||||
rectTrans.sizeDelta = new Vector2(20f, 20f);
|
||||
rectTrans.sizeDelta = new Vector2(16f, 16f);
|
||||
rectTrans.anchorMax = new Vector2(0f, 1f);
|
||||
rectTrans.anchorMin = new Vector2(0f, 1f);
|
||||
rectTrans.pivot = new Vector2(0f, 1f);
|
||||
rectTrans.anchoredPosition3D = new Vector3(100f, y - 5f, 0);
|
||||
rectTrans.anchoredPosition3D = new Vector3(102f, y, 0);
|
||||
var stateRemote = UnityEngine.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;
|
||||
rectTrans.sizeDelta = new Vector2(30f, 30f);
|
||||
rectTrans.sizeDelta = new Vector2(20f, 20f);
|
||||
rectTrans.anchorMax = new Vector2(0f, 1f);
|
||||
rectTrans.anchorMin = new Vector2(0f, 1f);
|
||||
rectTrans.pivot = new Vector2(0f, 1f);
|
||||
rectTrans.anchoredPosition3D = new Vector3(115f, y, 0);
|
||||
rectTrans.anchoredPosition3D = new Vector3(100f, y - 12f, 0);
|
||||
}
|
||||
|
||||
for (var i = 0; i < CarrierSlotCount; i++)
|
||||
@@ -665,291 +713,6 @@ public static class LogisticsPatch
|
||||
_tipPrefab.SetActive(false);
|
||||
}
|
||||
|
||||
public class StationTip : MonoBehaviour
|
||||
{
|
||||
[FormerlySerializedAs("RectTransform")]
|
||||
public RectTransform rectTransform;
|
||||
|
||||
private Transform[] _icons;
|
||||
private Transform[] _iconLocals;
|
||||
private Transform[] _iconRemotes;
|
||||
private Transform[] _countTexts;
|
||||
|
||||
private Image[] _iconsImage;
|
||||
private Image[] _iconLocalsImage;
|
||||
private Image[] _iconRemotesImage;
|
||||
private Text[] _countTextsText;
|
||||
|
||||
private Transform[] _carrierIcons;
|
||||
private Text[] _carrierTotalCountText;
|
||||
private Text[] _carrierIdleCountText;
|
||||
|
||||
private GameObject _infoText;
|
||||
private StationComponent _currentStation;
|
||||
private EStationTipLayout _layout = EStationTipLayout.None;
|
||||
private int _storageNum;
|
||||
private readonly StorageItemData[] _storageItems = new StorageItemData[5];
|
||||
|
||||
private static readonly Dictionary<int, Sprite> ItemSprites = new();
|
||||
private static readonly Color[] StateColor = [Color.gray, SupplyColor, DemandColor];
|
||||
|
||||
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,
|
||||
Collector,
|
||||
VeinCollector,
|
||||
PlanetaryLogistics,
|
||||
InterstellarLogistics
|
||||
}
|
||||
|
||||
public void InitStationTip()
|
||||
{
|
||||
rectTransform = (RectTransform)transform;
|
||||
_icons = new Transform[StorageSlotCount];
|
||||
_iconLocals = new Transform[StorageSlotCount];
|
||||
_iconRemotes = new Transform[StorageSlotCount];
|
||||
_iconsImage = new Image[StorageSlotCount];
|
||||
_iconLocalsImage = new Image[StorageSlotCount];
|
||||
_iconRemotesImage = new Image[StorageSlotCount];
|
||||
_countTexts = new Transform[StorageSlotCount];
|
||||
_countTextsText = new Text[StorageSlotCount];
|
||||
_carrierIcons = new Transform[3];
|
||||
_carrierTotalCountText = new Text[3];
|
||||
_carrierIdleCountText = new Text[2];
|
||||
|
||||
_infoText = transform.Find("info-text").gameObject;
|
||||
for (var i = CarrierSlotCount - 1; i >= 0; i--)
|
||||
{
|
||||
_carrierIcons[i] = transform.Find("carrierIcon" + i);
|
||||
_carrierIcons[i].gameObject.SetActive(false);
|
||||
_carrierTotalCountText[i] = _carrierIcons[i].Find("carrierTotalCountText").GetComponent<Text>();
|
||||
if (i >= CarrierSlotCount - 1) continue;
|
||||
_carrierIdleCountText[i] = _carrierIcons[i].Find("carrierIdleCountText").GetComponent<Text>();
|
||||
}
|
||||
|
||||
for (var i = StorageSlotCount - 1; i >= 0; i--)
|
||||
{
|
||||
_countTexts[i] = transform.Find("countText" + i);
|
||||
_countTextsText[i] = _countTexts[i].GetComponent<Text>();
|
||||
_icons[i] = transform.Find("icon" + i);
|
||||
_iconsImage[i] = _icons[i].GetComponent<Image>();
|
||||
_iconLocals[i] = transform.Find("iconLocal" + i);
|
||||
_iconRemotes[i] = transform.Find("iconRemote" + i);
|
||||
_iconLocalsImage[i] = _iconLocals[i].GetComponent<Image>();
|
||||
_iconRemotesImage[i] = _iconRemotes[i].GetComponent<Image>();
|
||||
_countTexts[i].gameObject.SetActive(false);
|
||||
_icons[i].gameObject.SetActive(false);
|
||||
_iconLocals[i].gameObject.SetActive(false);
|
||||
_iconRemotes[i].gameObject.SetActive(false);
|
||||
_storageItems[i] = (-1, -1, ELogisticStorage.None, ELogisticStorage.None);
|
||||
}
|
||||
|
||||
_infoText.SetActive(false);
|
||||
}
|
||||
|
||||
public void ResetStationTip()
|
||||
{
|
||||
_currentStation = null;
|
||||
_layout = EStationTipLayout.None;
|
||||
for (var i = StorageSlotCount - 1; i >= 0; i--)
|
||||
{
|
||||
_countTexts[i].gameObject.SetActive(false);
|
||||
_icons[i].gameObject.SetActive(false);
|
||||
_iconLocals[i].gameObject.SetActive(false);
|
||||
_iconRemotes[i].gameObject.SetActive(false);
|
||||
_storageItems[i] = (-1, -1, ELogisticStorage.None, ELogisticStorage.None);
|
||||
_countTextsText[i].color = StateColor[0];
|
||||
_iconLocalsImage[i].color = StateColor[0];
|
||||
_iconRemotesImage[i].color = StateColor[0];
|
||||
}
|
||||
|
||||
for (var i = CarrierSlotCount - 1; i >= 0; i--)
|
||||
{
|
||||
_carrierIcons[i].gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
private static Sprite GetItemSprite(int itemId)
|
||||
{
|
||||
if (ItemSprites.TryGetValue(itemId, out var sprite))
|
||||
return sprite;
|
||||
sprite = LDB.items.Select(itemId)?.iconSprite;
|
||||
ItemSprites[itemId] = sprite;
|
||||
return sprite;
|
||||
}
|
||||
|
||||
public void SetItem(int i, StationStore storage)
|
||||
{
|
||||
var (oldItemId, oldItemCount, oldLocalState, oldRemoteState) = _storageItems[i];
|
||||
var itemId = storage.itemId;
|
||||
var itemCount = storage.count;
|
||||
var icon = _icons[i];
|
||||
var iconLocal = _iconLocals[i];
|
||||
var iconRemote = _iconRemotes[i];
|
||||
var countUIText = _countTextsText[i];
|
||||
if (oldItemCount != itemCount)
|
||||
{
|
||||
_storageItems[i].Item2 = itemCount;
|
||||
countUIText.text = itemCount.ToString();
|
||||
}
|
||||
if (itemId != oldItemId)
|
||||
{
|
||||
_storageItems[i].Item1 = itemId;
|
||||
if (itemId <= 0)
|
||||
{
|
||||
icon.gameObject.SetActive(false);
|
||||
iconLocal.gameObject.SetActive(false);
|
||||
iconRemote.gameObject.SetActive(false);
|
||||
countUIText.color = StateColor[0];
|
||||
countUIText.text = "— ";
|
||||
return;
|
||||
}
|
||||
_iconsImage[i].sprite = GetItemSprite(itemId);
|
||||
icon.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
switch (_layout)
|
||||
{
|
||||
case EStationTipLayout.InterstellarLogistics:
|
||||
{
|
||||
var localLogic = storage.localLogic;
|
||||
if (oldLocalState != localLogic)
|
||||
{
|
||||
_storageItems[i].Item3 = localLogic;
|
||||
var iconLocalImage = _iconLocalsImage[i];
|
||||
iconLocalImage.sprite = StateSprite[(int)localLogic];
|
||||
iconLocalImage.color = StateColor[(int)localLogic];
|
||||
iconLocal.gameObject.SetActive(true);
|
||||
}
|
||||
var remoteLogic = storage.remoteLogic;
|
||||
if (oldRemoteState != remoteLogic)
|
||||
{
|
||||
_storageItems[i].Item4 = remoteLogic;
|
||||
var iconRemoteImage = _iconRemotesImage[i];
|
||||
iconRemoteImage.sprite = StateSprite[(int)remoteLogic];
|
||||
iconRemoteImage.color = StateColor[(int)remoteLogic];
|
||||
iconRemote.gameObject.SetActive(true);
|
||||
countUIText.color = iconRemoteImage.color;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case EStationTipLayout.VeinCollector:
|
||||
case EStationTipLayout.PlanetaryLogistics:
|
||||
{
|
||||
var localLogic = storage.localLogic;
|
||||
if (oldLocalState != localLogic)
|
||||
{
|
||||
_storageItems[i].Item3 = localLogic;
|
||||
var iconLocalImage = _iconLocalsImage[i];
|
||||
iconLocalImage.sprite = StateSprite[(int)localLogic];
|
||||
iconLocalImage.color = StateColor[(int)localLogic];
|
||||
iconLocal.gameObject.SetActive(true);
|
||||
countUIText.color = iconLocalImage.color;
|
||||
}
|
||||
iconRemote.gameObject.SetActive(false);
|
||||
break;
|
||||
}
|
||||
case EStationTipLayout.None:
|
||||
case EStationTipLayout.Collector:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly bool[][] CarrierEnabled = [
|
||||
[false, false, false],
|
||||
[false, false, false],
|
||||
[false, false, false],
|
||||
[true, false, false],
|
||||
[true, true, true],
|
||||
];
|
||||
private static readonly int[] StorageNums = [0, 2, 1, 4, 5];
|
||||
private static readonly float[] TipWindowWidths = [0f, 100f, 120f, 120f, 143f];
|
||||
private static readonly float[] TipWindowExtraHeights = [0f, 5f, 5f, 40f, 40f];
|
||||
private static readonly float[] CarrierPositionX = [5f, 45f, 108f];
|
||||
|
||||
public void UpdateStationInfo(StationComponent stationComponent, PlanetFactory factory)
|
||||
{
|
||||
if (_currentStation != stationComponent)
|
||||
{
|
||||
_currentStation = stationComponent;
|
||||
var layout = stationComponent.isCollector ? EStationTipLayout.Collector :
|
||||
stationComponent.isVeinCollector ? EStationTipLayout.VeinCollector :
|
||||
stationComponent.isStellar ? EStationTipLayout.InterstellarLogistics : EStationTipLayout.PlanetaryLogistics;
|
||||
|
||||
if (_layout != layout)
|
||||
{
|
||||
_layout = layout;
|
||||
for (var i = StorageSlotCount - 1; i >= 0; i--)
|
||||
{
|
||||
_iconLocals[i].gameObject.SetActive(false);
|
||||
_iconRemotes[i].gameObject.SetActive(false);
|
||||
_icons[i].gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
_storageNum = Math.Min(StorageNums[(int)layout], stationComponent.storage.Length);
|
||||
rectTransform.sizeDelta = new Vector2(TipWindowWidths[(int)layout], TipWindowExtraHeights[(int)layout] + 35f * _storageNum);
|
||||
for (var i = StorageSlotCount - 1; i >= 0; i--)
|
||||
{
|
||||
_countTexts[i].gameObject.SetActive(i < _storageNum);
|
||||
}
|
||||
|
||||
for (var i = CarrierSlotCount - 1; i >= 0; i--)
|
||||
{
|
||||
var active = CarrierEnabled[(int)layout][i];
|
||||
_carrierIcons[i].gameObject.SetActive(active);
|
||||
if (!active) continue;
|
||||
var rectTrans = (RectTransform)_carrierIcons[i].transform;
|
||||
rectTrans.anchoredPosition3D = new Vector3(CarrierPositionX[i], -5f - 35f * _storageNum, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var storageArray = stationComponent.storage;
|
||||
for (var j = _storageNum - 1; j >= 0; j--)
|
||||
{
|
||||
var storage = storageArray[j];
|
||||
SetItem(j, storage);
|
||||
}
|
||||
|
||||
int currentCount, totalCount;
|
||||
switch (_layout)
|
||||
{
|
||||
case EStationTipLayout.PlanetaryLogistics:
|
||||
totalCount = stationComponent.idleDroneCount + stationComponent.workDroneCount;
|
||||
currentCount = stationComponent.idleDroneCount;
|
||||
_carrierIdleCountText[0].text = currentCount.ToString();
|
||||
_carrierTotalCountText[0].text = totalCount.ToString();
|
||||
break;
|
||||
case EStationTipLayout.InterstellarLogistics:
|
||||
totalCount = stationComponent.idleDroneCount + stationComponent.workDroneCount;
|
||||
currentCount = stationComponent.idleDroneCount;
|
||||
_carrierIdleCountText[0].text = currentCount.ToString();
|
||||
_carrierTotalCountText[0].text = totalCount.ToString();
|
||||
totalCount = stationComponent.idleShipCount + stationComponent.workShipCount;
|
||||
currentCount = stationComponent.idleShipCount;
|
||||
_carrierIdleCountText[1].text = currentCount.ToString();
|
||||
_carrierTotalCountText[1].text = totalCount.ToString();
|
||||
currentCount = stationComponent.warperCount;
|
||||
_carrierTotalCountText[2].text = currentCount.ToString();
|
||||
break;
|
||||
case EStationTipLayout.None:
|
||||
case EStationTipLayout.Collector:
|
||||
case EStationTipLayout.VeinCollector:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void RecycleStationTips()
|
||||
{
|
||||
foreach (var stationTip in _stationTips)
|
||||
@@ -1002,6 +765,14 @@ public static class LogisticsPatch
|
||||
_lastPlanet = localPlanet;
|
||||
}
|
||||
|
||||
if (UpdateStorageMax())
|
||||
{
|
||||
foreach (var tip in _stationTips)
|
||||
{
|
||||
tip?.ResetStorageSlider();
|
||||
}
|
||||
}
|
||||
|
||||
var factory = localPlanet.factory;
|
||||
var transport = factory?.transport;
|
||||
if (transport == null || transport.stationCursor == 0 || (UIGame.viewMode != EViewMode.Normal && UIGame.viewMode != EViewMode.Globe))
|
||||
@@ -1111,5 +882,439 @@ public static class LogisticsPatch
|
||||
stationTip.UpdateStationInfo(stationComponent, factory);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class StationTip : MonoBehaviour
|
||||
{
|
||||
[FormerlySerializedAs("RectTransform")]
|
||||
public RectTransform rectTransform;
|
||||
|
||||
private Transform[] _icons;
|
||||
private Transform[] _iconLocals;
|
||||
private Transform[] _iconRemotes;
|
||||
private Transform[] _countTexts;
|
||||
private Transform[] _sliderBg;
|
||||
private Transform[] _sliderMax;
|
||||
private Transform[] _sliderCurrent;
|
||||
private Transform[] _sliderOrdered;
|
||||
private Image[] _sliderOrderedImage;
|
||||
|
||||
private Image[] _iconsImage;
|
||||
private Image[] _iconLocalsImage;
|
||||
private Image[] _iconRemotesImage;
|
||||
private Text[] _countTextsText;
|
||||
|
||||
private Transform[] _carrierIcons;
|
||||
private Text[] _carrierTotalCountText;
|
||||
private Text[] _carrierIdleCountText;
|
||||
|
||||
private GameObject _infoText;
|
||||
private StationComponent _currentStation;
|
||||
private EStationTipLayout _layout = EStationTipLayout.None;
|
||||
private int _storageNum;
|
||||
private float _pixelPerItem;
|
||||
|
||||
private readonly StorageItemData[] _storageItems = new StorageItemData[5];
|
||||
private static readonly Dictionary<int, Sprite> ItemSprites = new();
|
||||
private static readonly Color[] StateColor = [Color.gray, SupplyColor, DemandColor];
|
||||
|
||||
private struct StorageItemData
|
||||
{
|
||||
public int ItemId;
|
||||
public int ItemCount;
|
||||
public int ItemOrdered;
|
||||
public int ItemMax;
|
||||
public ELogisticStorage LocalState;
|
||||
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,
|
||||
Collector,
|
||||
VeinCollector,
|
||||
PlanetaryLogistics,
|
||||
InterstellarLogistics
|
||||
}
|
||||
|
||||
public void InitStationTip()
|
||||
{
|
||||
rectTransform = (RectTransform)transform;
|
||||
_icons = new Transform[StorageSlotCount];
|
||||
_iconLocals = new Transform[StorageSlotCount];
|
||||
_iconRemotes = new Transform[StorageSlotCount];
|
||||
_iconsImage = new Image[StorageSlotCount];
|
||||
_iconLocalsImage = new Image[StorageSlotCount];
|
||||
_iconRemotesImage = new Image[StorageSlotCount];
|
||||
_countTexts = new Transform[StorageSlotCount];
|
||||
_countTextsText = new Text[StorageSlotCount];
|
||||
_sliderBg = new Transform[StorageSlotCount];
|
||||
_sliderMax = new Transform[StorageSlotCount];
|
||||
_sliderCurrent = new Transform[StorageSlotCount];
|
||||
_sliderOrdered = new Transform[StorageSlotCount];
|
||||
_sliderOrderedImage = new Image[StorageSlotCount];
|
||||
_carrierIcons = new Transform[3];
|
||||
_carrierTotalCountText = new Text[3];
|
||||
_carrierIdleCountText = new Text[2];
|
||||
|
||||
_infoText = transform.Find("info-text").gameObject;
|
||||
for (var i = CarrierSlotCount - 1; i >= 0; i--)
|
||||
{
|
||||
_carrierIcons[i] = transform.Find("carrierIcon" + i);
|
||||
_carrierIcons[i].gameObject.SetActive(false);
|
||||
_carrierTotalCountText[i] = _carrierIcons[i].Find("carrierTotalCountText").GetComponent<Text>();
|
||||
if (i >= CarrierSlotCount - 1) continue;
|
||||
_carrierIdleCountText[i] = _carrierIcons[i].Find("carrierIdleCountText").GetComponent<Text>();
|
||||
}
|
||||
|
||||
for (var i = StorageSlotCount - 1; i >= 0; i--)
|
||||
{
|
||||
_countTexts[i] = transform.Find("countText" + i);
|
||||
_countTextsText[i] = _countTexts[i].GetComponent<Text>();
|
||||
_sliderBg[i] = transform.Find("sliderBg" + i);
|
||||
_sliderMax[i] = _sliderBg[i].Find("max-fg");
|
||||
_sliderCurrent[i] = _sliderBg[i].Find("current-fg");
|
||||
_sliderOrdered[i] = _sliderBg[i].Find("ordered-fg");
|
||||
_sliderOrderedImage[i] = _sliderOrdered[i].GetComponent<Image>();
|
||||
_icons[i] = transform.Find("icon" + i);
|
||||
_iconsImage[i] = _icons[i].GetComponent<Image>();
|
||||
_iconLocals[i] = transform.Find("iconLocal" + i);
|
||||
_iconRemotes[i] = transform.Find("iconRemote" + i);
|
||||
_iconLocalsImage[i] = _iconLocals[i].GetComponent<Image>();
|
||||
_iconRemotesImage[i] = _iconRemotes[i].GetComponent<Image>();
|
||||
_countTexts[i].gameObject.SetActive(false);
|
||||
_sliderBg[i].gameObject.SetActive(false);
|
||||
_icons[i].gameObject.SetActive(false);
|
||||
_iconLocals[i].gameObject.SetActive(false);
|
||||
_iconRemotes[i].gameObject.SetActive(false);
|
||||
_storageItems[i] = new StorageItemData
|
||||
{
|
||||
ItemId = -1, ItemCount = -1, ItemOrdered = -1, ItemMax = -1,
|
||||
LocalState = ELogisticStorage.None, RemoteState = ELogisticStorage.None
|
||||
};
|
||||
}
|
||||
|
||||
_infoText.SetActive(false);
|
||||
}
|
||||
|
||||
public void ResetStationTip()
|
||||
{
|
||||
_currentStation = null;
|
||||
_layout = EStationTipLayout.None;
|
||||
for (var i = StorageSlotCount - 1; i >= 0; i--)
|
||||
{
|
||||
_countTexts[i].gameObject.SetActive(false);
|
||||
_sliderBg[i].gameObject.SetActive(false);
|
||||
_icons[i].gameObject.SetActive(false);
|
||||
_iconLocals[i].gameObject.SetActive(false);
|
||||
_iconRemotes[i].gameObject.SetActive(false);
|
||||
_countTextsText[i].color = StateColor[0];
|
||||
_iconLocalsImage[i].color = StateColor[0];
|
||||
_iconRemotesImage[i].color = StateColor[0];
|
||||
|
||||
ref var storageItem = ref _storageItems[i];
|
||||
storageItem.ItemId = -1;
|
||||
storageItem.ItemCount = -1;
|
||||
storageItem.ItemOrdered = -1;
|
||||
storageItem.ItemMax = -1;
|
||||
storageItem.LocalState = ELogisticStorage.None;
|
||||
storageItem.RemoteState = ELogisticStorage.None;
|
||||
}
|
||||
|
||||
for (var i = CarrierSlotCount - 1; i >= 0; i--)
|
||||
{
|
||||
_carrierIcons[i].gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetStorageSlider()
|
||||
{
|
||||
for (var i = StorageSlotCount - 1; i >= 0; i--)
|
||||
{
|
||||
ref var storageItem = ref _storageItems[i];
|
||||
storageItem.ItemId = -1;
|
||||
storageItem.ItemCount = -1;
|
||||
storageItem.ItemOrdered = -1;
|
||||
storageItem.ItemMax = -1;
|
||||
}
|
||||
_pixelPerItem = _layout == EStationTipLayout.InterstellarLogistics ? _remoteStoragePixelPerItem : _localStoragePixelPerItem;
|
||||
}
|
||||
|
||||
private static Sprite GetItemSprite(int itemId)
|
||||
{
|
||||
if (ItemSprites.TryGetValue(itemId, out var sprite))
|
||||
return sprite;
|
||||
sprite = LDB.items.Select(itemId)?.iconSprite;
|
||||
ItemSprites[itemId] = sprite;
|
||||
return sprite;
|
||||
}
|
||||
|
||||
public void SetItem(int i, StationStore storage)
|
||||
{
|
||||
ref var storageState = ref _storageItems[i];
|
||||
var countUIText = _countTextsText[i];
|
||||
var itemId = storage.itemId;
|
||||
if (itemId != storageState.ItemId)
|
||||
{
|
||||
var icon = _icons[i];
|
||||
storageState.ItemId = itemId;
|
||||
if (itemId <= 0)
|
||||
{
|
||||
icon.gameObject.SetActive(false);
|
||||
_iconLocals[i].gameObject.SetActive(false);
|
||||
_iconRemotes[i].gameObject.SetActive(false);
|
||||
_sliderBg[i].gameObject.SetActive(false);
|
||||
|
||||
countUIText.color = StateColor[0];
|
||||
countUIText.text = "— ";
|
||||
return;
|
||||
}
|
||||
storage.count = -1;
|
||||
icon.gameObject.SetActive(true);
|
||||
_iconsImage[i].sprite = GetItemSprite(itemId);
|
||||
_iconLocals[i].gameObject.SetActive(CarrierEnabled[(int)_layout][0]);
|
||||
_iconLocalsImage[i].sprite = StateSprite[(int)storageState.LocalState];
|
||||
_iconRemotes[i].gameObject.SetActive(CarrierEnabled[(int)_layout][1]);
|
||||
_iconRemotesImage[i].sprite = StateSprite[(int)storageState.RemoteState];
|
||||
_sliderBg[i].gameObject.SetActive(RealtimeLogisticsInfoPanelBarsEnabled.Value);
|
||||
}
|
||||
else if (itemId <= 0) return;
|
||||
|
||||
var barEnabled = RealtimeLogisticsInfoPanelBarsEnabled.Value;
|
||||
var itemCount = storage.count;
|
||||
var itemMax = storage.max;
|
||||
if (storageState.ItemCount != itemCount)
|
||||
{
|
||||
storageState.ItemCount = itemCount;
|
||||
countUIText.text = itemCount.ToString();
|
||||
if (itemCount > itemMax) itemCount = itemMax;
|
||||
if (barEnabled)
|
||||
{
|
||||
if (itemCount == 0)
|
||||
{
|
||||
_sliderCurrent[i].gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
((RectTransform)_sliderCurrent[i].transform).sizeDelta = new Vector2(
|
||||
_pixelPerItem * itemCount,
|
||||
StorageSliderHeight
|
||||
);
|
||||
_sliderCurrent[i].gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (barEnabled)
|
||||
{
|
||||
var itemOrdered = storage.totalOrdered;
|
||||
if (storageState.ItemOrdered != itemOrdered)
|
||||
{
|
||||
storageState.ItemOrdered = itemOrdered;
|
||||
switch (itemOrdered)
|
||||
{
|
||||
case > 0:
|
||||
if (itemOrdered + itemCount > itemMax) itemOrdered = itemMax - itemCount;
|
||||
_sliderOrderedImage[i].color = OrderInColor;
|
||||
var rectTrans = (RectTransform)_sliderOrdered[i].transform;
|
||||
rectTrans.localPosition = new Vector3(
|
||||
_pixelPerItem * itemCount,
|
||||
0f, 0f
|
||||
);
|
||||
rectTrans.sizeDelta = new Vector2(
|
||||
_pixelPerItem * itemOrdered + 0.49f,
|
||||
StorageSliderHeight
|
||||
);
|
||||
_sliderOrdered[i].gameObject.SetActive(true);
|
||||
break;
|
||||
case < 0:
|
||||
if (itemOrdered + itemCount < 0) itemOrdered = -itemCount;
|
||||
_sliderOrderedImage[i].color = OrderOutColor;
|
||||
rectTrans = (RectTransform)_sliderOrdered[i].transform;
|
||||
rectTrans.localPosition = new Vector3(
|
||||
_pixelPerItem * (itemCount + itemOrdered),
|
||||
0f, 0f
|
||||
);
|
||||
rectTrans.sizeDelta = new Vector2(
|
||||
_pixelPerItem * -itemOrdered + 0.49f,
|
||||
StorageSliderHeight
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
_sliderOrdered[i].gameObject.SetActive(itemOrdered != 0);
|
||||
}
|
||||
|
||||
if (storageState.ItemMax != itemMax)
|
||||
{
|
||||
storageState.ItemMax = itemMax;
|
||||
_sliderBg[i].gameObject.SetActive(itemMax > 0);
|
||||
((RectTransform)_sliderMax[i].transform).sizeDelta = new Vector2(
|
||||
_pixelPerItem * itemMax,
|
||||
StorageSliderHeight
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
switch (_layout)
|
||||
{
|
||||
case EStationTipLayout.InterstellarLogistics:
|
||||
{
|
||||
var localLogic = storage.localLogic;
|
||||
if (storageState.LocalState != localLogic)
|
||||
{
|
||||
storageState.LocalState = localLogic;
|
||||
var iconLocalImage = _iconLocalsImage[i];
|
||||
iconLocalImage.sprite = StateSprite[(int)localLogic];
|
||||
iconLocalImage.color = StateColor[(int)localLogic];
|
||||
}
|
||||
var remoteLogic = storage.remoteLogic;
|
||||
if (storageState.RemoteState != remoteLogic)
|
||||
{
|
||||
storageState.RemoteState = remoteLogic;
|
||||
var iconRemoteImage = _iconRemotesImage[i];
|
||||
iconRemoteImage.sprite = StateSprite[(int)remoteLogic];
|
||||
iconRemoteImage.color = StateColor[(int)remoteLogic];
|
||||
countUIText.color = iconRemoteImage.color;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case EStationTipLayout.VeinCollector:
|
||||
case EStationTipLayout.PlanetaryLogistics:
|
||||
{
|
||||
var localLogic = storage.localLogic;
|
||||
if (storageState.LocalState != localLogic)
|
||||
{
|
||||
storageState.LocalState = localLogic;
|
||||
var iconLocalImage = _iconLocalsImage[i];
|
||||
iconLocalImage.sprite = StateSprite[(int)localLogic];
|
||||
iconLocalImage.color = StateColor[(int)localLogic];
|
||||
countUIText.color = iconLocalImage.color;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EStationTipLayout.None:
|
||||
case EStationTipLayout.Collector:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly bool[][] CarrierEnabled = [
|
||||
[false, false, false],
|
||||
[false, false, false],
|
||||
[false, false, false],
|
||||
[true, false, false],
|
||||
[true, true, true],
|
||||
];
|
||||
private static readonly int[] StorageNums = [0, 2, 1, 4, 5];
|
||||
private static readonly float[] TipWindowWidths = [0f, 100f, 120f, 120f, 120f];
|
||||
private static readonly float[] TipWindowExtraHeights = [0f, 5f, 5f, 40f, 40f];
|
||||
private static readonly float[] CarrierPositionX = [5f, 35f, 85f];
|
||||
|
||||
public void UpdateStationInfo(StationComponent stationComponent, PlanetFactory factory)
|
||||
{
|
||||
if (_currentStation != stationComponent)
|
||||
{
|
||||
_currentStation = stationComponent;
|
||||
var layout = stationComponent.isCollector ? EStationTipLayout.Collector :
|
||||
stationComponent.isVeinCollector ? EStationTipLayout.VeinCollector :
|
||||
stationComponent.isStellar ? EStationTipLayout.InterstellarLogistics : EStationTipLayout.PlanetaryLogistics;
|
||||
|
||||
if (_layout != layout)
|
||||
{
|
||||
_layout = layout;
|
||||
for (var i = StorageSlotCount - 1; i >= 0; i--)
|
||||
{
|
||||
_iconLocals[i].gameObject.SetActive(false);
|
||||
_iconRemotes[i].gameObject.SetActive(false);
|
||||
_icons[i].gameObject.SetActive(false);
|
||||
switch (layout)
|
||||
{
|
||||
case EStationTipLayout.PlanetaryLogistics:
|
||||
var rectTrans = (RectTransform)_iconLocals[i].transform;
|
||||
rectTrans.sizeDelta = new Vector2(20f, 20f);
|
||||
rectTrans.anchoredPosition3D = new Vector3(100f, -5f - 35f * i - 5f, 0);
|
||||
break;
|
||||
case EStationTipLayout.InterstellarLogistics:
|
||||
rectTrans = (RectTransform)_iconLocals[i].transform;
|
||||
rectTrans.sizeDelta = new Vector2(16f, 16f);
|
||||
rectTrans.anchoredPosition3D = new Vector3(102f, -5f - 35f * i, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_storageNum = Math.Min(StorageNums[(int)layout], stationComponent.storage.Length);
|
||||
rectTransform.sizeDelta = new Vector2(TipWindowWidths[(int)layout], TipWindowExtraHeights[(int)layout] + 35f * _storageNum);
|
||||
for (var i = StorageSlotCount - 1; i >= 0; i--)
|
||||
{
|
||||
_countTexts[i].gameObject.SetActive(i < _storageNum);
|
||||
}
|
||||
|
||||
for (var i = CarrierSlotCount - 1; i >= 0; i--)
|
||||
{
|
||||
var active = CarrierEnabled[(int)layout][i];
|
||||
_carrierIcons[i].gameObject.SetActive(active);
|
||||
if (!active) continue;
|
||||
var rectTrans = (RectTransform)_carrierIcons[i].transform;
|
||||
rectTrans.anchoredPosition3D = new Vector3(CarrierPositionX[i], -5f - 35f * _storageNum, 0);
|
||||
}
|
||||
_pixelPerItem = _layout == EStationTipLayout.InterstellarLogistics ? _remoteStoragePixelPerItem : _localStoragePixelPerItem;
|
||||
}
|
||||
}
|
||||
|
||||
var storageArray = stationComponent.storage;
|
||||
for (var j = _storageNum - 1; j >= 0; j--)
|
||||
{
|
||||
var storage = storageArray[j];
|
||||
SetItem(j, storage);
|
||||
}
|
||||
|
||||
int currentCount, totalCount;
|
||||
switch (_layout)
|
||||
{
|
||||
case EStationTipLayout.PlanetaryLogistics:
|
||||
totalCount = stationComponent.idleDroneCount + stationComponent.workDroneCount;
|
||||
currentCount = stationComponent.idleDroneCount;
|
||||
_carrierIdleCountText[0].text = currentCount.ToString();
|
||||
_carrierTotalCountText[0].text = totalCount.ToString();
|
||||
break;
|
||||
case EStationTipLayout.InterstellarLogistics:
|
||||
totalCount = stationComponent.idleDroneCount + stationComponent.workDroneCount;
|
||||
currentCount = stationComponent.idleDroneCount;
|
||||
_carrierIdleCountText[0].text = currentCount.ToString();
|
||||
_carrierTotalCountText[0].text = totalCount.ToString();
|
||||
totalCount = stationComponent.idleShipCount + stationComponent.workShipCount;
|
||||
currentCount = stationComponent.idleShipCount;
|
||||
_carrierIdleCountText[1].text = currentCount.ToString();
|
||||
_carrierTotalCountText[1].text = totalCount.ToString();
|
||||
currentCount = stationComponent.warperCount;
|
||||
_carrierTotalCountText[2].text = currentCount.ToString();
|
||||
break;
|
||||
case EStationTipLayout.None:
|
||||
case EStationTipLayout.Collector:
|
||||
case EStationTipLayout.VeinCollector:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetBarsVisible(bool on)
|
||||
{
|
||||
for (var i = _storageNum - 1; i >= 0; i--)
|
||||
{
|
||||
var bg = _sliderBg[i];
|
||||
bg.gameObject.SetActive(on && _storageItems[i].ItemId > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,8 @@
|
||||
- Enable game window resize
|
||||
- Remember window position and size on last exit
|
||||
- Convert Peace-Mode saves to Combat-Mode on loading
|
||||
- Scale up mouse cursor
|
||||
- Note: This will enable software cursor mode, which may cause mouse movement lag on heavy load.
|
||||
- Mod manager profile based save folder
|
||||
- Save files are stored in `Save\<ProfileName>` folder.
|
||||
- Will use original save location if matching default profile name.
|
||||
@@ -51,6 +53,7 @@
|
||||
- Logistics Control Panel Improvement
|
||||
- Auto apply filter with item under mouse cursor while opening the panel
|
||||
- Quick-set item filter while right-clicking item icons in storage list on the panel
|
||||
- Real-time logistic stations info panel
|
||||
- Re-intialize planet (without reseting veins)
|
||||
- Quick dismantle all buildings (without drops)
|
||||
- Quick build Orbital Collectors
|
||||
@@ -122,6 +125,8 @@
|
||||
- 可调整游戏窗口大小(可最大化和拖动边框)
|
||||
- 记住上次退出时的窗口位置和大小
|
||||
- 在加载和平模式存档时将其转换为战斗模式
|
||||
- 放大鼠标指针
|
||||
- 注意:这将启用软件指针模式,可能会在CPU负载较重时导致鼠标移动延迟
|
||||
- 基于mod管理器配置档案名的存档文件夹
|
||||
- 存档文件会存储在`Save\<ProfileName>`文件夹中
|
||||
- 如果匹配默认配置档案名则使用原始存档位置
|
||||
@@ -151,6 +156,8 @@
|
||||
- 物流控制面板改进
|
||||
- 打开面板时自动将鼠标指向物品设为筛选条件
|
||||
- 在控制面板物流塔列表中右键点击物品图标快速设置为筛选条件
|
||||
- 物流运输站实时信息面板
|
||||
- 注意:如果你启用了`Auxilaryfunction`中的`展示物流站信息`,此功能将被隐藏
|
||||
- 初始化本行星(不重置矿脉)
|
||||
- 快速拆除所有建筑(不掉落)
|
||||
- 快速建造轨道采集器
|
||||
|
||||
@@ -20,14 +20,15 @@ public static class UIConfigWindow
|
||||
I18N.Add("Tech/Combat", "Tech/Combat", "科研/战斗");
|
||||
I18N.Add("Enable game window resize", "Enable game window resize (maximum box and thick frame)", "可调整游戏窗口大小(可最大化和拖动边框)");
|
||||
I18N.Add("Remeber window position and size on last exit", "Remeber window position and size on last exit", "记住上次退出时的窗口位置和大小");
|
||||
I18N.Add("Mouse cursor scale up", "Mouse cursor scale up", "鼠标指针放大");
|
||||
I18N.Add("Scale up mouse cursor", "Scale up mouse cursor", "放大鼠标指针");
|
||||
/*
|
||||
I18N.Add("Better auto-save mechanism", "Better auto-save mechanism", "更好的自动存档机制");
|
||||
I18N.Add("Better auto-save mechanism tips", "Auto saves are stored in 'Save\\AutoSaves' folder, filenames are combined with cluster address and date-time", "自动存档会以星区地址和日期时间组合为文件名存储在'Save\\AutoSaves'文件夹中");
|
||||
*/
|
||||
I18N.Add("Convert old saves to Combat Mode on loading", "Convert old saves to Combat Mode on loading (Use settings in new game panel)", "读取旧档时转为战斗模式(使用新游戏面板的战斗难度设置)");
|
||||
I18N.Add("Profile-based save folder", "Mod manager profile based save folder", "基于mod管理器配置档案名的存档文件夹");
|
||||
I18N.Add("Profile-based save folder tips", "Save files are stored in 'Save\\<ProfileName>' folder.\nWill use original save location if matching default profile name", "存档文件会存储在'Save\\<ProfileName>'文件夹中\n如果匹配默认配置档案名则使用原始存档位置");
|
||||
I18N.Add("Profile-based save folder tips", "Save files are stored in 'Save\\<ProfileName>' folder.\nWill use original save location if matching default profile name",
|
||||
"存档文件会存储在'Save\\<ProfileName>'文件夹中\n如果匹配默认配置档案名则使用原始存档位置");
|
||||
I18N.Add("Default profile name", "Default profile name", "默认配置档案名");
|
||||
I18N.Add("Unlimited interactive range", "Unlimited interactive range", "无限交互距离");
|
||||
I18N.Add("Night Light", "Sunlight at night", "夜间日光灯");
|
||||
@@ -39,18 +40,26 @@ public static class UIConfigWindow
|
||||
I18N.Add("Enable player actions in globe view", "Enable player actions in globe view", "在行星视图中允许玩家操作");
|
||||
I18N.Add("Hide tips for soil piles changes", "Hide tips for soil piles changes", "隐藏沙土数量变动的提示");
|
||||
I18N.Add("Enhance control for logistic storage limits", "Enhance control for logistic storage limits", "物流塔存储限制控制改进");
|
||||
I18N.Add("Enhance control for logistic storage limits tips", "Logistic storage limits are not scaled on upgrading 'Logistics Carrier Capacity', if they are not set to maximum capacity.\nUse arrow keys to adjust logistic storage limits:\n \u2190/\u2192: -/+10 \u2193\u2191: -/+100", "当升级'运输机舱扩容'时,不会对各种物流塔的存储限制按比例提升,除非设置为最大允许容量。\n你可以使用方向键微调物流塔存储限制:\n \u2190\u2192: -/+10 \u2193\u2191: -/+100");
|
||||
I18N.Add("Enhance control for logistic storage limits tips",
|
||||
"Logistic storage limits are not scaled on upgrading 'Logistics Carrier Capacity', if they are not set to maximum capacity.\nUse arrow keys to adjust logistic storage limits:\n \u2190/\u2192: -/+10 \u2193\u2191: -/+100",
|
||||
"当升级'运输机舱扩容'时,不会对各种物流塔的存储限制按比例提升,除非设置为最大允许容量。\n你可以使用方向键微调物流塔存储限制:\n \u2190\u2192: -/+10 \u2193\u2191: -/+100");
|
||||
I18N.Add("Enhanced count control for hand-make", "Enhanced count control for hand-make", "手动制造物品的数量控制改进");
|
||||
I18N.Add("Enhanced count control for hand-make tips", "Maximum count is increased to 1000.\nHold Ctrl/Shift/Alt to change the count rapidly.", "最大数量提升至1000\n按住Ctrl/Shift/Alt可快速改变数量");
|
||||
I18N.Add("Quick build and dismantle stacking labs", "Quick build and dismantle stacking labs/storages/tanks(hold shift)", "快速建造和拆除堆叠研究站/储物仓/储液罐(按住shift)");
|
||||
I18N.Add("Protect veins from exhaustion", "Protect veins from exhaustion", "保护矿脉不会耗尽");
|
||||
I18N.Add("Protect veins from exhaustion tips", "By default, the vein amount is protected at 100, and oil speed is protected at 1.0/s, you can set them yourself in config file.\nWhen reach the protection value, veins/oils steeps will not be mined/extracted any longer.\nClose this function to resume mining and pumping, usually when you have enough level on `Veins Utilization`", "默认矿脉数量保护于剩余100,采油速保护于速度1.0/s,你可以在配置文件中自行设置。\n当达到保护值时,矿脉和油井将不再被开采。\n关闭此功能以恢复开采,一般是当你在`矿物利用`上有足够的等级时。\n");
|
||||
I18N.Add("Protect veins from exhaustion tips",
|
||||
"By default, the vein amount is protected at 100, and oil speed is protected at 1.0/s, you can set them yourself in config file.\nWhen reach the protection value, veins/oils steeps will not be mined/extracted any longer.\nClose this function to resume mining and pumping, usually when you have enough level on `Veins Utilization`",
|
||||
"默认矿脉数量保护于剩余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("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", "物流控制面板改进");
|
||||
I18N.Add("Logistics Control Panel Improvement tips", "Auto apply filter with item under mouse cursor while opening the panel\nQuick-set item filter while right-clicking item icons in storage list on the panel", "打开面板时自动将鼠标指向物品设为筛选条件\n在控制面板物流塔列表中右键点击物品图标快速设置为筛选条件");
|
||||
I18N.Add("Logistics Control Panel Improvement tips",
|
||||
"Auto apply filter with item under mouse cursor while opening the panel\nQuick-set item filter while right-clicking item icons in storage list on the panel",
|
||||
"打开面板时自动将鼠标指向物品设为筛选条件\n在控制面板物流塔列表中右键点击物品图标快速设置为筛选条件");
|
||||
I18N.Add("Real-time logistic stations info panel", "Real-time logistic stations info panel", "物流运输站实时信息面板");
|
||||
I18N.Add("Show status bars for storage items", "Show status bars for storage items", "显示存储物品状态条");
|
||||
I18N.Add("Auto navigation on sailings", "Auto navigation on sailings", "宇宙航行时自动导航");
|
||||
I18N.Add("Enable auto-cruise", "Enable auto-cruise", "启用自动巡航");
|
||||
I18N.Add("Auto boost", "Auto boost", "自动加速");
|
||||
@@ -84,12 +93,13 @@ public static class UIConfigWindow
|
||||
{
|
||||
public override int Min => 0;
|
||||
public override int Max => 40;
|
||||
|
||||
public override string FormatValue(string format, int value)
|
||||
{
|
||||
return value == 0 ? "max".Translate() : base.FormatValue(format, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class DistanceMapper : MyWindow.ValueMapper<double>
|
||||
{
|
||||
public override int Min => 1;
|
||||
@@ -97,7 +107,7 @@ public static class UIConfigWindow
|
||||
public override double IndexToValue(int index) => index * 0.5;
|
||||
public override int ValueToIndex(double value) => Mathf.RoundToInt((float)(value * 2.0));
|
||||
}
|
||||
|
||||
|
||||
private static void CreateUI(MyConfigWindow wnd, RectTransform trans)
|
||||
{
|
||||
MyCheckBox checkBoxForMeasureTipsPos;
|
||||
@@ -111,7 +121,7 @@ public static class UIConfigWindow
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab1, GamePatch.LoadLastWindowRectEnabled, "Remeber window position and size on last exit");
|
||||
y += 36f;
|
||||
var txt = wnd.AddText2(x, y, tab1, "Mouse cursor scale up", 15, "text-mouse-cursor-scale-up");
|
||||
var txt = wnd.AddText2(x, y, tab1, "Scale up mouse cursor", 15, "text-scale-up-mouse-cursor");
|
||||
x += txt.preferredWidth + 5f;
|
||||
wnd.AddSlider(x, y + 6f, tab1, GamePatch.MouseCursorScaleUpMultiplier, [1, 2, 3, 4], "0x", 100f);
|
||||
x = 0f;
|
||||
@@ -176,17 +186,13 @@ public static class UIConfigWindow
|
||||
x = 400f;
|
||||
y = 10f;
|
||||
wnd.AddButton(x, y, tab2, "Initialize This Planet", 16, "button-init-planet", () =>
|
||||
UIMessageBox.Show("Initialize This Planet".Translate(), "Initialize This Planet Confirm".Translate(), "取消".Translate(), "确定".Translate(), 2, null, () =>
|
||||
{
|
||||
PlanetFunctions.RecreatePlanet(true);
|
||||
})
|
||||
UIMessageBox.Show("Initialize This Planet".Translate(), "Initialize This Planet Confirm".Translate(), "取消".Translate(), "确定".Translate(), 2, null,
|
||||
() => { PlanetFunctions.RecreatePlanet(true); })
|
||||
);
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, tab2, "Dismantle All Buildings", 16, "button-dismantle-all", () =>
|
||||
UIMessageBox.Show("Dismantle All Buildings".Translate(), "Dismantle All Buildings Confirm".Translate(), "取消".Translate(), "确定".Translate(), 2, null, () =>
|
||||
{
|
||||
PlanetFunctions.DismantleAll(false);
|
||||
})
|
||||
UIMessageBox.Show("Dismantle All Buildings".Translate(), "Dismantle All Buildings Confirm".Translate(), "取消".Translate(), "确定".Translate(), 2, null,
|
||||
() => { PlanetFunctions.DismantleAll(false); })
|
||||
);
|
||||
y += 72f;
|
||||
wnd.AddButton(x, y, 200, tab2, "Quick build Orbital Collectors", 16, "button-init-planet", PlanetFunctions.BuildOrbitalCollectors);
|
||||
@@ -202,10 +208,17 @@ public static class UIConfigWindow
|
||||
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");
|
||||
x += checkBoxForMeasureTipsPos.Width + 5f;
|
||||
y += 6f;
|
||||
wnd.AddTipsButton2(x, y, tab2, "Logistics Control Panel Improvement", "Logistics Control Panel Improvement tips", "lcp-improvement-tips");
|
||||
// x -= 200f;
|
||||
wnd.AddTipsButton2(x + checkBoxForMeasureTipsPos.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);
|
||||
if (AuxilaryfunctionWrapper.ShowStationInfo != null)
|
||||
{
|
||||
AuxilaryfunctionWrapper.ShowStationInfo.SettingChanged += (_, _) => { OnAuxilaryInfoPanelChanged(); };
|
||||
}
|
||||
LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.SettingChanged += (_, _) => { OnRealtimeLogisticsInfoPanelChanged(); };
|
||||
OnAuxilaryInfoPanelChanged();
|
||||
OnRealtimeLogisticsInfoPanelChanged();
|
||||
|
||||
var tab3 = wnd.AddTab(trans, "Player/Mecha");
|
||||
x = 0f;
|
||||
@@ -224,15 +237,14 @@ public static class UIConfigWindow
|
||||
y += 30f;
|
||||
wnd.AddCheckBox(x, y, tab3, PlayerPatch.AutoNavigationEnabled, "Auto navigation on sailings");
|
||||
x = 20f;
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab3, PlayerPatch.AutoCruiseEnabled, "Enable auto-cruise", 14);
|
||||
y += 26f;
|
||||
wnd.AddCheckBox(x, y, tab3, PlayerPatch.AutoCruiseEnabled, "Enable auto-cruise", 13);
|
||||
x = 10f;
|
||||
y += 32f;
|
||||
wnd.AddCheckBox(x, y, tab3, PlayerPatch.AutoBoostEnabled, "Auto boost", 15);
|
||||
y += 26f;
|
||||
wnd.AddCheckBox(x, 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);
|
||||
|
||||
var tab4 = wnd.AddTab(trans, "Dyson Sphere");
|
||||
@@ -244,10 +256,8 @@ public static class UIConfigWindow
|
||||
x = 400f;
|
||||
y = 10f;
|
||||
wnd.AddButton(x, y, tab4, "Initialize Dyson Sphere", 16, "init-dyson-sphere", () =>
|
||||
UIMessageBox.Show("Initialize Dyson Sphere".Translate(), "Initialize Dyson Sphere Confirm".Translate(), "取消".Translate(), "确定".Translate(), 2, null, () =>
|
||||
{
|
||||
DysonSpherePatch.InitCurrentDysonSphere(-1);
|
||||
})
|
||||
UIMessageBox.Show("Initialize Dyson Sphere".Translate(), "Initialize Dyson Sphere Confirm".Translate(), "取消".Translate(), "确定".Translate(), 2, null,
|
||||
() => { DysonSpherePatch.InitCurrentDysonSphere(-1); })
|
||||
);
|
||||
y += 36f;
|
||||
wnd.AddText2(x, y, tab4, "Click to dismantle selected layer", 16, "text-dismantle-layer");
|
||||
@@ -256,10 +266,8 @@ public static class UIConfigWindow
|
||||
{
|
||||
var id = i + 1;
|
||||
var btn = wnd.AddFlatButton(x, y, tab4, id.ToString(), 12, "dismantle-layer-" + id, () =>
|
||||
UIMessageBox.Show("Dismantle selected layer".Translate(), "Dismantle selected layer Confirm".Translate(), "取消".Translate(), "确定".Translate(), 2, null, () =>
|
||||
{
|
||||
DysonSpherePatch.InitCurrentDysonSphere(id);
|
||||
})
|
||||
UIMessageBox.Show("Dismantle selected layer".Translate(), "Dismantle selected layer Confirm".Translate(), "取消".Translate(), "确定".Translate(), 2, null,
|
||||
() => { DysonSpherePatch.InitCurrentDysonSphere(id); })
|
||||
);
|
||||
((RectTransform)btn.transform).sizeDelta = new Vector2(40f, 20f);
|
||||
DysonLayerBtn[i] = btn;
|
||||
@@ -280,7 +288,7 @@ public static class UIConfigWindow
|
||||
y += 24f;
|
||||
wnd.AddSlider(x, y, tab4, DysonSpherePatch.AutoConstructMultiplier, [1, 2, 5, 10, 20, 50, 100], "0", 200f);
|
||||
_dysonTab = tab4;
|
||||
|
||||
|
||||
var tab5 = wnd.AddTab(_windowTrans, "Tech/Combat");
|
||||
x = 10;
|
||||
y = 10;
|
||||
@@ -312,6 +320,30 @@ public static class UIConfigWindow
|
||||
uiGame.CloseEnemyBriefInfo();
|
||||
uiGame.OpenCommunicatorWindow(5);
|
||||
});
|
||||
return;
|
||||
|
||||
void OnAuxilaryInfoPanelChanged()
|
||||
{
|
||||
if (AuxilaryfunctionWrapper.ShowStationInfo == null)
|
||||
{
|
||||
cb0.gameObject.SetActive(true);
|
||||
cb1.gameObject.SetActive(true);
|
||||
return;
|
||||
}
|
||||
var on = !AuxilaryfunctionWrapper.ShowStationInfo.Value;
|
||||
cb0.gameObject.SetActive(on);
|
||||
cb1.gameObject.SetActive(on);
|
||||
if (!on)
|
||||
{
|
||||
LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.Value = false;
|
||||
}
|
||||
}
|
||||
|
||||
void OnRealtimeLogisticsInfoPanelChanged()
|
||||
{
|
||||
var on = LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.Value;
|
||||
cb1.gameObject.SetActive(on);
|
||||
}
|
||||
}
|
||||
|
||||
private static void UpdateUI()
|
||||
@@ -344,4 +376,4 @@ public static class UIConfigWindow
|
||||
DysonLayerBtn[i].button.interactable = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,6 +117,8 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
||||
"Logistics control panel improvement");
|
||||
LogisticsPatch.RealtimeLogisticsInfoPanelEnabled = Config.Bind("Factory", "RealtimeLogisticsInfoPanel", false,
|
||||
"Realtime logistics info panel");
|
||||
LogisticsPatch.RealtimeLogisticsInfoPanelBarsEnabled = Config.Bind("Factory", "RealtimeLogisticsInfoPanelBars", false,
|
||||
"Realtime logistics info panel - Show status bars for storage item");
|
||||
PlanetFunctions.OrbitalCollectorMaxBuildCount = Config.Bind("Factory", "OCMaxBuildCount", 0, "Maximum Orbital Collectors to build once, set to 0 to build as many as possible");
|
||||
PlayerPatch.EnhancedMechaForgeCountControlEnabled = Config.Bind("Player", "EnhancedMechaForgeCountControl", false,
|
||||
"Enhanced count control for hand-make, increases maximum of count to 1000, and you can hold Ctrl/Shift/Alt to change the count rapidly");
|
||||
@@ -161,6 +163,10 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
||||
|
||||
I18N.Apply();
|
||||
I18N.OnInitialized += RecreateConfigWindow;
|
||||
GameLogic.OnDataLoaded += () =>
|
||||
{
|
||||
AuxilaryfunctionWrapper.Init(_patch);
|
||||
};
|
||||
}
|
||||
|
||||
private void Start()
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<BepInExPluginGuid>org.soardev.uxassist</BepInExPluginGuid>
|
||||
<Description>DSP MOD - UXAssist</Description>
|
||||
<Version>1.1.5</Version>
|
||||
<Version>1.1.6</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<PackageId>UXAssist</PackageId>
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 2.3 KiB |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "UXAssist",
|
||||
"version_number": "1.1.5",
|
||||
"version_number": "1.1.6",
|
||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist",
|
||||
"description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁",
|
||||
"dependencies": [
|
||||
|
||||
Reference in New Issue
Block a user