From a25f74443d24c882769ea50dcac9a5a03e8473c8 Mon Sep 17 00:00:00 2001 From: Soar Qin Date: Sun, 21 Sep 2025 15:38:03 +0800 Subject: [PATCH] donet format --- .../Functions/DysonSphereFunctions.cs | 37 +++-- CheatEnabler/Patches/CombatPatch.cs | 4 +- CheatEnabler/Patches/GamePatch.cs | 2 +- CheatEnabler/Patches/PlanetPatch.cs | 4 +- CheatEnabler/Patches/PlayerPatch.cs | 8 +- CheatEnabler/Patches/ResourcePatch.cs | 4 +- CheatEnabler/UIConfigWindow.cs | 12 +- Dustbin/BeltSignal.cs | 2 +- Dustbin/NebulaSupport/Packets.cs | 24 ++-- Dustbin/StoragePatch.cs | 4 +- Dustbin/TankPatch.cs | 2 +- DustbinPreloader/DustbinPreloader.cs | 2 +- LabOpt/Functions.cs | 134 +++++++++--------- LabOpt/LabOpt.cs | 6 +- LabOptPreloader/LabOptPreloader.cs | 2 +- UXAssist/Common/GameLogic.cs | 2 +- UXAssist/Common/I18N.cs | 4 +- UXAssist/Common/Util.cs | 8 +- UXAssist/Common/WinApi.cs | 6 +- UXAssist/Functions/FactoryFunctions.cs | 5 +- UXAssist/Functions/PlanetFunctions.cs | 3 +- UXAssist/Patches/DysonSpherePatch.cs | 6 +- UXAssist/Patches/GamePatch.cs | 3 +- UXAssist/Patches/LogisticsPatch.cs | 3 +- UXAssist/Patches/PlanetPatch.cs | 4 +- UXAssist/Patches/TechPatch.cs | 2 +- UXAssist/Patches/UIPatch.cs | 2 +- UXAssist/UI/MyCheckButton.cs | 12 +- UXAssist/UI/MyWindow.cs | 6 +- UniverseGenTweaks/EpicDifficulty.cs | 4 +- UniverseGenTweaks/UniverseGenTweaks.cs | 6 +- UserCloak/UserCloak.cs | 2 +- 32 files changed, 170 insertions(+), 155 deletions(-) diff --git a/CheatEnabler/Functions/DysonSphereFunctions.cs b/CheatEnabler/Functions/DysonSphereFunctions.cs index 4094295..df99d34 100644 --- a/CheatEnabler/Functions/DysonSphereFunctions.cs +++ b/CheatEnabler/Functions/DysonSphereFunctions.cs @@ -25,7 +25,7 @@ public static class DysonSphereFunctions private static readonly double factor2 = RawToDouble(rawNum2); private static readonly double factor3 = RawToDouble(rawNum3); private static readonly PrecalculatedTriangle[] PrecalculatedTriangles = [ - new PrecalculatedTriangle() { MaxOrbitRadius = 6869, PosA = new Vector3() { x = RawToFloat(0x00000000U), y = RawToFloat(0x00000000U), z = RawToFloat(0x45D66000U)}, PosB = new Vector3() { x = RawToFloat(0x2C88BEC4U), y = RawToFloat(0x00000000U), z = RawToFloat(0xC5D66000U)}, PosC = new Vector3() { x = RawToFloat(0xC5D66000U), y = RawToFloat(0x00000000U), z = RawToFloat(0xABB1589BU)} }, + new PrecalculatedTriangle() { MaxOrbitRadius = 6869, PosA = new Vector3() { x = RawToFloat(0x00000000U), y = RawToFloat(0x00000000U), z = RawToFloat(0x45D66000U)}, PosB = new Vector3() { x = RawToFloat(0x2C88BEC4U), y = RawToFloat(0x00000000U), z = RawToFloat(0xC5D66000U)}, PosC = new Vector3() { x = RawToFloat(0xC5D66000U), y = RawToFloat(0x00000000U), z = RawToFloat(0xABB1589BU)} }, new PrecalculatedTriangle() { MaxOrbitRadius = 13573, PosA = new Vector3() { x = RawToFloat(0x46540800U), y = RawToFloat(0x00000000U), z = RawToFloat(0x2C87400AU)}, PosB = new Vector3() { x = RawToFloat(0x4652DEA6U), y = RawToFloat(0x00000000U), z = RawToFloat(0xC4B14E71U)}, PosC = new Vector3() { x = RawToFloat(0xC6540800U), y = RawToFloat(0x00000000U), z = RawToFloat(0xAC2F683EU)} }, new PrecalculatedTriangle() { MaxOrbitRadius = 21257, PosA = new Vector3() { x = RawToFloat(0x46A60400U), y = RawToFloat(0x00000000U), z = RawToFloat(0x2CD3CBAAU)}, PosB = new Vector3() { x = RawToFloat(0xC6070C9DU), y = RawToFloat(0x00000000U), z = RawToFloat(0xC697A9AEU)}, PosC = new Vector3() { x = RawToFloat(0xC6A60400U), y = RawToFloat(0x00000000U), z = RawToFloat(0xAC8956FFU)} }, new PrecalculatedTriangle() { MaxOrbitRadius = 29718, PosA = new Vector3() { x = RawToFloat(0x469B4FBEU), y = RawToFloat(0x00000000U), z = RawToFloat(0x46AC7DAAU)}, PosB = new Vector3() { x = RawToFloat(0x46E81C00U), y = RawToFloat(0x00000000U), z = RawToFloat(0x2D140EBCU)}, PosC = new Vector3() { x = RawToFloat(0xC6E81C00U), y = RawToFloat(0x00000000U), z = RawToFloat(0xACC0046AU)} }, @@ -323,10 +323,10 @@ public static class DysonSphereFunctions num += num2; } var radius = Math.Round(polygon[0].magnitude * 10.0) / 10.0; - for (int j = 0; j < polygon.Length; j++) - { - polygon[j] = polygon[j].normalized * radius; - } + for (int j = 0; j < polygon.Length; j++) + { + polygon[j] = polygon[j].normalized * radius; + } var center = (sum / num).normalized * radius; float num3 = 0f; for (int k = 0; k < 3; k++) @@ -459,10 +459,10 @@ public static class DysonSphereFunctions num += num2; } shell.radius = Math.Round(shell.polygon[0].magnitude * 10.0) / 10.0; - for (int j = 0; j < shell.polygon.Count; j++) - { - shell.polygon[j] = shell.polygon[j].normalized * shell.radius; - } + for (int j = 0; j < shell.polygon.Count; j++) + { + shell.polygon[j] = shell.polygon[j].normalized * shell.radius; + } var normalized = (sum / num).normalized; shell.center = normalized * shell.radius; float num3 = 0f; @@ -1191,19 +1191,25 @@ public static class DysonSphereFunctions for (int i = 1; i <= 10; i++) { var layer = dysonSphere.layersIdBased[i]; - if (layer != null) { + if (layer != null) + { continue; } var radius = dysonSphere.maxOrbitRadius; - for (; radius > 4000; radius -= 10) { - if (dysonSphere.CheckLayerRadius(radius) == 0) { + for (; radius > 4000; radius -= 10) + { + if (dysonSphere.CheckLayerRadius(radius) == 0) + { break; } } PrecalculatedTriangle triangle; - try { + try + { triangle = PrecalculatedTriangles.First(t => t.MaxOrbitRadius > radius); - } catch (InvalidOperationException) { + } + catch (InvalidOperationException) + { UIMessageBox.Show("CheatEnabler".Translate(), string.Format("No precalculated triangle found for radius {0}.".Translate(), radius), "确定".Translate(), UIMessageBox.ERROR, null); return; } @@ -1389,7 +1395,8 @@ public static class DysonSphereFunctions { var lastGridScale = 0; var radiusList = new List(); - for (var r = 4000; r <= 250000; r++) { + for (var r = 4000; r <= 250000; r++) + { var gridScale = (int)(Math.Pow(r / 4000.0, 0.75) + 0.5); gridScale = (gridScale < 1) ? 1 : gridScale; if (gridScale == lastGridScale) continue; diff --git a/CheatEnabler/Patches/CombatPatch.cs b/CheatEnabler/Patches/CombatPatch.cs index 64d9d17..4f2e671 100644 --- a/CheatEnabler/Patches/CombatPatch.cs +++ b/CheatEnabler/Patches/CombatPatch.cs @@ -30,7 +30,7 @@ public static class CombatPatch MechaInvincible.Enable(false); } - private class MechaInvincible: PatchImpl + private class MechaInvincible : PatchImpl { [HarmonyTranspiler] [HarmonyPatch(typeof(Player), nameof(Player.invincible), MethodType.Getter)] @@ -65,7 +65,7 @@ public static class CombatPatch } } - private class BuildingsInvincible: PatchImpl + private class BuildingsInvincible : PatchImpl { [HarmonyTranspiler] [HarmonyPatch(typeof(SkillSystem), nameof(SkillSystem.DamageGroundObjectByLocalCaster))] diff --git a/CheatEnabler/Patches/GamePatch.cs b/CheatEnabler/Patches/GamePatch.cs index 8725a22..e45667b 100644 --- a/CheatEnabler/Patches/GamePatch.cs +++ b/CheatEnabler/Patches/GamePatch.cs @@ -187,7 +187,7 @@ public static class GamePatch } } - public class UnlockTech: PatchImpl + public class UnlockTech : PatchImpl { private static void UnlockTechRecursive(GameHistoryData history, [NotNull] TechProto techProto, int maxLevel = 10000) { diff --git a/CheatEnabler/Patches/PlanetPatch.cs b/CheatEnabler/Patches/PlanetPatch.cs index 7799b9a..805f6fa 100644 --- a/CheatEnabler/Patches/PlanetPatch.cs +++ b/CheatEnabler/Patches/PlanetPatch.cs @@ -29,7 +29,7 @@ public static class PlanetPatch TerraformAnyway.Enable(false); } - private class WaterPumperPatch: PatchImpl + private class WaterPumperPatch : PatchImpl { [HarmonyTranspiler] [HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CheckBuildConditions))] @@ -51,7 +51,7 @@ public static class PlanetPatch } } - private class TerraformAnyway: PatchImpl + private class TerraformAnyway : PatchImpl { [HarmonyTranspiler] [HarmonyPatch(typeof(BuildTool_Reform), nameof(BuildTool_Reform.ReformAction))] diff --git a/CheatEnabler/Patches/PlayerPatch.cs b/CheatEnabler/Patches/PlayerPatch.cs index 3890b84..82a0fce 100644 --- a/CheatEnabler/Patches/PlayerPatch.cs +++ b/CheatEnabler/Patches/PlayerPatch.cs @@ -33,7 +33,7 @@ public static class PlayerPatch WarpWithoutSpaceWarpers.Enable(false); } - private class InstantHandCraft: PatchImpl + private class InstantHandCraft : PatchImpl { [HarmonyPostfix] [HarmonyPatch(typeof(ForgeTask), MethodType.Constructor, typeof(int), typeof(int))] @@ -43,7 +43,7 @@ public static class PlayerPatch } } - private class InstantTeleport: PatchImpl + private class InstantTeleport : PatchImpl { [HarmonyTranspiler] [HarmonyPatch(typeof(UIGlobemap), nameof(UIGlobemap._OnUpdate))] @@ -66,7 +66,7 @@ public static class PlayerPatch } } - private class WarpWithoutSpaceWarpers: PatchImpl + private class WarpWithoutSpaceWarpers : PatchImpl { [HarmonyPrefix] [HarmonyPatch(typeof(Mecha), nameof(Mecha.HasWarper))] @@ -75,7 +75,7 @@ public static class PlayerPatch __result = true; return false; } - + [HarmonyPostfix] [HarmonyPatch(typeof(Mecha), nameof(Mecha.UseWarper))] private static void Mecha_UseWarper_Postfix(ref bool __result) diff --git a/CheatEnabler/Patches/ResourcePatch.cs b/CheatEnabler/Patches/ResourcePatch.cs index cd1fada..952203c 100644 --- a/CheatEnabler/Patches/ResourcePatch.cs +++ b/CheatEnabler/Patches/ResourcePatch.cs @@ -29,7 +29,7 @@ public static class ResourcePatch FastMining.Enable(false); } - private class InfiniteResource: PatchImpl + private class InfiniteResource : PatchImpl { [HarmonyTranspiler] [HarmonyPatch(typeof(FactorySystem), nameof(FactorySystem.GameTick), typeof(long), typeof(bool))] @@ -59,7 +59,7 @@ public static class ResourcePatch } } - private class FastMining: PatchImpl + private class FastMining : PatchImpl { [HarmonyTranspiler] [HarmonyPatch(typeof(FactorySystem), "GameTick", typeof(long), typeof(bool))] diff --git a/CheatEnabler/UIConfigWindow.cs b/CheatEnabler/UIConfigWindow.cs index 3f019e2..a80c9ef 100644 --- a/CheatEnabler/UIConfigWindow.cs +++ b/CheatEnabler/UIConfigWindow.cs @@ -304,17 +304,20 @@ public static class UIConfigWindow { y += 72f; var originalY = y; - var btn1 = wnd.AddButton(x, y, 300f, tab4, "Generate illegal dyson shell", 16, "button-generate-illegal-dyson-shells", () => { + var btn1 = wnd.AddButton(x, y, 300f, tab4, "Generate illegal dyson shell", 16, "button-generate-illegal-dyson-shells", () => + { UIMessageBox.Show("Generate illegal dyson shell".Translate(), "WARNING: This operation can be very slow, continue?".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.WARNING, null, () => { DysonSphereFunctions.CreateIllegalDysonShellWithMaxOutput(); }); }); y += 36f; - var btn2 = wnd.AddButton(x, y, 300f, tab4, "Keep max production shells and remove others", 16, "button-keep-max-production-shells", () => { + var btn2 = wnd.AddButton(x, y, 300f, tab4, "Keep max production shells and remove others", 16, "button-keep-max-production-shells", () => + { UIMessageBox.Show("Keep max production shells and remove others".Translate(), "WARNING: This operation is DANGEROUS, continue?".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.WARNING, null, () => { DysonSphereFunctions.KeepMaxProductionShells(); }); }); y += 36f; - var btn3 = wnd.AddButton(x, y, 300f, tab4, "Duplicate shells from that with highest production", 16, "button-duplicate-shells-from-the-highest-production", () => { + var btn3 = wnd.AddButton(x, y, 300f, tab4, "Duplicate shells from that with highest production", 16, "button-duplicate-shells-from-the-highest-production", () => + { UIMessageBox.Show("Duplicate shells from that with highest production".Translate(), "WARNING: This operation can be very slow, continue?".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.WARNING, null, () => { DysonSphereFunctions.DuplicateShellsWithHighestProduction(); }); }); @@ -322,7 +325,8 @@ public static class UIConfigWindow var slider1 = wnd.AddSlider(x + 20f, y, tab4, DysonSphereFunctions.ShellsCountForFunctions, new ShellsCountMapper()); y = originalY; - var btn4 = wnd.AddButton(x, y, 300f, tab4, "Generate illegal dyson shell quickly", 16, "button-generate-illegal-dyson-shells-quickly", () => { + var btn4 = wnd.AddButton(x, y, 300f, tab4, "Generate illegal dyson shell quickly", 16, "button-generate-illegal-dyson-shells-quickly", () => + { UIMessageBox.Show("Generate illegal dyson shell".Translate(), "WARNING: This operation can be very slow, continue?".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.WARNING, null, () => { DysonSphereFunctions.CreateIllegalDysonShellQuickly(DysonSphereFunctions.ShellsCountForFunctions.Value); }); }); diff --git a/Dustbin/BeltSignal.cs b/Dustbin/BeltSignal.cs index 2a02901..db3bbce 100644 --- a/Dustbin/BeltSignal.cs +++ b/Dustbin/BeltSignal.cs @@ -52,7 +52,7 @@ public static class BeltSignal tex.LoadImage(fileData); return tex; } - + private static Sprite LoadEmbeddedSprite(string path, Assembly assembly = null) { var tex = LoadEmbeddedTexture(path, assembly); diff --git a/Dustbin/NebulaSupport/Packets.cs b/Dustbin/NebulaSupport/Packets.cs index f6c1f18..6ef6511 100644 --- a/Dustbin/NebulaSupport/Packets.cs +++ b/Dustbin/NebulaSupport/Packets.cs @@ -61,19 +61,19 @@ namespace Dustbin.NebulaSupport NebulaModAPI.MultiplayerSession.Network.SendPacket(new SyncPlanetData(Dustbin.ExportData(factory))); return; case < 0: - { - var tankPool = factory.factoryStorage.tankPool; - tankPool[-storageId].IsDustbin = packet.Enable; - TankPatch.Reset(); - return; - } + { + var tankPool = factory.factoryStorage.tankPool; + tankPool[-storageId].IsDustbin = packet.Enable; + TankPatch.Reset(); + return; + } case > 0: - { - var storagePool = factory.factoryStorage.storagePool; - storagePool[storageId].IsDustbin = packet.Enable; - StoragePatch.Reset(); - return; - } + { + var storagePool = factory.factoryStorage.storagePool; + storagePool[storageId].IsDustbin = packet.Enable; + StoragePatch.Reset(); + return; + } } } } diff --git a/Dustbin/StoragePatch.cs b/Dustbin/StoragePatch.cs index 63e84b8..fd86cc0 100644 --- a/Dustbin/StoragePatch.cs +++ b/Dustbin/StoragePatch.cs @@ -13,7 +13,7 @@ public static class StoragePatch private static UI.MyCheckBox _storageDustbinCheckBox; private static int _lastStorageId; private static Harmony _patch; - + public static void Enable(bool on) { if (on) @@ -138,7 +138,7 @@ public static class StoragePatch _storageDustbinCheckBox.rectTrans.anchoredPosition3D = new Vector3(190, 57 - rectTrans.sizeDelta.y, 0); } } - + /* Adopt fix from starfi5h's NebulaCompatiblilityAssist */ [HarmonyPostfix] [HarmonyPatch(typeof(UIStorageGrid), nameof(UIStorageGrid.OnStorageSizeChanged))] diff --git a/Dustbin/TankPatch.cs b/Dustbin/TankPatch.cs index 94cf8ae..9ab02ff 100644 --- a/Dustbin/TankPatch.cs +++ b/Dustbin/TankPatch.cs @@ -11,7 +11,7 @@ public static class TankPatch private static UI.MyCheckBox _tankDustbinCheckBox; private static int _lastTankId; private static Harmony _patch; - + public static void Enable(bool on) { if (on) diff --git a/DustbinPreloader/DustbinPreloader.cs b/DustbinPreloader/DustbinPreloader.cs index 2632c4f..2e4bda3 100644 --- a/DustbinPreloader/DustbinPreloader.cs +++ b/DustbinPreloader/DustbinPreloader.cs @@ -7,7 +7,7 @@ namespace DustbinPreloader; public static class Preloader { - private static readonly ManualLogSource Logger = BepInEx.Logging.Logger.CreateLogSource("Dustbin Preloader"); + private static readonly ManualLogSource Logger = BepInEx.Logging.Logger.CreateLogSource("Dustbin Preloader"); public static IEnumerable TargetDLLs { get; } = new[] { "Assembly-CSharp.dll" }; public static void Patch(AssemblyDefinition assembly) diff --git a/LabOpt/Functions.cs b/LabOpt/Functions.cs index 41f5159..eb69cb5 100644 --- a/LabOpt/Functions.cs +++ b/LabOpt/Functions.cs @@ -410,30 +410,30 @@ public static class LabOptPatchFunctions public static void SetFunctionInternal(ref LabComponent lab, bool researchMode, int recpId, int techId, SignData[] signPool, LabComponent[] labPool) { // LabOptPatch.Logger.LogDebug($"SetFunctionInternal: id={lab.id} root={(int)RootLabIdField.GetValue(lab)} research={researchMode} recp={recpId} tech={techId}"); - lab.replicating = false; - lab.time = 0; - lab.hashBytes = 0; - lab.extraHashBytes = 0; - lab.extraTime = 0; - lab.extraSpeed = 0; - lab.extraPowerRatio = 0; - lab.productive = false; - if (researchMode) - { - lab.forceAccMode = false; - lab.researchMode = true; - lab.recipeId = 0; - lab.techId = 0; - lab.timeSpend = 0; - lab.extraTimeSpend = 0; - lab.requires = null; - lab.requireCounts = null; - lab.served = null; - lab.incServed = null; - lab.products = null; - lab.productCounts = null; - lab.produced = null; - lab.productive = true; + lab.replicating = false; + lab.time = 0; + lab.hashBytes = 0; + lab.extraHashBytes = 0; + lab.extraTime = 0; + lab.extraSpeed = 0; + lab.extraPowerRatio = 0; + lab.productive = false; + if (researchMode) + { + lab.forceAccMode = false; + lab.researchMode = true; + lab.recipeId = 0; + lab.techId = 0; + lab.timeSpend = 0; + lab.extraTimeSpend = 0; + lab.requires = null; + lab.requireCounts = null; + lab.served = null; + lab.incServed = null; + lab.products = null; + lab.productCounts = null; + lab.produced = null; + lab.productive = true; var rootLabId = lab.pcId; if (rootLabId > 0) { @@ -480,29 +480,29 @@ public static class LabOptPatchFunctions } } signPool[lab.entityId].iconId0 = (uint)lab.techId; - signPool[lab.entityId].iconType = lab.techId == 0 ? 0U : 3U; - return; - } - lab.researchMode = false; - lab.recipeId = 0; - lab.techId = 0; - lab.matrixPoints = null; - lab.matrixServed = null; - lab.matrixIncServed = null; - RecipeProto recipeProto = null; - if (recpId > 0) - { - recipeProto = LDB.recipes.Select(recpId); - } - if (recipeProto != null && recipeProto.Type == ERecipeType.Research) - { - lab.recipeId = recipeProto.ID; - lab.speed = 10000; - lab.speedOverride = lab.speed; - lab.timeSpend = recipeProto.TimeSpend * 10000; - lab.extraTimeSpend = recipeProto.TimeSpend * 100000; - lab.productive = recipeProto.productive; - lab.forceAccMode &= lab.productive; + signPool[lab.entityId].iconType = lab.techId == 0 ? 0U : 3U; + return; + } + lab.researchMode = false; + lab.recipeId = 0; + lab.techId = 0; + lab.matrixPoints = null; + lab.matrixServed = null; + lab.matrixIncServed = null; + RecipeProto recipeProto = null; + if (recpId > 0) + { + recipeProto = LDB.recipes.Select(recpId); + } + if (recipeProto != null && recipeProto.Type == ERecipeType.Research) + { + lab.recipeId = recipeProto.ID; + lab.speed = 10000; + lab.speedOverride = lab.speed; + lab.timeSpend = recipeProto.TimeSpend * 10000; + lab.extraTimeSpend = recipeProto.TimeSpend * 100000; + lab.productive = recipeProto.productive; + lab.forceAccMode &= lab.productive; var rootLabId = lab.pcId; if (rootLabId > 0) { @@ -544,26 +544,26 @@ public static class LabOptPatchFunctions Array.Clear(lab.produced, 0, lab.produced.Length); } } - else - { - lab.forceAccMode = false; - lab.recipeId = 0; - lab.speed = 0; - lab.speedOverride = 0; - lab.timeSpend = 0; - lab.extraTimeSpend = 0; - lab.requires = null; - lab.requireCounts = null; - lab.served = null; - lab.incServed = null; - lab.needs = null; - lab.products = null; - lab.productCounts = null; - lab.produced = null; - } - signPool[lab.entityId].iconId0 = (uint)lab.recipeId; - signPool[lab.entityId].iconType = lab.recipeId == 0 ? 0U : 2U; - } + else + { + lab.forceAccMode = false; + lab.recipeId = 0; + lab.speed = 0; + lab.speedOverride = 0; + lab.timeSpend = 0; + lab.extraTimeSpend = 0; + lab.requires = null; + lab.requireCounts = null; + lab.served = null; + lab.incServed = null; + lab.needs = null; + lab.products = null; + lab.productCounts = null; + lab.produced = null; + } + signPool[lab.entityId].iconId0 = (uint)lab.recipeId; + signPool[lab.entityId].iconType = lab.recipeId == 0 ? 0U : 2U; + } public static int InsertIntoLab(PlanetFactory factory, int labId, int itemId, byte itemCount, byte itemInc, ref byte remainInc, int[] needs) { diff --git a/LabOpt/LabOpt.cs b/LabOpt/LabOpt.cs index 4ce0e7a..2f83607 100644 --- a/LabOpt/LabOpt.cs +++ b/LabOpt/LabOpt.cs @@ -18,7 +18,7 @@ public class LabOptPatch : BaseUnityPlugin { Harmony.CreateAndPatchAll(typeof(LabOptPatch)); } - + // Patch LabComponent.Export() to save zero value if rootLabId > 0. [HarmonyTranspiler] [HarmonyPatch(typeof(LabComponent), nameof(LabComponent.Export))] @@ -274,7 +274,7 @@ public class LabOptPatch : BaseUnityPlugin ); return matcher.InstructionEnumeration(); } - + // Change locks on PlanetFactory.InsertInto(), by calling LabOptPatchFunctions.InsertIntoLab() [HarmonyTranspiler] [HarmonyPatch(typeof(PlanetFactory), nameof(PlanetFactory.InsertInto))] @@ -332,7 +332,7 @@ public class LabOptPatch : BaseUnityPlugin { LabOptPatchFunctions.SetRootId(ref __instance, 0); } - + [HarmonyTranspiler] [HarmonyPatch(typeof(LabOptPatchFunctions), nameof(LabOptPatchFunctions.SetRootId))] [HarmonyPatch(typeof(LabOptPatchFunctions), nameof(LabOptPatchFunctions.SetRootLabIdForStacking))] diff --git a/LabOptPreloader/LabOptPreloader.cs b/LabOptPreloader/LabOptPreloader.cs index a03ae57..797a4c6 100644 --- a/LabOptPreloader/LabOptPreloader.cs +++ b/LabOptPreloader/LabOptPreloader.cs @@ -7,7 +7,7 @@ namespace LabOptPreloader; public static class Preloader { - private static readonly ManualLogSource Logger = BepInEx.Logging.Logger.CreateLogSource("LabOpt Preloader"); + private static readonly ManualLogSource Logger = BepInEx.Logging.Logger.CreateLogSource("LabOpt Preloader"); public static IEnumerable TargetDLLs { get; } = new[] { "Assembly-CSharp.dll" }; public static void Patch(AssemblyDefinition assembly) diff --git a/UXAssist/Common/GameLogic.cs b/UXAssist/Common/GameLogic.cs index 2da52c5..3762995 100644 --- a/UXAssist/Common/GameLogic.cs +++ b/UXAssist/Common/GameLogic.cs @@ -3,7 +3,7 @@ using HarmonyLib; namespace UXAssist.Common; -public class GameLogic: PatchImpl +public class GameLogic : PatchImpl { public static Action OnDataLoaded; public static Action OnGameBegin; diff --git a/UXAssist/Common/I18N.cs b/UXAssist/Common/I18N.cs index efd833f..c53e5d1 100644 --- a/UXAssist/Common/I18N.cs +++ b/UXAssist/Common/I18N.cs @@ -122,14 +122,14 @@ public static class I18N _initialized = true; Apply(); } - + [HarmonyPostfix, HarmonyPriority(Priority.Last), HarmonyPatch(typeof(Localization), nameof(Localization.LoadLanguage))] private static void Localization_LoadLanguage_Postfix(int index) { if (!_initialized) return; ApplyLanguage(index); } - + [HarmonyPostfix, HarmonyPriority(Priority.Last), HarmonyPatch(typeof(Localization), nameof(Localization.NotifyLanguageChange))] private static void Localization_NotifyLanguageChange_Postfix() { diff --git a/UXAssist/Common/Util.cs b/UXAssist/Common/Util.cs index db8d386..4469aa5 100644 --- a/UXAssist/Common/Util.cs +++ b/UXAssist/Common/Util.cs @@ -36,13 +36,13 @@ public static class Util tex.LoadImage(fileData); return tex; } - + public static Sprite LoadSprite(string path) { var tex = LoadTexture(path); return Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f)); } - + public static Texture2D LoadEmbeddedTexture(string path, Assembly assembly = null) { var fileData = LoadEmbeddedResource(path, assembly); @@ -50,12 +50,12 @@ public static class Util tex.LoadImage(fileData); return tex; } - + public static Sprite LoadEmbeddedSprite(string path, Assembly assembly = null) { var tex = LoadEmbeddedTexture(path, assembly); return Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f)); } - + public static string PluginFolder(Assembly assembly = null) => Path.GetDirectoryName((assembly == null ? Assembly.GetCallingAssembly() : assembly).Location); } diff --git a/UXAssist/Common/WinApi.cs b/UXAssist/Common/WinApi.cs index 1b344e4..9b7c4a1 100644 --- a/UXAssist/Common/WinApi.cs +++ b/UXAssist/Common/WinApi.cs @@ -127,7 +127,7 @@ public static class WinApi [DllImport("user32", ExactSpelling = true)] public static extern bool MoveWindow(IntPtr hWnd, int x, int y, int nWidth, int nHeight, bool bRepaint); - + [DllImport("user32", ExactSpelling = true)] public static extern IntPtr MonitorFromRect([In] ref Rect lpRect, uint dwFlags); @@ -183,7 +183,7 @@ public static class WinApi public ushort Reserved1; public ushort Reserved3; } - + [StructLayout(LayoutKind.Sequential, Pack = 4)] private struct PROCESSOR_RELATIONSHIP { @@ -207,7 +207,7 @@ public static class WinApi public uint Size; public PROCESSOR_RELATIONSHIP Processor; } - + [DllImport("kernel32", SetLastError = true)] private static extern bool GetLogicalProcessorInformationEx( LOGICAL_PROCESSOR_RELATIONSHIP relationshipType, diff --git a/UXAssist/Functions/FactoryFunctions.cs b/UXAssist/Functions/FactoryFunctions.cs index 1f78005..3756fc1 100644 --- a/UXAssist/Functions/FactoryFunctions.cs +++ b/UXAssist/Functions/FactoryFunctions.cs @@ -13,7 +13,8 @@ public static class FactoryFunctions // Clear entity connection var factory = cargoTraffic.factory; factory.ReadObjectConn(belt.entityId, 0, out var isOutput, out var otherObjId, out var otherSlot); - if (isOutput && factory.entityPool[otherObjId].beltId == belt.outputId) { + if (isOutput && factory.entityPool[otherObjId].beltId == belt.outputId) + { factory.ClearObjectConnDirect(belt.entityId, 0); factory.ClearObjectConnDirect(otherObjId, otherSlot); } @@ -194,7 +195,7 @@ public static class FactoryFunctions bpBuildings.Add(new BPBuildingData { building = building, itemType = itemType, offset = offset }); } } - HashSet beltsWithInput = [..bpBelts.Select(pair => pair.Value.building.outputObj)]; + HashSet beltsWithInput = [.. bpBelts.Select(pair => pair.Value.building.outputObj)]; var beltHeads = bpBelts.Where(pair => !beltsWithInput.Contains(pair.Value.building)).ToDictionary(pair => pair.Key, pair => pair.Value); // Sort belt buildings List sortedBpBelts = []; diff --git a/UXAssist/Functions/PlanetFunctions.cs b/UXAssist/Functions/PlanetFunctions.cs index 83c86de..a9661cf 100644 --- a/UXAssist/Functions/PlanetFunctions.cs +++ b/UXAssist/Functions/PlanetFunctions.cs @@ -173,7 +173,8 @@ public static class PlanetFunctions { ref var warning = ref warningPool[i]; if (warning.id != i) continue; - switch (warning.factoryId) { + switch (warning.factoryId) + { case -4: if (warning.astroId == planetId) warningSystem.RemoveWarningData(i); diff --git a/UXAssist/Patches/DysonSpherePatch.cs b/UXAssist/Patches/DysonSpherePatch.cs index 21802fa..8e461b8 100644 --- a/UXAssist/Patches/DysonSpherePatch.cs +++ b/UXAssist/Patches/DysonSpherePatch.cs @@ -9,7 +9,7 @@ using GameLogic = UXAssist.Common.GameLogic; namespace UXAssist.Patches; -public class DysonSpherePatch: PatchImpl +public class DysonSpherePatch : PatchImpl { public static ConfigEntry StopEjectOnNodeCompleteEnabled; public static ConfigEntry OnlyConstructNodesEnabled; @@ -261,7 +261,7 @@ public class DysonSpherePatch: PatchImpl return matcher.InstructionEnumeration(); } - private class StopEjectOnNodeComplete: PatchImpl + private class StopEjectOnNodeComplete : PatchImpl { private static HashSet[] _nodeForAbsorb; private static bool _initialized; @@ -492,7 +492,7 @@ public class DysonSpherePatch: PatchImpl } [PatchSetCallbackFlag(PatchCallbackFlag.CallOnDisableAfterUnpatch)] - private class OnlyConstructNodes: PatchImpl + private class OnlyConstructNodes : PatchImpl { protected override void OnEnable() { diff --git a/UXAssist/Patches/GamePatch.cs b/UXAssist/Patches/GamePatch.cs index dde32c7..3b1275d 100644 --- a/UXAssist/Patches/GamePatch.cs +++ b/UXAssist/Patches/GamePatch.cs @@ -80,7 +80,8 @@ public class GamePatch : PatchImpl I18N.Add("Logical frame rate: {0}x", "[UXA] Logical frame rate: {0}x", "[UXA] 逻辑帧速率: {0}x"); EnableWindowResizeEnabled.SettingChanged += (_, _) => EnableWindowResize.Enable(EnableWindowResizeEnabled.Value); - LoadLastWindowRectEnabled.SettingChanged += (_, _) => { + LoadLastWindowRectEnabled.SettingChanged += (_, _) => + { if (LoadLastWindowRectEnabled.Value) { FixLastWindowRect(); diff --git a/UXAssist/Patches/LogisticsPatch.cs b/UXAssist/Patches/LogisticsPatch.cs index 609f223..3bf7bd5 100644 --- a/UXAssist/Patches/LogisticsPatch.cs +++ b/UXAssist/Patches/LogisticsPatch.cs @@ -298,7 +298,8 @@ public static class LogisticsPatch new CodeMatch(OpCodes.Ldc_I4_1), new CodeMatch(OpCodes.Call, AccessTools.PropertyGetter(typeof(GameMain), nameof(GameMain.mainPlayer))) ); - if (matcher.IsValid) { + if (matcher.IsValid) + { matcher.RemoveInstructions(7).InsertAndAdvance( new CodeInstruction(OpCodes.Ldc_I4_0) ); diff --git a/UXAssist/Patches/PlanetPatch.cs b/UXAssist/Patches/PlanetPatch.cs index 59dfd6c..c57b1c5 100644 --- a/UXAssist/Patches/PlanetPatch.cs +++ b/UXAssist/Patches/PlanetPatch.cs @@ -24,7 +24,7 @@ public static class PlanetPatch PlayerActionsInGlobeView.Enable(false); } - public class PlayerActionsInGlobeView: PatchImpl + public class PlayerActionsInGlobeView : PatchImpl { [HarmonyTranspiler] [HarmonyPatch(typeof(VFInput), nameof(VFInput.UpdateGameStates))] @@ -48,7 +48,7 @@ public static class PlanetPatch }); return matcher.InstructionEnumeration(); } - + [HarmonyTranspiler] [HarmonyPatch(typeof(PlayerController), nameof(PlayerController.GetInput))] private static IEnumerable PlayerController_GetInput_Transpiler(IEnumerable instructions, ILGenerator generator) diff --git a/UXAssist/Patches/TechPatch.cs b/UXAssist/Patches/TechPatch.cs index bba4a6a..606fb5e 100644 --- a/UXAssist/Patches/TechPatch.cs +++ b/UXAssist/Patches/TechPatch.cs @@ -287,7 +287,7 @@ public static class TechPatch } } - private class BatchBuyoutTech: PatchImpl + private class BatchBuyoutTech : PatchImpl { [HarmonyTranspiler] [HarmonyPatch(typeof(UITechNode), nameof(UITechNode.UpdateInfoDynamic))] diff --git a/UXAssist/Patches/UIPatch.cs b/UXAssist/Patches/UIPatch.cs index 12d6cd1..e7cb048 100644 --- a/UXAssist/Patches/UIPatch.cs +++ b/UXAssist/Patches/UIPatch.cs @@ -4,7 +4,7 @@ using Common; using HarmonyLib; [PatchGuid(PluginInfo.PLUGIN_GUID)] -public class UIPatch: PatchImpl +public class UIPatch : PatchImpl { public static void Start() { diff --git a/UXAssist/UI/MyCheckButton.cs b/UXAssist/UI/MyCheckButton.cs index d4a2618..92ef0a2 100644 --- a/UXAssist/UI/MyCheckButton.cs +++ b/UXAssist/UI/MyCheckButton.cs @@ -17,12 +17,12 @@ public class MyCheckButton : MonoBehaviour private static GameObject _baseObject; - private static Color openMouseOverColor; - private static Color openPressColor; - private static Color openNormalColor; - private static Color closeMouseOverColor; - private static Color closePressColor; - private static Color closeNormalColor; + private static Color openMouseOverColor; + private static Color openPressColor; + private static Color openNormalColor; + private static Color closeMouseOverColor; + private static Color closePressColor; + private static Color closeNormalColor; public static void InitBaseObject() { diff --git a/UXAssist/UI/MyWindow.cs b/UXAssist/UI/MyWindow.cs index 4f42d8a..26187c2 100644 --- a/UXAssist/UI/MyWindow.cs +++ b/UXAssist/UI/MyWindow.cs @@ -228,7 +228,7 @@ public class MyWindow : ManualBehaviour return comboBox; } -#region Slider + #region Slider public class ValueMapper { public virtual int Min => 1; @@ -402,7 +402,7 @@ public class MyWindow : ManualBehaviour { return AddSideSlider(x, y, parent, config, new ArrayMapper(valueList), format, width); } -#endregion + #endregion public InputField AddInputField(float x, float y, RectTransform parent, string text = "", int fontSize = 16, string objName = "input", UnityAction onChanged = null, UnityAction onEditEnd = null) @@ -593,7 +593,7 @@ public abstract class MyWindowManager } */ - public class Patch: PatchImpl + public class Patch : PatchImpl { protected override void OnEnable() { diff --git a/UniverseGenTweaks/EpicDifficulty.cs b/UniverseGenTweaks/EpicDifficulty.cs index d3a4181..c1e5f06 100644 --- a/UniverseGenTweaks/EpicDifficulty.cs +++ b/UniverseGenTweaks/EpicDifficulty.cs @@ -75,7 +75,7 @@ public static class EpicDifficulty } return 0; } - + public static int OilMultipliersCount() { return OilMultipliers.Length; @@ -111,7 +111,7 @@ public static class EpicDifficulty __instance.UpdateParametersUIDisplay(); return false; } - + [HarmonyPrefix] [HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect.UpdateParametersUIDisplay))] private static bool UIGalaxySelect_UpdateParametersUIDisplay_Prefix(UIGalaxySelect __instance) diff --git a/UniverseGenTweaks/UniverseGenTweaks.cs b/UniverseGenTweaks/UniverseGenTweaks.cs index 0009697..0e99764 100644 --- a/UniverseGenTweaks/UniverseGenTweaks.cs +++ b/UniverseGenTweaks/UniverseGenTweaks.cs @@ -19,15 +19,15 @@ public class UniverseGenTweaks : BaseUnityPlugin, IModCanSave MoreSettings.Enabled = Config.Bind("MoreSettings", "Enabled", true, "Enable more settings on Universe Generation"); MoreSettings.MaxStarCount = Config.Bind("MoreSettings", "MaxStarCount", 128, new ConfigDescription("(32 ~ 1024)\nMaximum star count for Universe Generation, enable MoreSettings.Enabled to take effect", - new AcceptableValueRange(32, 1024), new {})); + new AcceptableValueRange(32, 1024), new { })); EpicDifficulty.Enabled = Config.Bind("EpicDifficulty", "Enabled", true, "Enable Epic difficulty"); EpicDifficulty.ResourceMultiplier = Config.Bind("EpicDifficulty", "ResourceMultiplier", 0.01f, new ConfigDescription("Resource multiplier for Epic difficulty", - new AcceptableValueRange(0.0001f, 0.05f), new {})); + new AcceptableValueRange(0.0001f, 0.05f), new { })); EpicDifficulty.OilMultiplier = Config.Bind("EpicDifficulty", "OilMultiplier", 0.5f, new ConfigDescription("Oil multiplier for Epic difficulty relative to the Very-Hard difficulty", - new AcceptableValueRange(0.1f, 1f), new {})); + new AcceptableValueRange(0.1f, 1f), new { })); BirthPlanetPatch.SitiVeinsOnBirthPlanet = Config.Bind("Birth", "SiTiVeinsOnBirthPlanet", false, "Silicon/Titanium on birth planet"); diff --git a/UserCloak/UserCloak.cs b/UserCloak/UserCloak.cs index 004e267..2c113fc 100644 --- a/UserCloak/UserCloak.cs +++ b/UserCloak/UserCloak.cs @@ -8,7 +8,7 @@ using Random = UnityEngine.Random; namespace UserCloak; [BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)] -public class UserCloak: BaseUnityPlugin +public class UserCloak : BaseUnityPlugin { private static Harmony _patch; private static ConfigEntry _mode;