You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
3.1 KiB
106 lines
3.1 KiB
using UnityEngine;
|
|
using TMPro;
|
|
|
|
public class EscrTrainDgLevel : EScrCell
|
|
{
|
|
[SerializeField] GraphicsColorSetter levelTxtColorSetter;
|
|
|
|
GameObject unlockSet;
|
|
GameObject lockSet;
|
|
GameObject clearStamp;
|
|
GameObject btnTry;
|
|
GameObject imgHighlight;
|
|
|
|
TextMeshProUGUI txtLevel;
|
|
TextMeshProUGUI txtCur;
|
|
|
|
TextMeshProUGUI txtUnlockCondition;
|
|
|
|
TrainDgData trainDgData;
|
|
|
|
public override void InitCell()
|
|
{
|
|
unlockSet = transform.Find("Unlock").gameObject;
|
|
lockSet = transform.Find("Lock").gameObject;
|
|
clearStamp = unlockSet.transform.Find("Clear").gameObject;
|
|
btnTry = unlockSet.transform.Find("btnChallenge").gameObject;
|
|
|
|
imgHighlight = unlockSet.transform.Find("imgCurrent").gameObject;
|
|
txtLevel = unlockSet.transform.Find("txtLevel").GetComponent<TextMeshProUGUI>();
|
|
txtCur = unlockSet.transform.Find("txtCur").GetComponent<TextMeshProUGUI>();
|
|
|
|
txtUnlockCondition = lockSet.transform.Find("UnlockCondition").GetComponent<TextMeshProUGUI>();
|
|
}
|
|
|
|
public override void SetData(int itemid)
|
|
{
|
|
itemID = itemid;
|
|
|
|
GameModDataGroup.Instance.TryGetModData(TrainDgProp.CodeName, out trainDgData);
|
|
Debug.Assert(trainDgData != null, "invalid mod data");
|
|
|
|
clearStamp.SetActive(true);
|
|
btnTry.SetActive(false);
|
|
|
|
txtLevel.text = FormatString.StringFormat(LocalizationText.GetText("dg_diff"), itemID);
|
|
txtCur.text = FormatString.StringFormat(LocalizationText.GetText("recommand_battlepower"), FormatString.BigIntString1(trainDgData.GetRecommendBattlePower((uint)itemID)));
|
|
|
|
txtUnlockCondition.text = LocalizationText.GetText("awaken_unlock_dungeon");
|
|
|
|
if (itemID <= trainDgData.Level)
|
|
{
|
|
unlockSet.SetActive(true);
|
|
lockSet.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
unlockSet.SetActive(false);
|
|
lockSet.SetActive(true);
|
|
}
|
|
|
|
if (itemID == trainDgData.Level)
|
|
{
|
|
clearStamp.SetActive(false);
|
|
btnTry.SetActive(true);
|
|
}
|
|
|
|
if (itemID == EnhanceMgr.Instance.GetSelected())
|
|
{
|
|
imgHighlight.SetActive(true);
|
|
levelTxtColorSetter.SetColor("brown_dark");
|
|
}
|
|
else
|
|
{
|
|
imgHighlight.SetActive(false);
|
|
levelTxtColorSetter.SetColor("brown_light");
|
|
}
|
|
}
|
|
|
|
public override void RefreshCellView()
|
|
{
|
|
SetData(itemID);
|
|
}
|
|
|
|
public void OnBtnSelect()
|
|
{
|
|
EnhanceMgr.Instance.SetSelected(itemID);
|
|
}
|
|
|
|
public void OnBtnGoDungeon()
|
|
{
|
|
if (BattleMgr.Instance.CurrentBattleType != BattleMgr.BattleType.Stage)
|
|
{
|
|
GameUIMgr.SOpenToast(LocalizationText.GetText("donot_changedg"));
|
|
}
|
|
else if (BattleMgr.Instance.doNotInterupt)
|
|
{
|
|
GameUIMgr.SOpenToast(LocalizationText.GetText("donot_interupt"));
|
|
}
|
|
else if (!EnhanceMgr.Instance.GetAutoReroll())
|
|
{
|
|
DungeonMgr.Instance.OpenPopupPreset(trainDgData);
|
|
SoundMgr.Instance.PlaySfx(SoundName.BtnPress);
|
|
}
|
|
}
|
|
}
|
|
|