1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-08 20:13:29 +08:00

donet format

This commit is contained in:
2025-09-21 15:38:03 +08:00
parent 5f37b8b6d6
commit a25f74443d
32 changed files with 170 additions and 155 deletions

View File

@@ -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<int>();
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;

View File

@@ -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); });
});

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -80,7 +80,8 @@ public class GamePatch : PatchImpl<GamePatch>
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();

View File

@@ -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)
);