diff --git a/src/Communicators/IBaseCommunicator.cs b/src/Communicators/IBaseCommunicator.cs index d3cbaa8..a3fabcb 100644 --- a/src/Communicators/IBaseCommunicator.cs +++ b/src/Communicators/IBaseCommunicator.cs @@ -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; } diff --git a/src/Dashboards/IDashboard.cs b/src/Dashboards/IDashboard.cs index 5e325e2..ab2b4a0 100644 --- a/src/Dashboards/IDashboard.cs +++ b/src/Dashboards/IDashboard.cs @@ -1,8 +1,9 @@ using Nocturnis.Communicators; +using Nocturnis.Godot; namespace Nocturnis.Dashboards; -public interface IDashboard : INodeInterface +public interface IDashboard : INode { HashSet Communicators { get; set; } } \ No newline at end of file diff --git a/src/DataStructures/ConfigurableParameters/IModuleParameterSetter.cs b/src/DataStructures/ConfigurableParameters/IModuleParameterSetter.cs index f6bc6b3..879db19 100644 --- a/src/DataStructures/ConfigurableParameters/IModuleParameterSetter.cs +++ b/src/DataStructures/ConfigurableParameters/IModuleParameterSetter.cs @@ -1,6 +1,8 @@ +using Nocturnis.Godot; + namespace Nocturnis.DataStructures.ConfigurableParameters; -public interface IModuleParameterSetter : INodeInterface +public interface IModuleParameterSetter : INode { } \ No newline at end of file diff --git a/src/ENodeInterface.cs b/src/ENodeInterface.cs deleted file mode 100644 index d7afdc0..0000000 --- a/src/ENodeInterface.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Godot; - -namespace Nocturnis; - -public static class ENodeInterface -{ - public static Node AsNode(this INodeInterface n) - { - return n as Node; - } -} \ No newline at end of file diff --git a/src/Enigmos/Boards/IBaseBoard.cs b/src/Enigmos/Boards/IBaseBoard.cs index 402e8f6..6672f5c 100644 --- a/src/Enigmos/Boards/IBaseBoard.cs +++ b/src/Enigmos/Boards/IBaseBoard.cs @@ -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 OnBoardPorts { get; } diff --git a/src/Enigmos/ModuleManuals/IModuleManual.cs b/src/Enigmos/ModuleManuals/IModuleManual.cs index a1e9795..16b3322 100644 --- a/src/Enigmos/ModuleManuals/IModuleManual.cs +++ b/src/Enigmos/ModuleManuals/IModuleManual.cs @@ -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; } diff --git a/src/Enigmos/ModuleManuals/IModuleManualTab.cs b/src/Enigmos/ModuleManuals/IModuleManualTab.cs index 450b67d..4d3b16c 100644 --- a/src/Enigmos/ModuleManuals/IModuleManualTab.cs +++ b/src/Enigmos/ModuleManuals/IModuleManualTab.cs @@ -1,6 +1,8 @@ +using Nocturnis.Godot; + namespace Nocturnis.Enigmos.ModuleManuals; -public interface IModuleManualTab : INodeInterface +public interface IModuleManualTab : INode { string FullName(); } \ No newline at end of file diff --git a/src/GlobalManagement/Controls/EnigmosControl.cs b/src/GlobalManagement/Controls/EnigmosControl.cs index 33db3a1..9a9c2a2 100644 --- a/src/GlobalManagement/Controls/EnigmosControl.cs +++ b/src/GlobalManagement/Controls/EnigmosControl.cs @@ -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; } diff --git a/src/GlobalManagement/Providers/GlobalProvider.cs b/src/GlobalManagement/Providers/GlobalProvider.cs index da1dfe0..643b9a5 100644 --- a/src/GlobalManagement/Providers/GlobalProvider.cs +++ b/src/GlobalManagement/Providers/GlobalProvider.cs @@ -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 DataTypeTexture = new(); + public static IPlayerCharacter MainCharacter { get; set; } } diff --git a/src/GlobalManagement/Providers/IPositionProvider.cs b/src/GlobalManagement/Providers/IPositionProvider.cs new file mode 100644 index 0000000..d7d23e4 --- /dev/null +++ b/src/GlobalManagement/Providers/IPositionProvider.cs @@ -0,0 +1,11 @@ +using Godot; +using Nocturnis.Hermeteus.BracketSystem; + +namespace Nocturnis.GlobalManagement.Providers; + +public interface IPositionProvider +{ + delegate IInstructionArrowEnd Map(); + Dictionary Positions { get; set; } + IInstructionArrowEnd GetPosition(string query); +} diff --git a/src/Godot/ECanvasItem.cs b/src/Godot/ECanvasItem.cs new file mode 100644 index 0000000..f1400de --- /dev/null +++ b/src/Godot/ECanvasItem.cs @@ -0,0 +1,11 @@ +using Godot; + +namespace Nocturnis.Godot; + +public static class ECanvasItem +{ + public static CanvasItem AsCanvasItem(this ICanvasItem canvasItem) + { + return canvasItem as CanvasItem; + } +} \ No newline at end of file diff --git a/src/Godot/ENode.cs b/src/Godot/ENode.cs new file mode 100644 index 0000000..b111992 --- /dev/null +++ b/src/Godot/ENode.cs @@ -0,0 +1,11 @@ +using Godot; + +namespace Nocturnis.Godot; + +public static class ENode +{ + public static Node AsNode(this INode n) + { + return n as Node; + } +} \ No newline at end of file diff --git a/src/Godot/ENode2D.cs b/src/Godot/ENode2D.cs new file mode 100644 index 0000000..e6b0ec7 --- /dev/null +++ b/src/Godot/ENode2D.cs @@ -0,0 +1,11 @@ +using Godot; + +namespace Nocturnis.Godot; + +public static class ENode2D +{ + public static Node2D AsNode(this INode2D n) + { + return n as Node2D; + } +} \ No newline at end of file diff --git a/src/IControlNode.cs b/src/Godot/ICanvasItem.cs similarity index 55% rename from src/IControlNode.cs rename to src/Godot/ICanvasItem.cs index d934ddc..de1373d 100644 --- a/src/IControlNode.cs +++ b/src/Godot/ICanvasItem.cs @@ -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; } diff --git a/src/Godot/IControl.cs b/src/Godot/IControl.cs new file mode 100644 index 0000000..b84d42c --- /dev/null +++ b/src/Godot/IControl.cs @@ -0,0 +1,9 @@ +using Godot; + +namespace Nocturnis.Godot; + +public interface IControl : ICanvasItem +{ + Vector2 Position { get; set; } + Vector2 Size { get; set; } +} \ No newline at end of file diff --git a/src/INodeInterface.cs b/src/Godot/INode.cs similarity index 81% rename from src/INodeInterface.cs rename to src/Godot/INode.cs index 2425d6e..b360533 100644 --- a/src/INodeInterface.cs +++ b/src/Godot/INode.cs @@ -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)); diff --git a/src/Godot/INode2D.cs b/src/Godot/INode2D.cs new file mode 100644 index 0000000..1240f27 --- /dev/null +++ b/src/Godot/INode2D.cs @@ -0,0 +1,8 @@ +using Godot; + +namespace Nocturnis.Godot; + +public interface INode2D : ICanvasItem +{ + +} \ No newline at end of file diff --git a/src/Hermeteus/BracketSystem/EInstructionArrowEnd.cs b/src/Hermeteus/BracketSystem/EInstructionArrowEnd.cs new file mode 100644 index 0000000..d6ded25 --- /dev/null +++ b/src/Hermeteus/BracketSystem/EInstructionArrowEnd.cs @@ -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; +} \ No newline at end of file diff --git a/src/Hermeteus/BracketSystem/EInstructionArrowStart.cs b/src/Hermeteus/BracketSystem/EInstructionArrowStart.cs new file mode 100644 index 0000000..583665e --- /dev/null +++ b/src/Hermeteus/BracketSystem/EInstructionArrowStart.cs @@ -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; +} \ No newline at end of file diff --git a/src/Hermeteus/BracketSystem/IBracketLine.cs b/src/Hermeteus/BracketSystem/IBracketLine.cs index 0f729fd..f326999 100644 --- a/src/Hermeteus/BracketSystem/IBracketLine.cs +++ b/src/Hermeteus/BracketSystem/IBracketLine.cs @@ -11,5 +11,6 @@ public interface IBracketLine string[] Conditions { get; set; } HashSet Successors { get; set; } bool IsReady { get; } + float Delay { get; } } \ No newline at end of file diff --git a/src/Hermeteus/BracketSystem/ICondition.cs b/src/Hermeteus/BracketSystem/ICondition.cs deleted file mode 100644 index 16b4a98..0000000 --- a/src/Hermeteus/BracketSystem/ICondition.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Nocturnis.Hermeteus.BracketSystem; - -public interface ICondition -{ - Func Check { get; set; } -} \ No newline at end of file diff --git a/src/Hermeteus/BracketSystem/IInstructionAgent.cs b/src/Hermeteus/BracketSystem/IInstructionAgent.cs index 205910c..e709f75 100644 --- a/src/Hermeteus/BracketSystem/IInstructionAgent.cs +++ b/src/Hermeteus/BracketSystem/IInstructionAgent.cs @@ -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); } diff --git a/src/Hermeteus/BracketSystem/IInstructionArrowEnd.cs b/src/Hermeteus/BracketSystem/IInstructionArrowEnd.cs new file mode 100644 index 0000000..b09983f --- /dev/null +++ b/src/Hermeteus/BracketSystem/IInstructionArrowEnd.cs @@ -0,0 +1,8 @@ +using Godot; + +namespace Nocturnis.Hermeteus.BracketSystem; + +public interface IInstructionArrowEnd +{ + Marker2D EndMarker { get; } +} \ No newline at end of file diff --git a/src/Hermeteus/BracketSystem/IInstructionArrowManager.cs b/src/Hermeteus/BracketSystem/IInstructionArrowManager.cs new file mode 100644 index 0000000..fad0c42 --- /dev/null +++ b/src/Hermeteus/BracketSystem/IInstructionArrowManager.cs @@ -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); +} \ No newline at end of file diff --git a/src/Hermeteus/BracketSystem/IInstructionArrowStart.cs b/src/Hermeteus/BracketSystem/IInstructionArrowStart.cs new file mode 100644 index 0000000..db2beab --- /dev/null +++ b/src/Hermeteus/BracketSystem/IInstructionArrowStart.cs @@ -0,0 +1,8 @@ +using Godot; + +namespace Nocturnis.Hermeteus.BracketSystem; + +public interface IInstructionArrowStart +{ + Marker2D StartMarker { get; } +} \ No newline at end of file diff --git a/src/Hermeteus/BracketSystem/Processors/IBracketProcessor.cs b/src/Hermeteus/BracketSystem/Processors/IBracketProcessor.cs index c4ebf8c..a7d45eb 100644 --- a/src/Hermeteus/BracketSystem/Processors/IBracketProcessor.cs +++ b/src/Hermeteus/BracketSystem/Processors/IBracketProcessor.cs @@ -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); } diff --git a/src/Inventories/Items/IBaseItem.cs b/src/Inventories/Items/IBaseItem.cs index dd61ca5..8210efa 100644 --- a/src/Inventories/Items/IBaseItem.cs +++ b/src/Inventories/Items/IBaseItem.cs @@ -1,10 +1,11 @@ using Godot; +using Nocturnis.Godot; using Skeleton.Algebra; using Skeleton.Algebra.DimensionProviders; namespace Nocturnis.Inventories.Items; using R2 = CategoryOf.OnField.FVector; -public interface IBaseItem : INodeInterface +public interface IBaseItem : INode { StringName Status { get; set; } R2 ItemPosition { get; set; } diff --git a/src/Scenes/IRootScene.cs b/src/Scenes/IRootScene.cs index 8be9e55..9a60056 100644 --- a/src/Scenes/IRootScene.cs +++ b/src/Scenes/IRootScene.cs @@ -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; } } \ No newline at end of file diff --git a/src/Scenes/Worlds/IWorld.cs b/src/Scenes/Worlds/IWorld.cs index a894068..962d178 100644 --- a/src/Scenes/Worlds/IWorld.cs +++ b/src/Scenes/Worlds/IWorld.cs @@ -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; } } diff --git a/src/UIElements/ICorePanel.cs b/src/UIElements/ICorePanel.cs new file mode 100644 index 0000000..8659a73 --- /dev/null +++ b/src/UIElements/ICorePanel.cs @@ -0,0 +1,9 @@ +using Nocturnis.Godot; +using Nocturnis.Hermeteus.BracketSystem; + +namespace Nocturnis.UIElements; + +public interface ICorePanel : IControl, IInstructionArrowEnd +{ + +} \ No newline at end of file diff --git a/src/UIElements/IDashboardTab.cs b/src/UIElements/IDashboardTab.cs index e8e1f99..a7dbe9b 100644 --- a/src/UIElements/IDashboardTab.cs +++ b/src/UIElements/IDashboardTab.cs @@ -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 AllCommunicators { get; } void Init(); diff --git a/src/UIElements/IEngineSwitch.cs b/src/UIElements/IEngineSwitch.cs new file mode 100644 index 0000000..ae0dd4a --- /dev/null +++ b/src/UIElements/IEngineSwitch.cs @@ -0,0 +1,9 @@ +using Nocturnis.Godot; +using Nocturnis.Hermeteus.BracketSystem; + +namespace Nocturnis.UIElements; + +public interface IEngineSwitch : IControl, IInstructionArrowEnd +{ + +} \ No newline at end of file diff --git a/src/UIElements/Layers/IDashboardLayer.cs b/src/UIElements/Layers/IDashboardLayer.cs index 1285c1b..786653d 100644 --- a/src/UIElements/Layers/IDashboardLayer.cs +++ b/src/UIElements/Layers/IDashboardLayer.cs @@ -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; } diff --git a/src/UIElements/Layers/IInstructionLayer.cs b/src/UIElements/Layers/IInstructionLayer.cs index ebc706e..1d11f43 100644 --- a/src/UIElements/Layers/IInstructionLayer.cs +++ b/src/UIElements/Layers/IInstructionLayer.cs @@ -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(); diff --git a/src/UIElements/Layers/IWindowLayer.cs b/src/UIElements/Layers/IWindowLayer.cs index 0dbc75f..0bf3c6d 100644 --- a/src/UIElements/Layers/IWindowLayer.cs +++ b/src/UIElements/Layers/IWindowLayer.cs @@ -1,6 +1,8 @@ +using Nocturnis.Godot; + namespace Nocturnis.UIElements.Layers; -public interface IWindowLayer : INodeInterface +public interface IWindowLayer : INode { } \ No newline at end of file