64 lines
1.8 KiB
C#
64 lines
1.8 KiB
C#
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
|
|
public class BlindPopup : PopupBase//, IPointerClickHandler
|
|
{
|
|
private CanvasGroup canvasGroup;
|
|
protected override void Awake()
|
|
{
|
|
base.Awake();
|
|
canvasGroup = this.GetComponent<CanvasGroup>();
|
|
|
|
if (GameManager.Instance != null)
|
|
{
|
|
GameManager.Event.RegistEvent(EEventType.MoveToStore_Heart_DuringGame, this.MoveToStore_Heart_DuringGameCallback);
|
|
GameManager.Event.RegistEvent(EEventType.OnReturnToGameFromStore, this.OnReturnToGameFromStoreCallback);
|
|
}
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
if (GameManager.Instance != null)
|
|
{
|
|
GameManager.Event.RemoveEvent(EEventType.MoveToStore_Heart_DuringGame, this.MoveToStore_Heart_DuringGameCallback);
|
|
GameManager.Event.RemoveEvent(EEventType.OnReturnToGameFromStore, this.OnReturnToGameFromStoreCallback);
|
|
}
|
|
}
|
|
|
|
private void MoveToStore_Heart_DuringGameCallback()
|
|
{
|
|
canvasGroup.alpha = 0;
|
|
canvasGroup.blocksRaycasts = false;
|
|
canvasGroup.blocksRaycasts = false;
|
|
}
|
|
|
|
private void OnReturnToGameFromStoreCallback()
|
|
{
|
|
canvasGroup.alpha = 1;
|
|
canvasGroup.blocksRaycasts = true;
|
|
canvasGroup.blocksRaycasts = true;
|
|
}
|
|
|
|
|
|
public override void ShowPopup(int drawOrder)
|
|
{
|
|
this.gameObject.SetActive(true);
|
|
base.SetDrawOrder(drawOrder);
|
|
}
|
|
|
|
public override void SetDrawOrder(int drawOrder)
|
|
{
|
|
if (canvas == null) canvas = this.GetComponent<UnityEngine.Canvas>();
|
|
canvas.sortingOrder = ((drawOrder + 1) * 2) - 1;
|
|
}
|
|
|
|
public override void HidePopup()
|
|
{
|
|
this.gameObject.SetActive(false);
|
|
}
|
|
|
|
//public void OnPointerClick(PointerEventData eventData)
|
|
//{
|
|
// GameManager.UI.HideTopPopup();
|
|
//}
|
|
} |