+ 화면 밖에서 손님이 요구하는 중일 때, Indicator를 통해서 Ui 표시 + Open, Closed Ui 추가 및 기능 연결 + 테이블 찾는 로직 변경 (전부 랜덤) - 기존에는 항상 같은 순서로 자리를 채움 + 통계용 데이터 CustomerVisitInfo 추가 (추후에 통계Ui 생길 때 연결) + 대화 조건 변경 + 일부 가구들 상호작용 조건 변경 + Outline shader Render Face(Front -> Both 변경 - Front면 x축 뒤집는 경우 안나옴) + GraphicMaterialOverride를 사용하는 경우, 에디터에서 전체화면 등 특정 상황에서 material이 사라지는 버그 수정 + InteractionFuniture Open, Closed 공통 기능으로 병합
141 lines
3.7 KiB
C#
141 lines
3.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using BlueWater.Tycoons;
|
|
using DG.Tweening;
|
|
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 GoldUi GoldUi { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public TycoonUpgradeUi TycoonUpgradeUi { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public TycoonManagementUi TycoonManagementUi { get; private set; }
|
|
|
|
[field: SerializeField]
|
|
public TycoonStageUi TycoonStageUi { get; private set; }
|
|
|
|
// Variables
|
|
public List<PopupUi> PopupUiList { get; private set; }
|
|
|
|
#endregion
|
|
|
|
// Unity events
|
|
#region Unity events
|
|
|
|
protected override void OnAwake()
|
|
{
|
|
InitializeComponents();
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
TycoonManager.Instance.OnTycoonOpenedEvent += TycoonOpenEvent;
|
|
TycoonManager.Instance.OnTycoonClosedEvent += TycoonClosedEvent;
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
PopupUi.OnPopupUiOpenEvent += RegisterPopup;
|
|
PopupUi.OnPopupUiCloseEvent += UnregisterPopup;
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
PopupUi.OnPopupUiOpenEvent -= RegisterPopup;
|
|
PopupUi.OnPopupUiCloseEvent -= UnregisterPopup;
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
if (Quitting) return;
|
|
|
|
TycoonManager.Instance.OnTycoonOpenedEvent -= TycoonOpenEvent;
|
|
TycoonManager.Instance.OnTycoonClosedEvent -= TycoonClosedEvent;
|
|
}
|
|
|
|
#endregion
|
|
|
|
// Initialize methods
|
|
#region Initialize methods
|
|
|
|
[Button("셋팅 초기화")]
|
|
private void InitializeComponents()
|
|
{
|
|
MainCanvas = GetComponent<Canvas>();
|
|
GoldUi = transform.Find("GoldUi").GetComponent<GoldUi>();
|
|
TycoonUpgradeUi = GetComponentInChildren<TycoonUpgradeUi>(true);
|
|
TycoonManagementUi = GetComponentInChildren<TycoonManagementUi>(true);
|
|
TycoonStageUi = GetComponentInChildren<TycoonStageUi>(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;
|
|
|
|
private void TycoonOpenEvent()
|
|
{
|
|
TycoonStageUi.TycoonOpenUi();
|
|
}
|
|
|
|
private void TycoonClosedEvent()
|
|
{
|
|
TycoonStageUi.TycoonClosedUi();
|
|
TycoonManagementUi.CookMenuUi.CookUi.TycoonClosed();
|
|
TycoonManagementUi.CookMenuUi.DailyFoodMenuUi.TycoonClosed();
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |