mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-12 06:33:52 +08:00
work in progress
This commit is contained in:
@@ -85,8 +85,8 @@ public class CheatEnabler : BaseUnityPlugin
|
||||
"Unlock Dyson Sphere max orbit radius");
|
||||
DysonSpherePatch.UnlockMaxOrbitRadiusValue = Config.Bind("DysonSphere", "MaxOrbitRadiusValue", 10_000_000f,
|
||||
"Unlocked Dyson Sphere max orbit radius value");
|
||||
Functions.DysonSphereFunctions.RetainShellsCount = Config.Bind("DysonSphere", "RetainShellsCount", 2048,
|
||||
"Retain dyson shells count");
|
||||
Functions.DysonSphereFunctions.ShellsCountForFunctions = Config.Bind("DysonSphere", "ShellsCountForFunctions", 2048,
|
||||
"Shells count for various functions");
|
||||
CombatPatch.MechaInvincibleEnabled = Config.Bind("Battle", "MechaInvincible", false,
|
||||
"Mecha and Drones/Fleets invincible");
|
||||
CombatPatch.BuildingsInvincibleEnabled = Config.Bind("Battle", "BuildingsInvincible", false,
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace CheatEnabler.Functions;
|
||||
|
||||
public static class DysonSphereFunctions
|
||||
{
|
||||
public static ConfigEntry<int> RetainShellsCount;
|
||||
public static ConfigEntry<int> ShellsCountForFunctions;
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
@@ -625,7 +625,7 @@ public static class DysonSphereFunctions
|
||||
return true;
|
||||
}
|
||||
|
||||
private static int QuickAddDysonShell(this DysonSphereLayer layer, int protoId, DysonNode[] nodes, DysonFrame[] frames)
|
||||
private static int QuickAddDysonShell(this DysonSphereLayer layer, int protoId, DysonNode[] nodes, DysonFrame[] frames, bool limit)
|
||||
{
|
||||
int shellId = 0;
|
||||
if (layer.shellRecycleCursor > 0)
|
||||
@@ -682,7 +682,7 @@ public static class DysonSphereFunctions
|
||||
shell.nodes.Add(dysonNode);
|
||||
shell.frames.Add(dysonFrame);
|
||||
}
|
||||
if (!shell.MyGenerateGeometry() || DysonShell.s_vmap.Count < 32000)
|
||||
if (!shell.MyGenerateGeometry() || (limit && DysonShell.s_vmap.Count < 32000))
|
||||
{
|
||||
CheatEnabler.Logger.LogDebug($"Stripped VertCount: {DysonShell.s_vmap.Count}");
|
||||
shell.Free();
|
||||
@@ -701,6 +701,22 @@ public static class DysonSphereFunctions
|
||||
return shellId;
|
||||
}
|
||||
|
||||
private static void QuickRemoveDysonNode(this DysonSphereLayer layer, int nodeId)
|
||||
{
|
||||
var node = layer.nodePool[nodeId];
|
||||
if (node == null || node.id != nodeId) return;
|
||||
var dysonSphere = layer.dysonSphere;
|
||||
dysonSphere.swarm.OnNodeRemove(layer.id, nodeId);
|
||||
dysonSphere.RemoveAutoNode(node);
|
||||
dysonSphere.RemoveNodeRocket(node);
|
||||
dysonSphere.RemoveDysonNodeRData(node);
|
||||
node.Free();
|
||||
layer.nodePool[nodeId] = null;
|
||||
int recycleIndex = layer.nodeRecycleCursor;
|
||||
layer.nodeRecycleCursor = recycleIndex + 1;
|
||||
layer.nodeRecycle[recycleIndex] = nodeId;
|
||||
}
|
||||
|
||||
private static void QuickRemoveDysonFrame(this DysonSphereLayer layer, int frameId)
|
||||
{
|
||||
var frame = layer.framePool[frameId];
|
||||
@@ -759,13 +775,9 @@ public static class DysonSphereFunctions
|
||||
{
|
||||
var shell = layer.shellPool[j];
|
||||
if (shell == null || shell.id != j) continue;
|
||||
if (shell.nodes.Count != 3) continue;
|
||||
nodePos.Add(shell.nodes[0].pos);
|
||||
nodePos.Add(shell.nodes[1].pos);
|
||||
nodePos.Add(shell.nodes[2].pos);
|
||||
isEuler.Add(shell.frames[0].euler);
|
||||
isEuler.Add(shell.frames[1].euler);
|
||||
isEuler.Add(shell.frames[2].euler);
|
||||
nodePos.AddRange(shell.nodes.Select(node => node.pos));
|
||||
isEuler.AddRange(shell.frames.Select(frame => frame.euler));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -774,6 +786,7 @@ public static class DysonSphereFunctions
|
||||
UIMessageBox.Show("CheatEnabler".Translate(), string.Format("There is no Dyson Sphere shell on \"{0}\".".Translate(), star.displayName), "确定".Translate(), 3, null);
|
||||
return;
|
||||
}
|
||||
CheatEnabler.Logger.LogDebug($"NodePositions: {nodePos[0]}, {nodePos[1]}, {nodePos[2]}");
|
||||
UXAssist.Functions.DysonSphereFunctions.InitCurrentDysonLayer(star, -1);
|
||||
dysonSphere = GameMain.data?.dysonSpheres[star.index];
|
||||
for (var i = 1; i < dysonSphere.layersIdBased.Length; i++)
|
||||
@@ -784,19 +797,28 @@ public static class DysonSphereFunctions
|
||||
dysonSphere.QueryLayerRadius(ref orbitRadius, out var speed);
|
||||
Quaternion quaternion = Quaternion.Euler(0f, 0f, 0f);
|
||||
layer = dysonSphere.AddLayer(orbitRadius, quaternion,speed);
|
||||
DysonNode[] nodes = [
|
||||
layer.QuickAddDysonNode(0, nodePos[0]),
|
||||
layer.QuickAddDysonNode(0, nodePos[1]),
|
||||
layer.QuickAddDysonNode(0, nodePos[2]),
|
||||
];
|
||||
DysonFrame[] frames = [
|
||||
layer.QuickAddDysonFrame(0, nodes[0], nodes[1], isEuler[0]),
|
||||
layer.QuickAddDysonFrame(0, nodes[1], nodes[2], isEuler[1]),
|
||||
layer.QuickAddDysonFrame(0, nodes[2], nodes[0], isEuler[2]),
|
||||
];
|
||||
for (var i = 0; i < 1024; i++)
|
||||
var nodeCount = nodePos.Count;
|
||||
DysonNode[] nodes = [.. nodePos.Select(pos => layer.QuickAddDysonNode(0, pos))];
|
||||
DysonFrame[] frames = [.. nodes.Select((node, index) => layer.QuickAddDysonFrame(0, node, nodes[(index + 1) % nodes.Length], isEuler[index]))];
|
||||
layer.QuickAddDysonShell(0, nodes, frames, false);
|
||||
long[] cpMax = [.. nodes.Select(node => node.totalCpMax)];
|
||||
long[] totalCpMax = [.. cpMax];
|
||||
var keepCount = ShellsCountForFunctions.Value;
|
||||
for (var i = 1; i < keepCount; i++)
|
||||
{
|
||||
layer.QuickAddDysonShell(0, nodes, frames);
|
||||
for (var j = 0; j < nodeCount; j++)
|
||||
{
|
||||
totalCpMax[j] += cpMax[j];
|
||||
if (totalCpMax[j] > int.MaxValue)
|
||||
{
|
||||
totalCpMax[j] = cpMax[j];
|
||||
nodes[j] = layer.QuickAddDysonNode(0, nodePos[j]);
|
||||
var prev = j > 0 ? j - 1 : nodeCount - 1;
|
||||
frames[prev] = layer.QuickAddDysonFrame(0, nodes[prev], nodes[j], isEuler[prev]);
|
||||
frames[j] = layer.QuickAddDysonFrame(0, nodes[j], nodes[(j + 1) % nodeCount], isEuler[j]);
|
||||
}
|
||||
}
|
||||
layer.QuickAddDysonShell(0, nodes, frames, false);
|
||||
}
|
||||
foreach (var node in nodes)
|
||||
{
|
||||
@@ -810,6 +832,10 @@ public static class DysonSphereFunctions
|
||||
}
|
||||
dysonSphere.modelRenderer.RebuildModels();
|
||||
GameMain.gameScenario.NotifyOnPlanDysonShell();
|
||||
dysonSphere.inEditorRenderMaskS = 0;
|
||||
dysonSphere.inEditorRenderMaskL = 0;
|
||||
dysonSphere.inGameRenderMaskS = 0;
|
||||
dysonSphere.inGameRenderMaskL = 0;
|
||||
}
|
||||
|
||||
public static void CreatePossibleFramesAndShells2()
|
||||
@@ -842,7 +868,6 @@ public static class DysonSphereFunctions
|
||||
for (var i = 1; i < dysonSphere.layersIdBased.Length; i++)
|
||||
{
|
||||
Dictionary<(int, int), int> availableFrames = [];
|
||||
HashSet<DysonNode> dirtyNodes = [];
|
||||
HashSet<int> unusedFrameIds = [];
|
||||
var layer = dysonSphere.layersIdBased[i];
|
||||
if (layer == null || layer.id != i) continue;
|
||||
@@ -895,50 +920,67 @@ public static class DysonSphereFunctions
|
||||
unusedFrameIds.Add(frame.id);
|
||||
}
|
||||
}
|
||||
var total = 0;
|
||||
DysonFrame[] frames = null;
|
||||
DysonNode[] nodes = null;
|
||||
for (j = 0; j < count && total < 8192; j++)
|
||||
var maxJ = -1;
|
||||
var maxVertCount = -1;
|
||||
for (j = 0; j < count; j++)
|
||||
{
|
||||
var shell = supposedShells[j];
|
||||
frames = [layer.framePool[availableFrames[(shell.nodeA.id, shell.nodeB.id)]], layer.framePool[availableFrames[(shell.nodeB.id, shell.nodeC.id)]], layer.framePool[availableFrames[(shell.nodeA.id, shell.nodeC.id)]]];
|
||||
nodes = [shell.nodeA, shell.nodeB, shell.nodeC];
|
||||
if (layer.QuickAddDysonShell(0, nodes, frames) <= 0) continue;
|
||||
if (layer.QuickAddDysonShell(0, nodes, frames, true) <= 0) {
|
||||
var vertCount = DysonShell.s_vmap.Count;
|
||||
if (vertCount < 32768 && vertCount > maxVertCount) {
|
||||
maxVertCount = vertCount;
|
||||
maxJ = j;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
unusedFrameIds.Remove(frames[0].id);
|
||||
unusedFrameIds.Remove(frames[1].id);
|
||||
unusedFrameIds.Remove(frames[2].id);
|
||||
dirtyNodes.Add(shell.nodeA);
|
||||
dirtyNodes.Add(shell.nodeB);
|
||||
dirtyNodes.Add(shell.nodeC);
|
||||
total++;
|
||||
CheatEnabler.Logger.LogDebug($"Added Shell {shell.nodeA.pos}, {shell.nodeB.pos}, {shell.nodeC.pos} {DysonShell.s_vmap.Count}");
|
||||
shellsChanged = true;
|
||||
maxJ = -1;
|
||||
maxVertCount = -1;
|
||||
break;
|
||||
}
|
||||
while (total < 2048)
|
||||
if (maxJ >= 0)
|
||||
{
|
||||
layer.QuickAddDysonShell(0, nodes, frames);
|
||||
total++;
|
||||
var shell = supposedShells[maxJ];
|
||||
frames = [layer.framePool[availableFrames[(shell.nodeA.id, shell.nodeB.id)]], layer.framePool[availableFrames[(shell.nodeB.id, shell.nodeC.id)]], layer.framePool[availableFrames[(shell.nodeA.id, shell.nodeC.id)]]];
|
||||
nodes = [shell.nodeA, shell.nodeB, shell.nodeC];
|
||||
layer.QuickAddDysonShell(0, nodes, frames, false);
|
||||
unusedFrameIds.Remove(frames[0].id);
|
||||
unusedFrameIds.Remove(frames[1].id);
|
||||
unusedFrameIds.Remove(frames[2].id);
|
||||
CheatEnabler.Logger.LogDebug($"Added Shell {shell.nodeA.pos}, {shell.nodeB.pos}, {shell.nodeC.pos} {DysonShell.s_vmap.Count}");
|
||||
shellsChanged = true;
|
||||
}
|
||||
foreach (var frameId in unusedFrameIds)
|
||||
{
|
||||
layer.QuickRemoveDysonFrame(frameId);
|
||||
}
|
||||
foreach (var node in dirtyNodes)
|
||||
foreach (var node in layer.nodePool)
|
||||
{
|
||||
node.RecalcSpReq();
|
||||
node.RecalcCpReq();
|
||||
if (node == null) continue;
|
||||
if (node.frames.Count != 0 || node.shells.Count != 0) {
|
||||
node.RecalcSpReq();
|
||||
node.RecalcCpReq();
|
||||
continue;
|
||||
}
|
||||
layer.QuickRemoveDysonNode(node.id);
|
||||
}
|
||||
}
|
||||
dysonSphere.CheckAutoNodes();
|
||||
if (dysonSphere.autoNodeCount <= 0)
|
||||
{
|
||||
dysonSphere.PickAutoNode();
|
||||
}
|
||||
if (shellsChanged)
|
||||
{
|
||||
GameMain.gameScenario.NotifyOnPlanDysonShell();
|
||||
dysonSphere.modelRenderer.RebuildModels();
|
||||
}
|
||||
if (dysonSphere.autoNodeCount <= 0) dysonSphere.PickAutoNode();
|
||||
dysonSphere.modelRenderer.RebuildModels();
|
||||
if (shellsChanged) GameMain.gameScenario.NotifyOnPlanDysonShell();
|
||||
dysonSphere.inEditorRenderMaskS = 0;
|
||||
dysonSphere.inEditorRenderMaskL = 0;
|
||||
dysonSphere.inGameRenderMaskS = 0;
|
||||
dysonSphere.inGameRenderMaskL = 0;
|
||||
}
|
||||
|
||||
public static void CreatePossibleFramesAndShells()
|
||||
@@ -1046,7 +1088,7 @@ public static class DysonSphereFunctions
|
||||
if (availableShells.TryGetValue((shell.nodeA.id, shell.nodeB.id, shell.nodeC.id), out _)) continue;
|
||||
DysonFrame[] frames = [layer.framePool[availableFrames[(shell.nodeA.id, shell.nodeB.id)]], layer.framePool[availableFrames[(shell.nodeB.id, shell.nodeC.id)]], layer.framePool[availableFrames[(shell.nodeA.id, shell.nodeC.id)]]];
|
||||
DysonNode[] nodes = [shell.nodeA, shell.nodeB, shell.nodeC];
|
||||
if (layer.QuickAddDysonShell(0, nodes, frames) <= 0) continue;
|
||||
if (layer.QuickAddDysonShell(0, nodes, frames, false) <= 0) continue;
|
||||
unusedFrameIds.Remove(frames[0].id);
|
||||
unusedFrameIds.Remove(frames[1].id);
|
||||
unusedFrameIds.Remove(frames[2].id);
|
||||
@@ -1101,7 +1143,7 @@ public static class DysonSphereFunctions
|
||||
UIMessageBox.Show("CheatEnabler".Translate(), string.Format("There is no Dyson Sphere shell on \"{0}\".".Translate(), star.displayName), "确定".Translate(), 3, null);
|
||||
return;
|
||||
}
|
||||
int retainCount = RetainShellsCount.Value;
|
||||
int retainCount = ShellsCountForFunctions.Value;
|
||||
for (var i = 1; i < dysonSphere.layersIdBased.Length; i++)
|
||||
{
|
||||
var layer = dysonSphere.layersIdBased[i];
|
||||
|
||||
@@ -100,9 +100,9 @@ public static class UIConfigWindow
|
||||
}
|
||||
}
|
||||
|
||||
class RetainShellsCountMapper : MyWindow.RangeValueMapper<int>
|
||||
class ShellsCountMapper : MyWindow.RangeValueMapper<int>
|
||||
{
|
||||
public RetainShellsCountMapper() : base(1, 46)
|
||||
public ShellsCountMapper() : base(1, 139)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -113,7 +113,8 @@ public static class UIConfigWindow
|
||||
< 4 => value,
|
||||
< 64 => value / 4 + 3,
|
||||
< 256 => value / 16 + 15,
|
||||
_ => value / 256 + 30,
|
||||
< 4096 => value / 64 + 27,
|
||||
_ => value / 256 + 75,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -124,192 +125,195 @@ public static class UIConfigWindow
|
||||
< 4 => index,
|
||||
< 19 => (index - 3) * 4,
|
||||
< 31 => (index - 15) * 16,
|
||||
_ => (index - 30) * 256,
|
||||
< 91 => (index - 27) * 64,
|
||||
_ => (index - 75) * 256,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private static void CreateUI(MyConfigWindow wnd, RectTransform trans)
|
||||
{
|
||||
_windowTrans = trans;
|
||||
// General tab
|
||||
var x = 0f;
|
||||
var y = 10f;
|
||||
wnd.AddSplitter(trans, 10f);
|
||||
wnd.AddTabGroup(trans, "Cheat Enabler", "tab-group-cheatenabler");
|
||||
var tab1 = wnd.AddTab(_windowTrans, "General");
|
||||
var cb = wnd.AddCheckBox(x, y, tab1, GamePatch.DevShortcutsEnabled, "Enable Dev Shortcuts");
|
||||
x += cb.Width + 5f;
|
||||
y += 6f;
|
||||
wnd.AddTipsButton2(x, y, tab1, "Dev Shortcuts", "Dev Shortcuts Tips", "dev-shortcuts-tips");
|
||||
x = 0;
|
||||
y += 30f;
|
||||
wnd.AddCheckBox(x, y, tab1, GamePatch.AbnormalDisablerEnabled, "Disable Abnormal Checks");
|
||||
y += 36f;
|
||||
cb = wnd.AddCheckBox(x, y, tab1, GamePatch.UnlockTechEnabled, "Unlock Tech with Key-Modifiers");
|
||||
x += cb.Width + 5f;
|
||||
y += 6f;
|
||||
wnd.AddTipsButton2(x, y, tab1, "Unlock Tech with Key-Modifiers", "Unlock Tech with Key-Modifiers Tips", "unlock-tech-tips");
|
||||
x = 0f;
|
||||
y += 30f + 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; });
|
||||
|
||||
var tab2 = wnd.AddTab(_windowTrans, "Factory");
|
||||
x = 0f;
|
||||
y = 10f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.ImmediateEnabled, "Finish build immediately");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.ArchitectModeEnabled, "Architect mode");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.NoConditionEnabled, "Build without condition");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.NoCollisionEnabled, "No collision");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.BeltSignalGeneratorEnabled, "Belt signal generator");
|
||||
x += 26f;
|
||||
y += 26f;
|
||||
var cb1 = wnd.AddCheckBox(x, y, tab2, FactoryPatch.BeltSignalCountGenEnabled, "Count generations as production in statistics", 13);
|
||||
y += 26f;
|
||||
var cb2 = wnd.AddCheckBox(x, y, tab2, FactoryPatch.BeltSignalCountRemEnabled, "Count removals as consumption in statistics", 13);
|
||||
y += 26f;
|
||||
var cb3 = wnd.AddCheckBox(x, y, tab2, FactoryPatch.BeltSignalCountRecipeEnabled, "Count all raws and intermediates in statistics", 13);
|
||||
y += 26f;
|
||||
var cb4 = wnd.AddCheckBox(x, y, tab2, FactoryPatch.BeltSignalNumberAltFormat, "Belt signal alt format", 13);
|
||||
x += cb4.Width + 5f;
|
||||
y += 6f;
|
||||
var tip1 = wnd.AddTipsButton2(x, y, tab2, "Belt signal alt format", "Belt signal alt format tips", "belt-signal-alt-format-tips");
|
||||
x = 0f;
|
||||
y += 30f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.GreaterPowerUsageInLogisticsEnabled, "Increase maximum power usage in Logistic Stations and Advanced Mining Machines");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.ControlPanelRemoteLogisticsEnabled, "Retrieve/Place items from/to remote planets on logistics control panel");
|
||||
{
|
||||
_windowTrans = trans;
|
||||
// General tab
|
||||
var x = 0f;
|
||||
var y = 10f;
|
||||
wnd.AddSplitter(trans, 10f);
|
||||
wnd.AddTabGroup(trans, "Cheat Enabler", "tab-group-cheatenabler");
|
||||
var tab1 = wnd.AddTab(_windowTrans, "General");
|
||||
var cb = wnd.AddCheckBox(x, y, tab1, GamePatch.DevShortcutsEnabled, "Enable Dev Shortcuts");
|
||||
x += cb.Width + 5f;
|
||||
y += 6f;
|
||||
wnd.AddTipsButton2(x, y, tab1, "Dev Shortcuts", "Dev Shortcuts Tips", "dev-shortcuts-tips");
|
||||
x = 0;
|
||||
y += 30f;
|
||||
wnd.AddCheckBox(x, y, tab1, GamePatch.AbnormalDisablerEnabled, "Disable Abnormal Checks");
|
||||
y += 36f;
|
||||
cb = wnd.AddCheckBox(x, y, tab1, GamePatch.UnlockTechEnabled, "Unlock Tech with Key-Modifiers");
|
||||
x += cb.Width + 5f;
|
||||
y += 6f;
|
||||
wnd.AddTipsButton2(x, y, tab1, "Unlock Tech with Key-Modifiers", "Unlock Tech with Key-Modifiers Tips", "unlock-tech-tips");
|
||||
x = 0f;
|
||||
y += 30f + 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; });
|
||||
|
||||
var tab2 = wnd.AddTab(_windowTrans, "Factory");
|
||||
x = 0f;
|
||||
y = 10f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.ImmediateEnabled, "Finish build immediately");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.ArchitectModeEnabled, "Architect mode");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.NoConditionEnabled, "Build without condition");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.NoCollisionEnabled, "No collision");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.BeltSignalGeneratorEnabled, "Belt signal generator");
|
||||
x += 26f;
|
||||
y += 26f;
|
||||
var cb1 = wnd.AddCheckBox(x, y, tab2, FactoryPatch.BeltSignalCountGenEnabled, "Count generations as production in statistics", 13);
|
||||
y += 26f;
|
||||
var cb2 = wnd.AddCheckBox(x, y, tab2, FactoryPatch.BeltSignalCountRemEnabled, "Count removals as consumption in statistics", 13);
|
||||
y += 26f;
|
||||
var cb3 = wnd.AddCheckBox(x, y, tab2, FactoryPatch.BeltSignalCountRecipeEnabled, "Count all raws and intermediates in statistics", 13);
|
||||
y += 26f;
|
||||
var cb4 = wnd.AddCheckBox(x, y, tab2, FactoryPatch.BeltSignalNumberAltFormat, "Belt signal alt format", 13);
|
||||
x += cb4.Width + 5f;
|
||||
y += 6f;
|
||||
var tip1 = wnd.AddTipsButton2(x, y, tab2, "Belt signal alt format", "Belt signal alt format tips", "belt-signal-alt-format-tips");
|
||||
x = 0f;
|
||||
y += 30f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.GreaterPowerUsageInLogisticsEnabled, "Increase maximum power usage in Logistic Stations and Advanced Mining Machines");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.ControlPanelRemoteLogisticsEnabled, "Retrieve/Place items from/to remote planets on logistics control panel");
|
||||
FactoryPatch.BeltSignalGeneratorEnabled.SettingChanged += OnBeltSignalChanged;
|
||||
wnd.OnFree += () => { FactoryPatch.BeltSignalGeneratorEnabled.SettingChanged -= OnBeltSignalChanged; };
|
||||
OnBeltSignalChanged(null, null);
|
||||
void OnBeltSignalChanged(object o, EventArgs e)
|
||||
{
|
||||
FactoryPatch.BeltSignalGeneratorEnabled.SettingChanged += OnBeltSignalChanged;
|
||||
wnd.OnFree += () => { FactoryPatch.BeltSignalGeneratorEnabled.SettingChanged -= OnBeltSignalChanged; };
|
||||
OnBeltSignalChanged(null, null);
|
||||
void OnBeltSignalChanged(object o, EventArgs e)
|
||||
{
|
||||
var on = FactoryPatch.BeltSignalGeneratorEnabled.Value;
|
||||
cb1.gameObject.SetActive(on);
|
||||
cb2.gameObject.SetActive(on);
|
||||
cb3.gameObject.SetActive(on);
|
||||
cb4.gameObject.SetActive(on);
|
||||
tip1.gameObject.SetActive(on);
|
||||
}
|
||||
var on = FactoryPatch.BeltSignalGeneratorEnabled.Value;
|
||||
cb1.gameObject.SetActive(on);
|
||||
cb2.gameObject.SetActive(on);
|
||||
cb3.gameObject.SetActive(on);
|
||||
cb4.gameObject.SetActive(on);
|
||||
tip1.gameObject.SetActive(on);
|
||||
}
|
||||
x = 350f;
|
||||
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");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.BoostGeothermalPowerEnabled, "Boost geothermal power");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.BoostFuelPowerEnabled, "Boost fuel power");
|
||||
y += 26f;
|
||||
wnd.AddText2(x + 32f, y, tab2, "Boost fuel power 2", 13);
|
||||
|
||||
// Planet Tab
|
||||
var tab3 = wnd.AddTab(_windowTrans, "Planet");
|
||||
x = 0f;
|
||||
y = 10f;
|
||||
wnd.AddCheckBox(x, y, tab3, ResourcePatch.InfiniteResourceEnabled, "Infinite Natural Resources");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab3, ResourcePatch.FastMiningEnabled, "Fast Mining");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab3, PlanetPatch.WaterPumpAnywhereEnabled, "Pump Anywhere");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab3, PlanetPatch.TerraformAnywayEnabled, "Terraform without enough soil piles");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab3, PlayerPatch.InstantHandCraftEnabled, "Instant hand-craft");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab3, PlayerPatch.InstantTeleportEnabled, "Instant teleport (like that in Sandbox mode)");
|
||||
x = 400f;
|
||||
y = 10f;
|
||||
wnd.AddButton(x, y, 200f, tab3, "矿物掩埋标题", 16, "button-bury-all", () => { PlanetFunctions.BuryAllVeins(true); });
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, 200f, tab3, "矿物还原标题", 16, "button-bury-restore-all", () => { PlanetFunctions.BuryAllVeins(false); });
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, 200f, tab3, "铺满地基提示", 16, "button-reform-all", () =>
|
||||
{
|
||||
var player = GameMain.mainPlayer;
|
||||
if (player == null) return;
|
||||
var reformTool = player.controller.actionBuild.reformTool;
|
||||
var factory = GameMain.localPlanet?.factory;
|
||||
if (factory == null) return;
|
||||
GameMain.localPlanet.factory.PlanetReformAll(reformTool.brushType, reformTool.brushColor, reformTool.buryVeins);
|
||||
});
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, 200f, tab3, "还原地形提示", 16, "button-reform-revert-all", () =>
|
||||
{
|
||||
var factory = GameMain.localPlanet?.factory;
|
||||
if (factory == null) return;
|
||||
GameMain.localPlanet.factory.PlanetReformRevert();
|
||||
});
|
||||
|
||||
var tab4 = wnd.AddTab(_windowTrans, "Dyson Sphere");
|
||||
x = 0f;
|
||||
y = 10f;
|
||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.SkipBulletEnabled, "Skip bullet period");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.SkipAbsorbEnabled, "Skip absorption period");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.QuickAbsorbEnabled, "Quick absorb");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.EjectAnywayEnabled, "Eject anyway");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.OverclockEjectorEnabled, "Overclock Ejectors");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.OverclockSiloEnabled, "Overclock Silos");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.UnlockMaxOrbitRadiusEnabled, "Unlock Dyson Sphere max orbit radius");
|
||||
y += 30f;
|
||||
{
|
||||
var slider = wnd.AddSlider(x + 20f, y, tab4, DysonSpherePatch.UnlockMaxOrbitRadiusValue, new MaxOrbitRadiusValueMapper(), "##,#m").WithSmallerHandle(-40f);
|
||||
DysonSpherePatch.UnlockMaxOrbitRadiusEnabled.SettingChanged += UnlockMaxOrbitRadiusChanged;
|
||||
wnd.OnFree += () => { DysonSpherePatch.UnlockMaxOrbitRadiusEnabled.SettingChanged -= UnlockMaxOrbitRadiusChanged; };
|
||||
UnlockMaxOrbitRadiusChanged(null, null);
|
||||
void UnlockMaxOrbitRadiusChanged(object o, EventArgs e)
|
||||
{
|
||||
slider.slider.enabled = DysonSpherePatch.UnlockMaxOrbitRadiusEnabled.Value;
|
||||
}
|
||||
;
|
||||
}
|
||||
x = 300f;
|
||||
y = 10f;
|
||||
wnd.AddButton(x, y, 300f, tab4, "Complete Dyson Sphere shells instantly", 16, "button-complete-dyson-sphere-shells-instantly", DysonSphereFunctions.CompleteShellsInstantly);
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, 300f, tab4, "Generate tricky dyson shells", 16, "button-generate-tricky-dyson-shells", DysonSphereFunctions.CreatePossibleFramesAndShells3);
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, 300f, tab4, "Remove low production dyson shells", 16, "button-remove-low-production-dyson-shells", () => DysonSphereFunctions.RemoveLowProductionShells());
|
||||
y += 30f;
|
||||
wnd.AddSlider(x + 20f, y, tab4, DysonSphereFunctions.RetainShellsCount, new RetainShellsCountMapper());
|
||||
|
||||
var tab5 = wnd.AddTab(_windowTrans, "Mecha/Combat");
|
||||
x = 0f;
|
||||
y = 10f;
|
||||
wnd.AddCheckBox(x, y, tab5, CombatPatch.MechaInvincibleEnabled, "Mecha and Drones/Fleets invicible");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab5, CombatPatch.BuildingsInvincibleEnabled, "Buildings invicible");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab5, PlayerPatch.WarpWithoutSpaceWarpersEnabled, "Enable warp without space warpers");
|
||||
x = 400f;
|
||||
y = 10f;
|
||||
wnd.AddButton(x, y, 200f, tab5, "Teleport to outer space", 16, "button-teleport-to-outer-space", PlayerFunctions.TeleportToOuterSpace);
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, 200f, tab5, "Teleport to selected astronomical", 16, "button-teleport-to-selected-astronomical", PlayerFunctions.TeleportToSelectedAstronomical);
|
||||
}
|
||||
x = 350f;
|
||||
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");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.BoostGeothermalPowerEnabled, "Boost geothermal power");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.BoostFuelPowerEnabled, "Boost fuel power");
|
||||
y += 26f;
|
||||
wnd.AddText2(x + 32f, y, tab2, "Boost fuel power 2", 13);
|
||||
|
||||
// Planet Tab
|
||||
var tab3 = wnd.AddTab(_windowTrans, "Planet");
|
||||
x = 0f;
|
||||
y = 10f;
|
||||
wnd.AddCheckBox(x, y, tab3, ResourcePatch.InfiniteResourceEnabled, "Infinite Natural Resources");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab3, ResourcePatch.FastMiningEnabled, "Fast Mining");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab3, PlanetPatch.WaterPumpAnywhereEnabled, "Pump Anywhere");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab3, PlanetPatch.TerraformAnywayEnabled, "Terraform without enough soil piles");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab3, PlayerPatch.InstantHandCraftEnabled, "Instant hand-craft");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab3, PlayerPatch.InstantTeleportEnabled, "Instant teleport (like that in Sandbox mode)");
|
||||
x = 400f;
|
||||
y = 10f;
|
||||
wnd.AddButton(x, y, 200f, tab3, "矿物掩埋标题", 16, "button-bury-all", () => { PlanetFunctions.BuryAllVeins(true); });
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, 200f, tab3, "矿物还原标题", 16, "button-bury-restore-all", () => { PlanetFunctions.BuryAllVeins(false); });
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, 200f, tab3, "铺满地基提示", 16, "button-reform-all", () =>
|
||||
{
|
||||
var player = GameMain.mainPlayer;
|
||||
if (player == null) return;
|
||||
var reformTool = player.controller.actionBuild.reformTool;
|
||||
var factory = GameMain.localPlanet?.factory;
|
||||
if (factory == null) return;
|
||||
GameMain.localPlanet.factory.PlanetReformAll(reformTool.brushType, reformTool.brushColor, reformTool.buryVeins);
|
||||
});
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, 200f, tab3, "还原地形提示", 16, "button-reform-revert-all", () =>
|
||||
{
|
||||
var factory = GameMain.localPlanet?.factory;
|
||||
if (factory == null) return;
|
||||
GameMain.localPlanet.factory.PlanetReformRevert();
|
||||
});
|
||||
|
||||
var tab4 = wnd.AddTab(_windowTrans, "Dyson Sphere");
|
||||
x = 0f;
|
||||
y = 10f;
|
||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.SkipBulletEnabled, "Skip bullet period");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.SkipAbsorbEnabled, "Skip absorption period");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.QuickAbsorbEnabled, "Quick absorb");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.EjectAnywayEnabled, "Eject anyway");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.OverclockEjectorEnabled, "Overclock Ejectors");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.OverclockSiloEnabled, "Overclock Silos");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.UnlockMaxOrbitRadiusEnabled, "Unlock Dyson Sphere max orbit radius");
|
||||
y += 30f;
|
||||
{
|
||||
var slider = wnd.AddSlider(x + 20f, y, tab4, DysonSpherePatch.UnlockMaxOrbitRadiusValue, new MaxOrbitRadiusValueMapper(), "##,#m").WithSmallerHandle(-40f);
|
||||
DysonSpherePatch.UnlockMaxOrbitRadiusEnabled.SettingChanged += UnlockMaxOrbitRadiusChanged;
|
||||
wnd.OnFree += () => { DysonSpherePatch.UnlockMaxOrbitRadiusEnabled.SettingChanged -= UnlockMaxOrbitRadiusChanged; };
|
||||
UnlockMaxOrbitRadiusChanged(null, null);
|
||||
void UnlockMaxOrbitRadiusChanged(object o, EventArgs e)
|
||||
{
|
||||
slider.slider.enabled = DysonSpherePatch.UnlockMaxOrbitRadiusEnabled.Value;
|
||||
}
|
||||
;
|
||||
}
|
||||
x = 300f;
|
||||
y = 10f;
|
||||
wnd.AddButton(x, y, 300f, tab4, "Complete Dyson Sphere shells instantly", 16, "button-complete-dyson-sphere-shells-instantly", DysonSphereFunctions.CompleteShellsInstantly);
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, 300f, tab4, "Generate max production shell", 16, "button-generate-max-production-shell", DysonSphereFunctions.CreatePossibleFramesAndShells2);
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, 300f, tab4, "Generate tricky dyson shells", 16, "button-generate-tricky-dyson-shells", DysonSphereFunctions.CreatePossibleFramesAndShells3);
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, 300f, tab4, "Remove low production dyson shells", 16, "button-remove-low-production-dyson-shells", () => DysonSphereFunctions.RemoveLowProductionShells());
|
||||
y += 30f;
|
||||
wnd.AddSlider(x + 20f, y, tab4, DysonSphereFunctions.ShellsCountForFunctions, new ShellsCountMapper());
|
||||
|
||||
var tab5 = wnd.AddTab(_windowTrans, "Mecha/Combat");
|
||||
x = 0f;
|
||||
y = 10f;
|
||||
wnd.AddCheckBox(x, y, tab5, CombatPatch.MechaInvincibleEnabled, "Mecha and Drones/Fleets invicible");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab5, CombatPatch.BuildingsInvincibleEnabled, "Buildings invicible");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab5, PlayerPatch.WarpWithoutSpaceWarpersEnabled, "Enable warp without space warpers");
|
||||
x = 400f;
|
||||
y = 10f;
|
||||
wnd.AddButton(x, y, 200f, tab5, "Teleport to outer space", 16, "button-teleport-to-outer-space", PlayerFunctions.TeleportToOuterSpace);
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, 200f, tab5, "Teleport to selected astronomical", 16, "button-teleport-to-selected-astronomical", PlayerFunctions.TeleportToSelectedAstronomical);
|
||||
}
|
||||
|
||||
private static void UpdateUI()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user