67 lines
1.4 KiB
C#
67 lines
1.4 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using UnityEngine;
|
|||
|
|
using UnityEngine.UI;
|
|||
|
|
using DG.Tweening;
|
|||
|
|
|
|||
|
|
public class PanelDialog : BasePanel
|
|||
|
|
{
|
|||
|
|
[SerializeField] CanvasGroup mCvsBg;
|
|||
|
|
[SerializeField] RectTransform mRctBg;
|
|||
|
|
|
|||
|
|
[SerializeField] Button mBtnClose;
|
|||
|
|
[SerializeField] Button mBtnYes;
|
|||
|
|
[SerializeField] Button mBtnNo;
|
|||
|
|
|
|||
|
|
[SerializeField] Text mTxtTitle;
|
|||
|
|
[SerializeField] Text mTxtContent;
|
|||
|
|
|
|||
|
|
private Action mDelYes;
|
|||
|
|
private Action mDelNo;
|
|||
|
|
|
|||
|
|
private void Awake()
|
|||
|
|
{
|
|||
|
|
UIUtils.BindBtn(mBtnClose, OnClickClose);
|
|||
|
|
|
|||
|
|
UIUtils.BindBtn(mBtnYes, OnClickYes);
|
|||
|
|
UIUtils.BindBtn(mBtnNo, OnClickNo);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public override void OnOpen()
|
|||
|
|
{
|
|||
|
|
base.OnOpen();
|
|||
|
|
|
|||
|
|
mCvsBg.alpha = 0;
|
|||
|
|
mRctBg.anchoredPosition = new Vector2(0, -260);
|
|||
|
|
|
|||
|
|
mCvsBg.DOFade(1, 0.3f);
|
|||
|
|
mRctBg.DOAnchorPosY(0, 0.3f);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void Init(string pTitle, string pContent, Action pDelYes, Action pDelNo)
|
|||
|
|
{
|
|||
|
|
mTxtTitle.text = pTitle;
|
|||
|
|
mTxtContent.text = pContent;
|
|||
|
|
|
|||
|
|
mDelYes = pDelYes;
|
|||
|
|
mDelNo = pDelNo;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void OnClickClose()
|
|||
|
|
{
|
|||
|
|
mCvsBg.DOFade(0, 0.3f);
|
|||
|
|
mRctBg.DOAnchorPosY(-260, 0.3f).onComplete = Close;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void OnClickYes()
|
|||
|
|
{
|
|||
|
|
mDelYes?.Invoke();
|
|||
|
|
OnClickClose();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void OnClickNo()
|
|||
|
|
{
|
|||
|
|
mDelNo?.Invoke();
|
|||
|
|
OnClickClose();
|
|||
|
|
}
|
|||
|
|
}
|