TouhouLS/Assets/RealCode/Menu/ButtonS/ButtonJoinLobby.cs

28 lines
662 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;
LobbySetup.Instance.Setup();
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");
}
}
}
}