mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-02-04 18:22:18 +08:00
remove all frames
This commit is contained in:
@@ -78,6 +78,7 @@ public static class DysonSphereFunctions
|
|||||||
I18N.Add("There is no Dyson Sphere shell on \"{0}\".", "There is no Dyson Sphere shell on \"{0}\".", "“{0}”上没有可建造的戴森壳");
|
I18N.Add("There is no Dyson Sphere shell on \"{0}\".", "There is no Dyson Sphere shell on \"{0}\".", "“{0}”上没有可建造的戴森壳");
|
||||||
I18N.Add("There is no Dyson Sphere data on \"{0}\".", "There is no Dyson Sphere data on \"{0}\".", "“{0}”上没有戴森球数据");
|
I18N.Add("There is no Dyson Sphere data on \"{0}\".", "There is no Dyson Sphere data on \"{0}\".", "“{0}”上没有戴森球数据");
|
||||||
I18N.Add("This will complete all Dyson Sphere shells on \"{0}\" instantly. Are you sure?", "This will complete all Dyson Sphere shells on \"{0}\" instantly. Are you sure?", "这将立即完成“{0}”上的所有戴森壳。你确定吗?");
|
I18N.Add("This will complete all Dyson Sphere shells on \"{0}\" instantly. Are you sure?", "This will complete all Dyson Sphere shells on \"{0}\" instantly. Are you sure?", "这将立即完成“{0}”上的所有戴森壳。你确定吗?");
|
||||||
|
I18N.Add("This will remove all frames on \"{0}\". Are you sure?", "This will remove all frames on \"{0}\". Are you sure?", "这将移除“{0}”上的所有框架。你确定吗?");
|
||||||
I18N.Add("No precalculated shell found for radius {0}.", "No precalculated shell found for radius {0}.", "没有找到适合半径 {0} 的预计算壳面");
|
I18N.Add("No precalculated shell found for radius {0}.", "No precalculated shell found for radius {0}.", "没有找到适合半径 {0} 的预计算壳面");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,6 +220,70 @@ public static class DysonSphereFunctions
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void RemoveAllFrames()
|
||||||
|
{
|
||||||
|
StarData star = null;
|
||||||
|
var dysonEditor = UIRoot.instance?.uiGame?.dysonEditor;
|
||||||
|
if (dysonEditor != null && dysonEditor.gameObject.activeSelf)
|
||||||
|
{
|
||||||
|
star = dysonEditor.selection.viewStar;
|
||||||
|
}
|
||||||
|
if (star == null)
|
||||||
|
{
|
||||||
|
star = GameMain.data?.localStar;
|
||||||
|
if (star == null)
|
||||||
|
{
|
||||||
|
UIMessageBox.Show("CheatEnabler".Translate(), "You are not in any system.".Translate(), "确定".Translate(), UIMessageBox.ERROR, null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var dysonSphere = GameMain.data?.dysonSpheres[star.index];
|
||||||
|
if (dysonSphere == null || dysonSphere.layerCount == 0)
|
||||||
|
{
|
||||||
|
UIMessageBox.Show("CheatEnabler".Translate(), string.Format("There is no Dyson Sphere shell on \"{0}\".".Translate(), star.displayName), "确定".Translate(), UIMessageBox.ERROR, null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UIMessageBox.Show("CheatEnabler".Translate(), string.Format("This will remove all frames on \"{0}\". Are you sure?".Translate(), star.displayName), "取消".Translate(), "确定".Translate(), UIMessageBox.QUESTION, null, () =>
|
||||||
|
{
|
||||||
|
var totalFrameSpInfo = AccessTools.Field(typeof(DysonSphereLayer), "totalFrameSP");
|
||||||
|
|
||||||
|
foreach (var dysonSphereLayer in dysonSphere.layersIdBased)
|
||||||
|
{
|
||||||
|
if (dysonSphereLayer == null) continue;
|
||||||
|
for (var i = dysonSphereLayer.nodeCursor - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
var dysonNode = dysonSphereLayer.nodePool[i];
|
||||||
|
if (dysonNode == null || dysonNode.id != i) continue;
|
||||||
|
if (dysonNode.frames.Count > 0)
|
||||||
|
dysonNode.frames.Clear();
|
||||||
|
dysonNode.RecalcSpReq();
|
||||||
|
}
|
||||||
|
for (var i = dysonSphereLayer.shellCursor - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
var dysonShell = dysonSphereLayer.shellPool[i];
|
||||||
|
if (dysonShell == null || dysonShell.id != i) continue;
|
||||||
|
if (dysonShell.frames.Count > 0)
|
||||||
|
dysonShell.frames.Clear();
|
||||||
|
}
|
||||||
|
for (var i = dysonSphereLayer.frameCursor - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
var dysonFrame = dysonSphereLayer.framePool[i];
|
||||||
|
if (dysonFrame == null || dysonFrame.id != i) continue;
|
||||||
|
dysonFrame.Free();
|
||||||
|
dysonSphereLayer.framePool[i] = null;
|
||||||
|
}
|
||||||
|
dysonSphereLayer.frameCursor = 1;
|
||||||
|
dysonSphereLayer.frameRecycleCursor = 0;
|
||||||
|
dysonSphereLayer.SetFrameCapacity(64);
|
||||||
|
totalFrameSpInfo?.SetValue(dysonSphereLayer, 0);
|
||||||
|
}
|
||||||
|
dysonSphere.CheckAutoNodes();
|
||||||
|
dysonSphere.PickAutoNode();
|
||||||
|
dysonSphere.modelRenderer.RebuildModels();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private static DysonNode QuickAddDysonNode(this DysonSphereLayer layer, int protoId, Vector3 pos)
|
private static DysonNode QuickAddDysonNode(this DysonSphereLayer layer, int protoId, Vector3 pos)
|
||||||
{
|
{
|
||||||
int nodeId;
|
int nodeId;
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ public static class UIConfigWindow
|
|||||||
I18N.Add("Overclock Silos", "Overclock Silos (10x)", "高速发射井(10倍射速)");
|
I18N.Add("Overclock Silos", "Overclock Silos (10x)", "高速发射井(10倍射速)");
|
||||||
I18N.Add("Unlock Dyson Sphere max orbit radius", "Unlock Dyson Sphere max orbit radius", "解锁戴森球最大轨道半径");
|
I18N.Add("Unlock Dyson Sphere max orbit radius", "Unlock Dyson Sphere max orbit radius", "解锁戴森球最大轨道半径");
|
||||||
I18N.Add("Complete Dyson Sphere shells instantly", "Complete Dyson Sphere shells instantly", "立即完成戴森壳建造");
|
I18N.Add("Complete Dyson Sphere shells instantly", "Complete Dyson Sphere shells instantly", "立即完成戴森壳建造");
|
||||||
|
I18N.Add("Remove all frames on Dyson Sphere", "Remove all frames on Dyson Sphere", "移除戴森球上的所有框架");
|
||||||
I18N.Add("Generate illegal dyson shell", "Generate an illegal dyson shell (!!1st shell layer will be replaced!!)", "生成单层仙术戴森壳(!!会先删除第一层戴森壳!!)");
|
I18N.Add("Generate illegal dyson shell", "Generate an illegal dyson shell (!!1st shell layer will be replaced!!)", "生成单层仙术戴森壳(!!会先删除第一层戴森壳!!)");
|
||||||
I18N.Add("Keep max production shells and remove others", "Keep max production shells and remove others", "保留发电量最高的戴森壳并移除其他戴森壳");
|
I18N.Add("Keep max production shells and remove others", "Keep max production shells and remove others", "保留发电量最高的戴森壳并移除其他戴森壳");
|
||||||
I18N.Add("Duplicate shells from that with highest production", "Duplicate shells from that with highest production", "从发电量最高的壳复制戴森壳");
|
I18N.Add("Duplicate shells from that with highest production", "Duplicate shells from that with highest production", "从发电量最高的壳复制戴森壳");
|
||||||
@@ -301,6 +302,8 @@ public static class UIConfigWindow
|
|||||||
x = 300f;
|
x = 300f;
|
||||||
y = 10f;
|
y = 10f;
|
||||||
wnd.AddButton(x, y, 300f, tab4, "Complete Dyson Sphere shells instantly", 16, "button-complete-dyson-sphere-shells-instantly", DysonSphereFunctions.CompleteShellsInstantly);
|
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, "Remove all frames on Dyson Sphere", 16, "button-remove-all-frames-on-dyson-sphere", DysonSphereFunctions.RemoveAllFrames);
|
||||||
{
|
{
|
||||||
y += 72f;
|
y += 72f;
|
||||||
var originalY = y;
|
var originalY = y;
|
||||||
|
|||||||
Reference in New Issue
Block a user