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.
86 lines
2.3 KiB
86 lines
2.3 KiB
using BigFloatNumerics;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class DeepCaveDungeonView : View
|
|
{
|
|
[SerializeField] ExtendText dungeonLevelText;
|
|
[SerializeField] ExtendSlider bossHpbar;
|
|
[SerializeField] ExtendText bossHpText;
|
|
[SerializeField] ExtendText remainTimeText;
|
|
|
|
[SerializeField] Toggle autoProgressToggle;
|
|
|
|
DeepCaveDungeon dungeon;
|
|
|
|
Character enemy => dungeon.Boss;
|
|
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)
|
|
{
|
|
bossHpbar?.SetRate((BigFloat)enemy.CurrentHp / enemyHpStat.Value);
|
|
bossHpText?.SetText($"{FormatString.BigIntString1(enemy.CurrentHp)}/{FormatString.BigIntString1(enemyHpStat.Value)}");
|
|
}
|
|
|
|
remainTimeText?.SetText(FormatString.TextTime((int)dungeon.ModRemainingTime));
|
|
}
|
|
|
|
public void SetDungeon(DeepCaveDungeon dungeon)
|
|
{
|
|
this.dungeon = dungeon;
|
|
|
|
string levelFormat = LocalizationText.GetText("dg_diff");
|
|
dungeonLevelText?.SetText(FormatString.StringFormat(levelFormat, dungeon.Data.Level));
|
|
|
|
if (enemy.Data.TryGetStat(StatID.Hp, out enemyHpStat))
|
|
{
|
|
bossHpbar?.SetRateImmediate((BigFloat)enemy.CurrentHp / enemyHpStat.Value);
|
|
bossHpText?.SetText($"{FormatString.BigIntString1(enemy.CurrentHp)}/{FormatString.BigIntString1(enemyHpStat.Value)}");
|
|
}
|
|
|
|
remainTimeText?.SetText(FormatString.TextTime((int)dungeon.ModRemainingTime));
|
|
autoProgressToggle?.SetIsOnWithoutNotify(dungeon.Data.AutoProgress);
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
|
|
|