public void RefreshGameView(Int32 gameID, Entities.Enums.ConnectionType connectionType) { Join(gameID, connectionType); AS.GameRound.Base.ISelect _selectGameRound = BusinessLogic.UnityConfig.Container.Resolve <AS.GameRound.Base.ISelect>(); AS.Game.Base.ISelect _selectGame = BusinessLogic.UnityConfig.Container.Resolve <AS.Game.Base.ISelect>(); AS.GamePlayerKickVote.Base.ISelect _selectVotes = BusinessLogic.UnityConfig.Container.Resolve <AS.GamePlayerKickVote.Base.ISelect>(); AS.ActiveConnection.Base.ISelect _selectConnection = BusinessLogic.UnityConfig.Container.Resolve <AS.ActiveConnection.Base.ISelect>(); Int32 currentUserId = Authentication.Security.CurrentUserId; Entities.ActiveConnection connection = _selectConnection.Execute(new Entities.Filters.ActiveConnection.Select(Context.ConnectionId, currentUserId)); Entities.Filters.GamePlayerKickVote.SelectForGame kickVoteFilter = new Entities.Filters.GamePlayerKickVote.SelectForGame(); kickVoteFilter.GameID = gameID; List <Entities.GamePlayerKickVote> votes = _selectVotes.Execute(kickVoteFilter); IEnumerable <IGrouping <Int32, Entities.GamePlayerKickVote> > grouped = votes.GroupBy(x => x.KickUserId); Entities.Models.Game.Board.VoteToKick kickModel = null; List <Entities.Models.Game.Board.VoteToKick> votesToKick = new List <Entities.Models.Game.Board.VoteToKick>(); foreach (IGrouping <Int32, Entities.GamePlayerKickVote> group in grouped) { if (group.FirstOrDefault(x => x.VotedUserId == currentUserId) == null) { kickModel = new Entities.Models.Game.Board.VoteToKick(group.First().KickUser, group.Count(x => x.Vote), group.Count(x => !x.Vote)); votesToKick.Add(kickModel); } } List <Entities.GameRound> completedRounds = _selectGameRound.Execute(new Entities.Filters.GameRound.SelectCompleted(gameID)); Entities.Game game = _selectGame.Execute(new Entities.Filters.Game.Select { GameID = gameID, DataToSelect = Entities.Enums.Game.Select.GamePlayerCards | Entities.Enums.Game.Select.Rounds }); Entities.Enums.GamePlayerType playerType = (connection != null && connection.ConnectionType == Entities.Enums.ConnectionType.GamePlayer) ? Entities.Enums.GamePlayerType.Player : Entities.Enums.GamePlayerType.Spectator; Entities.Models.Game.Board.GameBoard model = new Entities.Models.Game.Board.GameBoard(game, currentUserId, playerType, votesToKick, completedRounds); Clients.Client(Context.ConnectionId).UpdateGameView(model, model.LobbyViewModel); }
/// <summary> /// Constructor /// </summary> /// <param name="joinGame"></param> /// <param name="sendMessage"></param> /// <param name="selectUser"></param> /// <param name="selectKickVotes"></param> public GameController(AS.Game.Base.IJoin joinGame, AS.Hubs.Base.ISendMessage sendMessage, AS.User.Base.ISelect selectUser, AS.GamePlayerKickVote.Base.ISelect selectKickVotes, AS.GameRound.Base.ISelect selectGameRounds) { this._joinGame = joinGame; this._sendMessage = sendMessage; this._selectUser = selectUser; this._selectKickVotes = selectKickVotes; this._selectGameRounds = selectGameRounds; }
public Select(DAL.Base.ISelect selectGame, GamePlayer.Base.ISelect selectGamePlayerREPO, AS.Deck.Base.ISelect selectDeck, AS.GameRound.Base.ISelect selectGameRound) { this._selectGame = selectGame; this._selectGamePlayerREPO = selectGamePlayerREPO; this._selectDeck = selectDeck; this._selectGameRound = selectGameRound; }
public Play(AS.GamePlayerCard.Base.ISelect selectGamePlayerCard, AS.GameRound.Base.ISelect selectGameRound, AS.GameRoundCard.Base.IInsert insertGameRoundCard, Base.IDelete deleteGamePlayerCard) { this._selectGamePlayerCard = selectGamePlayerCard; this._selectGameRound = selectGameRound; this._insertGameRoundCard = insertGameRoundCard; this._deleteGamePlayerCard = deleteGamePlayerCard; }
/// <summary> /// Constructor /// </summary> /// <param name="joinGame"></param> /// <param name="sendMessage"></param> /// <param name="selectUser"></param> /// <param name="selectKickVotes"></param> public GameController(AS.Game.Base.IJoin joinGame, AS.Hubs.Base.ISendMessage sendMessage, AS.User.Base.ISelect selectUser, AS.GamePlayerKickVote.Base.ISelect selectKickVotes, AS.GameRound.Base.ISelect selectGameRounds) { this._joinGame = joinGame; this._sendMessage = sendMessage; this._selectUser = selectUser; this._selectKickVotes = selectKickVotes; this._selectGameRounds = selectGameRounds; }
public Select(DAL.Base.ISelect selectGame, GamePlayer.Base.ISelect selectGamePlayerREPO, AS.Deck.Base.ISelect selectDeck, AS.GameRound.Base.ISelect selectGameRound) { this._selectGame = selectGame; this._selectGamePlayerREPO = selectGamePlayerREPO; this._selectDeck = selectDeck; this._selectGameRound = selectGameRound; }
public Play(AS.GamePlayerCard.Base.ISelect selectGamePlayerCard, AS.GameRound.Base.ISelect selectGameRound, AS.GameRoundCard.Base.IInsert insertGameRoundCard, Base.IDelete deleteGamePlayerCard) { this._selectGamePlayerCard = selectGamePlayerCard; this._selectGameRound = selectGameRound; this._insertGameRoundCard = insertGameRoundCard; this._deleteGamePlayerCard = deleteGamePlayerCard; }
public Complete(AS.GameRound.Base.ISelect selectGameRound, AS.GameRoundCard.Base.IUpdate updateGameRoundCard, AS.GameRound.Base.IStart startGameRoud, AS.Game.Base.ISelect selectGame, AS.GamePlayer.Base.IUpdate updateGamePlayer) { this._selectGameRound = selectGameRound; this._updateGameRoundCard = updateGameRoundCard; this._startGameRoud = startGameRoud; this._selectGame = selectGame; this._updateGamePlayer = updateGamePlayer; }
public Complete(AS.GameRound.Base.ISelect selectGameRound, AS.GameRoundCard.Base.IUpdate updateGameRoundCard, AS.GameRound.Base.IStart startGameRoud, AS.Game.Base.ISelect selectGame, AS.GamePlayer.Base.IUpdate updateGamePlayer) { this._selectGameRound = selectGameRound; this._updateGameRoundCard = updateGameRoundCard; this._startGameRoud = startGameRoud; this._selectGame = selectGame; this._updateGamePlayer = updateGamePlayer; }