|
- using System;
- using System.Collections.Generic;
- using CIG;
- using CIG.Translation;
- using SUISS.Core;
- using SUISSEngine;
-
- public class LevelUpPopupState : PopupBaseState
- {
- public override void Init()
- {
- base.Init();
- this.gameState = SingletonMonobehaviour<CIGGameState>.Instance;
- }
-
- public override void Leave(State newState)
- {
- base.Leave(newState);
- this.gameState.GiveLevelUpReward();
- SingletonMonobehaviour<InterstitialAdsManager>.Instance.TryShowingLevelUpAd(this._level);
- }
-
- public void UpdateElements(int level, Currencies newReward)
- {
- this._level = level;
- CIGBuilding[] allBuildings = SingletonMonobehaviour<GameObjectManager>.Instance.AllBuildings;
- List<CIGBuilding> list = new List<CIGBuilding>();
- int num = allBuildings.Length;
- for (int i = 0; i < num; i++)
- {
- if (Array.BinarySearch<int>(allBuildings[i].unlockLevels, level) >= 0)
- {
- list.Add(allBuildings[i]);
- }
- }
- if (list.Count == 0)
- {
- ((LevelUpPopupView)this.View).ShowCurrency(level, Localization.Format(Localization.Key("you_have_reached_level"), new ILocalizedString[]
- {
- Localization.Integer(level)
- }), newReward.LocalizedAmountString());
- }
- else
- {
- ((LevelUpPopupView)this.View).ShowBuildings(level, Localization.Format(Localization.Key("you_have_reached_level"), new ILocalizedString[]
- {
- Localization.Integer(level)
- }), newReward.LocalizedAmountString(), list);
- }
- }
-
- public const int MAX_VISIBLE_NEWLY_UNLOCKED_BUILDINGS = 2;
-
- private CIGGameState gameState;
-
- private int _level;
- }
|