mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-09 10:13:31 +08:00
WIP
This commit is contained in:
@@ -128,6 +128,34 @@ public static class DysonSpherePatch
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void InitCurrentDysonSphere(int index)
|
||||||
|
{
|
||||||
|
var star = GameMain.localStar;
|
||||||
|
if (star == null) return;
|
||||||
|
var dysonSpheres = GameMain.data?.dysonSpheres;
|
||||||
|
if (dysonSpheres == null) return;
|
||||||
|
if (index < 0)
|
||||||
|
{
|
||||||
|
if (dysonSpheres[star.index] == null) return;
|
||||||
|
var dysonSphere = new DysonSphere();
|
||||||
|
dysonSpheres[star.index] = dysonSphere;
|
||||||
|
dysonSphere.Init(GameMain.data, star);
|
||||||
|
dysonSphere.ResetNew();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var ds = dysonSpheres[star.index];
|
||||||
|
if (ds?.layersIdBased[index] == null) return;
|
||||||
|
var pool = ds.rocketPool;
|
||||||
|
for (var id = ds.rocketCursor - 1; id > 0; id--)
|
||||||
|
{
|
||||||
|
if (pool[id].id != id) continue;
|
||||||
|
if (pool[id].nodeLayerId != index) continue;
|
||||||
|
ds.RemoveDysonRocket(id);
|
||||||
|
}
|
||||||
|
ds.RemoveLayer(index);
|
||||||
|
}
|
||||||
|
|
||||||
private static class SkipBulletPatch
|
private static class SkipBulletPatch
|
||||||
{
|
{
|
||||||
private static long _sailLifeTime;
|
private static long _sailLifeTime;
|
||||||
@@ -345,6 +373,7 @@ public static class DysonSpherePatch
|
|||||||
private static IEnumerable<CodeInstruction> DysonSphereLayer_GameTick_Patch(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
private static IEnumerable<CodeInstruction> DysonSphereLayer_GameTick_Patch(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||||
{
|
{
|
||||||
var matcher = new CodeMatcher(instructions, generator);
|
var matcher = new CodeMatcher(instructions, generator);
|
||||||
|
/* Insert absorption functions on beginning */
|
||||||
matcher.Start().InsertAndAdvance(
|
matcher.Start().InsertAndAdvance(
|
||||||
new CodeInstruction(OpCodes.Ldarg_0),
|
new CodeInstruction(OpCodes.Ldarg_0),
|
||||||
new CodeInstruction(OpCodes.Ldarg_1),
|
new CodeInstruction(OpCodes.Ldarg_1),
|
||||||
@@ -354,6 +383,7 @@ public static class DysonSpherePatch
|
|||||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(DysonSphereLayer), nameof(DysonSphereLayer.dysonSphere))),
|
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(DysonSphereLayer), nameof(DysonSphereLayer.dysonSphere))),
|
||||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(DysonSphere), nameof(DysonSphere.swarm)))
|
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(DysonSphere), nameof(DysonSphere.swarm)))
|
||||||
).Insert(new CodeInstruction(OpCodes.Ret));
|
).Insert(new CodeInstruction(OpCodes.Ret));
|
||||||
|
/* Insert a RETURN before old absorption functions */
|
||||||
return matcher.InstructionEnumeration();
|
return matcher.InstructionEnumeration();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,9 +409,9 @@ public static class DysonSpherePatch
|
|||||||
{
|
{
|
||||||
var matcher = new CodeMatcher(instructions, generator);
|
var matcher = new CodeMatcher(instructions, generator);
|
||||||
matcher.MatchForward(false,
|
matcher.MatchForward(false,
|
||||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(EjectorComponent), nameof(EjectorComponent.localRot)))
|
new CodeMatch(instr => instr.opcode == OpCodes.Ldc_R8 && Math.Abs((double)instr.operand - 0.08715574) < 0.00000001)
|
||||||
);
|
);
|
||||||
var start = matcher.Pos - 6;
|
var start = matcher.Pos - 3;
|
||||||
matcher.MatchForward(false,
|
matcher.MatchForward(false,
|
||||||
new CodeMatch(OpCodes.And)
|
new CodeMatch(OpCodes.And)
|
||||||
).Advance(1).MatchForward(false,
|
).Advance(1).MatchForward(false,
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class MyCheckBox : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (labelText != null)
|
if (labelText != null)
|
||||||
{
|
{
|
||||||
labelText.text = val;
|
labelText.text = val.Translate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class MyKeyBinder : MonoBehaviour
|
|||||||
public static RectTransform CreateKeyBinder(float x, float y, RectTransform parent, ConfigEntry<KeyboardShortcut> config, string label = "", int fontSize = 17)
|
public static RectTransform CreateKeyBinder(float x, float y, RectTransform parent, ConfigEntry<KeyboardShortcut> config, string label = "", int fontSize = 17)
|
||||||
{
|
{
|
||||||
var optionWindow = UIRoot.instance.optionWindow;
|
var optionWindow = UIRoot.instance.optionWindow;
|
||||||
var uikeyEntry = GameObject.Instantiate<UIKeyEntry>(optionWindow.entryPrefab);
|
var uikeyEntry = Instantiate(optionWindow.entryPrefab);
|
||||||
GameObject go;
|
GameObject go;
|
||||||
(go = uikeyEntry.gameObject).SetActive(true);
|
(go = uikeyEntry.gameObject).SetActive(true);
|
||||||
go.name = "my-keybinder";
|
go.name = "my-keybinder";
|
||||||
@@ -65,7 +65,7 @@ public class MyKeyBinder : MonoBehaviour
|
|||||||
kb.setNoneKeyUIButton = uikeyEntry.setNoneKeyUIButton;
|
kb.setNoneKeyUIButton = uikeyEntry.setNoneKeyUIButton;
|
||||||
|
|
||||||
|
|
||||||
kb.functionText.text = label;
|
kb.functionText.text = label.Translate();
|
||||||
kb.functionText.fontSize = 17;
|
kb.functionText.fontSize = 17;
|
||||||
|
|
||||||
((RectTransform)kb.keyText.transform).anchoredPosition = new Vector2(20f, -27f);
|
((RectTransform)kb.keyText.transform).anchoredPosition = new Vector2(20f, -27f);
|
||||||
@@ -79,23 +79,17 @@ public class MyKeyBinder : MonoBehaviour
|
|||||||
kb.rectTrans = rect;
|
kb.rectTrans = rect;
|
||||||
|
|
||||||
//rect.sizeDelta = new Vector2(240f, 64f);
|
//rect.sizeDelta = new Vector2(240f, 64f);
|
||||||
GameObject.Destroy(uikeyEntry);
|
Destroy(uikeyEntry);
|
||||||
kb.setNoneKeyUIButton.gameObject.SetActive(false);
|
kb.setNoneKeyUIButton.gameObject.SetActive(false);
|
||||||
|
|
||||||
kb.SettingChanged();
|
kb.SettingChanged();
|
||||||
config.SettingChanged += (sender, args) => {
|
config.SettingChanged += (_, _) => {
|
||||||
kb.SettingChanged();
|
kb.SettingChanged();
|
||||||
};
|
};
|
||||||
kb.inputUIButton.onClick += kb.OnInputUIButtonClick;
|
kb.inputUIButton.onClick += kb.OnInputUIButtonClick;
|
||||||
kb.setDefaultUIButton.onClick += kb.OnSetDefaultKeyClick;
|
kb.setDefaultUIButton.onClick += kb.OnSetDefaultKeyClick;
|
||||||
//kb.setNoneKeyUIButton.onClick += kb.OnSetNoneKeyClick;
|
//kb.setNoneKeyUIButton.onClick += kb.OnSetNoneKeyClick;
|
||||||
return go.transform as RectTransform;
|
return go.transform as RectTransform;
|
||||||
|
|
||||||
void ResetAnchor(RectTransform theRect)
|
|
||||||
{
|
|
||||||
theRect.anchorMax = Vector2.zero;
|
|
||||||
theRect.anchorMin = Vector2.zero;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class MyWindow: ManualBehaviour
|
|||||||
var txt = gameObject.transform.Find("panel-bg/title-text")?.gameObject.GetComponent<Text>();
|
var txt = gameObject.transform.Find("panel-bg/title-text")?.gameObject.GetComponent<Text>();
|
||||||
if (txt)
|
if (txt)
|
||||||
{
|
{
|
||||||
txt.text = title;
|
txt.text = title.Translate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ public class MyWindow: ManualBehaviour
|
|||||||
var src = UIRoot.instance.uiGame.assemblerWindow.stateText;
|
var src = UIRoot.instance.uiGame.assemblerWindow.stateText;
|
||||||
var txt = Instantiate(src);
|
var txt = Instantiate(src);
|
||||||
txt.gameObject.name = objName;
|
txt.gameObject.name = objName;
|
||||||
txt.text = label;
|
txt.text = label.Translate();
|
||||||
txt.color = new Color(1f, 1f, 1f, 0.4f);
|
txt.color = new Color(1f, 1f, 1f, 0.4f);
|
||||||
txt.alignment = TextAnchor.MiddleLeft;
|
txt.alignment = TextAnchor.MiddleLeft;
|
||||||
txt.fontSize = fontSize;
|
txt.fontSize = fontSize;
|
||||||
@@ -74,7 +74,7 @@ public class MyWindow: ManualBehaviour
|
|||||||
var btn = Instantiate(panel.cpuActiveButton);
|
var btn = Instantiate(panel.cpuActiveButton);
|
||||||
btn.gameObject.name = objName;
|
btn.gameObject.name = objName;
|
||||||
var rect = Util.NormalizeRectWithTopLeft(btn, x, y, parent);
|
var rect = Util.NormalizeRectWithTopLeft(btn, x, y, parent);
|
||||||
rect.sizeDelta = new Vector2(120, rect.sizeDelta.y);
|
rect.sizeDelta = new Vector2(150, rect.sizeDelta.y);
|
||||||
var l = btn.gameObject.transform.Find("button-text").GetComponent<Localizer>();
|
var l = btn.gameObject.transform.Find("button-text").GetComponent<Localizer>();
|
||||||
var t = btn.gameObject.transform.Find("button-text").GetComponent<Text>();
|
var t = btn.gameObject.transform.Find("button-text").GetComponent<Text>();
|
||||||
if (l != null)
|
if (l != null)
|
||||||
@@ -99,6 +99,28 @@ public class MyWindow: ManualBehaviour
|
|||||||
return btn;
|
return btn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected UIButton AddFlatButton(float x, float y, RectTransform parent, string text = "", int fontSize = 12, string objName = "button", UnityAction onClick = null)
|
||||||
|
{
|
||||||
|
var panel = UIRoot.instance.uiGame.dysonEditor.controlPanel.hierarchy.layerPanel;
|
||||||
|
var btn = Instantiate(panel.layerButtons[0]);
|
||||||
|
btn.gameObject.name = objName;
|
||||||
|
Util.NormalizeRectWithTopLeft(btn, x, y, parent);
|
||||||
|
var t = btn.gameObject.transform.Find("Text").GetComponent<Text>();
|
||||||
|
if (t != null)
|
||||||
|
{
|
||||||
|
t.text = text.Translate();
|
||||||
|
}
|
||||||
|
t.fontSize = fontSize;
|
||||||
|
btn.button.onClick.RemoveAllListeners();
|
||||||
|
_buttons[btn] = onClick;
|
||||||
|
if (EventRegistered)
|
||||||
|
{
|
||||||
|
if (onClick != null)
|
||||||
|
btn.button.onClick.AddListener(onClick);
|
||||||
|
}
|
||||||
|
return btn;
|
||||||
|
}
|
||||||
|
|
||||||
protected InputField AddInputField(float x, float y, RectTransform parent, string text = "", int fontSize = 16, string objName = "input", UnityAction<string> onChanged = null, UnityAction<string> onEditEnd = null)
|
protected InputField AddInputField(float x, float y, RectTransform parent, string text = "", int fontSize = 16, string objName = "input", UnityAction<string> onChanged = null, UnityAction<string> onEditEnd = null)
|
||||||
{
|
{
|
||||||
var stationWindow = UIRoot.instance.uiGame.stationWindow;
|
var stationWindow = UIRoot.instance.uiGame.stationWindow;
|
||||||
@@ -169,7 +191,7 @@ public class MyWindow: ManualBehaviour
|
|||||||
|
|
||||||
public class MyWindowWithTabs : MyWindow
|
public class MyWindowWithTabs : MyWindow
|
||||||
{
|
{
|
||||||
private readonly List<Tuple<RectTransform, UIButton>> _tabs = new();
|
protected readonly List<Tuple<RectTransform, UIButton>> Tabs = new();
|
||||||
public override void TryClose()
|
public override void TryClose()
|
||||||
{
|
{
|
||||||
_Close();
|
_Close();
|
||||||
@@ -202,11 +224,11 @@ public class MyWindowWithTabs : MyWindow
|
|||||||
}
|
}
|
||||||
|
|
||||||
var btnText = btn.transform.Find("Text").GetComponent<Text>();
|
var btnText = btn.transform.Find("Text").GetComponent<Text>();
|
||||||
btnText.text = label;
|
btnText.text = label.Translate();
|
||||||
btnText.fontSize = 16;
|
btnText.fontSize = 16;
|
||||||
btn.data = index;
|
btn.data = index;
|
||||||
|
|
||||||
_tabs.Add(Tuple.Create(tabRect, btn));
|
Tabs.Add(Tuple.Create(tabRect, btn));
|
||||||
if (EventRegistered)
|
if (EventRegistered)
|
||||||
{
|
{
|
||||||
btn.onClick += OnTabButtonClick;
|
btn.onClick += OnTabButtonClick;
|
||||||
@@ -218,7 +240,7 @@ public class MyWindowWithTabs : MyWindow
|
|||||||
{
|
{
|
||||||
if (!EventRegistered)
|
if (!EventRegistered)
|
||||||
{
|
{
|
||||||
foreach (var t in _tabs)
|
foreach (var t in Tabs)
|
||||||
{
|
{
|
||||||
t.Item2.onClick += OnTabButtonClick;
|
t.Item2.onClick += OnTabButtonClick;
|
||||||
}
|
}
|
||||||
@@ -230,7 +252,7 @@ public class MyWindowWithTabs : MyWindow
|
|||||||
{
|
{
|
||||||
if (EventRegistered)
|
if (EventRegistered)
|
||||||
{
|
{
|
||||||
foreach (var t in _tabs)
|
foreach (var t in Tabs)
|
||||||
{
|
{
|
||||||
t.Item2.onClick -= OnTabButtonClick;
|
t.Item2.onClick -= OnTabButtonClick;
|
||||||
}
|
}
|
||||||
@@ -242,17 +264,16 @@ public class MyWindowWithTabs : MyWindow
|
|||||||
|
|
||||||
private void OnTabButtonClick(int index)
|
private void OnTabButtonClick(int index)
|
||||||
{
|
{
|
||||||
foreach (var t in _tabs)
|
foreach (var (rectTransform, btn) in Tabs)
|
||||||
{
|
{
|
||||||
var btn = t.Item2;
|
|
||||||
if (btn.data != index)
|
if (btn.data != index)
|
||||||
{
|
{
|
||||||
btn.highlighted = false;
|
btn.highlighted = false;
|
||||||
t.Item1.gameObject.SetActive(false);
|
rectTransform.gameObject.SetActive(false);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
btn.highlighted = true;
|
btn.highlighted = true;
|
||||||
t.Item1.gameObject.SetActive(true);
|
rectTransform.gameObject.SetActive(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using UnityEngine;
|
using Steamworks;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace CheatEnabler;
|
namespace CheatEnabler;
|
||||||
|
|
||||||
@@ -6,6 +7,8 @@ public class UIConfigWindow : UI.MyWindowWithTabs
|
|||||||
{
|
{
|
||||||
private RectTransform _windowTrans;
|
private RectTransform _windowTrans;
|
||||||
|
|
||||||
|
private readonly UIButton[] _dysonLayerBtn = new UIButton[10];
|
||||||
|
|
||||||
static UIConfigWindow()
|
static UIConfigWindow()
|
||||||
{
|
{
|
||||||
I18N.Add("General", "General", "常规");
|
I18N.Add("General", "General", "常规");
|
||||||
@@ -26,6 +29,8 @@ public class UIConfigWindow : UI.MyWindowWithTabs
|
|||||||
I18N.Add("Skip absorption period", "Skip absorption period", "跳过吸收阶段");
|
I18N.Add("Skip absorption period", "Skip absorption period", "跳过吸收阶段");
|
||||||
I18N.Add("Quick absorb", "Quick absorb", "快速吸收");
|
I18N.Add("Quick absorb", "Quick absorb", "快速吸收");
|
||||||
I18N.Add("Eject anyway", "Eject anyway", "全球弹射");
|
I18N.Add("Eject anyway", "Eject anyway", "全球弹射");
|
||||||
|
I18N.Add("Initialize Dyson Sphere", "Initialize Dyson Sphere", "初始化戴森球");
|
||||||
|
I18N.Add("Click to dismantle selected layer", "Click to dismantle selected layer", "点击拆除对应的戴森壳");
|
||||||
I18N.Add("Birth", "Birth Sys", "母星系");
|
I18N.Add("Birth", "Birth Sys", "母星系");
|
||||||
I18N.Add("Terraform without enought sands", "Terraform without enough sands", "沙土不够时依然可以整改地形");
|
I18N.Add("Terraform without enought sands", "Terraform without enough sands", "沙土不够时依然可以整改地形");
|
||||||
I18N.Add("Silicon/Titanium on birth planet", "Silicon/Titanium on birth planet", "母星有硅和钛");
|
I18N.Add("Silicon/Titanium on birth planet", "Silicon/Titanium on birth planet", "母星有硅和钛");
|
||||||
@@ -45,7 +50,7 @@ public class UIConfigWindow : UI.MyWindowWithTabs
|
|||||||
|
|
||||||
public static UIConfigWindow CreateInstance()
|
public static UIConfigWindow CreateInstance()
|
||||||
{
|
{
|
||||||
return UI.MyWindowManager.CreateWindow<UIConfigWindow>("CEConfigWindow", "CheatEnabler Config".Translate());
|
return UI.MyWindowManager.CreateWindow<UIConfigWindow>("CEConfigWindow", "CheatEnabler Config");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _OnCreate()
|
public override void _OnCreate()
|
||||||
@@ -61,35 +66,35 @@ public class UIConfigWindow : UI.MyWindowWithTabs
|
|||||||
// General tab
|
// General tab
|
||||||
var x = 0f;
|
var x = 0f;
|
||||||
var y = 10f;
|
var y = 10f;
|
||||||
var tab1 = AddTab(36f, 0, _windowTrans, "General".Translate());
|
var tab1 = AddTab(36f, 0, _windowTrans, "General");
|
||||||
UI.MyCheckBox.CreateCheckBox(x, y, tab1, DevShortcuts.Enabled, "Enable Dev Shortcuts".Translate());
|
UI.MyCheckBox.CreateCheckBox(x, y, tab1, DevShortcuts.Enabled, "Enable Dev Shortcuts");
|
||||||
y += 36f;
|
y += 36f;
|
||||||
UI.MyCheckBox.CreateCheckBox(x, y, tab1, AbnormalDisabler.Enabled, "Disable Abnormal Checks".Translate());
|
UI.MyCheckBox.CreateCheckBox(x, y, tab1, AbnormalDisabler.Enabled, "Disable Abnormal Checks");
|
||||||
y += 86f;
|
y += 86f;
|
||||||
UI.MyKeyBinder.CreateKeyBinder(x, y, tab1, CheatEnabler.Hotkey, "Hotkey".Translate());
|
UI.MyKeyBinder.CreateKeyBinder(x, y, tab1, CheatEnabler.Hotkey, "Hotkey");
|
||||||
|
|
||||||
var tab2 = AddTab(136f, 1, _windowTrans, "Build".Translate());
|
var tab2 = AddTab(136f, 1, _windowTrans, "Build");
|
||||||
x = 0f;
|
x = 0f;
|
||||||
y = 10f;
|
y = 10f;
|
||||||
UI.MyCheckBox.CreateCheckBox(x, y, tab2, BuildPatch.ImmediateEnabled, "Finish build immediately".Translate());
|
UI.MyCheckBox.CreateCheckBox(x, y, tab2, BuildPatch.ImmediateEnabled, "Finish build immediately");
|
||||||
y += 36f;
|
y += 36f;
|
||||||
UI.MyCheckBox.CreateCheckBox(x, y, tab2, BuildPatch.NoCostEnabled, "Infinite buildings".Translate());
|
UI.MyCheckBox.CreateCheckBox(x, y, tab2, BuildPatch.NoCostEnabled, "Infinite buildings");
|
||||||
y += 36f;
|
y += 36f;
|
||||||
UI.MyCheckBox.CreateCheckBox(x, y, tab2, BuildPatch.NoConditionEnabled, "Build without condition".Translate());
|
UI.MyCheckBox.CreateCheckBox(x, y, tab2, BuildPatch.NoConditionEnabled, "Build without condition");
|
||||||
y += 36f;
|
y += 36f;
|
||||||
UI.MyCheckBox.CreateCheckBox(x, y, tab2, BuildPatch.NoCollisionEnabled, "No collision".Translate());
|
UI.MyCheckBox.CreateCheckBox(x, y, tab2, BuildPatch.NoCollisionEnabled, "No collision");
|
||||||
|
|
||||||
// Planet Tab
|
// Planet Tab
|
||||||
var tab3 = AddTab(236f, 2, _windowTrans, "Planet".Translate());
|
var tab3 = AddTab(236f, 2, _windowTrans, "Planet");
|
||||||
x = 0f;
|
x = 0f;
|
||||||
y = 10f;
|
y = 10f;
|
||||||
UI.MyCheckBox.CreateCheckBox(x, y, tab3, ResourcePatch.InfiniteEnabled, "Infinite Natural Resources".Translate());
|
UI.MyCheckBox.CreateCheckBox(x, y, tab3, ResourcePatch.InfiniteEnabled, "Infinite Natural Resources");
|
||||||
y += 36f;
|
y += 36f;
|
||||||
UI.MyCheckBox.CreateCheckBox(x, y, tab3, ResourcePatch.FastEnabled, "Fast Mining".Translate());
|
UI.MyCheckBox.CreateCheckBox(x, y, tab3, ResourcePatch.FastEnabled, "Fast Mining");
|
||||||
y += 36f;
|
y += 36f;
|
||||||
UI.MyCheckBox.CreateCheckBox(x, y, tab3, WaterPumperPatch.Enabled, "Pump Anywhere".Translate());
|
UI.MyCheckBox.CreateCheckBox(x, y, tab3, WaterPumperPatch.Enabled, "Pump Anywhere");
|
||||||
y += 36f;
|
y += 36f;
|
||||||
UI.MyCheckBox.CreateCheckBox(x, y, tab3, TerraformPatch.Enabled, "Terraform without enought sands".Translate());
|
UI.MyCheckBox.CreateCheckBox(x, y, tab3, TerraformPatch.Enabled, "Terraform without enought sands");
|
||||||
x = 300f;
|
x = 300f;
|
||||||
y = 10f;
|
y = 10f;
|
||||||
AddButton(x, y, tab3, "矿物掩埋标题", 16, "button-bury-all", () =>
|
AddButton(x, y, tab3, "矿物掩埋标题", 16, "button-bury-all", () =>
|
||||||
@@ -129,41 +134,96 @@ public class UIConfigWindow : UI.MyWindowWithTabs
|
|||||||
PlanetFunctions.DismantleAll(false);
|
PlanetFunctions.DismantleAll(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
var tab4 = AddTab(336f, 3, _windowTrans, "Dyson Sphere".Translate());
|
var tab4 = AddTab(336f, 3, _windowTrans, "Dyson Sphere");
|
||||||
x = 0f;
|
x = 0f;
|
||||||
y = 10f;
|
y = 10f;
|
||||||
UI.MyCheckBox.CreateCheckBox(x, y, tab4, DysonSpherePatch.SkipBulletEnabled, "Skip bullet period".Translate());
|
UI.MyCheckBox.CreateCheckBox(x, y, tab4, DysonSpherePatch.SkipBulletEnabled, "Skip bullet period");
|
||||||
y += 36f;
|
y += 36f;
|
||||||
UI.MyCheckBox.CreateCheckBox(x, y, tab4, DysonSpherePatch.SkipAbsorbEnabled, "Skip absorption period".Translate());
|
UI.MyCheckBox.CreateCheckBox(x, y, tab4, DysonSpherePatch.SkipAbsorbEnabled, "Skip absorption period");
|
||||||
y += 36f;
|
y += 36f;
|
||||||
UI.MyCheckBox.CreateCheckBox(x, y, tab4, DysonSpherePatch.QuickAbsortEnabled, "Quick absorb".Translate());
|
UI.MyCheckBox.CreateCheckBox(x, y, tab4, DysonSpherePatch.QuickAbsortEnabled, "Quick absorb");
|
||||||
y += 36f;
|
y += 36f;
|
||||||
UI.MyCheckBox.CreateCheckBox(x, y, tab4, DysonSpherePatch.EjectAnywayEnabled, "Eject anyway".Translate());
|
UI.MyCheckBox.CreateCheckBox(x, y, tab4, DysonSpherePatch.EjectAnywayEnabled, "Eject anyway");
|
||||||
|
x = 300f;
|
||||||
|
y = 10f;
|
||||||
|
AddButton(x, y, tab4, "Initialize Dyson Sphere", 16, "init-dyson-sphere", () =>
|
||||||
|
{
|
||||||
|
DysonSpherePatch.InitCurrentDysonSphere(-1);
|
||||||
|
});
|
||||||
|
y += 36f;
|
||||||
|
AddText(x, y, tab4, "Click to dismantle selected layer", 16, "text-dismantle-layer");
|
||||||
|
y += 26f;
|
||||||
|
for (var i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
var id = i + 1;
|
||||||
|
var btn = AddFlatButton(x, y, tab4, id.ToString(), 12, "dismantle-layer-" + id, () => { DysonSpherePatch.InitCurrentDysonSphere(id); });
|
||||||
|
((RectTransform)btn.transform).sizeDelta = new Vector2(40f, 20f);
|
||||||
|
_dysonLayerBtn[i] = btn;
|
||||||
|
if (i == 4)
|
||||||
|
{
|
||||||
|
x -= 160f;
|
||||||
|
y += 20f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x += 40f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var tab5 = AddTab(436f, 4, _windowTrans, "Birth".Translate());
|
var tab5 = AddTab(436f, 4, _windowTrans, "Birth");
|
||||||
x = 0f;
|
x = 0f;
|
||||||
y = 10f;
|
y = 10f;
|
||||||
UI.MyCheckBox.CreateCheckBox(x, y, tab5, BirthPlanetPatch.SitiVeinsOnBirthPlanet, "Silicon/Titanium on birth planet".Translate());
|
UI.MyCheckBox.CreateCheckBox(x, y, tab5, BirthPlanetPatch.SitiVeinsOnBirthPlanet, "Silicon/Titanium on birth planet");
|
||||||
y += 36f;
|
y += 36f;
|
||||||
UI.MyCheckBox.CreateCheckBox(x, y, tab5, BirthPlanetPatch.FireIceOnBirthPlanet, "Fire ice on birth planet".Translate());
|
UI.MyCheckBox.CreateCheckBox(x, y, tab5, BirthPlanetPatch.FireIceOnBirthPlanet, "Fire ice on birth planet");
|
||||||
y += 36f;
|
y += 36f;
|
||||||
UI.MyCheckBox.CreateCheckBox(x, y, tab5, BirthPlanetPatch.KimberliteOnBirthPlanet, "Kimberlite on birth planet".Translate());
|
UI.MyCheckBox.CreateCheckBox(x, y, tab5, BirthPlanetPatch.KimberliteOnBirthPlanet, "Kimberlite on birth planet");
|
||||||
y += 36f;
|
y += 36f;
|
||||||
UI.MyCheckBox.CreateCheckBox(x, y, tab5, BirthPlanetPatch.FractalOnBirthPlanet, "Fractal silicon on birth planet".Translate());
|
UI.MyCheckBox.CreateCheckBox(x, y, tab5, BirthPlanetPatch.FractalOnBirthPlanet, "Fractal silicon on birth planet");
|
||||||
y += 36f;
|
y += 36f;
|
||||||
UI.MyCheckBox.CreateCheckBox(x, y, tab5, BirthPlanetPatch.OrganicOnBirthPlanet, "Organic crystal on birth planet".Translate());
|
UI.MyCheckBox.CreateCheckBox(x, y, tab5, BirthPlanetPatch.OrganicOnBirthPlanet, "Organic crystal on birth planet");
|
||||||
x = 200f;
|
x = 200f;
|
||||||
y = 10f;
|
y = 10f;
|
||||||
UI.MyCheckBox.CreateCheckBox(x, y, tab5, BirthPlanetPatch.OpticalOnBirthPlanet, "Optical grating crystal on birth planet".Translate());
|
UI.MyCheckBox.CreateCheckBox(x, y, tab5, BirthPlanetPatch.OpticalOnBirthPlanet, "Optical grating crystal on birth planet");
|
||||||
y += 36f;
|
y += 36f;
|
||||||
UI.MyCheckBox.CreateCheckBox(x, y, tab5, BirthPlanetPatch.SpiniformOnBirthPlanet, "Spiniform stalagmite crystal on birth planet".Translate());
|
UI.MyCheckBox.CreateCheckBox(x, y, tab5, BirthPlanetPatch.SpiniformOnBirthPlanet, "Spiniform stalagmite crystal on birth planet");
|
||||||
y += 36f;
|
y += 36f;
|
||||||
UI.MyCheckBox.CreateCheckBox(x, y, tab5, BirthPlanetPatch.UnipolarOnBirthPlanet, "Unipolar magnet on birth planet".Translate());
|
UI.MyCheckBox.CreateCheckBox(x, y, tab5, BirthPlanetPatch.UnipolarOnBirthPlanet, "Unipolar magnet on birth planet");
|
||||||
y += 36f;
|
y += 36f;
|
||||||
UI.MyCheckBox.CreateCheckBox(x, y, tab5, BirthPlanetPatch.FlatBirthPlanet, "Birth planet is solid flat (no water at all)".Translate());
|
UI.MyCheckBox.CreateCheckBox(x, y, tab5, BirthPlanetPatch.FlatBirthPlanet, "Birth planet is solid flat (no water at all)");
|
||||||
y += 36f;
|
y += 36f;
|
||||||
UI.MyCheckBox.CreateCheckBox(x, y, tab5, BirthPlanetPatch.HighLuminosityBirthStar, "Birth star has high luminosity".Translate());
|
UI.MyCheckBox.CreateCheckBox(x, y, tab5, BirthPlanetPatch.HighLuminosityBirthStar, "Birth star has high luminosity");
|
||||||
SetCurrentTab(0);
|
SetCurrentTab(0);
|
||||||
|
|
||||||
|
UpdateUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateUI()
|
||||||
|
{
|
||||||
|
if (Tabs[3].Item1.gameObject.activeSelf)
|
||||||
|
{
|
||||||
|
var star = GameMain.localStar;
|
||||||
|
if (star != null)
|
||||||
|
{
|
||||||
|
var dysonSpheres = GameMain.data?.dysonSpheres;
|
||||||
|
if (dysonSpheres?[star.index] != null)
|
||||||
|
{
|
||||||
|
var ds = dysonSpheres[star.index];
|
||||||
|
for (var i = 1; i <= 10; i++)
|
||||||
|
{
|
||||||
|
var layer = ds.layersIdBased[i];
|
||||||
|
_dysonLayerBtn[i - 1].button.interactable = layer != null && layer.id == i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
_dysonLayerBtn[i].button.interactable = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _OnDestroy()
|
public override void _OnDestroy()
|
||||||
@@ -190,8 +250,13 @@ public class UIConfigWindow : UI.MyWindowWithTabs
|
|||||||
|
|
||||||
public override void _OnUpdate()
|
public override void _OnUpdate()
|
||||||
{
|
{
|
||||||
if (!VFInput.escape || VFInput.inputing) return;
|
if (VFInput.escape && !VFInput.inputing)
|
||||||
|
{
|
||||||
VFInput.UseEscape();
|
VFInput.UseEscape();
|
||||||
_Close();
|
_Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateUI();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user