Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Lobby : Photon.MonoBehaviour {
  6. void Start() {
  7. PhotonNetwork.autoJoinLobby = true;
  8. PhotonNetwork.ConnectToRegion(CloudRegionCode.kr, "v0.0.1");
  9. }
  10. public virtual void OnJoinedLobby() {
  11. print("JOINED LOBBY. GET SOME ROOM LIST.");
  12. }
  13.  
  14. public virtual void OnReceivedRoomListUpdate() {
  15. print("RECEIVED ROOMS");
  16. print("Is in lobby? " + PhotonNetwork.insideLobby);
  17.  
  18. PrintRooms();
  19. }
  20.  
  21. void PrintRooms() {
  22. RoomInfo[] rooms = PhotonNetwork.GetRoomList();
  23. print(rooms);
  24.  
  25. foreach(RoomInfo roomInfo in rooms) {
  26. print("Name: " + roomInfo.Name + "nPlayers: " + roomInfo.PlayerCount + " / " + roomInfo.MaxPlayers);
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement