Example #1
0
    private void HandleEndMatchEvent(string matchId)
    {
        RemoveAvailableMatch(matchId);

        if (m_CurrentMatch != null && m_CurrentMatch.MatchIdentity == matchId)
        {
            ClearMatchState();
            CameraHandler.ActivateCamera(1);
        }
    }
Example #2
0
    private void SyncMatchParticipants(MatchState match)
    {
        if (m_CurrentMatch != null &&
            match.MatchIdentity == m_CurrentMatch.MatchIdentity)
        {
            SyncParticipantList(match);

            SetCurrentMatch(match);

            if (match.MatchIsFull() && !m_MatchIsDisplayed)
            {
                DisplayMatch();
            }

            m_PlayerPosition = m_CurrentMatch.
                               GetPlayerSlotFromId(AccountManager.AccountInstance.Identity);

            if (m_PlayerPosition != 0)
            {
                CameraHandler.ActivateCamera(m_PlayerPosition);
            }

            Debug.Log("Match Sync Successful: " + match.MatchIdentity);

            string playerOneId = m_CurrentMatch.PlayerOne == null ? "Null" : m_CurrentMatch.PlayerOne.Username;
            string playerTwoId = m_CurrentMatch.PlayerTwo == null ? "Null" : m_CurrentMatch.PlayerTwo.Username;

            Debug.LogFormat("Match Info: {0} vs {1}", playerOneId, playerTwoId);
        }

        if (m_AvailableMatches.ContainsKey(match.MatchIdentity))
        {
            m_AvailableMatches[match.MatchIdentity] = match;

            if (m_MatchPanelRelationships.ContainsKey(match.MatchIdentity))
            {
                m_MatchPanelRelationships[match.MatchIdentity].
                GetComponent <MatchPanelBehavior>().UpdateMatch(match);
            }
        }

        else
        {
            AddAvailableMatch(match);
        }
    }