46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
using Godot;
|
|
using Nocturnis;
|
|
using Nocturnis.Communicators;
|
|
using Nocturnis.Enigmos.ModuleManuals;
|
|
using Nocturnis.Enigmos.Modules;
|
|
|
|
namespace Enigmos.Manual;
|
|
public partial class CommunicatorPairTab : Panel, IModuleManualTab, ISceneConcept
|
|
{
|
|
private bool InitFlag { get; set; }
|
|
public string FullName() => "Pair";
|
|
|
|
public void Init(ICommunicateModule module)
|
|
{
|
|
Module = module;
|
|
InitFlag = true;
|
|
}
|
|
|
|
public ICommunicateModule Module { get; set; }
|
|
private OptionButton CommunicatorOptions { get; set; }
|
|
public override void _Ready()
|
|
{
|
|
if (!InitFlag)
|
|
throw new Exception("TODO - NEED INIT FIRST");
|
|
CommunicatorOptions = GetNode<OptionButton>("CommunicatorOptions");
|
|
IBaseCommunicator[] options = Module.CompatibleCommunicators();
|
|
for(int idx = 0; idx < options.Length; idx ++ )
|
|
{
|
|
CommunicatorOptions.AddIconItem
|
|
(
|
|
options[idx].IconTexture,
|
|
$"{options[idx].CustomName} " + (options[idx].Paired ? "(Already Paired)" : ""),
|
|
idx
|
|
);
|
|
}
|
|
|
|
Name = "Pair";
|
|
base._Ready();
|
|
}
|
|
|
|
private void SelectHandler(int idx)
|
|
{
|
|
Module.Pair(Module.CompatibleCommunicators()[idx]);
|
|
}
|
|
}
|