Exemple #1
0
 public void OnPeersDisconnected(string[] participantIds)
 {
     foreach (string participantID in participantIds)
     {
         ShowMPStatus("Player " + participantID + " has left.");
     }
     lobbyListener.HideLobby();
     lobbyListener = null;
 }
    public void OnRoomConnected(bool success)
    {
        if (success)
        {
            ShowMPStatus("We are connected to the room! I would probably start our game now.");

            lobbyListener.HideLobby();
            lobbyListener = null;
        }
        else
        {
            ShowMPStatus("Uh-oh. Encountered some error connecting to the room.");
        }
    }
 public void OnRoomConnected(bool success)
 {
     if (success)
     {
         mGameState = GameState.Playing;
         lobbylisterner.HideLobby();
         lobbylisterner = null;
         SceneManager.LoadScene("MiniGameMenu");
         ShowMPStatus("We are connected to the room! Start Game");
     }
     else
     {
         ShowMPStatus("Error connecting to room");
         mGameState = GameState.SetupFailed;
     }
 }
    public void OnRoomConnected(bool success)
    {
        if (success)
        {
            ShowGMStatus("We are connected to the room! I would probably start our game now.");

            List<Participant> participants = GetAllPlayers();
            int max = Int32.MinValue;
            int hashP;
            foreach (Participant p in participants)
            {
                hashP = Math.Abs(p.ParticipantId.GetHashCode());
                if (hashP > max)
                {
                    max = hashP;
                }

            }

            if(Math.Abs(GetMyParticipantId().GetHashCode()) == max)
            {
                Overlord.localPlayer.firstPlayer = true;
                Overlord.opponent.firstPlayer = false;
                Overlord.localPlayer.turn = true;
            }
            else
            {
                Overlord.localPlayer.firstPlayer = false;
                Overlord.opponent.firstPlayer = true;
                Overlord.localPlayer.turn = false;
            }

            lobbyListener.HideLobby();
            lobbyListener = null;
        }
        else {
            ShowGMStatus("Uh-oh. Encountered some error connecting to the room.");
        }
    }
Exemple #5
0
 /// <summary>
 /// Oyun odasından çıkmanızı sağlar.
 /// </summary>
 public void LeaveRoom()
 {
     PlayGamesPlatform.Instance.RealTime.LeaveRoom();
     lobbyListener   = null;
     processListener = null;
 }
 public void OnRoomConnected(bool success)
 {
     if (success)
     {
         lobbyListener.SetLobbyCreationPercentage(100);
         lobbyListener.HideLobby();
         lobbyListener = null;
         SceneManager.LoadScene(Map);
     }
     else {
         ShowMPStatus("Uh-oh. Encountered some error connecting to the room.");
     }
 }