< Summary

Information
Class: Trailblazer.TrailblazerLifecycleHooks
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Runtime/TrailblazerLifecycleHooks.cs
Line coverage
100%
Covered lines: 28
Uncovered lines: 0
Coverable lines: 28
Total lines: 72
Line coverage: 100%
Branch coverage
100%
Covered branches: 10
Total branches: 10
Branch coverage: 100%
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_SimulateHookCount()100%11100%
get_ResetHookCount()100%11100%
RegisterOnSimulate(...)100%11100%
RegisterOnLateSimulate(...)100%11100%
RegisterOnVisualize(...)100%11100%
RegisterOnReset(...)100%11100%
RegisterOnFrameRateChanged(...)100%11100%
InvokeSimulate()100%22100%
InvokeLateSimulate()100%22100%
InvokeVisualize()100%22100%
InvokeReset()100%22100%
InvokeFrameRateChanged()100%22100%

File(s)

/home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Runtime/TrailblazerLifecycleHooks.cs

#LineLine coverage
 1using SwiftCollections;
 2using System;
 3using Trailblazer.Support;
 4
 5namespace Trailblazer;
 6
 7/// <summary>
 8/// Owns ordered lifecycle hook storage for one Trailblazer runtime owner.
 9/// </summary>
 10internal sealed class TrailblazerLifecycleHooks
 11{
 96112    private readonly LifecycleHookHandler _hookHandler = new();
 13
 96114    private readonly SwiftList<OrderedLifecycleHook> _simulateHooks = new();
 15
 96116    private readonly SwiftList<OrderedLifecycleHook> _lateSimulateHooks = new();
 17
 96118    private readonly SwiftList<OrderedLifecycleHook> _visualizeHooks = new();
 19
 96120    private readonly SwiftList<OrderedLifecycleHook> _resetHooks = new();
 21
 96122    private readonly SwiftList<OrderedLifecycleHook> _frameRateChangedHooks = new();
 23
 224    internal int SimulateHookCount => _simulateHooks.Count;
 25
 226    internal int ResetHookCount => _resetHooks.Count;
 27
 28    internal IDisposable RegisterOnSimulate(string owner, int order, Action callback) =>
 729        _hookHandler.RegisterHook(_simulateHooks, owner, order, callback);
 30
 31    internal IDisposable RegisterOnLateSimulate(string owner, int order, Action callback) =>
 132        _hookHandler.RegisterHook(_lateSimulateHooks, owner, order, callback);
 33
 34    internal IDisposable RegisterOnVisualize(string owner, int order, Action callback) =>
 135        _hookHandler.RegisterHook(_visualizeHooks, owner, order, callback);
 36
 37    internal IDisposable RegisterOnReset(string owner, int order, Action callback) =>
 238        _hookHandler.RegisterHook(_resetHooks, owner, order, callback);
 39
 40    internal IDisposable RegisterOnFrameRateChanged(string owner, int order, Action callback) =>
 141        _hookHandler.RegisterHook(_frameRateChangedHooks, owner, order, callback);
 42
 43    internal void InvokeSimulate()
 44    {
 229945        if (_simulateHooks.Count != 0)
 246            _hookHandler.InvokeHooks(_simulateHooks);
 229947    }
 48
 49    internal void InvokeLateSimulate()
 50    {
 251        if (_lateSimulateHooks.Count != 0)
 152            _hookHandler.InvokeHooks(_lateSimulateHooks);
 253    }
 54
 55    internal void InvokeVisualize()
 56    {
 557        if (_visualizeHooks.Count != 0)
 258            _hookHandler.InvokeHooks(_visualizeHooks);
 559    }
 60
 61    internal void InvokeReset()
 62    {
 2563        if (_resetHooks.Count != 0)
 164            _hookHandler.InvokeHooks(_resetHooks);
 2565    }
 66
 67    internal void InvokeFrameRateChanged()
 68    {
 969        if (_frameRateChangedHooks.Count != 0)
 170            _hookHandler.InvokeHooks(_frameRateChangedHooks);
 971    }
 72}