29 lines
735 B
C#
29 lines
735 B
C#
using Photon.Pun;
|
|
using Photon.Realtime;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class JoinParty : MonoBehaviour
|
|
{
|
|
[SerializeField] private StringSharedField partyName;
|
|
[SerializeField] private Button button;
|
|
|
|
private void Start()
|
|
{
|
|
button.interactable = false;
|
|
}
|
|
public void OnInputFieldChanged(string value)
|
|
{
|
|
partyName.Value = value;
|
|
button.interactable = !string.IsNullOrEmpty(value);
|
|
}
|
|
|
|
public void JoinOrCreateParty()
|
|
{
|
|
PhotonNetwork.JoinOrCreateRoom(partyName.Value, new RoomOptions { MaxPlayers = 0, EmptyRoomTtl = 0 }, TypedLobby.Default);
|
|
button.interactable = false;
|
|
}
|
|
}
|