317 lines
8.1 KiB
C#
317 lines
8.1 KiB
C#
![]() |
//// ***********************************************************************
|
|||
|
//// Assembly : Game
|
|||
|
//// Author : Kimch
|
|||
|
//// Created : 2020-09-16
|
|||
|
//// Description :
|
|||
|
//// Last Modified By :
|
|||
|
//// Last Modified On :
|
|||
|
//// ***********************************************************************
|
|||
|
//// <copyright file= "SettlePanel" company="KUNPO"></copyright>
|
|||
|
//// <summary></summary>
|
|||
|
//// ***********************************************************************
|
|||
|
|
|||
|
//using UnityEngine;
|
|||
|
//using UnityEngine.UI;
|
|||
|
//using Text = TMPro.TextMeshProUGUI;
|
|||
|
|
|||
|
//namespace G.UI
|
|||
|
//{
|
|||
|
// /// <summary>
|
|||
|
// /// 结算界面
|
|||
|
// /// </summary>
|
|||
|
// public class SettlePanel : KUIWidget
|
|||
|
// {
|
|||
|
// #region Field
|
|||
|
|
|||
|
//#pragma warning disable CS0649 // 从未对字段赋值,字段将一直保持其默认值 null
|
|||
|
// [KUIFlag]
|
|||
|
// GameObject _goWin;
|
|||
|
// [KUIFlag]
|
|||
|
// GameObject _goLose;
|
|||
|
|
|||
|
// [KUIFlag]
|
|||
|
// KUIList __listReward;
|
|||
|
// [KUIFlag]
|
|||
|
// Button _btnCollect;
|
|||
|
// [KUIFlag]
|
|||
|
// Button _btnLoseCollect;
|
|||
|
// [KUIFlag]
|
|||
|
// Text _tmpLevel;
|
|||
|
// [KUIFlag]
|
|||
|
// Text _tmpStage;
|
|||
|
// [KUIFlag]
|
|||
|
// Text _tmpRank;
|
|||
|
// [KUIFlag]
|
|||
|
// Text _tmpGetCoin;
|
|||
|
// [KUIFlag]
|
|||
|
// Text _tmpGetExp;
|
|||
|
// [KUIFlag]
|
|||
|
// Button _btnAgain;
|
|||
|
// [KUIFlag]
|
|||
|
// Button _btnGrow;
|
|||
|
|
|||
|
// [KUIFlag]
|
|||
|
// Image _imgGradeExp;
|
|||
|
// [KUIFlag]
|
|||
|
// Text _tmpGrade;
|
|||
|
|
|||
|
// [KUIFlag]
|
|||
|
// Button _btnCollectTreble;
|
|||
|
// [KUIFlag]
|
|||
|
// Text _tmpTrebleAmount;
|
|||
|
// [KUIFlag]
|
|||
|
// Text _tmpTrebleRemainCount;
|
|||
|
// [KUIFlag]
|
|||
|
// GameObject _imgTrebleAd;
|
|||
|
|
|||
|
// [KUIFlag]
|
|||
|
// Button _btnCollectDouble;
|
|||
|
|
|||
|
//#pragma warning restore CS0649 // 从未对字段赋值,字段将一直保持其默认值 null
|
|||
|
|
|||
|
// #endregion
|
|||
|
|
|||
|
// #region Method
|
|||
|
|
|||
|
// public override void Refresh()
|
|||
|
// {
|
|||
|
// BattleResult result = null;
|
|||
|
// if (this.data is BattleResult gs)
|
|||
|
// {
|
|||
|
// result = gs;
|
|||
|
// }
|
|||
|
// if (result == null)
|
|||
|
// result = GameLevel.Instance.battleResult;
|
|||
|
// if (!result.isValid)
|
|||
|
// {
|
|||
|
// return;
|
|||
|
// }
|
|||
|
|
|||
|
// result.ApplyResult();
|
|||
|
// if (!result.infinity)
|
|||
|
// {
|
|||
|
// _goWin.SetActive(result.success);
|
|||
|
// _goLose.SetActive(!result.success);
|
|||
|
// string resultString = "";
|
|||
|
// if (result.success)
|
|||
|
// {
|
|||
|
// if (result.levelId > 1)
|
|||
|
// {
|
|||
|
// var remainCount = TimeProxy.Instance.GetDailyAmount2(9);
|
|||
|
// if (remainCount.x > 0)
|
|||
|
// {
|
|||
|
// _btnCollectDouble.gameObject.SetActive(false);
|
|||
|
// _btnCollectTreble.gameObject.SetActive(true);
|
|||
|
|
|||
|
// _imgTrebleAd.SetActive(result.levelId > 2);
|
|||
|
// //_tmpTrebleAmount.text = (result.coin * 2).ToString();
|
|||
|
// _tmpTrebleRemainCount.text = $"超级加倍剩余次数:{remainCount.x}/{remainCount.y}";
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// _btnCollectTreble.gameObject.SetActive(false);
|
|||
|
// _btnCollectDouble.gameObject.SetActive(true);
|
|||
|
// }
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// _btnCollectDouble.gameObject.SetActive(false);
|
|||
|
// _btnCollectTreble.gameObject.SetActive(false);
|
|||
|
// }
|
|||
|
|
|||
|
// resultString = "success";
|
|||
|
// LevelProxy.Instance.CompleteLevel(result.levelId);
|
|||
|
// PostNotification(GlobalDefine.EVENT_SETTLE_RESULT, result, resultString);
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// var restart = (this.data as string) == "restart";
|
|||
|
// resultString = restart ? "uncompleted" : "fail";
|
|||
|
|
|||
|
// _btnLoseCollect.gameObject.SetActive(restart);
|
|||
|
// _btnAgain.gameObject.SetActive(!restart);
|
|||
|
// _btnGrow.gameObject.SetActive(!restart);
|
|||
|
// PostNotification(GlobalDefine.EVENT_SETTLE_RESULT, result, resultString);
|
|||
|
// }
|
|||
|
|
|||
|
// _tmpLevel.text = $"第{result.levelId}关";
|
|||
|
// _tmpStage.text = $"{result.stageId}/{result.stageIndex}";
|
|||
|
// __listReward.Clear();
|
|||
|
|
|||
|
// result.equipments.Sort(EntityItemEquipment.SortByQuality);
|
|||
|
// foreach (var equipment in result.equipments)
|
|||
|
// {
|
|||
|
// __listReward.GetItem().SetData(equipment.propItem);
|
|||
|
// }
|
|||
|
|
|||
|
// _tmpGetCoin.text = result.coin.ToString();
|
|||
|
// _tmpGetExp.text = result.exp.ToString();
|
|||
|
|
|||
|
// StartCoroutine(ShowExpAnim(result));
|
|||
|
|
|||
|
// KStatistics.Instance.ReportEventEndPlay(result.levelId.ToString(), resultString, result.duration);
|
|||
|
// }
|
|||
|
|
|||
|
// SoundProxy.PlayFxAsync("Sounds/attack_ui_end.wav");
|
|||
|
|
|||
|
//#if UNITY_EDITOR
|
|||
|
// if (KGMOptions.Instance.自动挂机)
|
|||
|
// StartCoroutine(AutoGame());
|
|||
|
//#endif
|
|||
|
// }
|
|||
|
|
|||
|
// private System.Collections.IEnumerator ShowExpAnim(BattleResult result)
|
|||
|
// {
|
|||
|
// //var result = GameLevel.Instance.battleResult;
|
|||
|
// //int lastGrade = result.lastGrade;
|
|||
|
// //int currGrade = result.currGrade;
|
|||
|
// //float lastExpRatio = result.lastExpRatio;
|
|||
|
// //float currExpRatio = result.currExpRatio;
|
|||
|
|
|||
|
// _tmpGrade.text = result.lastGrade.ToString();
|
|||
|
// _imgGradeExp.fillAmount = result.lastExpRatio;
|
|||
|
|
|||
|
// while (result.lastGrade < result.currGrade)
|
|||
|
// {
|
|||
|
// result.lastExpRatio += 0.01f;
|
|||
|
// if (result.lastExpRatio >= 1f)
|
|||
|
// {
|
|||
|
// result.lastExpRatio -= 1f;
|
|||
|
// result.lastGrade += 1;
|
|||
|
// ToastBox.ShowText("恭喜升级", 1);
|
|||
|
// }
|
|||
|
// yield return null;
|
|||
|
// _tmpGrade.text = result.lastGrade.ToString();
|
|||
|
// _imgGradeExp.fillAmount = result.lastExpRatio;
|
|||
|
// }
|
|||
|
|
|||
|
// while (result.lastExpRatio < result.currExpRatio)
|
|||
|
// {
|
|||
|
// result.lastExpRatio += 0.01f;
|
|||
|
// yield return null;
|
|||
|
// _imgGradeExp.fillAmount = result.lastExpRatio;
|
|||
|
// }
|
|||
|
// }
|
|||
|
|
|||
|
// private void OnTrebleSuccess()
|
|||
|
// {
|
|||
|
// var reward = GameLevel.Instance.ApplyTreble();
|
|||
|
// RewardBox.ShowReward(reward, (error) =>
|
|||
|
// {
|
|||
|
// GameScene.Instance.EnterScene(0);
|
|||
|
// this.gameObject.SetActive(false);
|
|||
|
// });
|
|||
|
// }
|
|||
|
|
|||
|
// private void OnDoubleSuccess()
|
|||
|
// {
|
|||
|
// var reward = GameLevel.Instance.ApplyDouble();
|
|||
|
// RewardBox.ShowReward(reward, (error) =>
|
|||
|
// {
|
|||
|
// GameScene.Instance.EnterScene(0);
|
|||
|
// this.gameObject.SetActive(false);
|
|||
|
// });
|
|||
|
// }
|
|||
|
|
|||
|
// private void OnCollectBtnClick()
|
|||
|
// {
|
|||
|
// GameScene.Instance.EnterScene(0);
|
|||
|
// this.gameObject.SetActive(false);
|
|||
|
// SoundProxy.PlayFxAsync(GlobalDefine.BUTTON_CLICK_SOUND);
|
|||
|
// }
|
|||
|
|
|||
|
// private void OnTrebleCollectBtnClick()
|
|||
|
// {
|
|||
|
// if (GameLevel.Instance.curLevelId > 2)
|
|||
|
// {
|
|||
|
// if (TimeProxy.Instance.CostDailyAmount(9))
|
|||
|
// {
|
|||
|
// KPlatform.Instance.PlayRewardAd("settle", GameLevel.Instance.curStageId.ToString(), (error) =>
|
|||
|
// {
|
|||
|
// if (error == 0)
|
|||
|
// {
|
|||
|
// this.OnTrebleSuccess();
|
|||
|
// }
|
|||
|
// });
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// ToastBox.ShowText(KLocalization.GetLocalString(18));
|
|||
|
// }
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// this.OnTrebleSuccess();
|
|||
|
// }
|
|||
|
// SoundProxy.PlayFxAsync(GlobalDefine.BUTTON_CLICK_SOUND);
|
|||
|
// }
|
|||
|
|
|||
|
// private void OnDoubleCollectBtnClick()
|
|||
|
// {
|
|||
|
// if (PlayerProxy.Instance.UseEnergyForLevel(true))
|
|||
|
// {
|
|||
|
// KPlatform.Instance.PlayRewardAd("settle", GameLevel.Instance.curStageId.ToString(), (error) =>
|
|||
|
// {
|
|||
|
// if (error == 0)
|
|||
|
// {
|
|||
|
// PlayerProxy.Instance.UseEnergyForLevel();
|
|||
|
// this.OnDoubleSuccess();
|
|||
|
// }
|
|||
|
// });
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// ToastBox.ShowText("体力不足,无法双倍结算");
|
|||
|
// }
|
|||
|
// SoundProxy.PlayFxAsync(GlobalDefine.BUTTON_CLICK_SOUND);
|
|||
|
// }
|
|||
|
|
|||
|
// private void OnAgainBtnClick()
|
|||
|
// {
|
|||
|
// GameScene.Instance.EnterScene(0, "again_level");
|
|||
|
// this.gameObject.SetActive(false);
|
|||
|
// SoundProxy.PlayFxAsync(GlobalDefine.BUTTON_CLICK_SOUND);
|
|||
|
// }
|
|||
|
|
|||
|
// private void OnGrowBtnClick()
|
|||
|
// {
|
|||
|
// GameScene.Instance.EnterScene(0, "Cha");
|
|||
|
// this.gameObject.SetActive(false);
|
|||
|
// SoundProxy.PlayFxAsync(GlobalDefine.BUTTON_CLICK_SOUND);
|
|||
|
// }
|
|||
|
|
|||
|
//#if UNITY_EDITOR
|
|||
|
// private System.Collections.IEnumerator AutoGame()
|
|||
|
// {
|
|||
|
// yield return new WaitForSeconds(1f);
|
|||
|
// OnCollectBtnClick();
|
|||
|
// }
|
|||
|
//#endif
|
|||
|
|
|||
|
// #endregion
|
|||
|
|
|||
|
// #region Unity
|
|||
|
|
|||
|
// /// <summary>
|
|||
|
// ///
|
|||
|
// /// </summary>
|
|||
|
// private void Awake()
|
|||
|
// {
|
|||
|
// SetViewData();
|
|||
|
|
|||
|
// /*var ei =*/
|
|||
|
// __listReward.AddTemplate<EquipmentWidget>(true);
|
|||
|
// //ei.SetParticleMask(true);
|
|||
|
|
|||
|
// _btnCollect.onClick.AddListener(this.OnCollectBtnClick);
|
|||
|
// _btnLoseCollect.onClick.AddListener(this.OnCollectBtnClick);
|
|||
|
// _btnAgain.onClick.AddListener(this.OnAgainBtnClick);
|
|||
|
// _btnGrow.onClick.AddListener(this.OnGrowBtnClick);
|
|||
|
// _btnCollectDouble.onClick.AddListener(this.OnDoubleCollectBtnClick);
|
|||
|
// _btnCollectTreble.onClick.AddListener(this.OnTrebleCollectBtnClick);
|
|||
|
// }
|
|||
|
|
|||
|
// #endregion
|
|||
|
// }
|
|||
|
//}
|