private void InterEventDispatcher_MatchStartEvent(MatchStartEventArgs args) { string cmd = string.Format("{0}{1}{2}{1}{3}{1}{4}", (int)ReadProtocol.GetVersion(), m_SegmentTerminator, NetworkCommand.GetCommand(NetworkCommandType.StartMatch), args.MatchId, args.PlayerIdOfFirstToMove); MatchHandler.SendMessageToUsersInMatch(args.MatchId, cmd); }
private void MatchEventDispatcher_SpectatorSyncEvent(SpectatorSyncEventArgs args) { string cmd = string.Format("{0}{1}{2}{1}{3}{1}{4}{1}{5}", (int)ReadProtocol.GetVersion(), m_SegmentTerminator, NetworkCommand.GetCommand(NetworkCommandType.SyncMatchSpectator), args.Match.MatchIdentity, args.PlayerState.AccountIdentity, args.PlayerState.Username); MatchHandler.SendMessageToUsersInMatch(args.Match, cmd); }
private void InterEventDispatcher_TurnStateSyncEvent(TurnStateSyncEventArgs args) { string cmd = string.Format("{0}{1}{2}{1}{3}{1}{4}{1}{5}{1}{6}", (int)ReadProtocol.GetVersion(), m_SegmentTerminator, NetworkCommand.GetCommand(NetworkCommandType.TurnStateSync), args.MatchId, args.CurrentPlayerId, args.TurnStep.ToString(), args.LowestTurnStep.ToString()); MatchHandler.SendMessageToUsersInMatch(args.MatchId, cmd); }
private void HandleMatchMessage_One(string[] segments) { //protocol#|lbymsg#|matchId#|username#|time#|message<#> string cmd = string.Format("{0}{1}{2}{1}{3}{1}{4}{1}{5}{1}{6}", (int)ReadProtocol.GetVersion(), m_SegmentTerminator, NetworkCommand.GetCommand(NetworkCommandType.MatchMessage), segments[2], segments[3], segments[4], segments[5]); MatchHandler.SendMessageToUsersInMatch(segments[2], cmd); }
private void InterEventDispatcher_AttackSyncCompleteEvent(AttackSyncCompleteEventArgs args) { string cmd = string.Format("{0}{1}{2}{1}{3}{1}{4}{1}{5}{1}{6}{1}{7}", (int)ReadProtocol.GetVersion(), m_SegmentTerminator, NetworkCommand.GetCommand(NetworkCommandType.ProcessAttack), args.MatchId, args.AttackingPieceId, args.DefendingPlayerId, args.BoardVectorX.ToString(), args.BoardVectorY.ToString()); MatchHandler.SendMessageToUsersInMatch(args.MatchId, cmd); }
private void HandleNetworkPieceMove_One(string[] segments) { //protocol#|command#|matchId#|pieceNetId#|x#|y string cmd = string.Format("{0}{1}{2}{1}{3}{1}{4}{1}{5}{1}{6}", (int)ReadProtocol.GetVersion(), m_SegmentTerminator, NetworkCommand.GetCommand(NetworkCommandType.NetworkPieceMoveEvent), segments[2], segments[3], segments[4], segments[5]); MatchHandler.SendMessageToUsersInMatch(segments[2], cmd); }
private void HandleMatchCreationEvent(MatchState match) { //protocol#|mtchcrtd#|matchId#|playerOneId#|playerOneUsername string cmd = string.Format("{0}{1}{2}{1}{3}{1}{4}{1}{5}", (int)ReadProtocol.GetVersion(), m_SegmentTerminator, NetworkCommand.GetCommand(NetworkCommandType.MatchCreated), match.MatchIdentity, match.PlayerOne.AccountIdentity, match.PlayerOne.Username); MatchHandler.SendMessageToUsersInMatch(match, cmd); ClientState client = ClientManager.GetClientByAccount (AccountHandler.GetAccountById(match.PlayerOne.AccountIdentity)); ClientManager.SendMessageToAllClients(cmd, client); }
private void SendGamePieceSyncToSpectator (string matchId, string spectatorId, string controllerId, GamePieceNetworkState[] pieces) { for (int i = 0; i < pieces.Length; i++) { MatchHandler.SendMessageToUsersInMatch (matchId, GetSyncCommandFromPieceNetworkState(matchId, pieces[i])); } string cmd = string.Format("{0}{1}{2}{1}{3}{1}{4}", (int)ReadProtocol.GetVersion(), m_SegmentTerminator, NetworkCommand.GetCommand(NetworkCommandType.EndGamePieceSync), matchId, controllerId); ClientManager.SendMessageToClientByAccount(spectatorId, cmd); }
private void SendGamePieceSyncToMatch(string matchId, string controllerId, GamePieceNetworkState[] pieces, bool endSync) { for (int i = 0; i < pieces.Length; i++) { MatchHandler.SendMessageToUsersInMatch (matchId, GetSyncCommandFromPieceNetworkState(matchId, pieces[i])); } if (endSync) { string cmd = string.Format("{0}{1}{2}{1}{3}{1}{4}", (int)ReadProtocol.GetVersion(), m_SegmentTerminator, NetworkCommand.GetCommand(NetworkCommandType.EndGamePieceSync), matchId, controllerId); MatchHandler.FlagFirstSyncForPlayer(matchId, controllerId); MatchHandler.SendMessageToUsersInMatch(matchId, cmd); } }