mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-19 17:05:20 +08:00
Return feature-only helpers to their owners, remove inactive scaffolding and duplicate state, and reuse existing calculation and UI work without changing public contracts or gameplay. Record repository-wide coverage, justified retentions, independent reviews and validation, including baseline dashboard fixture failures. Assisted-by: Cindy (https://cindy.app)
52 lines
1.9 KiB
C#
52 lines
1.9 KiB
C#
using System;
|
|
using UnityEngine;
|
|
using UXAssist.Common;
|
|
using CheatEnabler;
|
|
|
|
namespace CheatEnabler.Functions.DysonSphere;
|
|
|
|
public static class DysonSphereResolver
|
|
{
|
|
public static (global::DysonSphere sphere, StarData star)? ResolveCurrent()
|
|
{
|
|
var star = GameMain.localStar;
|
|
if (star == null) return null;
|
|
var sphere = GameMain.data.dysonSpheres[star.index];
|
|
if (sphere == null) return null;
|
|
return (sphere, star);
|
|
}
|
|
|
|
public static StarData ResolveEditorOrLocalStar()
|
|
{
|
|
var dysonEditor = UIRoot.instance?.uiGame?.dysonEditor;
|
|
if (dysonEditor != null && dysonEditor.gameObject.activeSelf)
|
|
{
|
|
return dysonEditor.selection.viewStar;
|
|
}
|
|
var star = GameMain.localStar;
|
|
if (star == null)
|
|
{
|
|
UIMessageBox.Show(Localization.CheatEnabler.Translate(), Localization.YouAreNotInAnySystem.Translate(), Localization.OK.Translate(), UIMessageBox.ERROR, null);
|
|
}
|
|
return star;
|
|
}
|
|
|
|
public static (global::DysonSphere sphere, StarData star)? ResolveEditorOrLocalSphere(bool requireLayer = true)
|
|
{
|
|
var star = ResolveEditorOrLocalStar();
|
|
if (star == null) return null;
|
|
var sphere = GameMain.data?.dysonSpheres[star.index];
|
|
if (sphere == null)
|
|
{
|
|
UIMessageBox.Show(Localization.CheatEnabler.Translate(), string.Format(Localization.ThereIsNoDysonSphereDataOn0.Translate(), star.displayName), Localization.OK.Translate(), UIMessageBox.ERROR, null);
|
|
return null;
|
|
}
|
|
if (requireLayer && sphere.layerCount == 0)
|
|
{
|
|
UIMessageBox.Show(Localization.CheatEnabler.Translate(), string.Format(Localization.ThereIsNoDysonSphereShellOn0.Translate(), star.displayName), Localization.OK.Translate(), UIMessageBox.ERROR, null);
|
|
return null;
|
|
}
|
|
return (sphere, star);
|
|
}
|
|
}
|