private void HandleActionGhostCarLoaded(GameObject obj)
    {
        Debug.Log("[GhostController] HandleActionGhostCarLoaded");
        try{
            ghostRacer = obj.GetComponent <RS_DragCarController>();
            ghostRacer.gameObject.layer = LayerMask.NameToLayer("Ghost");

            PlayerSpawnPoint spawnPoint = GameObject.FindObjectOfType <PlayerSpawnPoint>();
            ghostRacer.transform.position = new Vector3(spawnPoint.transform.position.x - 4.8f, spawnPoint.transform.position.y, spawnPoint.transform.position.z);

            if (RS_GamePlayController.Mode == RS_GameMode.Multiplayer)
            {
                UM_TBM_Participant compet = RS_GamePlayController.Instance.Multiplayer.CurrentMatch.Competitor;
                if (compet != null)
                {
                    Debug.Log("[Compete With Other Palayer] Name:" + compet.DisplayName);
                }
                else
                {
                    Debug.Log("[I'm The Creator!!!]");
                }
            }
            else
            {
                Debug.Log("[Singleplayer Mode activated! Your data will be saved locally]");
            }
        } catch (Exception ex) {
            Debug.LogError("HandleActionGhostBikeLoaded - " + ex.Message);
        }
    }
Beispiel #2
0
    //--------------------------------------
    // Public Methods
    //--------------------------------------


    public void TakeTrun(byte[] matchData, UM_TBM_Participant nextParticipant = null)
    {
        if (nextParticipant == null)
        {
            nextParticipant = NextParticipant;
        }
        TBM.Matchmaker.TakeTurn(Id, matchData, nextParticipant);
    }
    public UM_TBM_Invite(GP_Invite invite)
    {
        _Id = invite.Id;
        _CreationTimestamp = UnixTimeStampToDateTime(invite.CreationTimestamp);


        _Inviter = new UM_TBM_Participant(invite.Participant);
    }
Beispiel #4
0
    public void TakeTurn(string matchId, byte[] matchData, UM_TBM_Participant nextParticipant)
    {
        string nextParticipantId = string.Empty;

        if (nextParticipant != null)
        {
            nextParticipantId = nextParticipant.Id;
        }
        GooglePlayTBM.Instance.TakeTrun(matchId, matchData, nextParticipantId);
    }
Beispiel #5
0
    public void QuitInTurn(string matchId, UM_TBM_Participant nextParticipant)
    {
        string nextParticipantId = string.Empty;

        if (nextParticipant != null)
        {
            nextParticipantId = nextParticipant.Id;
        }

        GooglePlayTBM.Instance.LeaveMatchDuringTurn(matchId, nextParticipantId);
    }
Beispiel #6
0
    public void SetInvite(UM_TBM_Invite invite)
    {
        _Invite    = invite;
        Competitor = invite.Inviter;

        OponentName.text             = Competitor.DisplayName;
        Competitor.SmallPhotoLoaded += HandleSmallPhotoLoaded;
        Competitor.LoadSmallPhoto();

        MatchStatus.text = invite.CreationTimestamp.ToString("MMMM dd, yyyy hh:mm:ss");

        AcceptInviteButton.SetActive(true);
        DeclineInviteButton.SetActive(true);
    }
Beispiel #7
0
    public UM_TBM_Match(GK_TBM_Match match)
    {
        _Id   = match.Id;
        _Data = match.Data;


        foreach (GK_TBM_Participant participant in match.Participants)
        {
            UM_TBM_Participant p = new UM_TBM_Participant(participant);
            _Participants.Add(p);
        }

        if (match.CurrentParticipant != null)
        {
            _CurrentParticipant = new UM_TBM_Participant(match.CurrentParticipant);
            if (_CurrentParticipant.Playerid.Equals(GameCenterManager.Player.Id))
            {
                _IsCurrentPlayerTurn = true;
            }
        }


        switch (match.Status)
        {
        case GK_TurnBasedMatchStatus.Unknown:
            _Status = UM_TBM_MatchStatus.Unknown;
            break;

        case GK_TurnBasedMatchStatus.Open:
            _Status = UM_TBM_MatchStatus.Active;
            break;

        case GK_TurnBasedMatchStatus.Matching:
            _Status = UM_TBM_MatchStatus.Matching;
            break;

        case GK_TurnBasedMatchStatus.Ended:
            _Status = UM_TBM_MatchStatus.Ended;
            break;
        }
    }
    private void SetCompetitor(UM_TBM_Participant particiopant)
    {
        Oponent = particiopant;

        if (Oponent != null)
        {
            EnemyName.text = Oponent.DisplayName.Length <= PlayerNameMaxLenght ? Oponent.DisplayName : Oponent.DisplayName.Substring(0, PlayerNameMaxLenght) + "...";

            if (EnemyName.text.Length == 0)
            {
                EnemyName.text = "Matching...";
            }

            Oponent.SmallPhotoLoaded += HandleSmallPhotoLoaded;
            Oponent.LoadSmallPhoto();
        }
        else
        {
            EnemyName.text = "Matching...";
        }
    }
Beispiel #9
0
    public UM_TBM_Match(GP_TBM_Match match)
    {
        _Id   = match.Id;
        _Data = match.Data;

        foreach (GP_Participant participant in match.Participants)
        {
            UM_TBM_Participant p = new UM_TBM_Participant(participant);
            _Participants.Add(p);
            if (match.PendingParticipantId.Equals(participant.id))
            {
                _CurrentParticipant = p;
            }
        }


        if (match.TurnStatus == GP_TBM_MatchTurnStatus.MATCH_TURN_STATUS_MY_TURN)
        {
            _IsCurrentPlayerTurn = true;
        }


        switch (match.Status)
        {
        case GP_TBM_MatchStatus.MATCH_STATUS_ACTIVE:
            _Status = UM_TBM_MatchStatus.Active;
            break;

        case GP_TBM_MatchStatus.MATCH_STATUS_AUTO_MATCHING:
            _Status = UM_TBM_MatchStatus.Matching;
            break;

        case GP_TBM_MatchStatus.MATCH_STATUS_CANCELED:
        case GP_TBM_MatchStatus.MATCH_STATUS_COMPLETE:
        case GP_TBM_MatchStatus.MATCH_STATUS_EXPIRED:
            _Status = UM_TBM_MatchStatus.Ended;
            break;
        }
    }
 public bool IsParticipantFriend(UM_TBM_Participant playerParticipant)
 {
     return(FriendsList.Contains(playerParticipant.Playerid));
 }
Beispiel #11
0
 public void QuitInTurn(UM_TBM_Participant nextParticipant)
 {
     TBM.Matchmaker.QuitInTurn(Id, nextParticipant);
 }
Beispiel #12
0
    public void SetMatch(UM_TBM_Match match)
    {
        _Match = match;

        RemoveButton.SetActive(true);

        OponentIcon.sprite = Sprite.Create(DefaultOponentIcon, new Rect(0, 0, DefaultOponentIcon.width, DefaultOponentIcon.height), new Vector2(0.5f, 0.5f));
        Competitor         = _Match.Competitor;

        if (Competitor != null && Competitor.IsPlayerDefined)
        {
            OponentName.text             = Competitor.DisplayName;
            Competitor.SmallPhotoLoaded += HandleSmallPhotoLoaded;
            Competitor.LoadSmallPhoto();
        }
        else
        {
            OponentName.text = "Mtaching...";
        }

        if (match.Status == UM_TBM_MatchStatus.Ended)
        {
            WaitTag.gameObject.SetActive(true);
            WaitTag.text = match.LocalParticipant.Outcome.ToString();
        }
        else
        {
            if (match.IsLocalPlayerTurn)
            {
                PlayButton.SetActive(true);
            }
            else
            {
                WaitTag.gameObject.SetActive(true);
            }
        }

        string statusString = string.Empty;

        if (match.IsLocalPlayerTurn)
        {
            statusString = statusString + "Your Turn \n";
        }
        else
        {
            statusString = statusString + "Waiting for Opponent  Move \n";
        }

        statusString += "Opponent Status: ";
        if (match.Competitor != null)
        {
            statusString += match.Competitor.Status + "\n";
        }
        else
        {
            statusString += "Matching \n";
        }

        statusString += "Match: " + match.Status + "  ";

        statusString += match.LocalParticipant.Outcome.ToString() + " / ";
        if (match.Competitor != null)
        {
            statusString += match.Competitor.Outcome.ToString();
        }
        else
        {
            statusString += UM_TBM_Outcome.None.ToString();
        }


        MatchStatus.text = statusString;
    }
Beispiel #13
0
 public void QuitInTurn(string matchId, UM_TBM_Participant nextParticipant)
 {
     GameCenter_TBM.Instance.QuitInTurn(matchId, GK_TurnBasedMatchOutcome.Quit, nextParticipant.Id, new byte[0]);
 }
Beispiel #14
0
 public void TakeTurn(string matchId, byte[] matchData, UM_TBM_Participant nextParticipant)
 {
     GameCenter_TBM.Instance.EndTurn(matchId, matchData, nextParticipant.Id);
 }
Beispiel #15
0
 public UM_TBM_Invite(GK_TBM_Match match)
 {
     _Id = match.Id;
     _CreationTimestamp = match.CreationTimestamp;
     _Inviter           = new UM_TBM_Participant(match.Participants[0]);
 }