예제 #1
0
 void OnEnable()
 {
     npd = ds.GetComponent <NetworkPlayersData> ();
     pd  = npd.localPd;
     PhotonNetwork.offlineMode = PlayerPrefs.GetInt("Single") == 1 ? true : false;
     if (PhotonNetwork.offlineMode)
     {
         PhotonNetwork.CreateRoom(null);
     }
     PhotonNetwork.automaticallySyncScene = true;
     if (PhotonNetwork.connected)
     {
         lobbyname.text = PhotonNetwork.room.name;
         startBtn.SetActive(PhotonNetwork.isMasterClient);
         myPlayer = PhotonNetwork.Instantiate("Entity/PLayers/TavernPlayer", Vector3.zero, transform.rotation, 0);
         DontDestroyOnLoad(myPlayer);
         if (PhotonNetwork.isMasterClient)
         {
             npd.Add(pd);
             PlaceTavernPlayers();
         }
         else
         {
             sendDataToMaster();
         }
     }
     else
     {
         lobbyname.text = PhotonNetwork.connectionStateDetailed.ToString();
         startBtn.SetActive(false);
     }
     showNames();
 }
예제 #2
0
    void AddPlayersData(object[] data)
    {
        PlayersData loadedPd = new PlayersData(data);

        npd.Add(loadedPd);
        if (PhotonNetwork.isMasterClient)
        {
            UpdatePlayersData();
        }
    }