52 lines
1.4 KiB
C#
52 lines
1.4 KiB
C#
|
|
using System.Collections;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using UnityEngine;
|
|||
|
|
using UnityEngine.UI;
|
|||
|
|
|
|||
|
|
public class EndingCell : MonoBehaviour
|
|||
|
|
{
|
|||
|
|
[SerializeField] Text mTxtEndingName;
|
|||
|
|
[SerializeField] GameObject mGobCheck;
|
|||
|
|
[SerializeField] GameObject mGobGood;
|
|||
|
|
[SerializeField] Button mBtnTip;
|
|||
|
|
[SerializeField] Button mBtnAdTip;
|
|||
|
|
|
|||
|
|
private int mLevelID;
|
|||
|
|
private int mEndingID;
|
|||
|
|
private EndingData mEdData;
|
|||
|
|
|
|||
|
|
private void Awake()
|
|||
|
|
{
|
|||
|
|
UIUtils.BindBtn(mBtnTip, OnClickTip);
|
|||
|
|
UIUtils.BindBtn(mBtnAdTip, OnClickAdTip);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void Init(int pLevelID, int pEndingID)
|
|||
|
|
{
|
|||
|
|
mLevelID = pLevelID;
|
|||
|
|
mEndingID = pEndingID;
|
|||
|
|
|
|||
|
|
mEdData = GameConfig.Instance.GetLevelData(mLevelID).Endings[pEndingID];
|
|||
|
|
|
|||
|
|
mTxtEndingName.text = mEdData.EndingName;
|
|||
|
|
mGobCheck.SetActive(PlayerData.Instance.HasUnlockedEnding(mLevelID, mEndingID));
|
|||
|
|
mGobGood.SetActive(mEdData.IsGoodEnding);
|
|||
|
|
|
|||
|
|
bool tHasWatchedAdTip = PlayerData.Instance.HasWatchedEndingAdTip(mLevelID, mEndingID);
|
|||
|
|
mBtnTip.gameObject.SetActive(tHasWatchedAdTip);
|
|||
|
|
mBtnAdTip.gameObject.SetActive(!tHasWatchedAdTip);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void OnClickTip()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void OnClickAdTip()
|
|||
|
|
{
|
|||
|
|
PlayerData.Instance.AddEndingAdTip(mLevelID, mEndingID);
|
|||
|
|
mBtnTip.gameObject.SetActive(true);
|
|||
|
|
mBtnAdTip.gameObject.SetActive(false);
|
|||
|
|
OnClickTip();
|
|||
|
|
}
|
|||
|
|
}
|