public IndexModel(ILogger <IndexModel> logger, ILogicLooperPool looperPool) { // The parameter is provided via Dependency Injection. // - See also: Startup.ConfigureServices method. _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _looperPool = looperPool ?? throw new ArgumentNullException(nameof(looperPool)); }
/// <summary> /// Initializes the shared pool of loopers with specified options. /// </summary> /// <param name="targetFrameRate"></param> /// <param name="looperCount"></param> /// <param name="balancer"></param> public static void InitializeSharedPool(int targetFrameRate, int looperCount = 0, ILogicLooperPoolBalancer?balancer = null) { if (looperCount == 0) { looperCount = Math.Max(1, Environment.ProcessorCount - 1); } Shared = new LogicLooperPool(targetFrameRate, looperCount, balancer ?? RoundRobinLogicLooperPoolBalancer.Instance); }
/// <summary> /// 新規ゲームを生成し、ゲームループをスレッドプールに登録 /// </summary> /// <param name="looperPool"></param> /// <param name="logger"></param> public static void CreateNew(ILogicLooperPool looperPool, ILogger logger, LoopData loopData) { ServerPlayingState.LogicInfo info; info.input = loopData.Input; info.threadLockObj = threadLockObj; // ゲームループを登録 var gameLoop = new ServerMainGameLoop(logger, loopData, info); looperPool.RegisterActionAsync(gameLoop.UpdateFrame); }
public LoopHostedService(ILogicLooperPool looperPool, ILogger <LoopHostedService> logger) { _looperPool = looperPool ?? throw new ArgumentNullException(nameof(looperPool)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
/// <summary> /// DIコンストラクタ /// </summary> /// <param name="mgr"></param> /// <param name="logger"></param> public MainGameHubServerImpl(ILogger <MatchingHubServerImpl> logger, ILogicLooperPool looperPool) { this.logger = logger; this.looperPool = looperPool; }
public MainGameLoopHostedService(ILogicLooperPool looperPool, ILogger <MainGameLoopHostedService> logger) { this.looperPool = looperPool ?? throw new ArgumentNullException(nameof(looperPool)); this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
/// <summary> /// Create a new life-game loop and register into the LooperPool. /// </summary> /// <param name="looperPool"></param> /// <param name="logger"></param> public static void CreateNew(ILogicLooperPool looperPool, ILogger logger) { var gameLoop = new LifeGameLoop(logger); looperPool.RegisterActionAsync(gameLoop.UpdateFrame); }