diff --git a/CheatEnabler/CheatEnabler.cs b/CheatEnabler/CheatEnabler.cs
index 127d03f..2c80131 100644
--- a/CheatEnabler/CheatEnabler.cs
+++ b/CheatEnabler/CheatEnabler.cs
@@ -81,6 +81,7 @@ public class CheatEnabler : BaseUnityPlugin
FactoryPatch.Init();
ResourcePatch.Init();
PlanetPatch.Init();
+ PlayerFunctions.Init();
PlayerPatch.Init();
DysonSpherePatch.Init();
CombatPatch.Init();
@@ -104,5 +105,4 @@ public class CheatEnabler : BaseUnityPlugin
if (VFInput.inputing) return;
FactoryPatch.OnUpdate();
}
-
}
diff --git a/CheatEnabler/CheatEnabler.csproj b/CheatEnabler/CheatEnabler.csproj
index d2a051c..00504f9 100644
--- a/CheatEnabler/CheatEnabler.csproj
+++ b/CheatEnabler/CheatEnabler.csproj
@@ -5,7 +5,7 @@
net472
org.soardev.cheatenabler
DSP MOD - CheatEnabler
- 2.3.18
+ 2.3.19
true
latest
CheatEnabler
diff --git a/CheatEnabler/PlayerFunctions.cs b/CheatEnabler/PlayerFunctions.cs
index 1982e55..b8aead7 100644
--- a/CheatEnabler/PlayerFunctions.cs
+++ b/CheatEnabler/PlayerFunctions.cs
@@ -1,10 +1,36 @@
using System;
using System.Linq;
+using UXAssist.Common;
namespace CheatEnabler;
public static class PlayerFunctions
{
+ public static void Init()
+ {
+ I18N.Add("ClearAllMetadataConsumptionDetails",
+ """
+ Metadata consumption records of all gamesaves are about to be cleared.
+ You will gain following metadata back:
+ """,
+ """
+ 所有存档的元数据消耗记录即将被清除,
+ 此操作将返还以下元数据:
+ """);
+ I18N.Add("ClearCurrentMetadataConsumptionDetails",
+ """
+ Metadata consumption records of current gamesave are about to be cleared.
+ You will gain following metadata back:
+ """,
+ """
+ 当前存档的元数据消耗记录即将被清除,
+ 此操作将返还以下元数据:
+ """);
+ I18N.Add("NoMetadataConsumptionRecord",
+ "No metadata consumption records found.",
+ "未找到元数据消耗记录。");
+ }
+
public static void TeleportToOuterSpace()
{
var maxSqrDistance = 0.0;
@@ -69,19 +95,31 @@ public static class PlayerFunctions
public static void RemoveAllMetadataConsumptions()
{
- var propertySysten = DSPGame.propertySystem;
- if (propertySysten == null) return;
- PurgePropertySystem(propertySysten);
+ var propertySystem = DSPGame.propertySystem;
+ if (propertySystem == null) return;
+ PurgePropertySystem(propertySystem);
var itemCnt = new int[6];
- foreach (var cons in propertySysten.propertyDatas.SelectMany(data => data.totalConsumption.Where(cons => cons.id is >= 6001 and <= 6006)))
+ foreach (var cons in propertySystem.propertyDatas.SelectMany(data => data.totalConsumption.Where(cons => cons.id is >= 6001 and <= 6006)))
{
itemCnt[cons.id - 6001] += cons.count;
}
- if (itemCnt.All(cnt => cnt == 0)) return;
- UIMessageBox.Show("Remove all metadata consumption records".Translate(), "".Translate(), "取消".Translate(), "确定".Translate(), 2, null, () =>
+ if (itemCnt.All(cnt => cnt == 0))
{
- foreach (var data in propertySysten.propertyDatas)
+ UIMessageBox.Show("Remove all metadata consumption records".Translate(), "NoMetadataConsumptionRecord".Translate(), "OK".Translate(), 0);
+ return;
+ }
+ var msg = "ClearAllMetadataConsumptionDetails".Translate();
+ for (var i = 0; i < 6; i++)
+ {
+ if (itemCnt[i] > 0)
+ {
+ msg += $"\n {LDB.items.Select(i + 6001).propertyName} x{itemCnt[i]}";
+ }
+ }
+ UIMessageBox.Show("Remove all metadata consumption records".Translate(), msg, "取消".Translate(), "确定".Translate(), 2, null, () =>
+ {
+ foreach (var data in propertySystem.propertyDatas)
{
for (var i = 0; i < data.totalConsumption.Count; i++)
{
@@ -90,11 +128,57 @@ public static class PlayerFunctions
data.totalConsumption[i] = new IDCNT(id, 0);
}
}
+ PurgePropertySystem(propertySystem);
+ propertySystem.SaveToFile();
});
}
public static void RemoveCurrentMetadataConsumptions()
{
-
+ var propertySystem = DSPGame.propertySystem;
+ if (propertySystem == null) return;
+ PurgePropertySystem(propertySystem);
+ var itemCnt = new int[6];
+ var seedKey = DSPGame.GameDesc.seedKey64;
+ var clusterPropertyData = propertySystem.propertyDatas.FirstOrDefault(cpd => cpd.seedKey == seedKey);
+ if (clusterPropertyData == null)
+ {
+ UIMessageBox.Show("Remove metadata consumption record in current game".Translate(), "NoMetadataConsumptionRecord".Translate(), "OK".Translate(), 0);
+ return;
+ }
+ foreach (var cons in clusterPropertyData.totalConsumption.Where(cons => cons.id is >= 6001 and <= 6006))
+ {
+ itemCnt[cons.id - 6001] += cons.count;
+ }
+
+ if (itemCnt.All(cnt => cnt == 0))
+ {
+ UIMessageBox.Show("Remove metadata consumption record in current game".Translate(), "NoMetadataConsumptionRecord".Translate(), "OK".Translate(), 0);
+ return;
+ }
+ var msg = "ClearCurrentMetadataConsumptionDetails".Translate();
+ for (var i = 0; i < 6; i++)
+ {
+ if (itemCnt[i] > 0)
+ {
+ msg += $"\n {LDB.items.Select(i + 6001).propertyName} x{itemCnt[i]}";
+ }
+ }
+ UIMessageBox.Show("Remove metadata consumption record in current game".Translate(), msg, "取消".Translate(), "确定".Translate(), 2, null, () =>
+ {
+ for (var i = 0; i < clusterPropertyData.totalConsumption.Count; i++)
+ {
+ if (clusterPropertyData.totalConsumption[i].count == 0) continue;
+ var id = clusterPropertyData.totalConsumption[i].id;
+ clusterPropertyData.totalConsumption[i] = new IDCNT(id, 0);
+ }
+ PurgePropertySystem(propertySystem);
+ propertySystem.SaveToFile();
+ });
+ }
+
+ public static void ClearMetadataBanAchievements()
+ {
+ GameMain.history.hasUsedPropertyBanAchievement = false;
}
}
diff --git a/CheatEnabler/README.md b/CheatEnabler/README.md
index 2ae384c..94fb682 100644
--- a/CheatEnabler/README.md
+++ b/CheatEnabler/README.md
@@ -4,6 +4,11 @@
#### 添加一些作弊功能,同时屏蔽异常检测
## Changlog
+* 2.3.19
+ + New features:
+ + `Remove all metadata consumption records`
+ + `Remove metadata consumption record in current game`
+ + `Clear metadata flag which bans achievements`
* 2.3.18
+ New features:
+ `Teleport to outer space`, this will teleport you to the outer space which is 50 LYs far from the farthest star.
@@ -121,6 +126,9 @@
+ Enable Dev Shortcuts (check config panel for usage)
+ Disable Abnormal Checks
+ Unlock techs with key-modifiers (Ctrl/Alt/Shift)
+ + Remove all metadata consumption records
+ + Remove metadata consumption record in current game
+ + Clear metadata flag which bans achievements
+ Assign gamesave to currrnet account
+ Factory:
+ Finish build immediately
@@ -165,6 +173,11 @@
* [Multifunction_mod](https://github.com/blacksnipebiu/Multifunction_mod): Some cheat functions
## 更新日志
+* 2.3.19
+ + 新功能:
+ + `移除所有元数据消耗记录`
+ + `移除当前存档的元数据消耗记录`
+ + `解除当前存档因使用元数据导致的成就限制`
* 2.3.18
+ 新功能:
+ `传送到外太空`,这会将你传送到距离最远星球50光年的外太空
@@ -282,6 +295,9 @@
+ 启用开发模式快捷键(使用说明见设置面板)
+ 屏蔽异常检测
+ 使用组合键解锁科技(Ctrl/Alt/Shift)
+ + 移除所有元数据消耗记录
+ + 移除当前存档的元数据消耗记录
+ + 解除当前存档因使用元数据导致的成就限制
+ 将游戏存档绑定给当前账号
+ 工厂:
+ 建造秒完成
diff --git a/CheatEnabler/UIConfigWindow.cs b/CheatEnabler/UIConfigWindow.cs
index b466fc0..90f91a6 100644
--- a/CheatEnabler/UIConfigWindow.cs
+++ b/CheatEnabler/UIConfigWindow.cs
@@ -9,6 +9,7 @@ public static class UIConfigWindow
private static RectTransform _windowTrans;
private static UIButton _resignGameBtn;
+ private static UIButton _clearBanBtn;
public static void Init()
{
@@ -26,9 +27,10 @@ public static class UIConfigWindow
I18N.Add("Unlock Tech with Key-Modifiers Tips",
"Click tech on tree while holding:\n Shift: Tech level + 1\n Ctrl: Tech level + 10\n Ctrl + Shift: Tech level + 100\n Alt: Tech level to MAX\n\nNote: all direct prerequisites will be unlocked as well.",
"按住以下组合键点击科技树:\n Shift:科技等级+1\n Ctrl:科技等级+10\n Ctrl+Shift:科技等级+100\n Alt:科技等级升到最大\n\n注意:所有直接前置科技也会被解锁");
- I18N.Add("Assign gamesave to current account", "Assign gamesave to current account", "将游戏存档绑定给当前账号");
I18N.Add("Remove all metadata consumption records", "Remove all metadata consumption records", "移除所有元数据消耗记录");
- I18N.Add("Remove metadata consumption record in current game", "Remove metadata consumption record in current game", "移除当前游戏的元数据消耗记录");
+ I18N.Add("Remove metadata consumption record in current game", "Remove metadata consumption record in current game", "移除当前存档的元数据消耗记录");
+ I18N.Add("Clear metadata flag which bans achievements", "Clear metadata flag which bans achievements in current game", "解除当前存档因使用元数据导致的成就限制");
+ I18N.Add("Assign gamesave to current account", "Assign gamesave to current account", "将游戏存档绑定给当前账号");
I18N.Add("Finish build immediately", "Finish build immediately", "建造秒完成");
I18N.Add("Architect mode", "Architect mode", "建筑师模式");
I18N.Add("Build without condition", "Build without condition check", "无条件建造");
@@ -89,13 +91,16 @@ public static class UIConfigWindow
x += 52f;
y += 72f;
MyWindow.AddTipsButton(x, y, tab1, "Unlock Tech with Key-Modifiers", "Unlock Tech with Key-Modifiers Tips", "unlock-tech-tips");
+ x = 0f;
+ y = 10f + 36f + 36f + 36f + 36f;
+ wnd.AddButton(x, y, 400f, tab1, "Remove all metadata consumption records", 16, "button-remove-all-metadata-consumption", PlayerFunctions.RemoveAllMetadataConsumptions);
+ y += 36f;
+ wnd.AddButton(x, y, 400f, tab1, "Remove metadata consumption record in current game", 16, "button-remove-current-metadata-consumption", PlayerFunctions.RemoveCurrentMetadataConsumptions);
+ y += 36f;
+ _clearBanBtn = wnd.AddButton(x, y, 400f, tab1, "Clear metadata flag which bans achievements", 16, "button-clear-ban-list", PlayerFunctions.ClearMetadataBanAchievements);
x = 300f;
y = 10f;
_resignGameBtn = wnd.AddButton(x, y, 300f, tab1, "Assign gamesave to current account", 16, "resign-game-btn", () => { GameMain.data.account = AccountData.me; });
- y += 36f;
- wnd.AddButton(x, y, 300f, tab1, "Remove all metadata consumption records", 16, "button-remove-all-metadata-consumption", PlayerFunctions.RemoveAllMetadataConsumptions);
- y += 36f;
- wnd.AddButton(x, y, 300f, tab1, "Remove metadata consumption record in current game", 16, "button-remove-current-metadata-consumption", PlayerFunctions.RemoveCurrentMetadataConsumptions);
var tab2 = wnd.AddTab(_windowTrans, "Factory");
x = 0f;
@@ -222,13 +227,21 @@ public static class UIConfigWindow
private static void UpdateUI()
{
- UpdateResignButton();
+ UpdateButtons();
}
- private static void UpdateResignButton()
+ private static void UpdateButtons()
{
var resignEnabled = GameMain.data.account != AccountData.me;
- if (_resignGameBtn.gameObject.activeSelf == resignEnabled) return;
- _resignGameBtn.gameObject.SetActive(resignEnabled);
+ if (_resignGameBtn.gameObject.activeSelf != resignEnabled)
+ {
+ _resignGameBtn.gameObject.SetActive(resignEnabled);
+ }
+
+ var banEnabled = GameMain.history.hasUsedPropertyBanAchievement;
+ if (_clearBanBtn.gameObject.activeSelf != banEnabled)
+ {
+ _clearBanBtn.gameObject.SetActive(banEnabled);
+ }
}
}
\ No newline at end of file
diff --git a/CheatEnabler/package/manifest.json b/CheatEnabler/package/manifest.json
index 1d591e6..2419243 100644
--- a/CheatEnabler/package/manifest.json
+++ b/CheatEnabler/package/manifest.json
@@ -1,6 +1,6 @@
{
"name": "CheatEnabler",
- "version_number": "2.3.18",
+ "version_number": "2.3.19",
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/CheatEnabler",
"description": "Add various cheat functions while disabling abnormal determinants / 添加一些作弊功能,同时屏蔽异常检测",
"dependencies": [
diff --git a/UXAssist/GamePatch.cs b/UXAssist/GamePatch.cs
index aedd281..f31fc54 100644
--- a/UXAssist/GamePatch.cs
+++ b/UXAssist/GamePatch.cs
@@ -380,8 +380,8 @@ public static class GamePatch
{
var matcher = new CodeMatcher(instructions, generator);
matcher.Start().MatchForward(false,
- new CodeMatch(instr => (instr.opcode == OpCodes.Ldc_I4 || instr.opcode == OpCodes.Ldc_I4_S) && instr.OperandIs(0x1B)),
- new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(PerformanceMonitor), nameof(PerformanceMonitor.EndData)))
+ new CodeMatch(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Player), nameof(Player.mecha))),
+ new CodeMatch(OpCodes.Callvirt, AccessTools.Method(typeof(Mecha), nameof(Mecha.CheckCombatModuleDataIsValidPatch)))
);
matcher.Advance(2).Opcode = OpCodes.Brfalse;
matcher.Insert(
diff --git a/UXAssist/README.md b/UXAssist/README.md
index 14e5cfd..5f8fbf7 100644
--- a/UXAssist/README.md
+++ b/UXAssist/README.md
@@ -4,6 +4,10 @@
#### 一些提升用户体验的功能和补丁
## Changlog
+* 1.1.3
+ + UI texts are updated following game settings now
+ + Fix hover area for checkboxes in config panel
+ + Fix an issue which makes `Convert Peace-Mode saves to Combat-Mode on loading` not working
* 1.1.2
+ `Belt signals for buy out dark fog items automatically`: Always add belt signals to the panel to fix missing belt icons when disabled.
* 1.1.1
@@ -227,6 +231,10 @@
* [CruiseAssist](https://dsp.thunderstore.io/package/tanu/CruiseAssist/) and its extension [AutoPilot](https://dsp.thunderstore.io/package/tanu/AutoPilot/): `Auto navigation on sailings` and `Auto-cruise` implementations
## 更新日志
+* 1.1.3
+ + 界面文本现在完全跟随游戏语言设置改变
+ + 修复了配置面板中勾选框的鼠标悬停区域
+ + 修复了`加载和平模式存档时将其转换为战斗模式`不起作用的问题
* 1.1.2
+ `用于自动购买黑雾物品的传送带信号`: 总是将传送带信号添加到面板,以修复禁用时传送带图标丢失的问题。
* 1.1.1
diff --git a/UXAssist/UI/MyCheckbox.cs b/UXAssist/UI/MyCheckbox.cs
index 041f599..bd95c52 100644
--- a/UXAssist/UI/MyCheckbox.cs
+++ b/UXAssist/UI/MyCheckbox.cs
@@ -1,5 +1,6 @@
using System;
using BepInEx.Configuration;
+using UITools;
using UnityEngine;
using UnityEngine.UI;
@@ -57,6 +58,8 @@ public class MyCheckBox : MonoBehaviour
cb.labelText = child.GetComponent();
cb.labelText.fontSize = fontSize;
cb.SetLabelText(label);
+ var width = cb.labelText.preferredWidth;
+ cb.labelText.rectTransform.sizeDelta = new Vector2(width, rect.sizeDelta.y);
}
//value
diff --git a/UXAssist/UI/MyConfigWindow.cs b/UXAssist/UI/MyConfigWindow.cs
index e5e5e04..951c925 100644
--- a/UXAssist/UI/MyConfigWindow.cs
+++ b/UXAssist/UI/MyConfigWindow.cs
@@ -14,6 +14,11 @@ public class MyConfigWindow : MyWindowWithTabs
{
return MyWindowManager.CreateWindow("UXAConfigWindow", "UXAssist Config");
}
+
+ public static void DestroyInstance(MyConfigWindow win)
+ {
+ MyWindowManager.DestroyWindow(win);
+ }
public override void _OnCreate()
{
@@ -27,6 +32,7 @@ public class MyConfigWindow : MyWindowWithTabs
public override void _OnDestroy()
{
+ _windowTrans = null;
}
public override bool _OnInit()
diff --git a/UXAssist/UI/MyWindow.cs b/UXAssist/UI/MyWindow.cs
index 9cbb863..bbeaa4d 100644
--- a/UXAssist/UI/MyWindow.cs
+++ b/UXAssist/UI/MyWindow.cs
@@ -388,6 +388,14 @@ public static class MyWindowManager
Windows.Add(win);
return (T)win;
}
+
+ public static void DestroyWindow(ManualBehaviour win)
+ {
+ if (win == null) return;
+ Windows.Remove(win);
+ win._Free();
+ win._Destroy();
+ }
/*
public static void SetRect(ManualBehaviour win, RectTransform rect)
@@ -409,7 +417,7 @@ public static class MyWindowManager
}
*/
- [HarmonyPostfix, HarmonyPatch(typeof(UIRoot), "_OnDestroy")]
+ [HarmonyPostfix, HarmonyPatch(typeof(UIRoot), nameof(UIRoot._OnDestroy))]
public static void UIRoot__OnDestroy_Postfix()
{
foreach (var win in Windows)
@@ -420,7 +428,7 @@ public static class MyWindowManager
Windows.Clear();
}
- [HarmonyPostfix, HarmonyPatch(typeof(UIRoot), "_OnOpen")]
+ [HarmonyPostfix, HarmonyPatch(typeof(UIRoot), nameof(UIRoot._OnOpen))]
public static void UIRoot__OnOpen_Postfix()
{
if (_initialized) return;
@@ -442,7 +450,7 @@ public static class MyWindowManager
}
*/
- [HarmonyPostfix, HarmonyPatch(typeof(UIRoot), "_OnUpdate")]
+ [HarmonyPostfix, HarmonyPatch(typeof(UIRoot), nameof(UIRoot._OnUpdate))]
public static void UIRoot__OnUpdate_Postfix()
{
if (GameMain.isPaused || !GameMain.isRunning)
@@ -455,7 +463,7 @@ public static class MyWindowManager
}
}
- [HarmonyPostfix, HarmonyPatch(typeof(UIGame), "ShutAllFunctionWindow")]
+ [HarmonyPostfix, HarmonyPatch(typeof(UIGame), nameof(UIGame.ShutAllFunctionWindow))]
public static void UIGame_ShutAllFunctionWindow_Postfix()
{
foreach (var win in Windows)
diff --git a/UXAssist/UXAssist.cs b/UXAssist/UXAssist.cs
index 1f0626e..f654930 100644
--- a/UXAssist/UXAssist.cs
+++ b/UXAssist/UXAssist.cs
@@ -145,6 +145,7 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
DysonSpherePatch.Init();
I18N.Apply();
+ I18N.OnInitialized += RecreateConfigWindow;
}
private void OnDestroy()
@@ -200,6 +201,16 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
}
}
+ private static void RecreateConfigWindow()
+ {
+ if (!_configWinInitialized) return;
+ var wasActive = _configWin.active;
+ if (wasActive) _configWin._Close();
+ MyConfigWindow.DestroyInstance(_configWin);
+ _configWinInitialized = false;
+ if (wasActive) ToggleConfigWindow();
+ }
+
// Add config button to main menu
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), nameof(UIRoot.OpenMainMenuUI))]
public static void UIRoot_OpenMainMenuUI_Postfix()
diff --git a/UXAssist/UXAssist.csproj b/UXAssist/UXAssist.csproj
index 7f0ec1b..bcb7e5f 100644
--- a/UXAssist/UXAssist.csproj
+++ b/UXAssist/UXAssist.csproj
@@ -4,7 +4,7 @@
net472
org.soardev.uxassist
DSP MOD - UXAssist
- 1.1.2
+ 1.1.3
true
latest
UXAssist
diff --git a/UXAssist/package/manifest.json b/UXAssist/package/manifest.json
index c83c90c..29f5261 100644
--- a/UXAssist/package/manifest.json
+++ b/UXAssist/package/manifest.json
@@ -1,6 +1,6 @@
{
"name": "UXAssist",
- "version_number": "1.1.2",
+ "version_number": "1.1.3",
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist",
"description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁",
"dependencies": [