mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-19 17:05:20 +08:00
refactor: remove single-owner helpers and redundant plumbing
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)
This commit is contained in:
1 parent
325536fc79
commit
ba2648a3e3
60 files changed
+1094
-994
No files matched your search
+5
-23
@@ -28,31 +28,14 @@ public static class BeltSignal
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] LoadEmbeddedResource(string path, Assembly assembly = null)
|
||||
private static Sprite LoadDustbinSprite()
|
||||
{
|
||||
if (assembly == null)
|
||||
{
|
||||
assembly = Assembly.GetCallingAssembly();
|
||||
}
|
||||
var info = assembly.GetName();
|
||||
var name = info.Name;
|
||||
using var stream = assembly.GetManifestResourceStream($"{name}.{path.Replace('/', '.')}")!;
|
||||
using var stream = Assembly.GetExecutingAssembly()
|
||||
.GetManifestResourceStream("Dustbin.assets.icon.signal-410.png")!;
|
||||
var buffer = new byte[stream.Length];
|
||||
_ = stream.Read(buffer, 0, buffer.Length);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
private static Texture2D LoadEmbeddedTexture(string path, Assembly assembly = null)
|
||||
{
|
||||
var fileData = LoadEmbeddedResource(path, assembly);
|
||||
var tex = new Texture2D(2, 2);
|
||||
tex.LoadImage(fileData);
|
||||
return tex;
|
||||
}
|
||||
|
||||
private static Sprite LoadEmbeddedSprite(string path, Assembly assembly = null)
|
||||
{
|
||||
var tex = LoadEmbeddedTexture(path, assembly);
|
||||
tex.LoadImage(buffer);
|
||||
return Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f));
|
||||
}
|
||||
|
||||
@@ -61,7 +44,6 @@ public static class BeltSignal
|
||||
private static void VFPreload_InvokeOnLoadWorkEnded_Postfix()
|
||||
{
|
||||
if (_initialized) return;
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
var signals = LDB._signals;
|
||||
var index = signals.dataArray.Length;
|
||||
var p = new SignalProto
|
||||
@@ -70,7 +52,7 @@ public static class BeltSignal
|
||||
Name = "DUSTBIN",
|
||||
GridIndex = 3110,
|
||||
IconPath = "Assets/signal-410.png",
|
||||
_iconSprite = LoadEmbeddedSprite("assets/icon/signal-410.png", assembly),
|
||||
_iconSprite = LoadDustbinSprite(),
|
||||
SID = ""
|
||||
};
|
||||
p.name = p.Name.Translate();
|
||||
|
||||
Reference in new issue
Block a user