53 lines
1.4 KiB
C#
53 lines
1.4 KiB
C#
using System;
|
|
using BrewMonster.Network;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace BrewMonster
|
|
{
|
|
public class HUDMainGamePlay : MonoBehaviour
|
|
{
|
|
#region Fields
|
|
|
|
[SerializeField]private Button _escapeBtn;
|
|
[SerializeField]private Button _btnTask;
|
|
[SerializeField]private Button _btnInvntory;
|
|
|
|
#endregion
|
|
|
|
private void OnEnable()
|
|
{
|
|
_escapeBtn.onClick.AddListener(OnEscapeClicked);
|
|
_btnTask.onClick.AddListener(OnTaskClicked);
|
|
_btnInvntory.onClick.AddListener(OnInventoryClicked);
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
_escapeBtn.onClick.RemoveListener(OnEscapeClicked);
|
|
_btnTask.onClick.RemoveListener(OnTaskClicked);
|
|
_btnInvntory.onClick.RemoveListener(OnInventoryClicked);
|
|
}
|
|
|
|
private void OnTaskClicked()
|
|
{
|
|
CECUIManager.Instance.ShowUI("Win_Quest");
|
|
}
|
|
private void OnInventoryClicked()
|
|
{
|
|
CECUIManager.Instance.ShowUI("Win_Inventory");
|
|
}
|
|
|
|
private void OnEscapeClicked()
|
|
{
|
|
// Open the exit dialog , not directly exit the game
|
|
|
|
// return;
|
|
if(EC_Game.GetGameRun()?.GetHostPlayer() != null)
|
|
{
|
|
EC_Game.GetGameRun()?.GetHostPlayer().OnClickBtnEscape();
|
|
}
|
|
}
|
|
}
|
|
}
|