+ 전투에서 사용되는 Item 오브젝트의 InteractionUi의 camera를 UiCamera로 연동 + Item의 드랍 방식을 같은 위치에서 랜덤한 위치로 흩뿌리는 방식으로 변경 + 술통, 쓰레기통 상호작용 추가 + 손님이 음료를 요구할 때, 음료 전달 기능 추가 + 가구 Opaque Unlit으로 재질 변경
101 lines
2.4 KiB
C#
101 lines
2.4 KiB
C#
using System.Collections.Generic;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine;
|
|
|
|
namespace BlueWater.Uis
|
|
{
|
|
public class TycoonUiManager : Singleton<TycoonUiManager>
|
|
{
|
|
// Variables
|
|
#region Variables
|
|
|
|
[field: SerializeField]
|
|
public Canvas MainCanvas { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public TycoonUpgradeUi TycoonUpgradeUi { get; private set; }
|
|
|
|
// Variables
|
|
public List<PopupUi> PopupUiList { get; private set; }
|
|
|
|
#endregion
|
|
|
|
// Unity events
|
|
#region Unity events
|
|
|
|
protected override void OnAwake()
|
|
{
|
|
InitializeComponents();
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
PopupUi.OnPopupUiOpenEvent += RegisterPopup;
|
|
PopupUi.OnPopupUiCloseEvent += UnregisterPopup;
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
PopupUi.OnPopupUiOpenEvent -= RegisterPopup;
|
|
PopupUi.OnPopupUiCloseEvent -= UnregisterPopup;
|
|
}
|
|
|
|
#endregion
|
|
|
|
// Initialize methods
|
|
#region Initialize methods
|
|
|
|
[Button("셋팅 초기화")]
|
|
private void InitializeComponents()
|
|
{
|
|
MainCanvas = GetComponent<Canvas>();
|
|
TycoonUpgradeUi = GetComponentInChildren<TycoonUpgradeUi>(true);
|
|
|
|
PopupUiList = new List<PopupUi>(8);
|
|
}
|
|
|
|
#endregion
|
|
|
|
// Methods
|
|
#region Methods
|
|
|
|
private void RegisterPopup(PopupUi popup)
|
|
{
|
|
if (!PopupUiList.Contains(popup))
|
|
{
|
|
PopupUiList.Add(popup);
|
|
}
|
|
}
|
|
|
|
private void UnregisterPopup(PopupUi popup)
|
|
{
|
|
if (PopupUiList.Contains(popup))
|
|
{
|
|
PopupUiList.Remove(popup);
|
|
}
|
|
}
|
|
|
|
public void CloseLastPopup()
|
|
{
|
|
if (PopupUiList.Count <= 0) return;
|
|
|
|
PopupUiList[^1].Close();
|
|
}
|
|
|
|
public void CloseAllPopup()
|
|
{
|
|
var tempList = new List<PopupUi>(PopupUiList);
|
|
|
|
foreach (var popup in tempList)
|
|
{
|
|
popup.Close();
|
|
}
|
|
|
|
PopupUiList.Clear();
|
|
}
|
|
|
|
public bool IsPopupListEmpty() => PopupUiList.Count == 0;
|
|
|
|
#endregion
|
|
}
|
|
} |