예제 #1
0
        private GameUser GetCheatCaller()
        {
            var orderedCheatCallers = UsersCallingCheat.Where((i) => i.State == GameUserState.Connected).OrderBy((i) => i.GameUserID).ToList();
            var currentTurnUserID   = GetCurrentPlayerTurn().GameUserID;

            var cheatCaller = orderedCheatCallers.Where((i) => i.GameUserID > currentTurnUserID).FirstOrDefault();

            if (cheatCaller == null)
            {
                cheatCaller = orderedCheatCallers.FirstOrDefault();
            }
            return(cheatCaller);
        }
예제 #2
0
        public void CallCheat(ClaimsPrincipal user)
        {
            lock (gameLogicLock)
            {
                if (CurrentGamePhase == GamePhase.TurnPhase)
                {
                    return;
                }

                var gameUser = GetPlayer(user);
                if (!UsersCallingCheat.Contains(gameUser))
                {
                    UsersCallingCheat.Add(gameUser);
                }
                ActionHistory.Add($"{user.GetUserName()} is calling cheat!");
            }
        }