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.
72 lines
2.1 KiB
72 lines
2.1 KiB
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class AtlantisDungeonView : View
|
|
{
|
|
[SerializeField] ExtendText dungeonLevelText;
|
|
[SerializeField] ExtendSlider scoreBar;
|
|
[SerializeField] ExtendText scoreText;
|
|
[SerializeField] ExtendText remainTimeText;
|
|
|
|
[SerializeField] Toggle autoProgressToggle;
|
|
|
|
AtlantisDungeon dungeon;
|
|
|
|
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()
|
|
{
|
|
scoreBar?.SetRate(dungeon.CurrentScore, dungeon.Data.GoalScore);
|
|
scoreText?.SetText(FormatString.StringFormat(LocalizationText.GetText("global_killogram_format"), dungeon.CurrentScore));
|
|
remainTimeText?.SetText(FormatString.TextTime((int)dungeon.ModRemainingTime));
|
|
}
|
|
|
|
public void SetDungeon(AtlantisDungeon dungeon)
|
|
{
|
|
this.dungeon = dungeon;
|
|
|
|
string levelFormat = LocalizationText.GetText("dg_diff");
|
|
dungeonLevelText?.SetText(FormatString.StringFormat(levelFormat, dungeon.Data.Level));
|
|
|
|
scoreBar?.SetRateImmediate(dungeon.CurrentScore, dungeon.Data.GoalScore);
|
|
scoreText?.SetText(FormatString.StringFormat(LocalizationText.GetText("global_killogram_format"), dungeon.CurrentScore));
|
|
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;
|
|
}
|