107 lines
2.1 KiB
C#
107 lines
2.1 KiB
C#
using cfg;
|
|
using Framework;
|
|
using Gameplay;
|
|
using Gameplay.Level;
|
|
using TMPro;
|
|
using Button = UnityEngine.UI.Button;
|
|
using Image = UnityEngine.UI.Image;
|
|
|
|
public class UIDefeatGameController : UIWindow{
|
|
|
|
//UI GameObj
|
|
///Auto Gen Start///
|
|
public Image Image_FailedBG;
|
|
public Image Image_Tip;
|
|
public TMP_Text Text_Failed;
|
|
public TMP_Text Text_FightTime;
|
|
public Image Image_Clock;
|
|
public TMP_Text Text_Time;
|
|
public Image Image_PhysicalPower;
|
|
public TMP_Text Text_PPNum;
|
|
public TMP_Text Text_PhysicalPowerBack;
|
|
public TMP_Text Text_FailedDescribe0;
|
|
public TMP_Text Text_FailedDescribe1;
|
|
public TMP_Text Text_FailedDescribe2;
|
|
public Image Image_AccountLogo;
|
|
public Button Button_Continue;
|
|
public TMP_Text Text_Continue;
|
|
|
|
///Auto Gen End///
|
|
|
|
// Use this for initialization
|
|
public override void OnInit()
|
|
{
|
|
//bind UI GameObj
|
|
UIDefeatGameBinder.GetComponents(this);
|
|
BindButton(Button_Continue, () =>
|
|
{
|
|
LevelManager.Instance.ExitLevelDirectly();
|
|
});
|
|
}
|
|
|
|
//invoke when open window
|
|
protected override void OnShowWindow(object data = null)
|
|
{
|
|
var blurImg = GetComponent<Image>("blurObj");
|
|
CommonUtils.SetImageBlur(blurImg);
|
|
blurImg.gameObject.SetActive(true);
|
|
_Refresh();
|
|
}
|
|
|
|
|
|
#region RefreshWindow
|
|
|
|
private void _Refresh()
|
|
{
|
|
_RefreshTime();
|
|
_RefreshPhysical();
|
|
}
|
|
|
|
private void _RefreshTime()
|
|
{
|
|
var minutes = TeamManager.Instance.GetFightPastMinute();
|
|
var seconds = TeamManager.Instance.GetFightPastSecond();
|
|
var timeStr = "";
|
|
|
|
if (minutes < 10)
|
|
{
|
|
timeStr += minutes;
|
|
}
|
|
else
|
|
{
|
|
timeStr += "0";
|
|
timeStr += minutes;
|
|
}
|
|
|
|
timeStr += ":";
|
|
|
|
if (minutes < 10)
|
|
{
|
|
timeStr += seconds;
|
|
}
|
|
else
|
|
{
|
|
timeStr += "0";
|
|
timeStr += seconds;
|
|
}
|
|
|
|
Text_Time.text = timeStr;
|
|
}
|
|
|
|
private void _RefreshPhysical()
|
|
{
|
|
var levelID = LevelManager.Instance.CurrentLevel.ID;
|
|
var levelCfg = TableManager.Instance.Tables.Level.GetOrDefault(levelID);
|
|
int count;
|
|
if (levelCfg != null)
|
|
{
|
|
var costPhysicals = levelCfg.CostItems;
|
|
count = costPhysicals.Count;
|
|
Text_PPNum.text = "x" + count;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|