/// <summary>
 /// Set player's playing deck and Enters the game.
 /// Player setting(Deck, ID, Avatar etc) is loaded and used in battle.
 /// </summary>
 /// <param name="newPlayer"></param>
 public override void OnPhotonPlayerConnected(PhotonPlayer newPlayer)
 {
     if (IsMaster)
     {
         if (PhotonNetwork.playerList.Length > 1)
         {
             SetLoggerAsString("Ready for game");
             string        deckName = dropDown.options[dropDown.value].text;
             PlayerProfile p        = FileBridge.LoadProfile();
             if (p != null)
             {
                 Debug.Log("Set Deck To Play");
                 p.SetDeckToPlay(deckName);
                 FileBridge.SaveProfile(p);
                 FileBridge.UpdateAsset(p);
             }
             else
             {
                 Debug.LogError("OnPhtonPlayerConnected: Can'tFindPlayer");
             }
             loggerUpdated.Raise();
             PhotonNetwork.room.IsOpen = false;
             PhotonNetwork.Instantiate("Multiplay Manager", Vector3.zero, Quaternion.identity, 0);
         }
     }
 }
Example #2
0
        void OnPhotonInstantiate(PhotonMessageInfo info)
        {
            photonId = photonView.ownerId;
            isLocal  = photonView.isMine;
            Debug.Log("Intantiate Photon Network Print // photon id is " + photonId);


            //if (this.isLocal)
            //{
            //    Debug.Log("Manager Client: My print");
            //    _Profile = FileBridge.LoadProfile();
            //    SetProfile();
            //}
            //When NetworkPrint bugs get fixed, delete below codes and use above codes
            if (NetworkManager.IsMaster)
            {
                if (this.isLocal)
                {
                    Debug.Log("Manager Client: My print");
                    _Profile = FileBridge.LoadProfile();
                    SetProfile();
                    //USING RPC TO SEND DATA
                }
                else
                {
                    Debug.Log("Manager Client: opponent print");
                    //How to call oppponent information?
                }
            }
            else
            {
                //if(!this.isLocal)
                if (this.isLocal)
                {
                    Debug.Log("Member Client: My print");
                    _Profile = FileBridge.LoadProfile();
                    SetProfile();
                }
                else
                {
                    Debug.Log("Manager Client: Opponent print");
                }
            }
            MultiplayManager.singleton.AddPlayer(this);
        }
 private void LoadProfile()
 {
     playerProfile = FileBridge.LoadProfile();
 }