2022-02-09 08:35:01 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.UI;
|
2022-02-11 09:21:44 +00:00
|
|
|
|
using DG.Tweening;
|
2022-02-09 08:35:01 +00:00
|
|
|
|
|
|
|
|
|
|
public class ButtonEndings : MonoBehaviour
|
|
|
|
|
|
{
|
|
|
|
|
|
public Action DelClick;
|
|
|
|
|
|
|
|
|
|
|
|
[SerializeField] GameObject mGobIncomplete;
|
|
|
|
|
|
[SerializeField] GameObject mGobComplete;
|
|
|
|
|
|
|
|
|
|
|
|
[SerializeField] Text mTxtUnlocked;
|
|
|
|
|
|
[SerializeField] Text mTxtTotal;
|
|
|
|
|
|
|
|
|
|
|
|
[SerializeField] Image mImgIcon;
|
|
|
|
|
|
|
|
|
|
|
|
[SerializeField] GameObject mGobTips;
|
2022-02-10 10:17:22 +00:00
|
|
|
|
[SerializeField] GameObject mGobNew;
|
2022-02-09 08:35:01 +00:00
|
|
|
|
|
|
|
|
|
|
private bool mIsCompleted;
|
|
|
|
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
|
|
{
|
|
|
|
|
|
Button tBtn = GetComponent<Button>();
|
2022-02-14 09:14:06 +00:00
|
|
|
|
UIUtils.BindBtn(tBtn, OnClick, AudioType.Click_Tip);
|
2022-02-09 08:35:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Init(int pLevelID, int pUnlockCount, int pTotalCount)
|
|
|
|
|
|
{
|
|
|
|
|
|
mIsCompleted = pUnlockCount == pTotalCount;
|
|
|
|
|
|
|
|
|
|
|
|
mGobIncomplete.SetActive(!mIsCompleted);
|
|
|
|
|
|
mGobComplete.SetActive(mIsCompleted);
|
|
|
|
|
|
|
|
|
|
|
|
if (!mIsCompleted)
|
|
|
|
|
|
{
|
|
|
|
|
|
mTxtUnlocked.text = pUnlockCount.ToString();
|
|
|
|
|
|
mTxtTotal.text = pTotalCount.ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
mImgIcon.sprite = ResourceManager.Instance.LoadRes<Sprite>(Const.Path.GetLevelIconSmall(pLevelID));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ShowTip(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void ShowTip(bool pShow)
|
|
|
|
|
|
{
|
2022-02-10 10:17:22 +00:00
|
|
|
|
if (mGobTips != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
mGobTips.SetActive(pShow);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void ShowNew(bool pShow)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (mGobNew != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
mGobNew.SetActive(pShow);
|
2022-02-11 09:21:44 +00:00
|
|
|
|
if (pShow)
|
|
|
|
|
|
{
|
|
|
|
|
|
mGobNew.GetComponent<DOTweenAnimation>().DOPlay();
|
|
|
|
|
|
}
|
2022-02-10 10:17:22 +00:00
|
|
|
|
}
|
2022-02-09 08:35:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnClick()
|
|
|
|
|
|
{
|
|
|
|
|
|
DelClick?.Invoke();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|