< Summary

Information
Class: Lattice.ECS.Framework.SystemGroup
Assembly: Lattice
File(s): /home/runner/work/Sideline/Sideline/godot/scripts/lattice/ECS/Framework/SystemGroup.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 26
Coverable lines: 26
Total lines: 85
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 4
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
.ctor(...)100%210%
.ctor(...)100%210%
.ctor(...)0%2040%
get_Name()100%210%
get_Metadata()100%210%
get_EnabledByDefault()100%210%
get_Systems()100%210%
OnInit(...)100%210%
OnEnabled(...)100%210%
OnDisabled(...)100%210%
OnUpdate(...)100%210%
OnDispose(...)100%210%
OnDestroy(...)100%210%

File(s)

/home/runner/work/Sideline/Sideline/godot/scripts/lattice/ECS/Framework/SystemGroup.cs

#LineLine coverage
 1// Copyright (c) 2026 Sideline Authors. All rights reserved.
 2// Licensed under GPL-3.0.
 3
 4using System;
 5using System.Collections.Generic;
 6using Lattice.ECS.Core;
 7using Lattice.Math;
 8
 9namespace Lattice.ECS.Framework
 10{
 11    /// <summary>
 12    /// 系统分组,仅作为系统层级容器。
 13    /// </summary>
 14    public sealed class SystemGroup : ISystem
 15    {
 16        private readonly ISystem[] _systems;
 17        private readonly SystemMetadata _metadata;
 18
 19        public SystemGroup(string name, params ISystem[] systems)
 020            : this(name, SystemMetadata.GroupDefault, enabledByDefault: true, systems)
 21        {
 022        }
 23
 24        public SystemGroup(string name, bool enabledByDefault, params ISystem[] systems)
 025            : this(name, SystemMetadata.GroupDefault, enabledByDefault, systems)
 26        {
 027        }
 28
 29        public SystemGroup(string name, SystemMetadata metadata, params ISystem[] systems)
 030            : this(name, metadata, enabledByDefault: true, systems)
 31        {
 032        }
 33
 034        public SystemGroup(string name, SystemMetadata metadata, bool enabledByDefault, params ISystem[] systems)
 35        {
 036            ArgumentException.ThrowIfNullOrWhiteSpace(name);
 037            Name = name;
 038            EnabledByDefault = enabledByDefault;
 039            _metadata = metadata with { Kind = SystemExecutionKind.Group };
 040            _systems = systems ?? Array.Empty<ISystem>();
 41
 042            for (int i = 0; i < _systems.Length; i++)
 43            {
 044                ArgumentNullException.ThrowIfNull(_systems[i]);
 45            }
 046        }
 47
 48        /// <summary>组名称。</summary>
 049        public string Name { get; }
 50
 51        /// <summary>组元数据。</summary>
 052        public SystemMetadata Metadata => _metadata;
 53
 54        /// <summary>组默认是否启用。</summary>
 055        public bool EnabledByDefault { get; }
 56
 57        /// <summary>子系统列表。</summary>
 058        public IReadOnlyList<ISystem> Systems => _systems;
 59
 60        public void OnInit(Frame frame)
 61        {
 062        }
 63
 64        public void OnEnabled(Frame frame)
 65        {
 066        }
 67
 68        public void OnDisabled(Frame frame)
 69        {
 070        }
 71
 72        public void OnUpdate(Frame frame, FP deltaTime)
 73        {
 074        }
 75
 76        public void OnDispose(Frame frame)
 77        {
 078        }
 79
 80        public void OnDestroy(Frame frame)
 81        {
 082            OnDispose(frame);
 083        }
 84    }
 85}