2024-01-12 16:04:49 +08:00
|
|
|
using cfg;
|
2024-04-03 12:52:49 +08:00
|
|
|
using Cysharp.Threading.Tasks;
|
2024-01-12 16:04:49 +08:00
|
|
|
using Framework;
|
2024-03-21 16:08:31 +08:00
|
|
|
using Gameplay;
|
2023-10-19 15:00:19 +08:00
|
|
|
using Gameplay.Level;
|
2024-04-24 14:31:42 +08:00
|
|
|
using System.Linq;
|
2023-08-22 19:08:45 +08:00
|
|
|
using TMPro;
|
2024-04-03 12:52:49 +08:00
|
|
|
using UnityEngine.UI;
|
2023-08-22 19:08:45 +08:00
|
|
|
using Button = UnityEngine.UI.Button;
|
|
|
|
|
using Image = UnityEngine.UI.Image;
|
|
|
|
|
|
|
|
|
|
public class UIDefeatGameController : UIWindow{
|
|
|
|
|
|
|
|
|
|
//UI GameObj
|
2024-01-11 16:52:03 +08:00
|
|
|
///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;
|
2024-04-03 12:52:49 +08:00
|
|
|
|
2024-01-11 16:52:03 +08:00
|
|
|
///Auto Gen End///
|
2024-04-03 12:52:49 +08:00
|
|
|
|
|
|
|
|
public static async UniTask<UIWindow> Open()
|
|
|
|
|
{
|
|
|
|
|
CommonUtils.CaptureScreenshot();
|
|
|
|
|
|
2024-05-16 12:40:15 +08:00
|
|
|
return await UIManager.Instance.CreateAndOpenWindow(UINameConst.UIDefeatGame);
|
2024-04-03 12:52:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 高斯模糊背景遮罩
|
|
|
|
|
/// </summary>
|
|
|
|
|
private RawImage rawImageGaussianBlurMask;
|
|
|
|
|
|
|
|
|
|
// Use this for initialization
|
|
|
|
|
public override void OnInit()
|
2023-08-22 19:08:45 +08:00
|
|
|
{
|
|
|
|
|
//bind UI GameObj
|
|
|
|
|
UIDefeatGameBinder.GetComponents(this);
|
2024-04-03 12:52:49 +08:00
|
|
|
rawImageGaussianBlurMask = GetComponent<RawImage>("GaussianBlurMask");
|
|
|
|
|
|
|
|
|
|
rawImageGaussianBlurMask.texture = CommonUtils.screenTexture;
|
|
|
|
|
|
|
|
|
|
BindButton(Button_Continue, () =>
|
2023-08-22 19:08:45 +08:00
|
|
|
{
|
2023-10-19 15:00:19 +08:00
|
|
|
LevelManager.Instance.ExitLevelDirectly();
|
|
|
|
|
});
|
2023-08-22 19:08:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//invoke when open window
|
2024-01-24 16:32:38 +08:00
|
|
|
protected override void OnShowWindow(object data = null)
|
2023-08-22 19:08:45 +08:00
|
|
|
{
|
2024-01-12 16:04:49 +08:00
|
|
|
_Refresh();
|
2023-08-22 19:08:45 +08:00
|
|
|
}
|
2024-01-12 16:04:49 +08:00
|
|
|
|
2024-04-28 16:50:25 +08:00
|
|
|
protected override void OnHideWindow()
|
|
|
|
|
{
|
|
|
|
|
AudioManager.Instance.AudioMgrObj.StopAllSounds();
|
|
|
|
|
|
|
|
|
|
base.OnHideWindow();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region RefreshWindow
|
2024-01-12 16:04:49 +08:00
|
|
|
|
2024-04-28 16:50:25 +08:00
|
|
|
private async void _Refresh()
|
2024-01-12 16:04:49 +08:00
|
|
|
{
|
|
|
|
|
_RefreshTime();
|
|
|
|
|
_RefreshPhysical();
|
2024-04-24 14:31:42 +08:00
|
|
|
|
|
|
|
|
Team team = TeamEditManager.Instance.GetSelectTeam();
|
|
|
|
|
uint[] ids = team.GetCharacterIDs();
|
|
|
|
|
if (ids.Count() > 0)
|
|
|
|
|
await DialogueManager.Instance.PlayDiaogue((int)ids[0], cfg.DialogueCfg.E_DialogueType.LevelFailure);
|
|
|
|
|
}
|
2024-01-12 16:04:49 +08:00
|
|
|
|
|
|
|
|
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
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
|
|
|
}
|