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.
142 lines
4.5 KiB
142 lines
4.5 KiB
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using TMPro;
|
|
|
|
public class EscrDungeonItem : EScrCell
|
|
{
|
|
GameObject unlockSet;
|
|
GameObject lockSet;
|
|
GameObject clearStamp;
|
|
ButtonIV btnTry;
|
|
Image imgTicket;
|
|
TextMeshProUGUI btnTicket;
|
|
|
|
TextMeshProUGUI txtEnter;
|
|
GameObject imgHighlight;
|
|
|
|
TextMeshProUGUI txtLevel;
|
|
TextMeshProUGUI txtCur;
|
|
|
|
TextMeshProUGUI txtUnlockCondition;
|
|
|
|
int dungeonId = 0;
|
|
|
|
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").GetComponent<ButtonIV>();
|
|
txtEnter = btnTry.transform.Find("txt").GetComponent<TextMeshProUGUI>();
|
|
txtEnter.text = LocalizationText.GetText("all_enter");
|
|
|
|
imgTicket = btnTry.transform.Find("icon").GetComponent<Image>();
|
|
btnTicket = btnTry.transform.Find("txtPrice").GetComponent<TextMeshProUGUI>();
|
|
|
|
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 Localize()
|
|
{
|
|
txtEnter.text = LocalizationText.GetText("all_enter");
|
|
}
|
|
|
|
public override void SetData(int itemid)
|
|
{
|
|
itemID = itemid;
|
|
|
|
DungeonMgr.DungeonKind dungeonKind = DungeonMgr.GetDungeonKind();
|
|
|
|
if (dungeonKind == DungeonMgr.DungeonKind.PetDG)
|
|
{
|
|
dungeonId = itemID + (iType * DataHandler.Const.dungeonPetStageMax);
|
|
txtLevel.text = FormatString.StringFormat(LocalizationText.GetText("stage_select_stage"), (dungeonId - 1) % 10 + 1);
|
|
}
|
|
else
|
|
{
|
|
dungeonId = itemID;
|
|
txtLevel.text = FormatString.StringFormat(LocalizationText.GetText("dg_diff"), dungeonId);
|
|
}
|
|
|
|
clearStamp.SetActive(true);
|
|
btnTry.gameObject.SetActive(false);
|
|
|
|
var targetDugeonInfo = DataHandler.GetDungeonTypeInfo(dungeonKind).diffs[dungeonId - 1];
|
|
var battlePower = DataHandler.CalcBattlePower(targetDugeonInfo.monAtk, targetDugeonInfo.monHp);
|
|
txtCur.text = FormatString.StringFormat(LocalizationText.GetText("recommand_battlepower"), FormatString.BigIntString1(battlePower));
|
|
|
|
txtUnlockCondition.text = LocalizationText.GetText("awaken_unlock_dungeon");
|
|
|
|
btnTicket.text = "1";//DataHandler.GetPlayerDungeonInfoKind(DungeonMgr.GetDungeonKind()).ticket.ToString();
|
|
//imgTicket.sprite = imgTicketSet[(int)DungeonMgr.GetDungeonKind()];
|
|
imgTicket.sprite = AddressableMgr.GetDungeonPanel(100 + (int)DungeonMgr.GetDungeonKind());
|
|
|
|
int totalCount = DataHandler.GetDungeonClearLevel(DungeonMgr.GetDungeonKind());
|
|
|
|
if (dungeonId <= totalCount + 1)
|
|
{
|
|
unlockSet.SetActive(true);
|
|
lockSet.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
unlockSet.SetActive(false);
|
|
lockSet.SetActive(true);
|
|
}
|
|
|
|
if (dungeonId == totalCount + 1)
|
|
{
|
|
clearStamp.SetActive(false);
|
|
btnTry.gameObject.SetActive(true);
|
|
}
|
|
|
|
if (dungeonId == DungeonMgr.GetSelectDgLv())
|
|
{
|
|
imgHighlight.SetActive(true);
|
|
txtLevel.color = Global.CLR_TextYellow;
|
|
}
|
|
else
|
|
{
|
|
imgHighlight.SetActive(false);
|
|
txtLevel.color = new Color(1f, 1f, 1f);
|
|
}
|
|
|
|
if (DataHandler.GetPlayerDungeonInfoKind(dungeonKind).ticket > 0)
|
|
{
|
|
btnTry.interactable = true;
|
|
}
|
|
else
|
|
{
|
|
btnTry.interactable = false;
|
|
}
|
|
}
|
|
|
|
public override void RefreshCellView()
|
|
{
|
|
base.RefreshCellView();
|
|
SetData(itemID);
|
|
}
|
|
|
|
public void OnBtnSelect()
|
|
{
|
|
SoundMgr.PlaySfx(SoundName.BtnPress);
|
|
Logger.Log("item id : " + itemID);
|
|
Logger.Log("calc : " + itemID + DungeonMgr.GetSelectPetArea() * DataHandler.Const.dungeonPetStageMax);
|
|
DungeonMgr.SetRewardList(itemID + DungeonMgr.GetSelectPetArea() * DataHandler.Const.dungeonPetStageMax);
|
|
}
|
|
|
|
public void OnBtnGoDungeon()
|
|
{
|
|
SoundMgr.PlaySfx(SoundName.BtnPress);
|
|
DungeonMgr.SPresetSetting();
|
|
}
|
|
|
|
public void UpdateCell()
|
|
{
|
|
|
|
}
|
|
}
|