コード例 #1
0
 private void Awake()
 {
     if (PhotonNetwork.InRoom)
     {
         GetCurrentRoomPlayers();
     }
     else
     {
         _console.AddText("Player is not in a room unable to get players.");
     }
 }
コード例 #2
0
    public override void OnRoomListUpdate(List <RoomInfo> roomList)
    {
        _console.AddText("FIRED ROOM LIST" + X);
        X++;
        foreach (RoomInfo info in roomList)
        {
            if (info.RemovedFromList)
            {
                int index = listings.FindIndex(x => x.RoomInfo.Name == info.Name);
                Debug.Log("Removed room name " + info.Name);

                if (index != -1)
                {
                    //Destroy(listings[index]);
                    listings[index].gameObject.SetActive(false);
                    //Clean up the inactive rooms.
                    Destroy(listings[index].gameObject);
                    listings.RemoveAt(index);
                }
            }
            else
            {
                RoomListing listing = Instantiate(_roomListingBtn, _content);
                if (listing != null)
                {
                    listing.SetRoomInfo(info);
                }
                listings.Add(listing);
            }
        }
    }
コード例 #3
0
 // Start is called before the first frame update
 void Start()
 {
     _console.AddText("Connecting...");
     PhotonNetwork.ConnectUsingSettings();
 }
コード例 #4
0
 public override void OnCreatedRoom()
 {
     _console.AddText("Room Created!...");
     //If the room is created we put the owner into the room.
     PhotonNetwork.LoadLevel("RoomScene");
 }