Compare commits

..

10 Commits

Author SHA1 Message Date
532a8a795b move to new git server 2025-01-19 13:54:30 +00:00
7ae3c9d374 Instruction System 2024-09-29 15:39:37 +01:00
67dd8ac8dc Bracket System 2024-09-26 10:29:27 +01:00
a9afe94ebc Bracket System & Godot Upgrade To 4.3 RC1 2024-07-30 17:59:52 +01:00
bae0a52e3f bracket system 2024-07-29 17:24:31 +01:00
5fbbbe83a1 To net8.0 2024-07-13 09:29:45 +01:00
574d00d4b7 Upgrade 2024-07-12 14:32:16 +01:00
f59c6edc39 Update 2024-07-11 12:54:28 +01:00
5b46cce212 Data Type 2024-07-11 11:21:29 +01:00
2955aaf1db source generator upgrade 2024-07-10 15:27:36 +01:00
108 changed files with 1154 additions and 242 deletions

7
BaseTypes Normal file
View File

@@ -0,0 +1,7 @@
Null
Real
Complex
Int
Bit
R2
C2

View File

@@ -0,0 +1,4 @@
ModuleRealValueParameterSetter,DoubleParameter
ModuleBoolValueParameterSetter,BoolParameter
ModuleCharValueParameterSetter,CharParameter
ModuleKeyValueParameterSetter,KeyParameter

6
ModuleTabs Normal file
View File

@@ -0,0 +1,6 @@
PortMaintenanceTab,BaseModule
ModuleParameterTab,ParameterizedModule
ModulePolymorphismTab,PolymorphismModule
CommunicatorPairTab,CommunicateModule
ProgrammableModuleSettingTab,ProgrammableModule
ErrorHandlerTab,ErrorHandlerModule

View File

@@ -1,22 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Godot.NET.Sdk/4.4.0-beta.1">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<EnableDynamicLoading>true</EnableDynamicLoading>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Nullable>disable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GodotSharp" Version="4.3.0-beta.2" />
<PackageReference Include="GodotSharp" Version="4.4.0-beta.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Nocturnis.Generators\Nocturnis.Generators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference Include="..\VirtualChemistry\VirtualChemistry.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="src\Configs\" />
<Folder Include="src\Enigmos\Modules\SubModules\" />
<Folder Include="src\GlobalManagement\" />
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="BaseTypes"/>
</ItemGroup>
</Project>

View File

@@ -1,6 +0,0 @@
namespace Nocturnis.Attributes;
[AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class)]
public class DirectAsset : Attribute
{
}

6
src/Attributes/Expose.cs Normal file
View File

@@ -0,0 +1,6 @@
namespace Nocturnis.Attributes;
[AttributeUsage(AttributeTargets.Method)]
public class Expose : Attribute
{
}

View File

@@ -1,6 +1,6 @@
namespace Nocturnis.Attributes;
[AttributeUsage(AttributeTargets.Class)]
public class UniqueInheritance : Attribute
public class Installer :Attribute
{
}

View File

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

View File

@@ -0,0 +1,16 @@
namespace Nocturnis.BracketSystem;
public interface IBracketLine
{
string Topic { get; set; }
string Line { get; set; }
bool CleanPrevious { get; set; }
string[] BraLines { get; set; }
string[] KetLines { get; set; }
string[] ArrowMarkers { get; set; }
string[] Conditions { get; set; }
HashSet<IBracketLine> Successors { get; set; }
bool IsReady { get; }
float Delay { get; }
}

View File

@@ -0,0 +1,13 @@
namespace Nocturnis.BracketSystem;
public interface IBracketTopic
{
bool Reusable { get; set; }
string Topic { get; set; }
bool Finished { get; set; }
IBracketLine Root { get; set; }
IBracketLine CurrentLine { get; set; }
void Activate();
void Finish();
Dictionary<string, IBracketLine> LineMap { get; set; }
}

View File

@@ -0,0 +1,11 @@
using Nocturnis.Godot;
using Nocturnis.UIElements.Layers;
namespace Nocturnis.BracketSystem;
public interface IInstructionAgent : INode
{
void Load(string content, Action callBack);
void Clean(Action callBack);
void Init(IInstructionLayer insLayer);
}

View File

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

View File

@@ -0,0 +1,10 @@
using Nocturnis.UIElements.Layers;
namespace Nocturnis.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.BracketSystem;
public interface IInstructionArrowStart
{
Marker2D StartMarker { get; }
}

View File

@@ -0,0 +1,15 @@
namespace Nocturnis.BracketSystem.Processors;
public interface IBracketProcessor
{
IInstructionAgent Bra { get; set; }
IInstructionAgent Ket { get; set; }
void BraCallback();
void KetCallback();
bool BraFinished { get; set; }
bool KetFinished { get; set; }
double BracketEsc { get; set; }
string Status { get; set; }
void Init(IInstructionAgent bra, IInstructionArrowManager pointer, IInstructionAgent ket);
void SyncLoad(IBracketLine talk);
}

View File

@@ -1,14 +1,17 @@
using Godot;
using Nocturnis.DataStructures;
using Nocturnis.DataStructures.Data;
using Nocturnis.DataStructures.DataTypes;
using Nocturnis.Enigmos.Modules;
using Nocturnis.Godot;
namespace Nocturnis.Communicators;
public interface IBaseCommunicator
public interface IBaseCommunicator : IControl
{
ICommunicateModule PairedModule { get; set; }
IData DataBuffer { get; set; }
StringName CommunicationDataType { get; }
DataVariable DataBuffer { get; set; }
DataType CommunicationDataType { get; }
StringName CommunicationDirection { get; }
Texture2D IconTexture { get; }
string CustomName { get; set; }

View File

@@ -0,0 +1,11 @@
using Nocturnis.DataStructures.States;
namespace Nocturnis.Controls;
public interface IStateControl
{
string this[string path] { get; set; }
void Load();
void Save();
public void AddRule(string path, StateTransferRule rule);
}

View File

@@ -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; }
}

View File

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

View File

@@ -4,5 +4,5 @@ public interface IDoubleParameter : IConfigurableParameter<double>
{
double MinValue { get; set; }
double MaxValue { get; set; }
double Step { get; set; }
double Step { get; }
}

View File

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

View File

@@ -0,0 +1,89 @@
using System.Numerics;
using Godot;
using Nocturnis.DataStructures.DataTypes;
using Nocturnis.GlobalManagement.Constants;
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 DataVariable
{
public DataVariable()
{
Data = null;
Type = new DataType();
Type.Assign(DataTypeConstant.BaseDataTypes.Null);
}
public void Assign(DataVariable oth)
{
Data = oth.Data;
Type.Assign(oth.Type);
}
public void Assign(object v, DataType t)
{
Data = v;
Type.Assign(t);
}
public object Data { get; set; }
public DataType Type { get; set; }
//StringName? Type { get; set; }
public virtual int Int
{
get => (int)Data;
set => Data = value;
}
public virtual double Real
{
get => (double)Data;
set => Data = value;
}
public virtual Complex Complex
{
get => (Complex)Data;
set => Data = value;
}
public virtual DataVariable[] Array
{
get => Data as DataVariable[];
set => Data = value;
}
public virtual R2 R2
{
get => Data as R2;
set => Data = value;
}
public virtual C2 C2
{
get => Data as C2;
set => Data = value;
}
public virtual bool Bit
{
get => (bool)Data;
set => Data = value;
}
public virtual string String
{
get => Data as string;
set => Data = value;
}
public virtual Dictionary<StringName, DataVariable> Struct
{
get => Data as Dictionary<StringName, DataVariable>;
set => Data = value;
}
}

View 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();
}

View File

@@ -1,30 +1,38 @@
using Godot;
using Nocturnis.DataStructures.Data;
using Nocturnis.DataStructures.DataTypes;
using Nocturnis.GlobalManagement.Constants;
using Nocturnis.GlobalManagement.Providers;
using Skeleton.DataStructure;
namespace Nocturnis.DataStructures;
public class DataCache : CacheItem<IData>
public class DataCache : CacheItem<DataVariable>
{
public new static DataCache Null => new DataCache(x => (0, ""));
public DataCache(Func<CacheItem?, IData> rec) : base(rec) => throw new Exception("CONSTRUCTION NOT ALLOWED");
public new static DataCache Null => new (x => (null, DataTypeConstant.BaseDataTypes.Null));
public DataCache(Func<CacheItem?, (object, StringName)> rec)
public DataCache(Func<CacheItem, DataVariable> rec)
{
Value = GlobalProvider.DataStructureProvider!.NewData(0, "");
Value = new DataVariable();
ProxyCalculator = c => (rec(c).Data, rec(c).Type);
}
public DataCache(Func<CacheItem, (object, DataType)> rec)
{
Value = new DataVariable();
ProxyCalculator = rec;
}
private new Func<CacheItem, (object, StringName)> ProxyCalculator { get; set; }
private new Func<CacheItem, (object, DataType)> ProxyCalculator { get; set; }
public override IData? Get
public override DataVariable Get
{
get
{
if (Expired)
{
(object val, StringName type) = ProxyCalculator(this);
Value!.Type = type;
(object val, DataType type) = ProxyCalculator(this);
Value!.Type.Assign(type);
Value.Data = val;
}
@@ -32,7 +40,7 @@ public class DataCache : CacheItem<IData>
}
}
public void UpdateCalculation(Func<CacheItem, (object, StringName)> rec)
public void UpdateCalculation(Func<CacheItem, (object, DataType)> rec)
{
Expire();
foreach (CacheItem item in Dependencies)

View File

@@ -1,6 +1,8 @@
using Nocturnis.Enigmos.Ports.DataPorts.Directions;
namespace Nocturnis.DataStructures.DataPortGroups;
public interface IDataInGroup : IDataPortGroup, IEnumerable<IDataInGroup>
public interface IDataInGroup : IDataPortGroup, IEnumerable<IDataInPort>
{
}

View File

@@ -1,11 +1,14 @@
using Godot;
using Nocturnis.DataStructures.DataTypeOptions;
using Nocturnis.DataStructures.DataTypes;
namespace Nocturnis.DataStructures.DataPortGroups;
public interface IDataPortGroup
{
StringName SelectedType { get; set; }
StringName[] TypeOptions { get; set; }
DataType SelectedType { get; set; }
DataTypeOption TypeOptions { get; set; }
void Inference();
string Description { get; set; }
}

View File

@@ -0,0 +1,46 @@
using Nocturnis.DataStructures.DataTypes;
using Nocturnis.GlobalManagement.Constants;
using Nocturnis.GlobalManagement.Providers;
namespace Nocturnis.DataStructures.DataTypeOptions;
public class DataTypeOption : List<DataType>
{
public DataTypeOption(params DataType[] options) : base(options)
{
}
public DataTypeOption()
{
}
public new bool Contains(DataType type)
{
if (Count == 0)
return true;
DataType t = this.First();
if (
Count == 1 &&
t == DataType.ArrayDataType(DataTypeConstant.BaseDataTypes.Null) &&
type.Type == DataTypeConstant.NestedDataTypeNames.Array
)
return true;
if (
Count == 1 &&
t == DataType.StructDataType(null) &&
type.Type == DataTypeConstant.NestedDataTypeNames.Struct
)
return true;
return base.Contains(type);
}
public DataTypeOption Union(DataTypeOption oth)
{
DataTypeOption res = new();
foreach (DataType t in this)
res.Add(t);
foreach (DataType t in oth)
res.Add(t);
return res;
}
}

View File

@@ -0,0 +1,111 @@
using Godot;
using Nocturnis.GlobalManagement.Constants;
namespace Nocturnis.DataStructures.DataTypes;
public class DataType
{
public static DataType ArrayDataType(DataType elementType) => new()
{
Type = DataTypeConstant.NestedDataTypeNames.Array,
ElementType = new DataType(elementType)
};
public static DataType StructDataType(StringName structName) => new()
{
Type = DataTypeConstant.NestedDataTypeNames.Struct,
StructName = structName
};
public static DataType BaseDataType(StringName baseType) => new()
{
Type = baseType
};
public static DataType AutoDataType() => new()
{
Type = DataTypeConstant.BaseDataTypeNames.Null,
Auto = true
};
public static DataType AutoArrayType() => new()
{
Type = DataTypeConstant.NestedDataTypeNames.Array,
ElementType = AutoDataType()
};
public static DataType AutoStructType() => new()
{
Type = DataTypeConstant.NestedDataTypeNames.Struct,
Auto = true,
StructName = null
};
public bool Equals(DataType other)
{
return this == other;
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((DataType)obj);
}
public override int GetHashCode() => Signature.GetHashCode();
public DataType(StringName baseType, bool auto = false)
{
Type = baseType;
ElementType = DataTypeConstant.BaseDataTypes.Null;
}
public DataType(DataType oth)
{
Type = oth.Type;
if (Type == DataTypeConstant.NestedDataTypeNames.Array)
ElementType = new DataType(oth.ElementType);
else
ElementType = null;
if (Type == DataTypeConstant.NestedDataTypeNames.Struct)
StructName = oth.StructName;
}
public DataType()
{
}
public StringName Type { get; set; }
public StringName StructName { get; set; }
public DataType ElementType { get; set; }
public bool Auto { get; set; } = false;
public string Signature
{
get
{
if (Type == DataTypeConstant.NestedDataTypeNames.Array)
return Type + $"<{ElementType!.Signature}>";
if (Type == DataTypeConstant.NestedDataTypeNames.Struct)
return Type + $"[{StructName}]";
return Type;
}
}
public static bool operator ==(DataType a, DataType b) => a?.Signature == b?.Signature;
public static bool operator !=(DataType a, DataType b) => a?.Signature != b?.Signature;
public void Assign(DataType oth)
{
Type = oth.Type;
if (ElementType == null)
ElementType = new();
if(Type == DataTypeConstant.NestedDataTypeNames.Array)
ElementType.Assign(oth.ElementType);
StructName = oth.StructName;
}
}

View 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)
{
}
}

View File

@@ -0,0 +1,35 @@
namespace Nocturnis.DataStructures;
public class DoubleKeyDictionary<TKey, TValue> : Dictionary<TKey, Dictionary<TKey, TValue>>
{
public DoubleKeyDictionary(TValue defaultValue)
{
DefaultValue = defaultValue;
}
private TValue DefaultValue { get; set; }
public TValue this[TKey pk1, TKey pk2]
{
get
{
try
{
return this[pk1][pk2];
}
catch (KeyNotFoundException)
{
return DefaultValue;
}
}
set
{
if(!ContainsKey(pk1))
this[pk1] = new Dictionary<TKey, TValue>();
this[pk1][pk2] = value;
}
}
public bool ContainsKey(TKey pk1, TKey pk2) => ContainsKey(pk1) && this[pk1].ContainsKey(pk2);
}

View File

@@ -1,25 +0,0 @@
using Godot;
using System.Numerics;
using Skeleton.Algebra;
using Skeleton.Algebra.DimensionProviders;
namespace Nocturnis.DataStructures;
using R2 = CategoryOf<IDim2>.OnField<double>.FVector;
using C2 = CategoryOf<IDim2>.OnField<Complex>.FVector;
public interface IData
{
public void Assign(IData oth);
public void Assign(object v, StringName t);
object? Data { get; set; }
StringName? Type { get; set; }
int Int { get; set; }
double Double { get; set; }
Complex Complex { get; set; }
IData[] Array { get; set; }
R2 R2 { get; set; }
C2 C2 { get; set; }
bool Bit { get; set; }
StringName String { get; set; }
IStruct Struct { get; set; }
}

View File

@@ -1,9 +0,0 @@
using Godot;
namespace Nocturnis.DataStructures;
public interface IStruct : IData
{
StringName TypeName { get; set; }
Dictionary<StringName, IData> Properties { get; set; }
}

View File

@@ -1,9 +0,0 @@
using Godot;
namespace Nocturnis.DataStructures;
public interface IVariantWithType
{
Variant UnderlyingData { get; set; }
string TypeHint { get; set; }
}

View File

@@ -0,0 +1,3 @@
namespace Nocturnis.DataStructures.States;
public delegate bool StateTransferRule (string path, string fromState, string toState);

View File

@@ -0,0 +1,14 @@
using Godot;
namespace Nocturnis.DataStructures;
public partial class VariantWithType : Resource
{
public VariantWithType(StringName typeHint, Variant underlyingData)
{
TypeHint = typeHint;
UnderlyingData = underlyingData;
}
public StringName TypeHint { get; set; }
public Variant UnderlyingData { get; set; }
}

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,23 +1,26 @@
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
public interface IBaseBoard : INode
{
IPanelViewer? PanelViewer { get; set; }
IPanelViewer PanelViewer { get; set; }
IEnumerable<IBasePort> OnBoardPorts { get; }
IBasePort? ConnectPending { get; set; }
IBasePort ConnectPending { get; set; }
Dictionary<IBasePort, IBaseCable> CablePairing { get; set; }
void AddCable(IBaseCable cable);
HashSet<IBaseCable> FocusedCables { get; set; }
bool ManualOpened { get; set; }
bool CableVisualMode { get; set; }
IModuleManualLayer? ModuleManualLayer { get; set; }
IModuleMovingLayer? ModuleMovingLayer { get; set; }
IModuleManualLayer ModuleManualLayer { get; set; }
IModuleMovingLayer ModuleMovingLayer { get; set; }
void Reset();
void SetCableVisualMode(bool mode);
void SetLabelVisualMode(bool mode);
public IEnumerable<ITerminalModule> TerminalModules { get; }
}

View File

@@ -1,8 +0,0 @@
using Nocturnis.Enigmos.Modules;
namespace Nocturnis.Enigmos.Boards;
public interface IPrimaryBoard : IBaseBoard
{
IEngineModule Engine { get; set; }
}

View 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();
}

View File

@@ -0,0 +1,12 @@
using Godot;
using Nocturnis.Enigmos.Modules;
using Nocturnis.Godot;
namespace Nocturnis.Enigmos.ModuleManuals;
public interface IModuleManual : INode
{
Vector2 Size { get; set; }
Vector2 Position { get; set; }
void Init(IBaseModule m);
}

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

@@ -0,0 +1,8 @@
using Nocturnis.DataStructures.DataPortGroups;
namespace Nocturnis.Enigmos.ModuleManuals;
public interface IPortTypeSelector
{
void Init(IDataPortGroup g);
}

View File

@@ -1,4 +1,5 @@
using Nocturnis.DataStructures;
using Nocturnis.DataStructures.Data;
using Nocturnis.Enigmos.Ports.DataPorts.Directions;
using Skeleton.DataStructure;
@@ -6,8 +7,8 @@ namespace Nocturnis.Enigmos.Modules.ComputationalModules;
public static class EBinaryComputationalModule
{
public static IData X(this IBinaryComputationalModule p, CacheItem x) => p.DataInPorts[0].GetData.GetFrom(x)!;
public static IData Y(this IBinaryComputationalModule p, CacheItem x) => p.DataInPorts[1].GetData.GetFrom(x)!;
public static DataVariable X(this IBinaryComputationalModule p, CacheItem x) => p.DataInPorts[0].GetData.GetFrom(x)!;
public static DataVariable Y(this IBinaryComputationalModule p, CacheItem x) => p.DataInPorts[1].GetData.GetFrom(x)!;
public static void BinaryInit(this IBinaryComputationalModule p)
{

View File

@@ -1,4 +1,5 @@
using Godot;
using Nocturnis.DataStructures.DataTypes;
using Nocturnis.Enigmos.Ports.DataPorts.Directions;
using Skeleton.DataStructure;
@@ -6,13 +7,13 @@ namespace Nocturnis.Enigmos.Modules.ComputationalModules;
public static class EDuplicateOutputModule
{
public static void Define(this IDuplicateOutputModule m, Func<CacheItem, (object, StringName)> define)
public static void Define(this IDuplicateOutputModule m, Func<CacheItem, (object, DataType)> define)
{
foreach (IDataOutPort op in m.DataOutPorts)
op.OutData.UpdateCalculation(define);
}
public static void SetOutputType(this IDuplicateOutputModule m, StringName type)
public static void SetOutputType(this IDuplicateOutputModule m, DataType type)
{
foreach (IDataOutPort op in m.DataOutPorts)
op.SetDataType(type);

View File

@@ -7,9 +7,9 @@ public static class ELogicModule
{
public static void LogicModuleInit(this ILogicModule lm)
{
foreach (IDataOutPort op in lm.DataOutPorts)
op.SetDataType(EnigmosConstant.DataPortTypes.Bit);
foreach (IDataInPort ip in lm.DataInPorts)
ip.SetDataType(EnigmosConstant.DataPortTypes.Bit);
//foreach (IDataOutPort op in lm.DataOutPorts)
// op.SetDataType(DataTypeConstant.BaseDataTypes.Bit);
//foreach (IDataInPort ip in lm.DataInPorts)
// ip.SetDataType(DataTypeConstant.BaseDataTypes.Bit);
}
}

View File

@@ -1,11 +1,12 @@
using Godot;
using Nocturnis.DataStructures.DataTypes;
using Nocturnis.Enigmos.Ports.DataPorts.Directions;
namespace Nocturnis.Enigmos.Modules.ComputationalModules;
public static class EOperationModule
{
public static void SetInputType(this IOperationModule m, StringName type)
public static void SetInputType(this IOperationModule m, DataType type)
{
foreach (IDataInPort ip in m.DataInPorts)
ip.SetDataType(type);

View File

@@ -1,14 +1,15 @@
using Nocturnis.DataStructures;
using Nocturnis.DataStructures.Data;
using Skeleton.DataStructure;
namespace Nocturnis.Enigmos.Modules.ComputationalModules;
public static class ETernaryComputationalModule
{
public static IData X(this ITernaryComputationalModule m, CacheItem cache) =>
public static DataVariable X(this ITernaryComputationalModule m, CacheItem cache) =>
m.DataOutPorts[0].OutData.GetFrom(cache)!;
public static IData Y(this ITernaryComputationalModule m, CacheItem cache) =>
public static DataVariable Y(this ITernaryComputationalModule m, CacheItem cache) =>
m.DataOutPorts[1].OutData.GetFrom(cache)!;
public static IData Z(this ITernaryComputationalModule m, CacheItem cache) =>
public static DataVariable Z(this ITernaryComputationalModule m, CacheItem cache) =>
m.DataOutPorts[2].OutData.GetFrom(cache)!;
}

View File

@@ -1,10 +1,11 @@
using Nocturnis.DataStructures;
using Nocturnis.DataStructures.Data;
using Skeleton.DataStructure;
namespace Nocturnis.Enigmos.Modules.ComputationalModules;
public static class EUnaryComputationalModule
{
public static IData X(this IUnaryComputationalModule m, CacheItem cache) =>
public static DataVariable X(this IUnaryComputationalModule m, CacheItem cache) =>
m.DataOutPorts[0].OutData.GetFrom(cache)!;
}

View File

@@ -14,6 +14,6 @@ public static class EBaseModule
return port;
}
throw new Exception("NOT A PORT");
throw new Exception($"NOT A PORT {typeof(TPort)}");
}
}

View File

@@ -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();
}

View File

@@ -1,4 +1,5 @@
using Nocturnis.Enigmos.Ports.SignalPorts.Directions;
using Nocturnis.GlobalManagement.Controls;
namespace Nocturnis.Enigmos.Modules;
@@ -10,4 +11,15 @@ public static class EControllingModule
for (int i = 1; i <= sI; i++)
m.SignalInPorts[i - 1] = m.GetPort<ISignalInPort>($"{prefix}{i}");
}
}
public static void Visit(this IControllingModule m)
{
if (m.Visited)
{
EnigmosControl.Instance.RootModule.ActionFinished = true;
return;
}
m.Execute();
m.Visited = true;
}
}

View File

@@ -6,9 +6,15 @@ public static class ETerminalModule
{
public static void Consume(this ITerminalModule m)
{
foreach (IDataInPort ip in m.DataInPorts)
if(ip.GetData.Expired)
_ = ip.GetData.Get;
foreach (IDataInPort p in m.Ports.OfType<IDataInPort>())
{
if (!p.Connected)
{
m.Finished = true;
return;
}
}
m.Drain();
m.Finished = true;
}
}

View File

@@ -1,26 +1,26 @@
using Godot;
using Nocturnis.Enigmos.Boards;
using Nocturnis.Enigmos.ModuleManuals;
using Nocturnis.Enigmos.Ports;
using Nocturnis.UIElements;
namespace Nocturnis.Enigmos.Modules;
public interface IBaseModule
{
Texture2D? PreviewTexture { get; }
Texture2D PreviewTexture { get; }
IEnumerable<IBasePort> Ports { get; }
IBaseBoard? Board { get; set; }
IBaseBoard Board { get; set; }
Vector2 PositionToBoard { get; }
Vector2 Size { get; set; }
double MaintenanceAlpha { get; }
double MaintenanceBeta { get; }
string GetDescription { get; }
Label? Label { get; }
Label Label { get; }
Node AsNode { get; }
Vector2 Position { get; set; }
string LabelString { get; set; }
void UpdateCables();
Node GetNode(NodePath path);
void Init();
IModuleManual Manual { get; set; }
}

View File

@@ -1,13 +1,15 @@
using Godot;
using Nocturnis.Communicators;
using Nocturnis.DataStructures;
using Nocturnis.DataStructures.Data;
using Nocturnis.DataStructures.DataTypes;
namespace Nocturnis.Enigmos.Modules;
public interface ICommunicateModule : IBaseModule
{
IBaseCommunicator? PairedCommunicator { get; set; }
StringName CommunicationDataType { get; }
DataType CommunicationDataType { get; }
StringName CommunicationDirection { get; }
IData DataBuffer { get; set; }
DataVariable DataBuffer { get; set; }
}

View File

@@ -1,9 +1,10 @@
using Nocturnis.DataStructures;
using Nocturnis.DataStructures.Data;
namespace Nocturnis.Enigmos.Modules;
public interface IEnumerableProcessingModule : ICompositeModule
{
IData[] CachedInputArray { get; set; }
DataVariable[] CachedInputArray { get; set; }
int ProcessingIndex { get; set; }
}

View File

@@ -1,12 +1,13 @@
using Nocturnis.DataStructures;
using Nocturnis.DataStructures.Data;
namespace Nocturnis.Enigmos.Modules;
public interface IFilterModule : IProgrammableModule
{
void Filter();
IData[] CachedInputArray { get; set; }
IData[] CachedResult { get; set; }
DataVariable[] CachedInputArray { get; set; }
DataVariable[] CachedResult { get; set; }
int ProcessingIndex { get; set; }
bool FilterFinished { get; set; }
bool FilterStarted { get; set; }

View File

@@ -1,10 +1,11 @@
using Nocturnis.DataStructures;
using Nocturnis.DataStructures.Data;
namespace Nocturnis.Enigmos.Modules;
public interface IInternalComputationalModule : ICompositeModule
{
IData? CachedResult { get; set; }
DataVariable? CachedResult { get; set; }
void Compute();
bool ComputationFinished { get; set; }
bool ComputationStarted { get; set; }

View File

@@ -1,6 +1,9 @@
using Nocturnis.DataStructures.ConfigurableParameters;
namespace Nocturnis.Enigmos.Modules;
public interface IKeyListenerModule
{
bool Pressed { get; set; }
IKeyParameter ListeningKey { get; set; }
}

View File

@@ -1,10 +1,11 @@
using Nocturnis.DataStructures;
using Nocturnis.DataStructures.Data;
namespace Nocturnis.Enigmos.Modules;
public interface IOptimizationModule : IProgrammableModule
{
IData CachedResult { get; set; }
DataVariable CachedResult { get; set; }
bool ComputationStarted { get; set; }
bool ComputationFinished { get; set; }
void Optimize();

View File

@@ -1,5 +1,8 @@
using Nocturnis.Enigmos.Boards;
namespace Nocturnis.Enigmos.Modules;
public interface IProgrammableModule : ICompositeModule
{
IBaseBoard UnderlyingBoard { get; set; }
}

View File

@@ -5,9 +5,8 @@ namespace Nocturnis.Enigmos.Modules;
public interface IRootModule : IRoutingModule
{
Stopwatch? Timer { get; set; }
bool ActionFinished { get; set; }
IBaseCreature? ManagedBy { get; set; }
IBaseCreature ManagedBy { get; set; }
void Start();
}

View File

@@ -4,5 +4,6 @@ public interface ITerminalModule : IParameterModule
{
void Drain();
bool Finished { get; set; }
}

View File

@@ -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; }
}

View File

@@ -1,10 +1,11 @@
using Godot;
using Nocturnis.DataStructures.DataTypes;
namespace Nocturnis.Enigmos.Ports.DataPorts;
public interface IDataPort : IBasePort
{
new IDataPort? ConnectedPort { get; set; }
StringName? DataType { get; set; }
void SetDataType(StringName type);
DataType DataType { get; set; }
void SetDataType(DataType type);
}

View File

@@ -21,7 +21,7 @@ public static class EBasePort
p.Condition = Mathf.FloorToInt(Math.Max(0, Math.Min(100, p.Condition + dCond)));
p.Quality = Mathf.FloorToInt(Math.Max(0, Math.Min(20000, p.Quality + dQuality)));
}
public static void Connect(this IBasePort p)
public static void ExtConnect(this IBasePort p)
{
if(p.Connected)
p.Disconnect();

View File

@@ -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();

View File

@@ -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();
}

View File

@@ -0,0 +1,33 @@
using Godot;
using Nocturnis.DataStructures.DataTypeOptions;
using Nocturnis.DataStructures.DataTypes;
using Nocturnis.GlobalManagement.Providers;
namespace Nocturnis.GlobalManagement.Constants;
public static partial class DataTypeConstant
{
public static class NestedDataTypeNames
{
public static readonly StringName Array = "Array";
public static readonly StringName Struct = "Struct";
public static readonly StringName Auto = "Auto";
}
public static class AutoDataTypes
{
public static readonly DataType Auto = DataType.AutoDataType();
public static readonly DataType AutoArray = DataType.AutoArrayType();
public static readonly DataType AutoStruct = DataType.AutoStructType();
}
public static partial class DataTypeOptions
{
public static readonly DataTypeOption ScalarTypes = new(BaseDataTypes.Real, BaseDataTypes.Complex);
public static readonly DataTypeOption VectorTypes = new(BaseDataTypes.R2, BaseDataTypes.C2);
public static readonly DataTypeOption TensorTypes = ScalarTypes.Union(VectorTypes);
public static readonly DataTypeOption AnyType = new();
public static readonly DataTypeOption AnyArray = new(DataType.ArrayDataType(BaseDataTypes.Null));
public static readonly DataTypeOption AnyStruct = new(DataType.StructDataType(null));
}
}

View File

@@ -4,23 +4,7 @@ namespace Nocturnis.GlobalManagement.Constants;
public static class EnigmosConstant
{
public static class DataPortTypes
{
public static readonly StringName Null = "Null";
public static readonly StringName Bit = "Bit";
public static readonly StringName Real = "Real";
public static readonly StringName Complex = "Complex";
public static readonly StringName R2 = "R2";
public static readonly StringName C2 = "C2";
public static readonly StringName RealArray = "RealArray";
public static readonly StringName AnyArrayType = "AnyArrayType";
public static readonly StringName[] NumericTypes = new[] { Real, Complex };
public static readonly StringName[] AnyTensor = new[] { Real, Complex, R2, C2 };
public static readonly StringName[] AnyType = new[] { Real, Complex, R2, C2 };
public static readonly StringName[] VectorTypes = new[] { R2, C2 };
public static readonly StringName[] AnyArray = Array.Empty<StringName>();
}
public static class CommunicationDirections
{
public static readonly StringName Send = "Send";

View File

@@ -19,5 +19,5 @@ public class CreatureControl
{
}
public IPlayerCharacter? CurrentCharacter { get; set; }
public IPlayerCharacter CurrentCharacter { get; set; }
}

View File

@@ -1,3 +1,5 @@
using Godot;
using Nocturnis.DataStructures.States;
using Nocturnis.Enigmos.Modules;
using Nocturnis.GlobalManagement.Providers;
@@ -7,6 +9,9 @@ public class EnigmosControl
{
private static EnigmosControl _instance { get; set; }
private static object _lock = new();
public const string StateOff = "Off";
public const string StateOn = "On";
public const string StateEngine = "Engine";
public static EnigmosControl Instance
{
get
@@ -18,20 +23,34 @@ public class EnigmosControl
private EnigmosControl()
{
StateControl.Instance.AddRule(
(path, fromState, toState) =>
path.Equals(StateEngine) && (
toState.Equals(StateOff) || toState.Equals(StateOn)
)
);
}
public IRootModule RootModule { get; set; }
public void ShutDownEngine()
{
((GlobalProvider.SceneProvider.RootScene.EngineSwitch as TextureButton)!).TextureNormal =
GlobalProvider.TextureProvider.EngineSwitchOff;
EngineUp = false;
StateControl.Instance[StateEngine] = StateOff;
}
public void PowerUpEngine()
{
CreatureControl.Instance.CurrentCharacter.MotherBoard.Reset();
(GlobalProvider.SceneProvider.RootScene.EngineSwitch as TextureButton)!.TextureNormal =
GlobalProvider.TextureProvider.EngineSwitchOn;
EngineUp = true;
StateControl.Instance[StateEngine] = StateOn;
}
public double Energy { get; set; } = 0d;
public double Energy { get; set; } = 1d;
public bool EngineUp { get; private set; }
public double IdlePower => CreatureControl.Instance.CurrentCharacter.MotherBoard.IdlePower + VoidPower;
public double VoidPower { get; set; } = 0;
}

View File

@@ -0,0 +1,76 @@
using System.Text.Json;
using Nocturnis.Controls;
using Nocturnis.DataStructures.States;
using FileAccess = Godot.FileAccess;
namespace Nocturnis.GlobalManagement.Controls;
public sealed class StateControl
{
public const string NullState = "NullState";
private HashSet<StateTransferRule> Rules { get; set; }
public Dictionary<string, string> States { get; set; }
private StateControl()
{
States = new Dictionary<string, string>();
Rules = new HashSet<StateTransferRule>();
}
private static StateControl _instance = null;
public static StateControl Instance => _instance ??= new StateControl();
public void Load()
{
if (!FileAccess.FileExists("States.json"))
return;
using FileAccess file = FileAccess.Open("States.json", FileAccess.ModeFlags.Read);
string jsonData = file.GetAsText();
States = JsonSerializer.Deserialize<Dictionary<string, string>>(jsonData);
}
public void Save()
{
string jsonData = JsonSerializer.Serialize(States);
using FileAccess file = FileAccess.Open("States.json", FileAccess.ModeFlags.Write);
file.StoreString(jsonData);
}
public bool Transfer(string path, string state)
{
foreach (var rule in Rules)
if (rule(path, States[path], state))
{
States[path] = state;
return true;
}
return false;
}
public string this[string path]
{
get
{
try
{
return States[path];
}
catch (KeyNotFoundException)
{
return NullState;
}
}
set
{
if(!States.ContainsKey(path))
States[path] = NullState;
Transfer(path, value);
}
}
public void AddRule(StateTransferRule rule)
{
Rules.Add(rule);
}
}

View File

@@ -0,0 +1,70 @@
using System.Text.Json;
using Nocturnis.BracketSystem;
using Nocturnis.GlobalManagement.Providers;
namespace Nocturnis.GlobalManagement.Controls;
public class TopicControl
{
private static TopicControl _instance;
public static TopicControl Instance => _instance ??= new TopicControl();
public HashSet<IBracketTopic> ActiveTopics { get; set; }
public Dictionary<string, IBracketTopic> Topics { get; set; }
private TopicControl()
{
ActiveTopics = new HashSet<IBracketTopic>();
Topics = new Dictionary<string, IBracketTopic>();
}
public void Load(string topicName)
{
string jsonContent = GlobalProvider.FileAccessProvider.Read($"res://Resources/Topics/{topicName}.json");
TopicData topicData = JsonSerializer.Deserialize<TopicData>(jsonContent);
IBracketTopic topic = GlobalProvider.ConstructorProvider.NewBracketTopic();
topic.Topic = topicData.topic;
topic.Reusable = topicData.reusable;
topic.Finished = false;
topic.LineMap = new Dictionary<string, IBracketLine>();
foreach (var lineData in topicData.lines)
{
IBracketLine line = GlobalProvider.ConstructorProvider.NewBracketLine();
line.Conditions = lineData.conditions;
line.Line = lineData.line;
line.Successors = new HashSet<IBracketLine>();
topic.LineMap[lineData.line] = line;
line.BraLines = lineData.braLines;
line.KetLines = lineData.ketLines;
line.ArrowMarkers = lineData.arrows;
line.CleanPrevious = lineData.cleanPrevious;
line.Topic = topicData.topic;
}
foreach (LineData lineData in topicData.lines)
{
IBracketLine line = topic.LineMap[lineData.line];
foreach (string successorId in lineData.successors)
line.Successors.Add(topic.LineMap[successorId]);
}
topic.Root = topic.LineMap[topicData.lines[0].line];
topic.CurrentLine = topic.Root;
Topics.Add(topic.Topic, topic);
}
private class TopicData
{
public bool reusable { get; set; }
public string topic { get; set; }
public LineData[] lines { get; set; }
}
private class LineData
{
public bool cleanPrevious { get; set; }
public string line { get; set; }
public string[] conditions { get; set; }
public string[] successors { get; set; }
public string[] braLines { get; set; }
public string[] ketLines { get; set; }
public string[] arrows { get; set; }
}
}

View File

@@ -1,22 +1,35 @@
using Godot;
using Nocturnis.Creatures.Characters;
using Nocturnis.Enigmos.Modules;
using Nocturnis.Inventories.Items;
namespace Nocturnis.GlobalManagement.Providers;
public static class GlobalProvider
{
public static IEnigmosProvider? EnigmosProvider { get; set; }
public static IDataStructureProvider? DataStructureProvider { get; set; }
public static IUIProvider? UIProvider { get; set; }
public static ISceneProvider? SceneProvider { get; set; }
public static IPolymorphismProvider? PolymorphismProvider { get; set; }
public static IDataPackageTypeProvider? DataPackageTypeProvider { get; set; }
public static ITextureProvider? TextureProvider { get; set; }
public static IEnigmosProvider EnigmosProvider { get; set; }
public static IDataStructureProvider DataStructureProvider { get; set; }
public static IUIProvider UIProvider { get; set; }
public static ISceneProvider SceneProvider { get; set; }
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 IPositionProvider PositionProvider { get; set; }
public static IConstructorProvider ConstructorProvider { get; set; }
public static IFileAccessProvider FileAccessProvider { get; set; }
public static readonly Dictionary<StringName, PackedScene> AssetNameMapper = new();
public static class ItemIconMapper<W>
public static class ModulePreviewMapper<TModule>
where TModule : IBaseModule
{
public static Texture2D? Texture { get; set; }
public static Texture2D Preview { get; set; }
}
public static class ItemIconMapper<TItem>
where TItem : IBaseItem
{
public static Texture2D Texture { get; set; }
}
public static class AssetMapper<T>
@@ -24,5 +37,10 @@ public static class GlobalProvider
public static PackedScene Scene { get; set; }
}
public static readonly Dictionary<string, PackedScene> SceneNameMapper = new();
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,9 @@
using Nocturnis.BracketSystem;
namespace Nocturnis.GlobalManagement.Providers;
public interface IConstructorProvider
{
IBracketTopic NewBracketTopic();
IBracketLine NewBracketLine();
}

View File

@@ -0,0 +1,10 @@
using FileAccess = Godot.FileAccess;
namespace Nocturnis.GlobalManagement.Providers;
public interface IFileAccessProvider
{
public string Read(string path);
public void Write(string path, string content);
public string ResRead(string path);
}

View File

@@ -1,13 +0,0 @@
using Godot;
namespace Nocturnis.GlobalManagement.Providers;
public interface IDataPackageTypeProvider
{
bool IsComplexTensorType(StringName type);
StringName ComplexVersionOf(StringName type);
StringName BuildType(StringName nType, int i, int j);
StringName GetBaseField(StringName type);
bool DataPortTypeCompatible(StringName inType, StringName outType);
StringName ToElement(StringName arrayType);
}

View File

@@ -1,7 +1,8 @@
using Godot;
using Nocturnis.DataStructures;
using Nocturnis.DataStructures.ConfigurableParameters;
using Nocturnis.DataStructures.DataPortGroups;
using Nocturnis.DataStructures.DataTypeOptions;
using Nocturnis.DataStructures.DataTypes;
using Nocturnis.Enigmos.Modules;
using Nocturnis.Enigmos.Ports.DataPorts;
using Nocturnis.Enigmos.Ports.DataPorts.Directions;
@@ -13,17 +14,12 @@ public interface IDataStructureProvider
Variant NewVariantWithType(string type, Variant a);
IBoolParameter NewBoolParameter(string d, string t, string f, bool def);
IDataPortGroup NewDataPortGroup(IBaseModule m, IDataPort[] pts, string desc, StringName defType, StringName[] typeOpts);
IDataPortGroup NewDataPortGroup(IPolymorphismModule m, IDataPort[] pts, string desc, DataType defType, DataTypeOption typeOpts);
IDataInGroup NewDataInGroup(IBaseModule m, IDataInPort[] pts, string desc, StringName defType, StringName[] typeOpts);
IDataInGroup NewDataInGroup(IPolymorphismModule m, IDataInPort[] pts, string desc, DataType defType, DataTypeOption typeOpts);
IDataOutGroup NewDataOutGroup(IBaseModule m, IDataOutPort[] pts, string desc, StringName defType, StringName[] typeOpts);
IData NewData(object data, StringName type);
IDataOutGroup NewDataOutGroup(IPolymorphismModule m, IDataOutPort[] pts, string desc, DataType defType, DataTypeOption typeOpts);
IDoubleParameter NewDoubleParameter(string name, double min, double max, double def);
IKeyParameter NewKeyParameter(string a, string b);
IData NullData { get; }
IData DefaultData { get; }
StringName ArrayToElement(StringName arrayType);
}
}

View File

@@ -0,0 +1,13 @@
using Nocturnis.DataStructures.DataTypes;
namespace Nocturnis.GlobalManagement.Providers;
public interface IDataTypeProvider
{
bool IsComplexTensorType(DataType type);
DataType ComplexVersionOf(DataType type);
DataType GetBaseField(DataType type);
bool DataPortTypeCompatible(DataType inType, DataType outType);
DataType ToElement(DataType arrayType);
DataType ToVector(DataType scalarType);
}

View File

@@ -1,21 +1,20 @@
using Godot;
using Nocturnis.DataStructures.DataTypes;
namespace Nocturnis.GlobalManagement.Providers;
public interface IEnigmosProvider
{
Texture2D DataPortStatusNormal { get; set; }
Texture2D DataPortStatusPending { get; set; }
Texture2D DataPortStatusConnected { get; set; }
AnimatedTexture DataPortStatusNormal { get; set; }
AnimatedTexture DataPortStatusPending { get; set; }
AnimatedTexture DataPortStatusConnected { get; set; }
Texture2D SignalPortStatusNormal { get; set; }
Texture2D SignalPortStatusPending { get; set; }
Texture2D SignalPortStatusConnected { get; set; }
AnimatedTexture SignalPortStatusNormal { get; set; }
AnimatedTexture SignalPortStatusPending { get; set; }
AnimatedTexture SignalPortStatusConnected { get; set; }
PackedScene SignalCableScene { get; set; }
PackedScene DataCableScene { get; set; }
Dictionary<StringName, Texture2D> DataPortTypeMap { get; set; }
bool CommunicationDirectionCompatible(StringName moduleDir, StringName communicatorDir);
string ModuleDescription<T>();

View File

@@ -1,18 +1,18 @@
using Godot;
using Nocturnis.DataStructures;
using Nocturnis.DataStructures.Data;
using Nocturnis.DataStructures.DataTypes;
namespace Nocturnis.GlobalManagement.Providers;
public interface IPolymorphismProvider
{
(object, StringName) Square(IData a);
(object, StringName) Neg(IData a);
(object, StringName) Add(IData a, IData b);
(object, StringName) Sub(IData a, IData b);
(object, StringName) Div(IData a, IData b);
(object, StringName) Dot(IData a, IData b);
(object, StringName) Mul(IData a, IData b);
(object, StringName) Pow(IData a, IData b);
(object, StringName) ScalarDiv(IData a, IData b);
(object, StringName) ScalarMul(IData a, IData b);
(object, DataType) Square(DataVariable a);
(object, DataType) Neg(DataVariable a);
(object, DataType) Add(DataVariable a, DataVariable b);
(object, DataType) Sub(DataVariable a, DataVariable b);
(object, DataType) Div(DataVariable a, DataVariable b);
(object, DataType) Dot(DataVariable a, DataVariable b);
(object, DataType) Mul(DataVariable a, DataVariable b);
(object, DataType) Pow(DataVariable a, DataVariable b);
(object, DataType) ScalarDiv(DataVariable a, DataVariable b);
(object, DataType) ScalarMul(DataVariable a, DataVariable b);
}

View File

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

View File

@@ -0,0 +1,22 @@
using Nocturnis.DataStructures.ConfigurableParameters;
using Nocturnis.DataStructures.DataPortGroups;
using Nocturnis.Enigmos.ModuleManuals;
using Nocturnis.Enigmos.Modules;
namespace Nocturnis.GlobalManagement.Providers;
public interface IProcessProvider
{
void BuildManual(IBaseModule module);
IModuleManualTab BuildPortMaintenanceTab(IBaseModule module);
IModuleManualTab BuildModulePolymorphismTab(IPolymorphismModule module);
IModuleManualTab BuildModuleParameterTab(IParameterizedModule module);
IModuleManualTab BuildCommunicatorPairTab(ICommunicateModule module);
IModuleManualTab BuildProgrammableModuleSettingTab(IProgrammableModule module);
IModuleManualTab BuildErrorHandlerTab(IErrorHandlerModule module);
IModuleParameterSetter BuildModuleRealValueParameterSetter(IDoubleParameter para);
IModuleParameterSetter BuildModuleBoolValueParameterSetter(IBoolParameter para);
IModuleParameterSetter BuildModuleCharValueParameterSetter(ICharParameter para);
IModuleParameterSetter BuildModuleKeyValueParameterSetter(IKeyParameter para);
IPortTypeSelector BuildPortTypeSelector(IDataPortGroup group);
}

View File

@@ -4,5 +4,6 @@ namespace Nocturnis.GlobalManagement.Providers;
public interface ISceneProvider
{
IRootScene? RootScene { get; set; }
IRootScene RootScene { get; set; }
}

View File

@@ -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; }
}

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;
}
}

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

@@ -0,0 +1,9 @@
using Godot;
namespace Nocturnis.Godot;
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; }
}

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

@@ -0,0 +1,11 @@
using Godot;
namespace Nocturnis.Godot;
public interface INode
{
void RemoveChild(Node node);
void AddChild(Node node, bool forceReadableName = false, Node.InternalMode @internal = (Node.InternalMode)(0));
bool Visible { get; set; }
Node GetNode(NodePath path);
}

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

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

View File

@@ -1,8 +0,0 @@
using Nocturnis.Attributes;
namespace Nocturnis;
[DirectAsset]
public interface IDirectAsset
{
}

View File

@@ -1,8 +0,0 @@
using Godot;
namespace Nocturnis;
public interface INodeInterface
{
}

View File

@@ -4,5 +4,5 @@ namespace Nocturnis.Inventories.ItemSlots.ItemSlots;
public interface IChemicalItemSlot
{
IBaseChemicalItem? Item { get; set; }
IBaseChemicalItem Item { get; set; }
}

View File

@@ -1,11 +1,16 @@
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; }
}
Texture2D ItemIcon { get; }
void Free();
StringName ItemClass { get; }
}

View File

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

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More