Instruction System

This commit is contained in:
h z
2024-09-29 15:39:37 +01:00
parent 67dd8ac8dc
commit 7ae3c9d374
35 changed files with 168 additions and 43 deletions

View File

@@ -3,10 +3,11 @@ using Nocturnis.DataStructures;
using Nocturnis.DataStructures.Data;
using Nocturnis.DataStructures.DataTypes;
using Nocturnis.Enigmos.Modules;
using Nocturnis.Godot;
namespace Nocturnis.Communicators;
public interface IBaseCommunicator : IControlNode
public interface IBaseCommunicator : IControl
{
ICommunicateModule PairedModule { get; set; }
DataVariable DataBuffer { get; set; }

View File

@@ -1,8 +1,9 @@
using Nocturnis.Communicators;
using Nocturnis.Godot;
namespace Nocturnis.Dashboards;
public interface IDashboard : INodeInterface
public interface IDashboard : INode
{
HashSet<IBaseCommunicator> Communicators { get; set; }
}

View File

@@ -1,6 +1,8 @@
using Nocturnis.Godot;
namespace Nocturnis.DataStructures.ConfigurableParameters;
public interface IModuleParameterSetter : INodeInterface
public interface IModuleParameterSetter : INode
{
}

View File

@@ -1,11 +0,0 @@
using Godot;
namespace Nocturnis;
public static class ENodeInterface
{
public static Node AsNode(this INodeInterface n)
{
return n as Node;
}
}

View File

@@ -1,12 +1,13 @@
using Nocturnis.Enigmos.Cables;
using Nocturnis.Enigmos.Modules;
using Nocturnis.Enigmos.Ports;
using Nocturnis.Godot;
using Nocturnis.UIElements;
using Nocturnis.UIElements.Layers;
namespace Nocturnis.Enigmos.Boards;
public interface IBaseBoard : INodeInterface
public interface IBaseBoard : INode
{
IPanelViewer PanelViewer { get; set; }
IEnumerable<IBasePort> OnBoardPorts { get; }

View File

@@ -1,9 +1,10 @@
using Godot;
using Nocturnis.Enigmos.Modules;
using Nocturnis.Godot;
namespace Nocturnis.Enigmos.ModuleManuals;
public interface IModuleManual : INodeInterface
public interface IModuleManual : INode
{
Vector2 Size { get; set; }
Vector2 Position { get; set; }

View File

@@ -1,6 +1,8 @@
using Nocturnis.Godot;
namespace Nocturnis.Enigmos.ModuleManuals;
public interface IModuleManualTab : INodeInterface
public interface IModuleManualTab : INode
{
string FullName();
}

View File

@@ -1,3 +1,4 @@
using Godot;
using Nocturnis.Enigmos.Modules;
using Nocturnis.GlobalManagement.Providers;
@@ -24,7 +25,7 @@ public class EnigmosControl
public void ShutDownEngine()
{
GlobalProvider.SceneProvider.RootScene.EngineSwitch.TextureNormal =
((GlobalProvider.SceneProvider.RootScene.EngineSwitch as TextureButton)!).TextureNormal =
GlobalProvider.TextureProvider.EngineSwitchOff;
EngineUp = false;
}
@@ -32,7 +33,7 @@ public class EnigmosControl
public void PowerUpEngine()
{
CreatureControl.Instance.CurrentCharacter.MotherBoard.Reset();
GlobalProvider.SceneProvider.RootScene.EngineSwitch.TextureNormal =
(GlobalProvider.SceneProvider.RootScene.EngineSwitch as TextureButton)!.TextureNormal =
GlobalProvider.TextureProvider.EngineSwitchOn;
EngineUp = true;
}

View File

@@ -1,4 +1,5 @@
using Godot;
using Nocturnis.Creatures.Characters;
using Nocturnis.Enigmos.Modules;
using Nocturnis.Inventories.Items;
@@ -14,7 +15,7 @@ public static class GlobalProvider
public static IDataTypeProvider DataTypeProvider { get; set; }
public static IProcessProvider ProcessProvider { get; set; }
public static ITextureProvider TextureProvider { get; set; }
public static IPositionProvider PositionProvider { get; set; }
public static IConstructorProvider ConstructorProvider { get; set; }
public static IFileAccessProvider FileAccessProvider { get; set; }
@@ -41,4 +42,5 @@ public static class GlobalProvider
public static Font Font { get; set; }
public static readonly Dictionary<StringName, Texture2D> DataTypeTexture = new();
public static IPlayerCharacter MainCharacter { get; set; }
}

View File

@@ -0,0 +1,11 @@
using Godot;
using Nocturnis.Hermeteus.BracketSystem;
namespace Nocturnis.GlobalManagement.Providers;
public interface IPositionProvider
{
delegate IInstructionArrowEnd Map();
Dictionary<string, Map> Positions { get; set; }
IInstructionArrowEnd GetPosition(string query);
}

11
src/Godot/ECanvasItem.cs Normal file
View File

@@ -0,0 +1,11 @@
using Godot;
namespace Nocturnis.Godot;
public static class ECanvasItem
{
public static CanvasItem AsCanvasItem(this ICanvasItem canvasItem)
{
return canvasItem as CanvasItem;
}
}

11
src/Godot/ENode.cs Normal file
View File

@@ -0,0 +1,11 @@
using Godot;
namespace Nocturnis.Godot;
public static class ENode
{
public static Node AsNode(this INode n)
{
return n as Node;
}
}

11
src/Godot/ENode2D.cs Normal file
View File

@@ -0,0 +1,11 @@
using Godot;
namespace Nocturnis.Godot;
public static class ENode2D
{
public static Node2D AsNode(this INode2D n)
{
return n as Node2D;
}
}

View File

@@ -1,8 +1,8 @@
using Godot;
namespace Nocturnis;
namespace Nocturnis.Godot;
public interface IControlNode : INodeInterface
public interface ICanvasItem : INode
{
Vector2 Position { get; set; }
Vector2 Size { get; set; }

9
src/Godot/IControl.cs Normal file
View File

@@ -0,0 +1,9 @@
using Godot;
namespace Nocturnis.Godot;
public interface IControl : ICanvasItem
{
Vector2 Position { get; set; }
Vector2 Size { get; set; }
}

View File

@@ -1,8 +1,8 @@
using Godot;
namespace Nocturnis;
namespace Nocturnis.Godot;
public interface INodeInterface
public interface INode
{
void RemoveChild(Node node);
void AddChild(Node node, bool forceReadableName = false, Node.InternalMode @internal = (Node.InternalMode)(0));

8
src/Godot/INode2D.cs Normal file
View File

@@ -0,0 +1,8 @@
using Godot;
namespace Nocturnis.Godot;
public interface INode2D : ICanvasItem
{
}

View File

@@ -0,0 +1,9 @@
using Godot;
namespace Nocturnis.Hermeteus.BracketSystem;
public static class EInstructionArrowEnd
{
public static Vector2 InstructionArrowEndPoint(this IInstructionArrowEnd a) =>
a.EndMarker.GetViewport().GetGlobalCanvasTransform().Inverse() * a.EndMarker.GlobalPosition;
}

View File

@@ -0,0 +1,9 @@
using Godot;
namespace Nocturnis.Hermeteus.BracketSystem;
public static class EInstructionArrowStart
{
public static Vector2 InstructionArrowStartPoint(this IInstructionArrowStart a) =>
a.StartMarker.GetViewport().GetGlobalCanvasTransform().Inverse() * a.StartMarker.GlobalPosition;
}

View File

@@ -11,5 +11,6 @@ public interface IBracketLine
string[] Conditions { get; set; }
HashSet<IBracketLine> Successors { get; set; }
bool IsReady { get; }
float Delay { get; }
}

View File

@@ -1,6 +0,0 @@
namespace Nocturnis.Hermeteus.BracketSystem;
public interface ICondition
{
Func<bool> Check { get; set; }
}

View File

@@ -1,13 +1,12 @@
using Godot;
using Nocturnis.Godot;
using Nocturnis.UIElements.Layers;
namespace Nocturnis.Hermeteus.BracketSystem;
public interface IInstructionAgent : INodeInterface
public interface IInstructionAgent : INode
{
void Load(string content, Action callBack);
void Clean(Action callBack);
void LoadArrows(string[] ends);
void CleanArrows();
void Init(IInstructionLayer insLayer);
}

View File

@@ -0,0 +1,8 @@
using Godot;
namespace Nocturnis.Hermeteus.BracketSystem;
public interface IInstructionArrowEnd
{
Marker2D EndMarker { get; }
}

View File

@@ -0,0 +1,10 @@
using Nocturnis.UIElements.Layers;
namespace Nocturnis.Hermeteus.BracketSystem;
public interface IInstructionArrowManager : IInstructionArrowStart
{
void LoadArrows(string[] ends);
void CleanArrows();
void Init(IInstructionLayer insLayer);
}

View File

@@ -0,0 +1,8 @@
using Godot;
namespace Nocturnis.Hermeteus.BracketSystem;
public interface IInstructionArrowStart
{
Marker2D StartMarker { get; }
}

View File

@@ -10,6 +10,6 @@ public interface IBracketProcessor
bool KetFinished { get; set; }
double BracketEsc { get; set; }
string Status { get; set; }
void Init(IInstructionAgent bra, IInstructionAgent pointer, IInstructionAgent ket);
void Init(IInstructionAgent bra, IInstructionArrowManager pointer, IInstructionAgent ket);
void SyncLoad(IBracketLine talk);
}

View File

@@ -1,10 +1,11 @@
using Godot;
using Nocturnis.Godot;
using Skeleton.Algebra;
using Skeleton.Algebra.DimensionProviders;
namespace Nocturnis.Inventories.Items;
using R2 = CategoryOf<IDim2>.OnField<double>.FVector;
public interface IBaseItem : INodeInterface
public interface IBaseItem : INode
{
StringName Status { get; set; }
R2 ItemPosition { get; set; }

View File

@@ -1,15 +1,16 @@
using Godot;
using Nocturnis.Godot;
using Nocturnis.Hermeteus;
using Nocturnis.UIElements;
using Nocturnis.UIElements.Layers;
namespace Nocturnis.Scenes;
public interface IRootScene : INodeInterface
public interface IRootScene : INode
{
void ChangeScene(Node scene);
IKeyListener KeyListener { get; set; }
TextureButton EngineSwitch { get; set; }
IEngineSwitch EngineSwitch { get; set; }
IWindowLayer WindowLayer { get; set; }
IInstructionLayer InstructionLayer { get; set; }
}

View File

@@ -1,9 +1,10 @@
using Godot;
using Nocturnis.Godot;
using Nocturnis.UIElements.Layers;
namespace Nocturnis.Scenes.Worlds;
public interface IWorld : INodeInterface
public interface IWorld : INode
{
IDashboardLayer DashboardLayer { get; set; }
}

View File

@@ -0,0 +1,9 @@
using Nocturnis.Godot;
using Nocturnis.Hermeteus.BracketSystem;
namespace Nocturnis.UIElements;
public interface ICorePanel : IControl, IInstructionArrowEnd
{
}

View File

@@ -1,9 +1,10 @@
using Nocturnis.Communicators;
using Nocturnis.Dashboards;
using Nocturnis.Godot;
namespace Nocturnis.UIElements;
public interface IDashboardTab : INodeInterface
public interface IDashboardTab : INode
{
IEnumerable<IBaseCommunicator> AllCommunicators { get; }
void Init();

View File

@@ -0,0 +1,9 @@
using Nocturnis.Godot;
using Nocturnis.Hermeteus.BracketSystem;
namespace Nocturnis.UIElements;
public interface IEngineSwitch : IControl, IInstructionArrowEnd
{
}

View File

@@ -1,8 +1,9 @@
using Godot;
using Nocturnis.Godot;
namespace Nocturnis.UIElements.Layers;
public interface IDashboardLayer : INodeInterface
public interface IDashboardLayer : INode
{
IDashboardTab DashboardTab { get; set; }

View File

@@ -1,13 +1,14 @@
using Nocturnis.Godot;
using Nocturnis.Hermeteus;
using Nocturnis.Hermeteus.BracketSystem;
using Nocturnis.Hermeteus.BracketSystem.Processors;
namespace Nocturnis.UIElements.Layers;
public interface IInstructionLayer : INodeInterface
public interface IInstructionLayer : INode
{
IInstructionAgent Bra { get; set; }
IInstructionAgent Pointer { get; set; }
IInstructionArrowManager Pointer { get; set; }
IInstructionAgent Ket { get; set; }
IBracketProcessor Processor { get; set; }
void Init();

View File

@@ -1,6 +1,8 @@
using Nocturnis.Godot;
namespace Nocturnis.UIElements.Layers;
public interface IWindowLayer : INodeInterface
public interface IWindowLayer : INode
{
}