Split project
This commit is contained in:
45
Manual/CommunicatorPairTab.cs
Normal file
45
Manual/CommunicatorPairTab.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using Enigmos.Modules.Extensions;
|
||||
using Godot;
|
||||
using Nocturnis.Communicators;
|
||||
using Nocturnis.Enigmos.ModuleManuals;
|
||||
using Nocturnis.Enigmos.Modules;
|
||||
|
||||
namespace Enigmos.Manual;
|
||||
public partial class CommunicatorPairTab : Panel, IModuleManualTab
|
||||
{
|
||||
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]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user