146 lines
3.0 KiB
C#
146 lines
3.0 KiB
C#
|
|
using UnityEngine;
|
|||
|
|
using UnityEngine.Events;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public class UIBaseClass : MonoBehaviour
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>رջص<D5BB>
|
|||
|
|
/// </summary>
|
|||
|
|
private UnityAction hideCallback;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>ڵ㻭<DAB5><E3BBAD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
private CanvasGroup nodeCG;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>״̬<D7B4><CCAC>
|
|||
|
|
/// </summary>
|
|||
|
|
protected Animation showHideAnimation;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>״̬<D7B4><CCAC>
|
|||
|
|
/// </summary>
|
|||
|
|
protected Animator showHideAnimator;
|
|||
|
|
|
|||
|
|
protected virtual void Awake()
|
|||
|
|
{
|
|||
|
|
Init();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public virtual void OnShow()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>ر<EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public virtual void OnHide()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// ɾ<><C9BE>
|
|||
|
|
/// </summary>
|
|||
|
|
public virtual void OnDelete()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>ʼ<EFBFBD><CABC>
|
|||
|
|
/// </summary>
|
|||
|
|
private void Init()
|
|||
|
|
{
|
|||
|
|
nodeCG = transform.Find("Node").GetComponent<CanvasGroup>();
|
|||
|
|
GetComponent<Canvas>().worldCamera=UIManager.Instance.uICamera;
|
|||
|
|
if (transform.TryGetComponent(out Animation animation))
|
|||
|
|
{
|
|||
|
|
this.showHideAnimation = animation;
|
|||
|
|
}
|
|||
|
|
if (transform.TryGetComponent(out Animator animator))
|
|||
|
|
{
|
|||
|
|
this.showHideAnimator = animator;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// ȫ<><C8AB>ʧЧ<CAA7><D0A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void AllLapseInitiate(bool isAllLapse)
|
|||
|
|
{
|
|||
|
|
nodeCG.interactable = isAllLapse;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>ر<EFBFBD><D8B1>Լ<EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
protected void HideMe()
|
|||
|
|
{
|
|||
|
|
UIManager.Instance.HideUI(this.name);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// ɾ<><C9BE><EFBFBD>Լ<EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
protected void DeleteMe()
|
|||
|
|
{
|
|||
|
|
UIManager.Instance.DeleteUI(this.name);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>嶯<EFBFBD><E5B6AF>
|
|||
|
|
/// </summary>
|
|||
|
|
public virtual void ShowPanelAnimation()
|
|||
|
|
{
|
|||
|
|
if (showHideAnimation != null)
|
|||
|
|
{
|
|||
|
|
showHideAnimation.Play("ShowUI");
|
|||
|
|
}
|
|||
|
|
if(showHideAnimator!=null)
|
|||
|
|
{
|
|||
|
|
showHideAnimator.Play("ShowUI");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="hideCall"><3E>رպ<D8B1><D5BA><EFBFBD>ʲô<CAB2><C3B4></param>
|
|||
|
|
public virtual void HidePanel(UnityAction hideCallback)
|
|||
|
|
{
|
|||
|
|
this.hideCallback= hideCallback;
|
|||
|
|
if (showHideAnimation == null&&showHideAnimator==null)
|
|||
|
|
{
|
|||
|
|
this.hideCallback?.Invoke();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (showHideAnimation != null)
|
|||
|
|
{
|
|||
|
|
showHideAnimation.Play("HideUI");
|
|||
|
|
}
|
|||
|
|
if(showHideAnimator!=null)
|
|||
|
|
{
|
|||
|
|
showHideAnimator.Play("HideUI");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>رջص<D5BB>
|
|||
|
|
/// </summary>
|
|||
|
|
public void HideCallback()
|
|||
|
|
{
|
|||
|
|
this.hideCallback?.Invoke();
|
|||
|
|
}
|
|||
|
|
}
|