예제 #1
0
        public AmongUsGame(ILoggerFactory loggerFactory, MothershipCommArray comms)
        {
            this.Logger = loggerFactory.CreateLogger <AmongUsGame>();
            this.Comms  = comms;

            this._gameStarted    = new AsyncEvent <AmongUsGame, GameStartAsyncEventArgs>("AMONGUS_GAME_STARTED", TimeSpan.Zero, this.AsyncEventExceptionHandler);
            this._gameEnded      = new AsyncEvent <AmongUsGame, GameEndAsyncEventArgs>("AMONGUS_GAME_ENDED", TimeSpan.Zero, this.AsyncEventExceptionHandler);
            this._playerJoined   = new AsyncEvent <AmongUsGame, PlayerAsyncEventArgs>("AMONGUS_PLAYER_JOINED", TimeSpan.Zero, this.AsyncEventExceptionHandler);
            this._playerLeft     = new AsyncEvent <AmongUsGame, PlayerAsyncEventArgs>("AMONGUS_PLAYER_LEFT", TimeSpan.Zero, this.AsyncEventExceptionHandler);
            this._playerDied     = new AsyncEvent <AmongUsGame, PlayerAsyncEventArgs>("AMONGUS_PLAYER_DIED", TimeSpan.Zero, this.AsyncEventExceptionHandler);
            this._meetingStarted = new AsyncEvent <AmongUsGame, MeetingStartAsyncEventArgs>("AMONGUS_MEETING_STARTED", TimeSpan.Zero, this.AsyncEventExceptionHandler);
            this._meetingEnded   = new AsyncEvent <AmongUsGame, MeetingEndAsyncEventArgs>("AMONGUS_MEETING_ENDED", TimeSpan.Zero, this.AsyncEventExceptionHandler);

            this.Comms.ProbeEventReceived += this.Comms_ProbeEventReceived;
        }
예제 #2
0
        public AmongUsDirectorHostedService(
            DiscordBotService discordBot,
            AmongUsGame game,
            GameManagerService gameManager,
            DiscoveryServer discovery,
            MothershipCommArray comms,
            RedisClientService redis)
        {
            this.DiscordBot  = discordBot;
            this.Game        = game;
            this.GameManager = gameManager;
            this.Discovery   = discovery;
            this.Comms       = comms;
            this.Redis       = redis;

            this.Game.GameStarted    += this.Game_GameStarted;
            this.Game.GameEnded      += this.Game_GameEnded;
            this.Game.PlayerJoined   += this.Game_PlayerJoined;
            this.Game.PlayerLeft     += this.Game_PlayerLeft;
            this.Game.PlayerDied     += this.Game_PlayerDied;
            this.Game.MeetingStarted += this.Game_MeetingStarted;
            this.Game.MeetingEnded   += this.Game_MeetingEnded;
        }