26 lines
626 B
C#
26 lines
626 B
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
using TMPro;
|
|||
|
|
|||
|
public class ButtonJoinLobby : ButtonOnClick {
|
|||
|
|
|||
|
public TMP_InputField joinField;
|
|||
|
|
|||
|
public override void OnClick() {
|
|||
|
if (GameTransition.Instance.state == GameState.Multiplayer){
|
|||
|
GameTransition.Instance.state = GameState.ConnectionInProgress;
|
|||
|
|
|||
|
var roomCode = joinField.text;
|
|||
|
Debug.LogFormat("Joining room '{0}'", roomCode);
|
|||
|
if (NetworkManager.net.OpJoinRoomWithProperties(roomCode)) {
|
|||
|
Debug.Log("Room joined");
|
|||
|
} else {
|
|||
|
Debug.Log("Couldn't join room");
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|