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

26 lines
626 B
C#
Raw Normal View History

2020-08-22 05:29:00 +00:00
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");
}
}
}
}