63 lines
1.6 KiB
C#
63 lines
1.6 KiB
C#
using BrewMonster.Network;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace BrewMonster.Scripts
|
|
{
|
|
public class DlgConsole : MonoBehaviour
|
|
{
|
|
[SerializeField] GameObject _panelConsole;
|
|
|
|
[SerializeField] TMP_InputField _consoleInput;
|
|
//send button
|
|
[SerializeField] Button _btnSend;
|
|
[SerializeField] Button _btnOpen;
|
|
[SerializeField] Button _btnClose;
|
|
|
|
[Space(10)]
|
|
[Header("Command Buttons")]
|
|
[SerializeField] Button _btnNoCooldown;
|
|
|
|
private void Awake()
|
|
{
|
|
_btnSend?.onClick.AddListener(OnBtnSendClicked);
|
|
_btnOpen?.onClick.AddListener(OnBtnOpenClicked);
|
|
_btnClose?.onClick.AddListener(OnBtnCloseClicked);
|
|
_btnNoCooldown?.onClick.AddListener(OnBtnNoCooldownClicked);
|
|
}
|
|
|
|
|
|
#region button events
|
|
private void OnBtnSendClicked()
|
|
{
|
|
string input = _consoleInput.text;
|
|
if (string.IsNullOrEmpty(input))
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (!input.StartsWith("d "))
|
|
return;
|
|
|
|
input = input.Substring(2);
|
|
string[] cmdParams = input.Split(' ');
|
|
|
|
}
|
|
|
|
private void OnBtnOpenClicked()
|
|
{
|
|
_panelConsole.SetActive(true);
|
|
}
|
|
private void OnBtnCloseClicked()
|
|
{
|
|
_panelConsole.SetActive(false);
|
|
}
|
|
private void OnBtnNoCooldownClicked()
|
|
{
|
|
UnityGameSession.c2s_CmdDebug(8903, 73125);
|
|
}
|
|
#endregion
|
|
}
|
|
}
|