コード例 #1
0
        public void SendModifiedPieceSync(string matchId, bool endSync = true)
        {
            InterEventDispatcher.InvokeSendGamePiecesSyncEvent(new SendGamePiecesSyncEventArgs
                                                                   (matchId, AccountIdentity, ModifiedNetworkStates.ToArray(), endSync));

            m_ModifiedNetworkStates.Clear();
        }
コード例 #2
0
        public void SyncAllNetStatesWithSpec(PlayerState state)
        {
            if (PlayerOne != null)
            {
                InterEventDispatcher.InvokeSpectatorJoinSyncEvent(new SpectatorJoinSyncEventArgs
                                                                      (MatchIdentity, state.AccountIdentity,
                                                                      PlayerOne.AccountIdentity, PlayerOne.GamePieceNetworkStates.Values.ToArray()));
            }

            if (PlayerTwo != null)
            {
                InterEventDispatcher.InvokeSpectatorJoinSyncEvent(new SpectatorJoinSyncEventArgs
                                                                      (MatchIdentity, state.AccountIdentity,
                                                                      PlayerTwo.AccountIdentity, PlayerTwo.GamePieceNetworkStates.Values.ToArray()));
            }
        }
コード例 #3
0
        public void ProcessAttackSyncComplete(string attackerId, int x, int y)
        {
            if (PlayerOne.GamePieceNetworkStates.ContainsKey(attackerId))
            {
                PlayerTwo.SendModifiedPieceSync(MatchIdentity, false);
                InterEventDispatcher.InvokeAttackSyncCompleteEvent
                    (new AttackSyncCompleteEventArgs(MatchIdentity, attackerId, PlayerTwo.AccountIdentity, x, y));
                return;
            }

            if (PlayerTwo.GamePieceNetworkStates.ContainsKey(attackerId))
            {
                PlayerOne.SendModifiedPieceSync(MatchIdentity, false);
                InterEventDispatcher.InvokeAttackSyncCompleteEvent
                    (new AttackSyncCompleteEventArgs(MatchIdentity, attackerId, PlayerOne.AccountIdentity, x, y));
                return;
            }
        }
コード例 #4
0
        public void FlagFirstPieceSyncForPlayer(string controllerId)
        {
            if (PlayerOne.AccountIdentity == controllerId)
            {
                m_PlayerOneHasSyncedPieces = true;
            }
            else
            if (PlayerTwo.AccountIdentity == controllerId)
            {
                m_PlayerTwoHasSyncedPieces = true;
            }

            if (m_PlayerOneHasSyncedPieces && m_PlayerTwoHasSyncedPieces)
            {
                InterEventDispatcher.InvokeMatchStartEvent
                    (new MatchStartEventArgs(MatchIdentity, TurnState.CurrentPlayerId));
            }
        }
コード例 #5
0
        private void DepartureTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            m_CurrentIntervalCount++;

            InterEventDispatcher.InvokeMatchDepartureTimerTickEvent
                (new MatchDepartureTimerTickEventArgs(m_Match, m_CurrentIntervalCount));

            if (m_CurrentIntervalCount >= m_Seconds)
            {
                m_DepartureTimer.Enabled = false;
                m_DepartureTimer.Dispose();

                InterEventDispatcher.InvokeMatchDepartureTimerExpiredEvent
                    (new MatchDepartureTimerEventArgs(m_Match, m_PlayerState));

                m_Match.DisposeOfDepartureTimer(this);
            }
        }