68 lines
1.8 KiB
C#
68 lines
1.8 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using DG.Tweening;
|
|
|
|
namespace MMO
|
|
{
|
|
public class MMOUINewTask : MMOUIBase
|
|
{
|
|
[SerializeField] CanvasGroup mCvsBg;
|
|
[SerializeField] RectTransform mRctBg;
|
|
|
|
[SerializeField] Text mTxtHead;
|
|
[SerializeField] Text mTxtTitle;
|
|
[SerializeField] Text mTxtContent;
|
|
[SerializeField] Image mImgTaskIcon;
|
|
|
|
[SerializeField] Button mBtnOK;
|
|
[SerializeField] Button mBtnClose;
|
|
|
|
protected override void OnInit()
|
|
{
|
|
base.OnInit();
|
|
|
|
BindBtn(mBtnOK, OnClickClose);
|
|
BindBtn(mBtnClose, OnClickClose);
|
|
}
|
|
|
|
public void ConfigInfo(string pContent, MMOTaskType pType)
|
|
{
|
|
if (pType != MMOTaskType.Final)
|
|
{
|
|
mImgTaskIcon.gameObject.SetActive(true);
|
|
mImgTaskIcon.sprite = MMOUtils.LoadTaskIcon(pType);
|
|
|
|
mTxtHead.text = "New Task";
|
|
mTxtTitle.text = "Almost there!Please complete the task to obtain your gift.";
|
|
}
|
|
else
|
|
{
|
|
mImgTaskIcon.gameObject.SetActive(false);
|
|
|
|
mTxtHead.text = "Task Complete";
|
|
mTxtTitle.text = "Congratulations!";
|
|
}
|
|
|
|
mTxtContent.text = pContent;
|
|
}
|
|
|
|
public override void OnOpen()
|
|
{
|
|
base.OnOpen();
|
|
|
|
mCvsBg.alpha = 0;
|
|
mRctBg.anchoredPosition = new Vector2(0, -160);
|
|
|
|
mCvsBg.DOFade(1, 0.3f);
|
|
mRctBg.DOAnchorPosY(0, 0.3f);
|
|
}
|
|
|
|
private void OnClickClose()
|
|
{
|
|
mCvsBg.DOFade(0, 0.3f);
|
|
mRctBg.DOAnchorPosY(-160, 0.3f).onComplete = Close;
|
|
}
|
|
}
|
|
} |