120 lines
2.8 KiB
C#
120 lines
2.8 KiB
C#
![]() |
// ***********************************************************************
|
|||
|
// Assembly : Game
|
|||
|
// Author : Kimch
|
|||
|
// Created : 2021-06-22
|
|||
|
// Description :
|
|||
|
// Last Modified By :
|
|||
|
// Last Modified On :
|
|||
|
// ***********************************************************************
|
|||
|
// <copyright file= "EndlessSettleWindow.View" company="Kunpo"></copyright>
|
|||
|
// <summary></summary>
|
|||
|
// ***********************************************************************
|
|||
|
namespace G.UI
|
|||
|
{
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using Text = TMPro.TextMeshProUGUI;
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
partial class EndlessSettleWindow
|
|||
|
{
|
|||
|
#region Field
|
|||
|
|
|||
|
#pragma warning disable CS0649 // 从未对字段赋值,字段将一直保持其默认值 null
|
|||
|
[KUIFlag]
|
|||
|
private GameObject _goNew;
|
|||
|
|
|||
|
[KUIFlag]
|
|||
|
private KUIList __listReward;
|
|||
|
[KUIFlag]
|
|||
|
private Button _btnCollect;
|
|||
|
|
|||
|
[KUIFlag]
|
|||
|
private Text _tmpStage;
|
|||
|
[KUIFlag]
|
|||
|
private Text _tmpRank;
|
|||
|
|
|||
|
#pragma warning restore CS0649 // 从未对字段赋值,字段将一直保持其默认值 null
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Method
|
|||
|
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
public void InitView()
|
|||
|
{
|
|||
|
SetViewData();
|
|||
|
|
|||
|
__listReward.AddTemplate<PropWidget>(true);
|
|||
|
_btnCollect.onClick.AddListener(this.OnCollectBtnClick);
|
|||
|
}
|
|||
|
|
|||
|
public void RefreshView()
|
|||
|
{
|
|||
|
if (this.data is BattleResult result)
|
|||
|
{
|
|||
|
result.ApplyResult2();
|
|||
|
|
|||
|
__listReward.Clear();
|
|||
|
foreach (var money in result.moneyDict)
|
|||
|
{
|
|||
|
if (money.Value > 0)
|
|||
|
__listReward.GetItem<PropWidget>().SetCount(money.Key, money.Value);
|
|||
|
}
|
|||
|
foreach (var prop in result.propDict)
|
|||
|
{
|
|||
|
__listReward.GetItem<PropWidget>().SetCount(prop.Key, prop.Value);
|
|||
|
}
|
|||
|
|
|||
|
int levelType = result.levelType;
|
|||
|
if (levelType == 4)
|
|||
|
{
|
|||
|
var swordRewards = SwordProxy.Instance.GetSettleRewards();
|
|||
|
if (swordRewards.count > 0)
|
|||
|
__listReward.GetItem<PropWidget>().SetCount(swordRewards.id, swordRewards.count);
|
|||
|
}
|
|||
|
|
|||
|
if (levelType == 2)
|
|||
|
{
|
|||
|
_tmpRank.text = "击败全球80%的玩家";
|
|||
|
_tmpStage.text = $"第{result.stageIndex}关";
|
|||
|
|
|||
|
var isNew = LevelProxy.Instance.CompleteLevel(result.levelId, result.stageIndex);
|
|||
|
_goNew.SetActive(isNew);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_tmpRank.text = "";
|
|||
|
_tmpStage.text = "";
|
|||
|
_goNew.SetActive(false);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
SoundProxy.PlayFxAsync("Sounds/attack_ui_end.mp3");
|
|||
|
}
|
|||
|
|
|||
|
private void OnCollectBtnClick()
|
|||
|
{
|
|||
|
if (this.data is BattleResult result)
|
|||
|
{
|
|||
|
int levelType = result.levelType;
|
|||
|
if (levelType == 2)
|
|||
|
GameScene.Instance.EnterScene(0, "endless");
|
|||
|
else if (levelType == 4)
|
|||
|
GameScene.Instance.EnterScene(0, "sword");
|
|||
|
else
|
|||
|
GameScene.Instance.EnterScene(0, "special");
|
|||
|
}
|
|||
|
CloseWindow(this);
|
|||
|
SoundProxy.PlayFxAsync(GlobalDefine.BUTTON_CLICK_SOUND);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|