This commit is contained in:
h z
2024-07-11 12:54:28 +01:00
parent 5b46cce212
commit f59c6edc39
7 changed files with 18 additions and 37 deletions

View File

@@ -9,12 +9,12 @@ namespace Nocturnis.DataStructures;
public class DataCache : CacheItem<DataVariable>
{
public new static DataCache Null => new (x => (0, GlobalProvider.DataStructureProvider!.NullDataType));
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, (object, DataType)> rec)
{
Value = GlobalProvider.DataStructureProvider!.NewData(0, DataTypeConstant.BaseDataTypes.Null);
Value = new DataVariable();
ProxyCalculator = rec;
}

View File

@@ -94,13 +94,15 @@ public class DataType
}
}
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 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();
ElementType.Assign(oth.ElementType);
StructName = oth.StructName;
}

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

@@ -1,5 +1,4 @@
using Godot;
using Nocturnis.DataStructures.Data;
using Nocturnis.DataStructures.DataTypes;
using Nocturnis.Enigmos.Modules;
using Nocturnis.Inventories.Items;
@@ -8,23 +7,23 @@ 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 IDataTypeProvider? DataTypeProvider { 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 class ModulePreviewMapper<TModule>
where TModule : IBaseModule
{
public static Texture2D? Preview { get; set; }
public static Texture2D Preview { get; set; }
}
public static class ItemIconMapper<TItem>
where TItem : IBaseItem
{
public static Texture2D? Texture { get; set; }
public static Texture2D Texture { get; set; }
}
public static class AssetMapper<T>
@@ -34,16 +33,7 @@ public static class GlobalProvider
public static readonly Dictionary<string, PackedScene> SceneNameMapper = new();
public static Font? Font { get; set; }
public static Font Font { get; set; }
public static class DataTypes
{
public static DataType Null { get; set; }
public static DataType Bit { get; set; }
public static DataType Real { get; set; }
public static DataType Complex { get; set; }
public static DataType R2 { get; set; }
public static DataType C2 { get; set; }
public static DataType Int { get; set; }
}
public static readonly Dictionary<StringName, Texture2D> DataTypeTexture = new();
}

View File

@@ -1,7 +1,5 @@
using Godot;
using Nocturnis.DataStructures;
using Nocturnis.DataStructures.ConfigurableParameters;
using Nocturnis.DataStructures.Data;
using Nocturnis.DataStructures.DataPortGroups;
using Nocturnis.DataStructures.DataTypeOptions;
using Nocturnis.DataStructures.DataTypes;
@@ -13,7 +11,6 @@ namespace Nocturnis.GlobalManagement.Providers;
public interface IDataStructureProvider
{
DataType NullDataType { get; }
Variant NewVariantWithType(string type, Variant a);
IBoolParameter NewBoolParameter(string d, string t, string f, bool def);
@@ -23,11 +20,6 @@ public interface IDataStructureProvider
IDataOutGroup NewDataOutGroup(IBaseModule m, IDataOutPort[] pts, string desc, DataType defType, DataTypeOption typeOpts);
DataVariable NewData(object data, DataType type);
IDoubleParameter NewDoubleParameter(string name, double min, double max, double def);
IKeyParameter NewKeyParameter(string a, string b);
DataVariable NullData { get; }
DataVariable DefaultData { get; }
StringName ArrayToElement(StringName arrayType);
}

View File

@@ -1,4 +1,3 @@
using Godot;
using Nocturnis.DataStructures.DataTypes;
namespace Nocturnis.GlobalManagement.Providers;

View File

@@ -1,5 +1,3 @@
using Godot;
using Nocturnis.DataStructures;
using Nocturnis.DataStructures.Data;
using Nocturnis.DataStructures.DataTypes;