您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

58 行
1.5 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using CIG;
  4. using CIG.Translation;
  5. using SUISS.Core;
  6. using SUISSEngine;
  7. public class LevelUpPopupState : PopupBaseState
  8. {
  9. public override void Init()
  10. {
  11. base.Init();
  12. this.gameState = SingletonMonobehaviour<CIGGameState>.Instance;
  13. }
  14. public override void Leave(State newState)
  15. {
  16. base.Leave(newState);
  17. this.gameState.GiveLevelUpReward();
  18. SingletonMonobehaviour<InterstitialAdsManager>.Instance.TryShowingLevelUpAd(this._level);
  19. }
  20. public void UpdateElements(int level, Currencies newReward)
  21. {
  22. this._level = level;
  23. CIGBuilding[] allBuildings = SingletonMonobehaviour<GameObjectManager>.Instance.AllBuildings;
  24. List<CIGBuilding> list = new List<CIGBuilding>();
  25. int num = allBuildings.Length;
  26. for (int i = 0; i < num; i++)
  27. {
  28. if (Array.BinarySearch<int>(allBuildings[i].unlockLevels, level) >= 0)
  29. {
  30. list.Add(allBuildings[i]);
  31. }
  32. }
  33. if (list.Count == 0)
  34. {
  35. ((LevelUpPopupView)this.View).ShowCurrency(level, Localization.Format(Localization.Key("you_have_reached_level"), new ILocalizedString[]
  36. {
  37. Localization.Integer(level)
  38. }), newReward.LocalizedAmountString());
  39. }
  40. else
  41. {
  42. ((LevelUpPopupView)this.View).ShowBuildings(level, Localization.Format(Localization.Key("you_have_reached_level"), new ILocalizedString[]
  43. {
  44. Localization.Integer(level)
  45. }), newReward.LocalizedAmountString(), list);
  46. }
  47. }
  48. public const int MAX_VISIBLE_NEWLY_UNLOCKED_BUILDINGS = 2;
  49. private CIGGameState gameState;
  50. private int _level;
  51. }