159 lines
3.8 KiB
C#
159 lines
3.8 KiB
C#
// ***********************************************************************
|
|
// Assembly : Game
|
|
// Author : Kimch
|
|
// Created : 2021-05-02
|
|
// Description :
|
|
// Last Modified By :
|
|
// Last Modified On :
|
|
// ***********************************************************************
|
|
// <copyright file= "EndlessWindow.View" company="Kunpo"></copyright>
|
|
// <summary></summary>
|
|
// ***********************************************************************
|
|
namespace G.UI
|
|
{
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
partial class EndlessWindow
|
|
{
|
|
#region Field
|
|
|
|
#pragma warning disable CS0649 // 从未对字段赋值,字段将一直保持其默认值 null
|
|
|
|
[KUIFlag]
|
|
TextMeshProUGUI _tmpRemainCount;
|
|
[KUIFlag]
|
|
TextMeshProUGUI _tmpRemainTimer;
|
|
[KUIFlag]
|
|
TextMeshProUGUI _tmpHighest;
|
|
[KUIFlag]
|
|
Button _btnClose;
|
|
[KUIFlag]
|
|
Button _btnBack;
|
|
[KUIFlag]
|
|
Button _btnRanking;
|
|
[KUIFlag]
|
|
Button _btnChallenge;
|
|
[KUIFlag]
|
|
Button _btnRestart;
|
|
[KUIFlag]
|
|
Button _btnTips;
|
|
[KUIFlag]
|
|
Button _btnSuit;
|
|
[KUIFlag]
|
|
GameObject _goPropItem2;
|
|
[KUIFlag]
|
|
TextMeshProUGUI _tmpChallenge;
|
|
|
|
#pragma warning restore CS0649 // 从未对字段赋值,字段将一直保持其默认值 null
|
|
|
|
private PropWidget _propWidget;
|
|
|
|
#endregion
|
|
|
|
#region Method
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public void InitView()
|
|
{
|
|
SetViewData();
|
|
_btnClose.onClick.AddListener(this.OnBackBtnClick);
|
|
_btnBack.onClick.AddListener(this.OnBackBtnClick);
|
|
_btnRanking.onClick.AddListener(this.OnRankingBtnClick);
|
|
_btnChallenge.onClick.AddListener(this.OnChallengeBtnClick);
|
|
_btnRestart.onClick.AddListener(this.OnRestartBtnClick);
|
|
|
|
_btnTips.onClick.AddListener(this.OnTipsBtnClick);
|
|
_btnSuit.onClick.AddListener(this.OnSuitBtnClick);
|
|
|
|
_propWidget = _goPropItem2.AddComponent<PropWidget>();
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public void RefreshView()
|
|
{
|
|
var proxy = LevelProxy.Instance;
|
|
int highestEndlessStage = proxy.highestEndlessStage;
|
|
_tmpHighest.text = $"本周最佳记录:{highestEndlessStage}";
|
|
_propWidget.SetItem(proxy.highestEndlessRewards);
|
|
if (highestEndlessStage > 5)
|
|
{
|
|
_tmpChallenge.text = "继续挑战";
|
|
//_btnRestart.gameObject.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
_tmpChallenge.text = "挑战";
|
|
//_btnRestart.gameObject.SetActive(false);
|
|
}
|
|
var amount = TimeProxy.Instance.GetTimeInfo2(TimeProxy.武道会挑战次数);
|
|
_tmpRemainCount.text = $"本日可挑战次数:{amount.remain}/{amount.max}";
|
|
|
|
UpdateView();
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public void UpdateView()
|
|
{
|
|
_tmpRemainTimer.text = F.Utils.Time.ToTimeString(LevelProxy.Instance.endlessLevelRemainSeconds);
|
|
}
|
|
|
|
private void OnBackBtnClick()
|
|
{
|
|
if ("endless".Equals(this.data))
|
|
{
|
|
CloseWindow(this);
|
|
OpenWindow<MainWindow>();
|
|
}
|
|
else
|
|
{ CloseWindow(this); }
|
|
SoundProxy.PlayFxAsync(GlobalDefine.BUTTON_CLICK_SOUND);
|
|
}
|
|
|
|
private void OnRankingBtnClick()
|
|
{
|
|
OpenWindow<RankingWindow>("endless");
|
|
SoundProxy.PlayFxAsync(GlobalDefine.BUTTON_CLICK_SOUND);
|
|
}
|
|
|
|
private void OnChallengeBtnClick()
|
|
{
|
|
CloseWindow(this);
|
|
LevelProxy.Instance.StartEndless();
|
|
SoundProxy.PlayFxAsync(GlobalDefine.BUTTON_CLICK_SOUND);
|
|
}
|
|
|
|
private void OnRestartBtnClick()
|
|
{
|
|
CloseWindow(this);
|
|
LevelProxy.Instance.StartEndless(true);
|
|
SoundProxy.PlayFxAsync(GlobalDefine.BUTTON_CLICK_SOUND);
|
|
}
|
|
|
|
private void OnTipsBtnClick()
|
|
{
|
|
MessageBox.ShowMessage(KLocalization.GetLocalString(61), KLocalization.GetLocalString(62));
|
|
SoundProxy.PlayFxAsync(GlobalDefine.BUTTON_CLICK_SOUND);
|
|
}
|
|
|
|
private void OnSuitBtnClick()
|
|
{
|
|
CloseWindow(this);
|
|
OpenWindow<MainWindow>("Cha");
|
|
//PostNotification(GlobalDefine.EVENT_MAIN_WINDOW_PAGE, 3, "");
|
|
SoundProxy.PlayFxAsync(GlobalDefine.BUTTON_CLICK_SOUND);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|