Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //CAMBIAR VALORES DESDE ADENTRO DE LAS SALAS
- if (PhotonNetwork.InRoom)
- {
- Hashtable newdata = PhotonNetwork.CurrentRoom.CustomProperties;
- newdata["HOLA"] = 3000;
- PhotonNetwork.CurrentRoom.SetCustomProperties(newdata);
- }
- //CREAR SALA Y ASIGNAR CUSTOMS PROPERTIES
- RoomOptions roomOptions = new RoomOptions();
- roomOptions.MaxPlayers = 5;
- roomOptions.IsVisible = true;
- roomOptions.IsOpen = true;
- Hashtable roomSettings = new Hashtable();
- roomSettings["HOLA"] = 100;
- roomOptions.CustomRoomProperties = roomSettings;
- roomOptions.CustomRoomPropertiesForLobby = new string[] { "HOLA" };
- string roomName = "Room" + (Random.Range(10000, 99999)).ToString();
- PhotonNetwork.JoinRandomOrCreateRoom(null, 0, MatchmakingMode.FillRoom, TypedLobby.Default, null, roomName, roomOptions);
- //OBTENER CUSTOMS PROPERTIES DESDE EL ROOMINFO DESDE EL LOBBY
- public RoomInfo info_room;
- private void Start()
- {
- Hashtable customs = info_room.CustomProperties;
- if (customs.ContainsKey("HOLA"))
- {
- #if UNITY_EDITOR
- Debug.Log(customs["HOLA"]);
- #endif
- GetComponentInChildren<TextMeshProUGUI>().text = "Room: " + info_room.Name + " | Players: " + info_room.PlayerCount + "/" + info_room.MaxPlayers + " | VALOR: " + (int)customs["HOLA"];
- }
- else
- {
- GetComponentInChildren<TextMeshProUGUI>().text = "Room: " + info_room.Name + " | Players: " + info_room.PlayerCount + "/" + info_room.MaxPlayers;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement