source generator
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Enigmos.Modules.ProgrammableModules;
|
||||
using Godot;
|
||||
using Nocturnis;
|
||||
using Nocturnis.Enigmos.ModuleManuals;
|
||||
using Nocturnis.Enigmos.Modules;
|
||||
using Nocturnis.Enigmos.Ports;
|
||||
@@ -7,7 +8,7 @@ using Nocturnis.GlobalManagement.Providers;
|
||||
|
||||
namespace Enigmos.Manual;
|
||||
|
||||
public partial class PortMaintenanceTab : Panel, IModuleManualTab
|
||||
public abstract partial class PortMaintenanceTab : Panel, IModuleManualTab, ISceneConcept
|
||||
{
|
||||
private bool InitFlag { get; set; }
|
||||
|
||||
@@ -18,7 +19,10 @@ public partial class PortMaintenanceTab : Panel, IModuleManualTab
|
||||
}
|
||||
|
||||
public string FullName() => "Maintenance";
|
||||
private static readonly PackedScene PortFixerScene = GlobalProvider.SceneProvider!.AssetMapper<PortFixer>();
|
||||
|
||||
protected abstract PortFixer PortFixerInstantiate();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Should Be Assigned Before This Tab Been Added As Child To Tab Container
|
||||
/// </summary>
|
||||
@@ -31,7 +35,7 @@ public partial class PortMaintenanceTab : Panel, IModuleManualTab
|
||||
Ports = GetNode<VBoxContainer>("ScrolledItems/Ports");
|
||||
foreach (IBasePort port in Module!.Ports)
|
||||
{
|
||||
PortFixer fixer = PortFixerScene.Instantiate<PortFixer>();
|
||||
PortFixer fixer = PortFixerInstantiate();
|
||||
fixer.Init(port);
|
||||
Ports.AddChild(fixer);
|
||||
}
|
||||
@@ -39,18 +43,18 @@ public partial class PortMaintenanceTab : Panel, IModuleManualTab
|
||||
if (Module is ProgrammableModule programmableModule)
|
||||
{
|
||||
HashSet<string> used = new HashSet<string>();
|
||||
foreach (IBasePort port in programmableModule.ExplicitPorts)
|
||||
foreach (IBasePort port in programmableModule.Ports)
|
||||
{
|
||||
int i = 0;
|
||||
while (used.Contains("Exterior" + port.Name + $"#{i}"))
|
||||
i++;
|
||||
used.Add("Exterior" + port.Name + $"#{i}");
|
||||
port.Name = "Exterior" + port.Name + $"#{i}";
|
||||
PortFixer fixer = PortFixerScene.Instantiate<PortFixer>();
|
||||
PortFixer fixer = PortFixerInstantiate();
|
||||
fixer.Init(port);
|
||||
Ports.AddChild(fixer);
|
||||
}
|
||||
foreach (IBasePort port in programmableModule.ImplicitPorts)
|
||||
foreach (IBasePort port in programmableModule.Board!.OnBoardPorts)
|
||||
{
|
||||
string baseName = port.Name.ToString().Replace("Empty", "Interior");
|
||||
int i = 0;
|
||||
@@ -58,7 +62,7 @@ public partial class PortMaintenanceTab : Panel, IModuleManualTab
|
||||
i++;
|
||||
used.Add(baseName + $"#{i}");
|
||||
port.Name = baseName + $"#{i}";
|
||||
PortFixer fixer = PortFixerScene.Instantiate<PortFixer>();
|
||||
PortFixer fixer = PortFixerInstantiate();
|
||||
fixer.Init(port);
|
||||
Ports.AddChild(fixer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user