コード例 #1
0
    //--------------------------------------
    // Public Methods
    //--------------------------------------

    public MultiplayerReplayData GetParticipantData(string participantID)
    {
        MultiplayerReplayData particip = null;

        foreach (var mrd in _ParticipantsData)
        {
            if (mrd.ParticipantID.Equals(participantID))
            {
                particip = mrd;
            }
        }

        return(particip);
    }
コード例 #2
0
    public void SetParticipantData(MultiplayerReplayData newMrd)
    {
        int index = 0;

        foreach (var mrd in _ParticipantsData)
        {
            if (mrd.ParticipantID.Equals(newMrd.ParticipantID))
            {
                _ParticipantsData.Remove(mrd);
                break;
            }
            index++;
        }

        _ParticipantsData.Add(newMrd);
    }
コード例 #3
0
    private void HandleOnLevelFinishedAction()
    {
        Debug.Log("[GhostController] HandleOnLevelFinishedAction");
        RS_GamePlayController.Instance.OnLevelFinishedAction -= HandleOnLevelFinishedAction;
        RS_GamePlayController.Instance.OnPlayerSpawned       -= HandleOnSpawnPlayer;
        RS_CarFactory.CarLoadedAction -= HandleActionGhostCarLoaded;

        NewGhostData.SetFinishTime(RaceTimer.Instance.GetCurrentGlobalTime());
        NewGhostData.AddDataBundle(TemporaryBundleList);
        TemporaryBundleList.Clear();

        if (RS_GamePlayController.Mode == RS_GameMode.Multiplayer)
        {
            //Take Turn of finish the Match
            Debug.Log(RS_GamePlayController.Mode.ToString() + " Time to make a Turn...");
                        #if !UNITY_EDITOR
            MultiplayerReplayData replayData = new MultiplayerReplayData(RS_GamePlayController.Instance.Multiplayer.CurrentMatch.LocalParticipant.Id, NewGhostData);
            RS_GamePlayController.Instance.Multiplayer.MatchData.SetParticipantData(replayData);

            ST_TBM_MatchData match = RS_GamePlayController.Instance.Multiplayer.MatchData;

            Debug.Log("MATCH STATUS: " + match.Match.Status.ToString());
            Debug.Log("MATCH IsLocalPlayerTurn: " + match.Match.IsLocalPlayerTurn.ToString());

            foreach (UM_TBM_Participant player in match.Match.Participants)
            {
                Debug.Log("[PARTICIPANT] " + player.Id +
                          "\t\n" + player.DisplayName +
                          "\t\n" + player.Status.ToString());
            }

            if (RS_GamePlayController.Instance.Multiplayer.CurrentMatch.Competitor != null &&
                RS_GamePlayController.Instance.Multiplayer.CurrentMatch.Competitor.Status != UM_TBM_ParticipantStatus.Unknown)
            {
                if (match.LocalPlayerTime > match.CompetitorTime)
                {
                    match.Loose();
                }
                else if (match.LocalPlayerTime < match.CompetitorTime)
                {
                    match.Win();
                }
                else
                {
                    match.Tie();
                }
            }
            else
            {
                match.TakeTrun();
            }
                        #else
            Debug.Log("But, wait! We are in Editor Mode.");
                        #endif
        }
        else
        {
            if (LoadedGhostData != null)
            {
                if (LoadedGhostData.FinishTime >= NewGhostData.FinishTime)
                {
                    Debug.Log("[Saving ghost data locally]");
                    Debug.Log(NewGhostData.CarId);
                    Debug.Log(NewGhostData.CarLevel);
                    Debug.Log(NewGhostData.RawData.ToString() + " Count:" + NewGhostData.RawData.Count);

                    NewGhostData.SaveLocalRecord();
                }
            }
            else
            {
                Debug.Log("[Saving ghost data locally]");
                Debug.Log(NewGhostData.CarId);
                Debug.Log(NewGhostData.CarLevel);
                Debug.Log(NewGhostData.RawData.ToString() + " Count:" + NewGhostData.RawData.Count);

                NewGhostData.SaveLocalRecord();
            }
        }
    }