您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

50 行
1.2 KiB

using UnityEngine;
namespace LobbyRelaySample.UI
{
/// <summary>
/// Handles the menu for a player creating a new lobby.
/// </summary>
public class CreateMenuUI : UIPanelBase
{
public JoinCreateLobbyUI m_JoinCreateLobbyUI;
string m_ServerName;
bool m_IsServerPrivate;
public override void Start()
{
base.Start();
m_JoinCreateLobbyUI.m_OnTabChanged.AddListener(OnTabChanged);
}
void OnTabChanged(JoinCreateTabs tabState)
{
if (tabState == JoinCreateTabs.Create)
{
Show();
}
else
{
Hide();
}
}
public void SetServerName(string serverName)
{
m_ServerName = serverName;
}
public void SetServerPrivate(bool priv)
{
m_IsServerPrivate = priv;
}
public void OnCreatePressed()
{
//Disabled as it's a one-off butto call
#pragma warning disable 4014
GameManager.Instance.CreateLobby(m_ServerName, m_IsServerPrivate);
#pragma warning restore 4014
}
}
}