bracket system
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="src\Configs\" />
|
||||
<Folder Include="src\Enigmos\Modules\SubModules\" />
|
||||
<Folder Include="src\GlobalManagement\" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -6,7 +6,7 @@ using Nocturnis.Enigmos.Modules;
|
||||
|
||||
namespace Nocturnis.Communicators;
|
||||
|
||||
public interface IBaseCommunicator
|
||||
public interface IBaseCommunicator : IControlNode
|
||||
{
|
||||
ICommunicateModule PairedModule { get; set; }
|
||||
DataVariable DataBuffer { get; set; }
|
||||
|
||||
@@ -5,6 +5,6 @@ namespace Nocturnis.Creatures.Characters;
|
||||
|
||||
public interface IPlayerCharacter : IBaseCharacter
|
||||
{
|
||||
IDashboardTab DashboardTab { get; set; }
|
||||
IPrimaryBoard MotherBoard { get; set; }
|
||||
IDashboardTab CurrentDashboardTab { get; set; }
|
||||
IPrimaryModuleBoard MotherBoard { get; set; }
|
||||
}
|
||||
8
src/Dashboards/IDashboard.cs
Normal file
8
src/Dashboards/IDashboard.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Nocturnis.Communicators;
|
||||
|
||||
namespace Nocturnis.Dashboards;
|
||||
|
||||
public interface IDashboard : INodeInterface
|
||||
{
|
||||
HashSet<IBaseCommunicator> Communicators { get; set; }
|
||||
}
|
||||
@@ -33,55 +33,55 @@ public class DataVariable
|
||||
public object Data { get; set; }
|
||||
public DataType Type { get; set; }
|
||||
//StringName? Type { get; set; }
|
||||
int Int
|
||||
public virtual int Int
|
||||
{
|
||||
get => (int)Data;
|
||||
set => Data = value;
|
||||
}
|
||||
|
||||
public double Real
|
||||
public virtual double Real
|
||||
{
|
||||
get => (double)Data;
|
||||
set => Data = value;
|
||||
}
|
||||
|
||||
public Complex Complex
|
||||
public virtual Complex Complex
|
||||
{
|
||||
get => (Complex)Data;
|
||||
set => Data = value;
|
||||
}
|
||||
|
||||
public DataVariable[] Array
|
||||
public virtual DataVariable[] Array
|
||||
{
|
||||
get => Data as DataVariable[];
|
||||
set => Data = value;
|
||||
}
|
||||
|
||||
public R2 R2
|
||||
public virtual R2 R2
|
||||
{
|
||||
get => Data as R2;
|
||||
set => Data = value;
|
||||
}
|
||||
|
||||
public C2 C2
|
||||
public virtual C2 C2
|
||||
{
|
||||
get => Data as C2;
|
||||
set => Data = value;
|
||||
}
|
||||
|
||||
public bool Bit
|
||||
public virtual bool Bit
|
||||
{
|
||||
get => (bool)Data;
|
||||
set => Data = value;
|
||||
}
|
||||
|
||||
public string String
|
||||
public virtual string String
|
||||
{
|
||||
get => Data as string;
|
||||
set => Data = value;
|
||||
}
|
||||
|
||||
public Dictionary<StringName, DataVariable> Struct
|
||||
public virtual Dictionary<StringName, DataVariable> Struct
|
||||
{
|
||||
get => Data as Dictionary<StringName, DataVariable>;
|
||||
set => Data = value;
|
||||
|
||||
22
src/DataStructures/Data/DefaultDataConst.cs
Normal file
22
src/DataStructures/Data/DefaultDataConst.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.Numerics;
|
||||
using Godot;
|
||||
using Skeleton.Algebra;
|
||||
using Skeleton.Algebra.DimensionProviders;
|
||||
|
||||
namespace Nocturnis.DataStructures.Data;
|
||||
using R2 = CategoryOf<IDim2>.OnField<double>.FVector;
|
||||
using C2 = CategoryOf<IDim2>.OnField<Complex>.FVector;
|
||||
|
||||
public class DefaultDataConst : DataVariable
|
||||
{
|
||||
public static DefaultDataConst Const = new();
|
||||
public override int Int => 0;
|
||||
public override double Real => 0;
|
||||
public override Complex Complex => 0;
|
||||
public override DataVariable[] Array => [];
|
||||
public override R2 R2 => new ();
|
||||
public override C2 C2 => new ();
|
||||
public override bool Bit => false;
|
||||
public override string String => "";
|
||||
public override Dictionary<StringName, DataVariable> Struct => new();
|
||||
}
|
||||
@@ -10,7 +10,12 @@ namespace Nocturnis.DataStructures;
|
||||
public class DataCache : CacheItem<DataVariable>
|
||||
{
|
||||
public new static DataCache Null => new (x => (null, DataTypeConstant.BaseDataTypes.Null));
|
||||
public DataCache(Func<CacheItem, DataVariable> rec) : base(rec) => throw new Exception("CONSTRUCTION NOT ALLOWED");
|
||||
|
||||
public DataCache(Func<CacheItem, DataVariable> rec)
|
||||
{
|
||||
Value = new DataVariable();
|
||||
ProxyCalculator = c => (rec(c).Data, rec(c).Type);
|
||||
}
|
||||
|
||||
public DataCache(Func<CacheItem, (object, DataType)> rec)
|
||||
{
|
||||
|
||||
25
src/DataStructures/DefaultDataCache.cs
Normal file
25
src/DataStructures/DefaultDataCache.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Nocturnis.DataStructures.Data;
|
||||
using Nocturnis.DataStructures.DataTypes;
|
||||
using Skeleton.DataStructure;
|
||||
|
||||
namespace Nocturnis.DataStructures;
|
||||
|
||||
public class DefaultDataCache : DataCache
|
||||
{
|
||||
public static readonly DefaultDataCache Default = new DefaultDataCache();
|
||||
|
||||
public DefaultDataCache() : base(cache => new DataVariable())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override DataVariable Get => DefaultDataConst.Const;
|
||||
|
||||
public DefaultDataCache(Func<CacheItem, DataVariable> rec) : base(rec)
|
||||
{
|
||||
}
|
||||
|
||||
public DefaultDataCache(Func<CacheItem, (object, DataType)> rec) : base(rec)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using Nocturnis.Enigmos.Modules;
|
||||
|
||||
namespace Nocturnis.Enigmos.Boards;
|
||||
|
||||
public interface IPrimaryBoard : IBaseBoard
|
||||
{
|
||||
IEngineModule Engine { get; set; }
|
||||
IRootModule Root { get; set; }
|
||||
}
|
||||
14
src/Enigmos/Boards/IPrimaryModuleBoard.cs
Normal file
14
src/Enigmos/Boards/IPrimaryModuleBoard.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Nocturnis.Creatures;
|
||||
using Nocturnis.Creatures.Characters;
|
||||
using Nocturnis.Enigmos.Modules;
|
||||
|
||||
namespace Nocturnis.Enigmos.Boards;
|
||||
|
||||
public interface IPrimaryModuleBoard : IBaseBoard
|
||||
{
|
||||
IEngineModule Engine { get; set; }
|
||||
IRootModule Root { get; set; }
|
||||
double IdlePower { get; }
|
||||
void Init(IBaseCreature player);
|
||||
void Start();
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public static class ECommunicateModule
|
||||
}
|
||||
|
||||
public static IBaseCommunicator[] CompatibleCommunicators(this ICommunicateModule module) =>
|
||||
CreatureControl.Instance.CurrentCharacter!.DashboardTab.AllCommunicators
|
||||
CreatureControl.Instance.CurrentCharacter!.CurrentDashboardTab.AllCommunicators
|
||||
.Where(module.IsMatch)
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
using Nocturnis.Enigmos.Ports.DataPorts.Directions;
|
||||
|
||||
namespace Nocturnis.Enigmos.Modules;
|
||||
|
||||
public static class ETerminalModule
|
||||
{
|
||||
public static void Consume(this ITerminalModule m)
|
||||
{
|
||||
foreach (IDataInPort p in m.Ports.OfType<IDataInPort>())
|
||||
{
|
||||
if (!p.Connected)
|
||||
{
|
||||
m.Finished = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
m.Drain();
|
||||
m.Finished = true;
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@ namespace Nocturnis.Enigmos.Ports.DataPorts.Directions;
|
||||
public interface IDataInPort : IDataPort
|
||||
{
|
||||
DataCache GetData { get; }
|
||||
new IDataOutPort? ConnectedPort { get; set; }
|
||||
new IDataOutPort ConnectedPort { get; set; }
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@ public interface IBasePort
|
||||
{
|
||||
Vector2 PositionToBoard { get; }
|
||||
bool Connected { get; }
|
||||
IBaseModule? Module { get; set; }
|
||||
IBaseModule Module { get; set; }
|
||||
bool IsMatch(IBasePort oth);
|
||||
IBasePort? ConnectedPort { get; set; }
|
||||
IBasePort ConnectedPort { get; set; }
|
||||
void SetStatusConnected();
|
||||
void SetStatusNormal();
|
||||
void SetStatusPending();
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Nocturnis.Enigmos.Ports.SignalPorts.Directions;
|
||||
public interface ISignalOutPort : ISignalPort
|
||||
{
|
||||
new IRoutingModule Module { get; set; }
|
||||
new ISignalInPort? ConnectedPort { get; set; }
|
||||
new ISignalInPort ConnectedPort { get; set; }
|
||||
void Route();
|
||||
|
||||
}
|
||||
@@ -19,5 +19,5 @@ public class CreatureControl
|
||||
{
|
||||
}
|
||||
|
||||
public IPlayerCharacter? CurrentCharacter { get; set; }
|
||||
public IPlayerCharacter CurrentCharacter { get; set; }
|
||||
}
|
||||
@@ -24,14 +24,22 @@ public class EnigmosControl
|
||||
|
||||
public void ShutDownEngine()
|
||||
{
|
||||
GlobalProvider.SceneProvider.RootScene.EngineSwitch.TextureNormal =
|
||||
GlobalProvider.TextureProvider.EngineSwitchOff;
|
||||
EngineUp = false;
|
||||
}
|
||||
|
||||
public void PowerUpEngine()
|
||||
{
|
||||
CreatureControl.Instance.CurrentCharacter.MotherBoard.Reset();
|
||||
GlobalProvider.SceneProvider.RootScene.EngineSwitch.TextureNormal =
|
||||
GlobalProvider.TextureProvider.EngineSwitchOn;
|
||||
EngineUp = true;
|
||||
}
|
||||
|
||||
public double Energy { get; set; } = 0d;
|
||||
public bool EngineUp { get; private set; }
|
||||
public double IdlePower => CreatureControl.Instance.CurrentCharacter.MotherBoard.IdlePower + VoidPower;
|
||||
public double VoidPower { get; set; } = 0;
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ public static class GlobalProvider
|
||||
public static IPolymorphismProvider PolymorphismProvider { get; set; }
|
||||
public static IDataTypeProvider DataTypeProvider { get; set; }
|
||||
public static IProcessProvider ProcessProvider { get; set; }
|
||||
public static ITextureProvider TextureProvider { get; set; }
|
||||
|
||||
public static class ModulePreviewMapper<TModule>
|
||||
where TModule : IBaseModule
|
||||
|
||||
@@ -4,5 +4,6 @@ namespace Nocturnis.GlobalManagement.Providers;
|
||||
|
||||
public interface ISceneProvider
|
||||
{
|
||||
IRootScene? RootScene { get; set; }
|
||||
IRootScene RootScene { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ namespace Nocturnis.GlobalManagement.Providers;
|
||||
|
||||
public interface ITextureProvider
|
||||
{
|
||||
Texture2D ModuleTextureMapper(IBaseModule module);
|
||||
Texture2D ItemTextureMapper(IBaseItem item);
|
||||
}
|
||||
Texture2D EngineSwitchOn { get; set; }
|
||||
Texture2D EngineSwitchOff { get; set; }
|
||||
Texture2D LEDOn { get; set; }
|
||||
Texture2D LEDOff { get; set; }
|
||||
}
|
||||
|
||||
14
src/Hermeteus/IBracketChapter.cs
Normal file
14
src/Hermeteus/IBracketChapter.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Skeleton.DataStructure.Tree;
|
||||
|
||||
namespace Nocturnis.Hermeteus;
|
||||
|
||||
public interface IBracketChapter : IBracketRouter
|
||||
{
|
||||
IBracketStory Story { get; set; }
|
||||
string State { get; set; }
|
||||
bool Finished { get; set; }
|
||||
string Chapter { get; set; }
|
||||
IBracketTopic CurrentTopic { get; set; }
|
||||
HashSet<IBracketTopic> Children { get; set; }
|
||||
HashSet<ICondition> Conditions { get; set; }
|
||||
}
|
||||
6
src/Hermeteus/IBracketRouter.cs
Normal file
6
src/Hermeteus/IBracketRouter.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Nocturnis.Hermeteus;
|
||||
|
||||
public interface IBracketRouter
|
||||
{
|
||||
IBracketRouter Route();
|
||||
}
|
||||
9
src/Hermeteus/IBracketStory.cs
Normal file
9
src/Hermeteus/IBracketStory.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using Skeleton.DataStructure.Tree;
|
||||
|
||||
namespace Nocturnis.Hermeteus;
|
||||
|
||||
public interface IBracketStory : IBracketRouter
|
||||
{
|
||||
IBracketChapter CurrentChapter { get; set; }
|
||||
IBracketChapter[] Children { get; set; }
|
||||
}
|
||||
17
src/Hermeteus/IBracketTalk.cs
Normal file
17
src/Hermeteus/IBracketTalk.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Godot;
|
||||
|
||||
namespace Nocturnis.Hermeteus;
|
||||
|
||||
public interface IBracketTalk : IBracketRouter
|
||||
{
|
||||
IBracketTopic Topic { get; set; }
|
||||
string TriggerStatus { get; set; }
|
||||
string EnterStatus { get; set; }
|
||||
double TriggerEsc { get; set; }
|
||||
bool CleanPrevious { get; set; }
|
||||
string[] BraLines { get; set; }
|
||||
string[] KetLines { get; set; }
|
||||
HashSet<ICondition> Conditions { get; set; }
|
||||
Vector2[] ArrowMarkers { get; set; }
|
||||
bool Finished { get; set; }
|
||||
}
|
||||
13
src/Hermeteus/IBracketTopic.cs
Normal file
13
src/Hermeteus/IBracketTopic.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Skeleton.DataStructure.Tree;
|
||||
|
||||
namespace Nocturnis.Hermeteus;
|
||||
|
||||
public interface IBracketTopic : IBracketRouter
|
||||
{
|
||||
IBracketChapter Chapter { get; set; }
|
||||
string Topic { get; set; }
|
||||
bool Finished { get; set; }
|
||||
HashSet<IBracketTalk> Children { get; set; }
|
||||
IBracketTalk CurrentTalk { get; set; }
|
||||
HashSet<ICondition> Conditions { get; set; }
|
||||
}
|
||||
6
src/Hermeteus/ICondition.cs
Normal file
6
src/Hermeteus/ICondition.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Nocturnis.Hermeteus;
|
||||
|
||||
public interface ICondition
|
||||
{
|
||||
Func<bool> Check { get; set; }
|
||||
}
|
||||
16
src/Hermeteus/Processors/IBracketProcessor.cs
Normal file
16
src/Hermeteus/Processors/IBracketProcessor.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Nocturnis.UIElements;
|
||||
|
||||
namespace Nocturnis.Hermeteus.Processors;
|
||||
|
||||
public interface IBracketProcessor
|
||||
{
|
||||
IInstructionHint Bra { get; }
|
||||
IInstructionHint Ket { get; }
|
||||
void BraCallback();
|
||||
void KetCallback();
|
||||
bool BraFinished { get; set; }
|
||||
bool KetFinished { get; set; }
|
||||
double BracketEsc { get; set; }
|
||||
string Status { get; set; }
|
||||
void Process(double delta);
|
||||
}
|
||||
9
src/IControlNode.cs
Normal file
9
src/IControlNode.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using Godot;
|
||||
|
||||
namespace Nocturnis;
|
||||
|
||||
public interface IControlNode : INodeInterface
|
||||
{
|
||||
Vector2 Position { get; set; }
|
||||
Vector2 Size { get; set; }
|
||||
}
|
||||
@@ -4,5 +4,7 @@ namespace Nocturnis;
|
||||
|
||||
public interface INodeInterface
|
||||
{
|
||||
|
||||
}
|
||||
void RemoveChild(Node node);
|
||||
void AddChild(Node node, bool forceReadableName = false, Node.InternalMode @internal = (Node.InternalMode)(0));
|
||||
bool Visible { get; set; }
|
||||
}
|
||||
|
||||
@@ -4,5 +4,5 @@ namespace Nocturnis.Inventories.ItemSlots.ItemSlots;
|
||||
|
||||
public interface IChemicalItemSlot
|
||||
{
|
||||
IBaseChemicalItem? Item { get; set; }
|
||||
IBaseChemicalItem Item { get; set; }
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using Godot;
|
||||
using Nocturnis.UIElements;
|
||||
using Nocturnis.UIElements.Layers;
|
||||
|
||||
namespace Nocturnis.Scenes;
|
||||
|
||||
@@ -7,4 +8,8 @@ public interface IRootScene
|
||||
{
|
||||
void ChangeScene(Node scene);
|
||||
IKeyListener KeyListener { get; set; }
|
||||
TextureButton EngineSwitch { get; set; }
|
||||
IWindowLayer WindowLayer { get; set; }
|
||||
IInstructionHint Bra { get; set; }
|
||||
IInstructionHint Ket { get; set; }
|
||||
}
|
||||
9
src/Scenes/Worlds/IWorld.cs
Normal file
9
src/Scenes/Worlds/IWorld.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using Godot;
|
||||
using Nocturnis.UIElements.Layers;
|
||||
|
||||
namespace Nocturnis.Scenes.Worlds;
|
||||
|
||||
public interface IWorld : INodeInterface
|
||||
{
|
||||
IDashboardLayer DashboardLayer { get; set; }
|
||||
}
|
||||
@@ -1,8 +1,12 @@
|
||||
using Nocturnis.Communicators;
|
||||
using Nocturnis.Dashboards;
|
||||
|
||||
namespace Nocturnis.UIElements;
|
||||
|
||||
public interface IDashboardTab
|
||||
public interface IDashboardTab : INodeInterface
|
||||
{
|
||||
IEnumerable<IBaseCommunicator> AllCommunicators { get; }
|
||||
void Init();
|
||||
void AddDashboard(IDashboard dashboard);
|
||||
bool[] Used { get; set; }
|
||||
}
|
||||
9
src/UIElements/IInstructionHint.cs
Normal file
9
src/UIElements/IInstructionHint.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Nocturnis.UIElements;
|
||||
|
||||
public interface IInstructionHint : INodeInterface
|
||||
{
|
||||
void Load(string content);
|
||||
void Load(string content, Action callBack);
|
||||
void Clean();
|
||||
void Clean(Action callBack);
|
||||
}
|
||||
9
src/UIElements/Layers/IDashboardLayer.cs
Normal file
9
src/UIElements/Layers/IDashboardLayer.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using Godot;
|
||||
|
||||
namespace Nocturnis.UIElements.Layers;
|
||||
|
||||
public interface IDashboardLayer : INodeInterface
|
||||
{
|
||||
IDashboardTab DashboardTab { get; set; }
|
||||
|
||||
}
|
||||
6
src/UIElements/Layers/IWindowLayer.cs
Normal file
6
src/UIElements/Layers/IWindowLayer.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Nocturnis.UIElements.Layers;
|
||||
|
||||
public interface IWindowLayer : INodeInterface
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user