< Summary

Information
Class: Lattice.ECS.Session.SessionRuntimeBoundary
Assembly: Lattice
File(s): /home/runner/work/Sideline/Sideline/godot/scripts/lattice/ECS/Session/SessionRuntimeBoundary.cs
Line coverage
100%
Covered lines: 13
Uncovered lines: 0
Coverable lines: 13
Total lines: 121
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_RuntimeKind()100%11100%
get_SupportedCapabilities()100%11100%
get_UnsupportedCapabilities()100%11100%
Supports(...)100%11100%
ExplicitlyDoesNotSupport(...)100%11100%

File(s)

/home/runner/work/Sideline/Sideline/godot/scripts/lattice/ECS/Session/SessionRuntimeBoundary.cs

#LineLine coverage
 1using System;
 2
 3namespace Lattice.ECS.Session
 4{
 5    /// <summary>
 6    /// 当前 Session 的正式运行时类型。
 7    /// </summary>
 8    public enum SessionRuntimeKind
 9    {
 10        /// <summary>
 11        /// 纯 C#、单线程、固定顺序、可回滚的最小预测运行时。
 12        /// </summary>
 13        MinimalPrediction = 0,
 14
 15        /// <summary>
 16        /// 纯 C#、单线程、固定顺序的本地权威运行时。
 17        /// 该模式保留固定帧推进与显式 checkpoint,但不承诺预测验证与 rewind 玩法入口。
 18        /// </summary>
 19        LocalAuthoritative = 1
 20    }
 21
 22    /// <summary>
 23    /// 当前 Session 公开承诺的运行能力。
 24    /// </summary>
 25    [Flags]
 26    public enum SessionRuntimeCapability
 27    {
 28        None = 0,
 29
 30        /// <summary>
 31        /// 支持本地固定帧推进。
 32        /// </summary>
 33        LocalPredictionStep = 1 << 0,
 34
 35        /// <summary>
 36        /// 支持最小验证与回滚修正。
 37        /// </summary>
 38        PredictionVerification = 1 << 1,
 39
 40        /// <summary>
 41        /// 支持本地 rewind 玩法入口。
 42        /// </summary>
 43        LocalRewind = 1 << 2,
 44
 45        /// <summary>
 46        /// 支持显式 checkpoint 保存与恢复。
 47        /// </summary>
 48        CheckpointRestore = 1 << 3
 49    }
 50
 51    /// <summary>
 52    /// 当前 Session 未作为正式能力承诺的运行面。
 53    /// </summary>
 54    [Flags]
 55    public enum UnsupportedSessionRuntimeCapability
 56    {
 57        None = 0,
 58
 59        /// <summary>
 60        /// 不支持多线程系统调度。
 61        /// </summary>
 62        ThreadedScheduling = 1 << 0,
 63
 64        /// <summary>
 65        /// 不支持资源化 / 配置化多模式启动。
 66        /// </summary>
 67        ResourceConfiguredBoot = 1 << 1,
 68
 69        /// <summary>
 70        /// 不支持完整网络会话管理。
 71        /// </summary>
 72        FullNetworkSession = 1 << 2,
 73
 74        /// <summary>
 75        /// 不支持玩家映射、房间态与传输层。
 76        /// </summary>
 77        PlayerMappingAndTransport = 1 << 3
 78    }
 79
 80    /// <summary>
 81    /// Session 运行边界描述。
 82    /// 用于把“当前正式支持什么、不支持什么”显式暴露在代码层,而不只停留在文档。
 83    /// </summary>
 84    public sealed class SessionRuntimeBoundary
 85    {
 386        public SessionRuntimeBoundary(
 387            SessionRuntimeKind runtimeKind,
 388            SessionRuntimeCapability supportedCapabilities,
 389            UnsupportedSessionRuntimeCapability unsupportedCapabilities)
 90        {
 391            RuntimeKind = runtimeKind;
 392            SupportedCapabilities = supportedCapabilities;
 393            UnsupportedCapabilities = unsupportedCapabilities;
 394        }
 95
 96        /// <summary>
 97        /// 当前运行时类型。
 98        /// </summary>
 999        public SessionRuntimeKind RuntimeKind { get; }
 100
 101        /// <summary>
 102        /// 当前正式支持的运行能力。
 103        /// </summary>
 622104        public SessionRuntimeCapability SupportedCapabilities { get; }
 105
 106        /// <summary>
 107        /// 当前明确不承诺的运行能力。
 108        /// </summary>
 8109        public UnsupportedSessionRuntimeCapability UnsupportedCapabilities { get; }
 110
 111        public bool Supports(SessionRuntimeCapability capability)
 112        {
 622113            return (SupportedCapabilities & capability) == capability;
 114        }
 115
 116        public bool ExplicitlyDoesNotSupport(UnsupportedSessionRuntimeCapability capability)
 117        {
 8118            return (UnsupportedCapabilities & capability) == capability;
 119        }
 120    }
 121}