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

UXAssist v1.0.10

This commit is contained in:
2024-01-02 00:02:58 +08:00
parent 74c98c9934
commit 980b38d39e
9 changed files with 43 additions and 34 deletions

View File

@@ -791,7 +791,7 @@ public static class FactoryPatch
var stationPool = __instance.stationPool;
var factory = __instance.factory;
var history = GameMain.history;
for (var i = __instance.stationCursor; i > 0; i--)
for (var i = __instance.stationCursor - 1; i > 0; i--)
{
if (stationPool[i] == null || stationPool[i].id != i || (stationPool[i].isStellar && !stationPool[i].isCollector && !stationPool[i].isVeinCollector)) continue;
var modelIndex = factory.entityPool[stationPool[i].entityId].modelIndex;
@@ -813,7 +813,7 @@ public static class FactoryPatch
var stationPool = __instance.stationPool;
var factory = __instance.factory;
var history = GameMain.history;
for (var i = __instance.stationCursor; i > 0; i--)
for (var i = __instance.stationCursor - 1; i > 0; i--)
{
if (stationPool[i] == null || stationPool[i].id != i || !stationPool[i].isStellar || stationPool[i].isCollector || stationPool[i].isVeinCollector) continue;
var modelIndex = factory.entityPool[stationPool[i].entityId].modelIndex;

View File

@@ -35,7 +35,7 @@ public static class GamePatch
ConvertSavesFromPeace.Enable(ConvertSavesFromPeaceEnabled.Value);
_gamePatch ??= Harmony.CreateAndPatchAll(typeof(GamePatch));
}
public static void Uninit()
{
LoadLastWindowRect.Enable(false);
@@ -155,7 +155,7 @@ public static class GamePatch
width = w;
height = h;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Screen), nameof(Screen.SetResolution), typeof(int), typeof(int), typeof(FullScreenMode), typeof(int))]
private static void Screen_SetResolution_Postfix(FullScreenMode fullscreenMode)
@@ -219,7 +219,7 @@ public static class GamePatch
__result = true;
return false;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(UILoadGameWindow), nameof(UILoadGameWindow.RefreshList))]
public static void UILoadGameWindow_RefreshList_Postfix(UILoadGameWindow __instance)
@@ -309,6 +309,7 @@ public static class GamePatch
matcher.Repeat(m => m.SetAndAdvance(OpCodes.Ldfld, AccessTools.Field(typeof(UIGameSaveEntry), nameof(UIGameSaveEntry._saveName))));
return matcher.InstructionEnumeration();
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(GameSave), nameof(GameSave.LoadCurrentGame))]
[HarmonyPatch(typeof(GameSave), nameof(GameSave.LoadGameDesc))]

View File

@@ -24,7 +24,7 @@ public static class PlanetFunctions
var sc = GameMain.localPlanet.factory.transport.stationPool[stationId];
if (toBag)
{
for (var i = 0; i < sc.storage.Length; i++)
for (var i = sc.storage.Length - 1; i >= 0; i--)
{
var package = player.TryAddItemToPackage(sc.storage[i].itemId, sc.storage[i].count, 0, true, etd.id);
UIItemup.Up(sc.storage[i].itemId, package);

View File

@@ -4,6 +4,9 @@
#### 一些提升用户体验的功能和补丁
## Changlog
* 1.0.10
+ Fix a button display bug
+ Fix a possible crash while `Enhanced control for logistic storage limits` is enabled
* 1.0.9
+ New function: `Better auto-save mechanism`
- Auto saves are stored in 'Save\AutoSaves' folder, filenames are combined with cluster address and date-time
@@ -88,6 +91,9 @@
* [OffGridConstruction](https://github.com/Velociraptor115-DSPModding/OffGridConstruction): Off-grid building & stepped rotation implementations
## 更新日志
* 1.0.10
+ 修复了一个按钮显示错误
+ 修复了`物流塔存储数量限制控制改进`启用时可能导致的崩溃问题
* 1.0.9
+ 新功能:`更好的自动保存机制`
- 自动存档会以星区地址和日期时间组合为文件名存储在'Save\AutoSaves'文件夹中

View File

@@ -124,7 +124,13 @@ public class MyWindow: ManualBehaviour
var btn = Instantiate(panel.layerButtons[0]);
btn.gameObject.name = objName;
btn.highlighted = false;
var img = btn.gameObject.transform.Find("frame")?.GetComponent<Image>();
var img = btn.GetComponent<Image>();
if (img != null)
{
img.sprite = panel.buttonDefaultSprite;
img.color = new Color(img.color.r, img.color.g, img.color.b, 13f / 255f);
}
img = btn.gameObject.transform.Find("frame")?.GetComponent<Image>();
if (img != null)
{
img.color = new Color(img.color.r, img.color.g, img.color.b, 0f);

View File

@@ -117,7 +117,6 @@ public static class UIConfigWindow
PlanetFunctions.DismantleAll(false);
})
);
y += 72f;
wnd.AddButton(x, y, 200, tab2, "Quick build Orbital Collectors", 16, "button-init-planet", PlanetFunctions.BuildOrbitalCollectors);
x += 10f;

View File

@@ -106,6 +106,25 @@ public class UXAssist : BaseUnityPlugin
FactoryPatch.NightLight.LateUpdate();
}
private static void ToggleConfigWindow()
{
if (!_configWinInitialized)
{
if (!I18N.Initialized()) return;
_configWinInitialized = true;
_configWin = MyConfigWindow.CreateInstance();
}
if (_configWin.active)
{
_configWin._Close();
}
else
{
_configWin.Open();
}
}
// Add config button to main menu
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), nameof(UIRoot.OpenMainMenuUI))]
public static void UIRoot_OpenMainMenuUI_Postfix()
@@ -185,7 +204,7 @@ public class UXAssist : BaseUnityPlugin
return matcher.InstructionEnumeration();
}
// Patch to fix bug that warning popup on VeinUtil upgraded to level 8000+
// Patch to fix the issue that warning popup on VeinUtil upgraded to level 8000+
[HarmonyTranspiler]
[HarmonyPatch(typeof(ABN_VeinsUtil), nameof(ABN_VeinsUtil.CheckValue))]
private static IEnumerable<CodeInstruction> ABN_VeinsUtil_CheckValue_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -208,25 +227,6 @@ public class UXAssist : BaseUnityPlugin
return matcher.InstructionEnumeration();
}
private static void ToggleConfigWindow()
{
if (!_configWinInitialized)
{
if (!I18N.Initialized()) return;
_configWinInitialized = true;
_configWin = MyConfigWindow.CreateInstance();
}
if (_configWin.active)
{
_configWin._Close();
}
else
{
_configWin.Open();
}
}
// Bring popup tip window to top layer
[HarmonyTranspiler]
[HarmonyPatch(typeof(UIButton), nameof(UIButton.LateUpdate))]
@@ -250,6 +250,7 @@ public class UXAssist : BaseUnityPlugin
return matcher.InstructionEnumeration();
}
// Sort blueprint structures by item id, model index, recipe id, area index, and position before saving
[HarmonyPostfix]
[HarmonyPatch(typeof(BlueprintUtils), nameof(BlueprintUtils.GenerateBlueprintData))]
private static void BlueprintUtils_GenerateBlueprintData_Postfix(BlueprintData _blueprintData)
@@ -260,19 +261,15 @@ public class UXAssist : BaseUnityPlugin
var tmpItemId = a.itemId - b.itemId;
if(tmpItemId != 0)
return tmpItemId;
var tmpModelIndex = a.modelIndex - b.modelIndex;
if(tmpModelIndex != 0)
return tmpModelIndex;
var tmpRecipeId = a.recipeId - b.recipeId;
if(tmpRecipeId != 0)
return tmpRecipeId;
var tmpAreaIndex = a.areaIndex - b.areaIndex;
if(tmpAreaIndex != 0)
return tmpAreaIndex;
const double ky = 256.0;
const double kx = 1024.0;
var scorePosA = (a.localOffset_y * ky + a.localOffset_x) * kx + a.localOffset_z;

View File

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

View File

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