This commit is contained in:
h z
2024-07-12 14:32:16 +01:00
parent f59c6edc39
commit 574d00d4b7
29 changed files with 130 additions and 43 deletions

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

@@ -7,7 +7,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="GodotSharp" Version="4.3.0-beta.2" /> <PackageReference Include="GodotSharp" Version="4.3.0-beta.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

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

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

View File

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

View File

@@ -0,0 +1,6 @@
namespace Nocturnis.DataStructures.ConfigurableParameters;
public interface IModuleParameterSetter : INodeInterface
{
}

View File

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

View File

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

View File

@@ -4,7 +4,7 @@ using Nocturnis.GlobalManagement.Providers;
namespace Nocturnis.DataStructures.DataTypeOptions; namespace Nocturnis.DataStructures.DataTypeOptions;
public class DataTypeOption : HashSet<DataType> public class DataTypeOption : List<DataType>
{ {
public DataTypeOption(params DataType[] options) : base(options) public DataTypeOption(params DataType[] options) : base(options)
{ {

View File

@@ -103,6 +103,7 @@ public class DataType
Type = oth.Type; Type = oth.Type;
if (ElementType == null) if (ElementType == null)
ElementType = new(); ElementType = new();
if(Type == DataTypeConstant.NestedDataTypeNames.Array)
ElementType.Assign(oth.ElementType); ElementType.Assign(oth.ElementType);
StructName = oth.StructName; StructName = oth.StructName;
} }

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,14 @@
using Godot;
namespace Alchegos.DataStructure;
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,23 +1,25 @@
using Nocturnis.Enigmos.Cables; using Nocturnis.Enigmos.Cables;
using Nocturnis.Enigmos.Modules;
using Nocturnis.Enigmos.Ports; using Nocturnis.Enigmos.Ports;
using Nocturnis.UIElements; using Nocturnis.UIElements;
using Nocturnis.UIElements.Layers; using Nocturnis.UIElements.Layers;
namespace Nocturnis.Enigmos.Boards; namespace Nocturnis.Enigmos.Boards;
public interface IBaseBoard public interface IBaseBoard : INodeInterface
{ {
IPanelViewer? PanelViewer { get; set; } IPanelViewer PanelViewer { get; set; }
IEnumerable<IBasePort> OnBoardPorts { get; } IEnumerable<IBasePort> OnBoardPorts { get; }
IBasePort? ConnectPending { get; set; } IBasePort ConnectPending { get; set; }
Dictionary<IBasePort, IBaseCable> CablePairing { get; set; } Dictionary<IBasePort, IBaseCable> CablePairing { get; set; }
void AddCable(IBaseCable cable); void AddCable(IBaseCable cable);
HashSet<IBaseCable> FocusedCables { get; set; } HashSet<IBaseCable> FocusedCables { get; set; }
bool ManualOpened { get; set; } bool ManualOpened { get; set; }
bool CableVisualMode { get; set; } bool CableVisualMode { get; set; }
IModuleManualLayer? ModuleManualLayer { get; set; } IModuleManualLayer ModuleManualLayer { get; set; }
IModuleMovingLayer? ModuleMovingLayer { get; set; } IModuleMovingLayer ModuleMovingLayer { get; set; }
void Reset(); void Reset();
void SetCableVisualMode(bool mode); void SetCableVisualMode(bool mode);
void SetLabelVisualMode(bool mode); void SetLabelVisualMode(bool mode);
public IEnumerable<ITerminalModule> TerminalModules { get; }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -21,7 +21,7 @@ public static class EBasePort
p.Condition = Mathf.FloorToInt(Math.Max(0, Math.Min(100, p.Condition + dCond))); 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))); 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) if(p.Connected)
p.Disconnect(); p.Disconnect();

View File

@@ -13,6 +13,7 @@ public static class GlobalProvider
public static ISceneProvider SceneProvider { get; set; } public static ISceneProvider SceneProvider { get; set; }
public static IPolymorphismProvider PolymorphismProvider { get; set; } public static IPolymorphismProvider PolymorphismProvider { get; set; }
public static IDataTypeProvider DataTypeProvider { get; set; } public static IDataTypeProvider DataTypeProvider { get; set; }
public static IProcessProvider ProcessProvider { get; set; }
public static class ModulePreviewMapper<TModule> public static class ModulePreviewMapper<TModule>
where TModule : IBaseModule where TModule : IBaseModule

View File

@@ -14,11 +14,11 @@ public interface IDataStructureProvider
Variant NewVariantWithType(string type, Variant a); Variant NewVariantWithType(string type, Variant a);
IBoolParameter NewBoolParameter(string d, string t, string f, bool def); IBoolParameter NewBoolParameter(string d, string t, string f, bool def);
IDataPortGroup NewDataPortGroup(IBaseModule m, IDataPort[] pts, string desc, DataType defType, DataTypeOption typeOpts); IDataPortGroup NewDataPortGroup(IPolymorphismModule m, IDataPort[] pts, string desc, DataType defType, DataTypeOption typeOpts);
IDataInGroup NewDataInGroup(IBaseModule m, IDataInPort[] pts, string desc, DataType defType, DataTypeOption typeOpts); IDataInGroup NewDataInGroup(IPolymorphismModule m, IDataInPort[] pts, string desc, DataType defType, DataTypeOption typeOpts);
IDataOutGroup NewDataOutGroup(IBaseModule m, IDataOutPort[] pts, string desc, DataType defType, DataTypeOption typeOpts); IDataOutGroup NewDataOutGroup(IPolymorphismModule m, IDataOutPort[] pts, string desc, DataType defType, DataTypeOption typeOpts);
IDoubleParameter NewDoubleParameter(string name, double min, double max, double def); IDoubleParameter NewDoubleParameter(string name, double min, double max, double def);
IKeyParameter NewKeyParameter(string a, string b); IKeyParameter NewKeyParameter(string a, string b);

View File

@@ -6,8 +6,8 @@ public interface IDataTypeProvider
{ {
bool IsComplexTensorType(DataType type); bool IsComplexTensorType(DataType type);
DataType ComplexVersionOf(DataType type); DataType ComplexVersionOf(DataType type);
DataType BuildType(DataType nType, int i, int j);
DataType GetBaseField(DataType type); DataType GetBaseField(DataType type);
bool DataPortTypeCompatible(DataType inType, DataType outType); bool DataPortTypeCompatible(DataType inType, DataType outType);
DataType ToElement(DataType arrayType); DataType ToElement(DataType arrayType);
DataType ToVector(DataType scalarType);
} }

View File

@@ -5,18 +5,16 @@ namespace Nocturnis.GlobalManagement.Providers;
public interface IEnigmosProvider public interface IEnigmosProvider
{ {
Texture2D DataPortStatusNormal { get; set; } AnimatedTexture DataPortStatusNormal { get; set; }
Texture2D DataPortStatusPending { get; set; } AnimatedTexture DataPortStatusPending { get; set; }
Texture2D DataPortStatusConnected { get; set; } AnimatedTexture DataPortStatusConnected { get; set; }
Texture2D SignalPortStatusNormal { get; set; } AnimatedTexture SignalPortStatusNormal { get; set; }
Texture2D SignalPortStatusPending { get; set; } AnimatedTexture SignalPortStatusPending { get; set; }
Texture2D SignalPortStatusConnected { get; set; } AnimatedTexture SignalPortStatusConnected { get; set; }
PackedScene SignalCableScene { get; set; } PackedScene SignalCableScene { get; set; }
PackedScene DataCableScene { get; set; } PackedScene DataCableScene { get; set; }
Dictionary<DataType, Texture2D> DataPortTypeMap { get; set; }
bool CommunicationDirectionCompatible(StringName moduleDir, StringName communicatorDir); bool CommunicationDirectionCompatible(StringName moduleDir, StringName communicatorDir);
string ModuleDescription<T>(); string ModuleDescription<T>();

View File

@@ -0,0 +1,20 @@
using Nocturnis.DataStructures.ConfigurableParameters;
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);
}

View File

@@ -8,4 +8,8 @@ public interface IBaseItem : INodeInterface
{ {
StringName Status { get; set; } StringName Status { get; set; }
R2 ItemPosition { get; set; } R2 ItemPosition { get; set; }
Texture2D ItemIcon { get; }
void Free();
StringName ItemClass { get; }
} }

View File

@@ -5,4 +5,5 @@ namespace Nocturnis.UIElements;
public interface IKeyListener public interface IKeyListener
{ {
void Register(IKeyListenerModule module); void Register(IKeyListenerModule module);
void Init();
} }

View File

@@ -4,7 +4,7 @@ namespace Nocturnis.UIElements;
public interface IPanelViewer public interface IPanelViewer
{ {
Camera2D? PanelViewerCamera { get; set; } IPanelViewerCamera PanelViewerCamera { get; }
void BackToCenter(); void BackToCenter();
} }

View File

@@ -0,0 +1,8 @@
using Godot;
namespace Nocturnis.UIElements;
public interface IPanelViewerCamera
{
Vector2 Zoom { get; set; }
}