コード例 #1
0
 public void startMultiplayerGame()
 {
     if (!PhotonNetwork.IsMasterClient)
     {
         //GameObject.Find("Canvas/MultiplayerPanel/RoomPanel/NotMasterClient").SetActive(true);
         //startNotMasterFade();
         RoomHandling rh = GameObject.Find("Canvas/MultiplayerPanel/RoomPanel").GetComponent <RoomHandling>();
         rh.SendReadyStatus(rh.getSlotPosition(PhotonNetwork.LocalPlayer));
     }
     else
     {
         Debug.Log(RpcTarget.All);
         bool allPlayersReady = true;
         for (int i = 1; i <= 6; i++)
         {
             if (!(bool)PhotonNetwork.CurrentRoom.CustomProperties["Team" + i + "Ready"])
             {
                 allPlayersReady = false;
                 break;
             }
         }
         if (allPlayersReady)
         {
             startGame();
         }
         else
         {
             GameObject notReadyPanel = GameObject.Find("Canvas/MultiplayerPanel/RoomPanel");
             notReadyPanel = notReadyPanel.transform.Find("PlayersNotReady").gameObject;
             notReadyPanel.SetActive(true);
         }
         //PhotonView.Get(this).RPC("startGame", RpcTarget.All);
     }
 }
コード例 #2
0
    public override void OnPlayerLeftRoom(Photon.Realtime.Player newPlayer)
    {
        RoomHandling rh        = GameObject.Find("Canvas/MultiplayerPanel/RoomPanel").GetComponent <RoomHandling>();
        int          playerLoc = rh.getSlotPosition(newPlayer);
        Hashtable    ht        = PhotonNetwork.CurrentRoom.CustomProperties;

        ht["Team" + (PhotonNetwork.PlayerList.Length + 1) + "Ready"] = true;
        GameObject.Find("Canvas/MultiplayerPanel/RoomPanel").GetComponent <RoomHandling>().UpdatePlayerList();
        Debug.Log(newPlayer.NickName + " has left the room");
    }