示例#1
0
    private void OnJoinedRoom()
    {
        PhotonNetwork.player.NickName = "PLAYER " + PhotonNetwork.room.PlayerCount;
        if (PhotonNetwork.room.PlayerCount == PhotonNetwork.room.MaxPlayers)
        {
            switch (PhotonNetwork.room.Name.Substring(0, 2))
            {
            case "1_":
                StartCoroutine(LoadSceneAsync(1));
                break;

            case "2_":
                StartCoroutine(LoadSceneAsync(2));
                break;

            case "F1":
                StartCoroutine(LoadSceneAsync(1));
                break;

            case "F2":
                StartCoroutine(LoadSceneAsync(2));
                break;
            }
        }
        else
        {
            PopUpWaitingPlayers.SetActive(true);
            PopUpWaitingPlayersFriend.SetActive(true);
            textPlayersConnected.text = "( " + PhotonNetwork.playerList.Length + " / " + PhotonNetwork.room.MaxPlayers + " )";
            textFriendsConnected.text = "( " + PhotonNetwork.playerList.Length + " / " + PhotonNetwork.room.MaxPlayers + " )";
            textIDRoomFriend.text     = "ID : " + PhotonNetwork.room.Name.Substring(PhotonNetwork.room.Name.Length - 8, 8);
        }
    }
示例#2
0
 public void LeaveRoom()
 {
     PhotonNetwork.LeaveRoom();
     PopUpWaitingPlayers.SetActive(false);
     PopUpWaitingPlayersFriend.SetActive(false);
 }