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.
81 lines
2.3 KiB
81 lines
2.3 KiB
using BigFloatNumerics;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class HuntEagleDgView : View
|
|
{
|
|
[SerializeField] ExtendText dungeonLevelText;
|
|
[SerializeField] ExtendSlider enemyHpbar;
|
|
[SerializeField] ExtendText enemyHpText;
|
|
[SerializeField] ExtendText remainTimeText;
|
|
|
|
[SerializeField] Toggle autoProgressToggle;
|
|
|
|
HuntEagleDg dungeon;
|
|
|
|
StatData enemyHpStat;
|
|
|
|
private void Start()
|
|
{
|
|
viewState = ViewState.Hidden;
|
|
gameObject.SetActive(false);
|
|
}
|
|
|
|
public override void Show()
|
|
{
|
|
ResetPosition();
|
|
viewState = ViewState.Shown;
|
|
gameObject.SetActive(true);
|
|
}
|
|
|
|
public override void Hide()
|
|
{
|
|
gameObject.SetActive(false);
|
|
viewState = ViewState.Hidden;
|
|
}
|
|
|
|
private void LateUpdate()
|
|
{
|
|
if (enemyHpStat != null)
|
|
{
|
|
enemyHpbar?.SetRate((BigFloat)dungeon.EagleHerd.CurrentHp / enemyHpStat.Value);
|
|
enemyHpText?.SetText($"{FormatString.BigIntString1(dungeon.EagleHerd.CurrentHp)}/{FormatString.BigIntString1(enemyHpStat.Value)}");
|
|
}
|
|
|
|
remainTimeText?.SetText(FormatString.TextTime((int)dungeon.ModRemainingTime));
|
|
}
|
|
|
|
public void SetDungeon(HuntEagleDg dungeon)
|
|
{
|
|
this.dungeon = dungeon;
|
|
|
|
string levelFormat = LocalizationText.GetText("dg_diff");
|
|
dungeonLevelText?.SetText(FormatString.StringFormat(levelFormat, dungeon.Data.Level));
|
|
|
|
if (dungeon.EagleHerd.Data.TryGetStat(StatID.Hp, out enemyHpStat))
|
|
{
|
|
enemyHpbar?.SetRateImmediate((BigFloat)dungeon.EagleHerd.CurrentHp / enemyHpStat.Value);
|
|
enemyHpText?.SetText($"{FormatString.BigIntString1(dungeon.EagleHerd.CurrentHp)}/{FormatString.BigIntString1(enemyHpStat.Value)}");
|
|
}
|
|
|
|
remainTimeText?.SetText(FormatString.TextTime((int)dungeon.ModRemainingTime));
|
|
}
|
|
|
|
public void OpenQuitDungeon()
|
|
{
|
|
GameUIMgr.SOpenPopup2Button(LocalizationText.GetText("msg_dungeonout"), QuitDungeon);
|
|
}
|
|
|
|
private void QuitDungeon()
|
|
{
|
|
if (BattleMgr.Instance.doNotInterupt)
|
|
{
|
|
GameUIMgr.SOpenToast(LocalizationText.GetText("donot_interupt"));
|
|
return;
|
|
}
|
|
|
|
dungeon.QuitDungeon();
|
|
}
|
|
|
|
public void SetAutoProgress(bool onOff) => dungeon.Data.AutoProgress = onOff;
|
|
}
|