From bfbfed5cea59b9ad4c129d020e54f0334140036a Mon Sep 17 00:00:00 2001 From: Ashley Canning Date: Wed, 1 Nov 2023 15:38:31 +0000 Subject: [PATCH 1/2] Add missing meta files for Unity package --- Arch.SystemGroups/Descriptors.meta | 8 ++++++++ .../Descriptors/SystemDescriptor.cs.meta | 11 +++++++++++ .../Descriptors/SystemGroupDescriptor.cs.meta | 11 +++++++++++ .../Descriptors/SystemGroupWorldExtensions.cs.meta | 11 +++++++++++ 4 files changed, 41 insertions(+) create mode 100644 Arch.SystemGroups/Descriptors.meta create mode 100644 Arch.SystemGroups/Descriptors/SystemDescriptor.cs.meta create mode 100644 Arch.SystemGroups/Descriptors/SystemGroupDescriptor.cs.meta create mode 100644 Arch.SystemGroups/Descriptors/SystemGroupWorldExtensions.cs.meta diff --git a/Arch.SystemGroups/Descriptors.meta b/Arch.SystemGroups/Descriptors.meta new file mode 100644 index 0000000..60d3d19 --- /dev/null +++ b/Arch.SystemGroups/Descriptors.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6b9a0ff45dc470f4f9199ea858ccd14f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Arch.SystemGroups/Descriptors/SystemDescriptor.cs.meta b/Arch.SystemGroups/Descriptors/SystemDescriptor.cs.meta new file mode 100644 index 0000000..f4e2ed5 --- /dev/null +++ b/Arch.SystemGroups/Descriptors/SystemDescriptor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 00298494503af42478c1802c0349f0d8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Arch.SystemGroups/Descriptors/SystemGroupDescriptor.cs.meta b/Arch.SystemGroups/Descriptors/SystemGroupDescriptor.cs.meta new file mode 100644 index 0000000..78147d1 --- /dev/null +++ b/Arch.SystemGroups/Descriptors/SystemGroupDescriptor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3fa294551ab694446bb8d7ae5b01c9a8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Arch.SystemGroups/Descriptors/SystemGroupWorldExtensions.cs.meta b/Arch.SystemGroups/Descriptors/SystemGroupWorldExtensions.cs.meta new file mode 100644 index 0000000..a120105 --- /dev/null +++ b/Arch.SystemGroups/Descriptors/SystemGroupWorldExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 36e384939c10e064a9439501b463e997 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From cf7156ab4af40a85c116f3312c01535583f1f447 Mon Sep 17 00:00:00 2001 From: Ashley Canning Date: Wed, 1 Nov 2023 15:46:51 +0000 Subject: [PATCH 2/2] Move to block scope --- .../Descriptors/SystemGroupDescriptor.cs | 5 +- .../Descriptors/SystemGroupWorldExtensions.cs | 97 ++++++++++--------- 2 files changed, 52 insertions(+), 50 deletions(-) diff --git a/Arch.SystemGroups/Descriptors/SystemGroupDescriptor.cs b/Arch.SystemGroups/Descriptors/SystemGroupDescriptor.cs index 15cd18a..2e95b51 100644 --- a/Arch.SystemGroups/Descriptors/SystemGroupDescriptor.cs +++ b/Arch.SystemGroups/Descriptors/SystemGroupDescriptor.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; -namespace Arch.SystemGroups.Descriptors; - +namespace Arch.SystemGroups.Descriptors +{ /// /// Descriptor for a SystemGroup /// @@ -35,3 +35,4 @@ public SystemGroupDescriptor(string name, IReadOnlyList system /// public IReadOnlyList Groups { get; } } +} diff --git a/Arch.SystemGroups/Descriptors/SystemGroupWorldExtensions.cs b/Arch.SystemGroups/Descriptors/SystemGroupWorldExtensions.cs index ed1911a..e484969 100644 --- a/Arch.SystemGroups/Descriptors/SystemGroupWorldExtensions.cs +++ b/Arch.SystemGroups/Descriptors/SystemGroupWorldExtensions.cs @@ -1,64 +1,65 @@ using System.Collections.Generic; using JetBrains.Annotations; -namespace Arch.SystemGroups.Descriptors; - -/// -/// Extensions for SystemGroupWorld -/// -public static class SystemGroupWorldExtensions +namespace Arch.SystemGroups.Descriptors { /// - /// Generate the descriptor for the SystemGroupWorld + /// Extensions for SystemGroupWorld /// - /// - [UsedImplicitly] - public static IReadOnlyList GenerateDescriptors(this SystemGroupWorld world) + public static class SystemGroupWorldExtensions { - var descriptors = new List(); - // Foreach system group such as initialization, simulation, presentation - foreach (var worldSystemGroup in world.SystemGroups) + /// + /// Generate the descriptor for the SystemGroupWorld + /// + /// + [UsedImplicitly] + public static IReadOnlyList GenerateDescriptors(this SystemGroupWorld world) { - descriptors.Add(GenerateGroupDescriptor(worldSystemGroup.GetType().Name, worldSystemGroup.Nodes)); - } + var descriptors = new List(); + // Foreach system group such as initialization, simulation, presentation + foreach (var worldSystemGroup in world.SystemGroups) + { + descriptors.Add(GenerateGroupDescriptor(worldSystemGroup.GetType().Name, worldSystemGroup.Nodes)); + } - return descriptors; - } + return descriptors; + } - /// - /// Generate the descriptor for the SystemGroup - /// - /// Name of the system group - /// List of nodes within the system group - private static SystemGroupDescriptor GenerateGroupDescriptor(string name, IReadOnlyList> nodes) - { - var groupSystems = new List(); - var groupNestedGroups = new List(); - GenerateNestedGroupDescriptors(nodes, groupSystems, groupNestedGroups); - return new SystemGroupDescriptor(name, groupSystems, groupNestedGroups - ); - } + /// + /// Generate the descriptor for the SystemGroup + /// + /// Name of the system group + /// List of nodes within the system group + private static SystemGroupDescriptor GenerateGroupDescriptor(string name, IReadOnlyList> nodes) + { + var groupSystems = new List(); + var groupNestedGroups = new List(); + GenerateNestedGroupDescriptors(nodes, groupSystems, groupNestedGroups); + return new SystemGroupDescriptor(name, groupSystems, groupNestedGroups + ); + } - /// - /// Generate the descriptor for the SystemGroupWorld - /// - /// - /// - /// - /// - private static void GenerateNestedGroupDescriptors(IReadOnlyList> nodes, - List groupSystems, List groupNestedGroups) - { - if(nodes is null) return; - foreach (var node in nodes) + /// + /// Generate the descriptor for the SystemGroupWorld + /// + /// + /// + /// + /// + private static void GenerateNestedGroupDescriptors(IReadOnlyList> nodes, + List groupSystems, List groupNestedGroups) { - if (node.IsGroup) - { - groupNestedGroups.Add(GenerateGroupDescriptor(node.CustomGroup.GetType().Name, node.CustomGroup.Nodes)); - } - else + if(nodes is null) return; + foreach (var node in nodes) { - groupSystems.Add(new SystemDescriptor(node.System.GetType().Name, node.ThrottlingEnabled)); + if (node.IsGroup) + { + groupNestedGroups.Add(GenerateGroupDescriptor(node.CustomGroup.GetType().Name, node.CustomGroup.Nodes)); + } + else + { + groupSystems.Add(new SystemDescriptor(node.System.GetType().Name, node.ThrottlingEnabled)); + } } } }