diff --git a/AwperativeKernel/Kernel/Component/Component.cs b/AwperativeKernel/Kernel/Component/Component.cs index f61ee9f..9066d84 100644 --- a/AwperativeKernel/Kernel/Component/Component.cs +++ b/AwperativeKernel/Kernel/Component/Component.cs @@ -26,6 +26,13 @@ public abstract partial class Component : ComponentDocker public bool Enabled = true; + + /// + /// Component name + /// + public string Name; + + /// /// Order for when Components are called on. Only applies between Components on the same Docker. @@ -42,8 +49,11 @@ public abstract partial class Component : ComponentDocker /// To be called when the Component is created. /// /// Docker that this spawned in this Component - internal void Initiate(ComponentDocker __parent) { + /// Name of the component + internal void Initiate(ComponentDocker __parent, string __name, string[] __tags) { ComponentDocker = __parent; + Name = __name; + _tags = [..__tags]; Create(); } diff --git a/AwperativeKernel/Kernel/ComponentDocker/ComponentDocker.cs b/AwperativeKernel/Kernel/ComponentDocker/ComponentDocker.cs index 87abefc..1614edb 100644 --- a/AwperativeKernel/Kernel/ComponentDocker/ComponentDocker.cs +++ b/AwperativeKernel/Kernel/ComponentDocker/ComponentDocker.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; - +using System.Reflection; namespace AwperativeKernel; @@ -130,7 +130,11 @@ public abstract class ComponentDocker /// Arguments to construct the Component with /// Type of Component to instantiate /// - public __Type Add<__Type>(object[] __args) where __Type : Component { + public __Type Add<__Type>(object[] __args, string name = "", string[] tags = null) where __Type : Component { + + if(name == "") { name = typeof(__Type).Name; } + if (tags == null) tags = []; + @@ -162,7 +166,7 @@ public abstract class ComponentDocker //Add to docker and initialize the new Component _Components.Add(newComponent); - newComponent.Initiate(this); + newComponent.Initiate(this, name, tags); return (__Type) newComponent; @@ -175,7 +179,7 @@ public abstract class ComponentDocker /// /// /// - public __Type Add<__Type>() where __Type : Component => Add<__Type>([]); + public __Type Add<__Type>(string name = "", string[] tags = null) where __Type : Component => Add<__Type>([], name: name, tags: tags); @@ -316,7 +320,7 @@ public abstract class ComponentDocker /// /// Finds the first instance of a component with a given tag /// - /// + /// Tag to search for /// internal Component Get(string __tag) { if (_taggedComponents.TryGetValue(__tag, out SortedSet components)) @@ -325,7 +329,17 @@ public abstract class ComponentDocker return null; } + + + /// + /// Finds the first instance of a component with a given tag + /// + /// Tag to search for + /// Component that has been found + /// + internal bool TryGet(string __tag, out Component __component) { __component = Get(__tag); return __component != null; } + /// /// Finds all Components with a given tag @@ -340,6 +354,16 @@ public abstract class ComponentDocker } + + /// + /// Searches for all Components with a given tag + /// + /// + /// + /// + internal bool TryGetAll(string __tag, out ImmutableArray __components) { __components = GetAll(__tag); return __components.Length > 0; } + + /// /// Finds the first Component that has all the given tags @@ -350,6 +374,15 @@ public abstract class ComponentDocker + /// + /// Finds the first Component that has all the given tags + /// + /// + /// + internal bool TryGet(List __tags, out Component __component) { __component = Get(__tags); return __component != null; } + + + /// /// Finds all Components that have all the given tags /// @@ -370,6 +403,16 @@ public abstract class ComponentDocker return [..foundComponents]; } + + + + /// + /// Tries to get all components with the given tags + /// + /// + /// + /// + internal bool TryGetAll(List __tags, out ImmutableArray __components) { __components = GetAll(__tags); return __components.Length > 0; } @@ -394,6 +437,16 @@ public abstract class ComponentDocker Debug.LogError("Docker does not have target Component", ["Type", "Docker"], [typeof(__Type).ToString(), GetHashCode().ToString()]); return null; } + + + + /// + /// + /// + /// + /// + /// + public bool TryGet<__Type>(out __Type __component) where __Type : Component { __component = Get<__Type>(); return __component != null; } @@ -430,6 +483,18 @@ public abstract class ComponentDocker return [..foundComponents]; } + + + + /// + /// + /// + /// + /// + /// + public bool TryGetAll<__Type>(out ImmutableArray<__Type> __components) where __Type : Component { __components = GetAll<__Type>(); return __components.Length > 0; } + + diff --git a/AwperativeKernel/Kernel/Inspector/Show.cs b/AwperativeKernel/Kernel/Inspector/Show.cs new file mode 100644 index 0000000..8636783 --- /dev/null +++ b/AwperativeKernel/Kernel/Inspector/Show.cs @@ -0,0 +1,11 @@ +using System; + + +namespace AwperativeKernel; + + +[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] +public class Show : Attribute +{ + public bool UseInspectorDefaults = true; +} \ No newline at end of file diff --git a/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.AssemblyInfo.cs b/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.AssemblyInfo.cs index 6f5eb04..8236e87 100644 --- a/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.AssemblyInfo.cs +++ b/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("AwperativeKernel")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+b0f5efc0d7c0e8575f8d65258fc04f5f6c0198ff")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+31304e9361e9cb2c8a96c5b71df5898a3a6da2a5")] [assembly: System.Reflection.AssemblyProductAttribute("AwperativeKernel")] [assembly: System.Reflection.AssemblyTitleAttribute("AwperativeKernel")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.AssemblyInfoInputs.cache b/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.AssemblyInfoInputs.cache index 8f3302d..9bac41f 100644 --- a/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.AssemblyInfoInputs.cache +++ b/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.AssemblyInfoInputs.cache @@ -1 +1 @@ -58a3ed0a72d5710615a3b290d863e83a9ed7dd9e66d3e9ec7d3e4367fd65f804 +35c328d3af30548ed777d71d5913f389ba8fda839eeb8f7de7916868a456c94c diff --git a/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.csproj.CoreCompileInputs.cache b/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.csproj.CoreCompileInputs.cache index ffe374e..c5e7555 100644 --- a/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.csproj.CoreCompileInputs.cache +++ b/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -e9ac80148ad36c975d2dc92051a6a9a191bea17d88f00cb4594c69ebd55d71a4 +1492481e4eae3b80db2d149ab088600d21214f29161b6bc87c6dbab466600b9b diff --git a/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.csproj.FileListAbsolute.txt b/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.csproj.FileListAbsolute.txt index 35172c4..b052c26 100644 --- a/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.csproj.FileListAbsolute.txt +++ b/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.csproj.FileListAbsolute.txt @@ -25,3 +25,4 @@ /home/avery/Projects/Awperative/Build/Kernel/net8.0/AwperativeKernel.deps.json /home/avery/Projects/Awperative/Build/Kernel/net8.0/AwperativeKernel.dll /home/avery/Projects/Awperative/Build/Kernel/net8.0/AwperativeKernel.pdb +/home/avery/Projects/Awperative/AwperativeKernel/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.sourcelink.json diff --git a/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.dll b/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.dll index c7bc86e..8a10c6c 100644 Binary files a/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.dll and b/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.dll differ diff --git a/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.pdb b/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.pdb index d954545..9d31f24 100644 Binary files a/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.pdb and b/AwperativeKernel/obj/Debug/net8.0/AwperativeKernel.pdb differ diff --git a/AwperativeKernel/obj/Debug/net8.0/ref/AwperativeKernel.dll b/AwperativeKernel/obj/Debug/net8.0/ref/AwperativeKernel.dll index 87de2e7..4a66acf 100644 Binary files a/AwperativeKernel/obj/Debug/net8.0/ref/AwperativeKernel.dll and b/AwperativeKernel/obj/Debug/net8.0/ref/AwperativeKernel.dll differ diff --git a/AwperativeKernel/obj/Debug/net8.0/refint/AwperativeKernel.dll b/AwperativeKernel/obj/Debug/net8.0/refint/AwperativeKernel.dll index 87de2e7..4a66acf 100644 Binary files a/AwperativeKernel/obj/Debug/net8.0/refint/AwperativeKernel.dll and b/AwperativeKernel/obj/Debug/net8.0/refint/AwperativeKernel.dll differ