using System; using CIG; using CIGEnums; using SUISS.Cloud; using SUISS.Core; using UnityEngine; public class LeaderboardsPopupState : PopupBaseState { public CIGGameState State { get { if (this._state == null) { this._state = SingletonMonobehaviour.Instance; } return this._state; } } public override void Enter(State oldState) { base.Enter(oldState); this.SwitchTab(this._lastOpenedTab); } public void SwitchTab(LeaderboardTabs leaderboardTab) { this._lastOpenedTab = leaderboardTab; CIGSparkSocServices instance = SingletonMonobehaviour.Instance; int level = this.State.Level; int globalPopulation = this.State.GlobalPopulation; int islandsUnlockedCount = this.State.GetIslandsUnlockedCount(); int score = (int)Mathf.Round(this.State.LevelProgress * 100f); Leaderboard top; Leaderboard personal; if (leaderboardTab != LeaderboardTabs.Global) { if (leaderboardTab != LeaderboardTabs.Country) { UnityEngine.Debug.LogWarningFormat("Missing leaderboard top & personal for '{0}'", new object[] { leaderboardTab }); return; } top = instance.GetCountryLeaderboard(level, globalPopulation, islandsUnlockedCount, score); personal = instance.GetPersonalCountryLeaderboard(level, globalPopulation, islandsUnlockedCount, score); } else { top = instance.GetGlobalLeaderboard(level, globalPopulation, islandsUnlockedCount, score); personal = instance.GetPersonalGlobalLeaderboard(level, globalPopulation, islandsUnlockedCount, score); } ((LeaderboardsPopupView)this.View).SwitchTab(leaderboardTab, top, personal); } public void OpenLoginPopup() { SingletonMonobehaviour.Instance.RequestFirstPopup(null); base.ClosePopup(); } private LeaderboardTabs _lastOpenedTab; private CIGGameState _state; }