您不能選擇超過 %s 個話題 話題必須以字母或數字為開頭,可包含連接號 ('-') 且最長為 35 個字
 
 
 

69 行
1.9 KiB

  1. using System;
  2. using CIG;
  3. using CIGEnums;
  4. using SUISS.Cloud;
  5. using SUISS.Core;
  6. using UnityEngine;
  7. public class LeaderboardsPopupState : PopupBaseState
  8. {
  9. public CIGGameState State
  10. {
  11. get
  12. {
  13. if (this._state == null)
  14. {
  15. this._state = SingletonMonobehaviour<CIGGameState>.Instance;
  16. }
  17. return this._state;
  18. }
  19. }
  20. public override void Enter(State oldState)
  21. {
  22. base.Enter(oldState);
  23. this.SwitchTab(this._lastOpenedTab);
  24. }
  25. public void SwitchTab(LeaderboardTabs leaderboardTab)
  26. {
  27. this._lastOpenedTab = leaderboardTab;
  28. CIGSparkSocServices instance = SingletonMonobehaviour<CIGSparkSocServices>.Instance;
  29. int level = this.State.Level;
  30. int globalPopulation = this.State.GlobalPopulation;
  31. int islandsUnlockedCount = this.State.GetIslandsUnlockedCount();
  32. int score = (int)Mathf.Round(this.State.LevelProgress * 100f);
  33. Leaderboard top;
  34. Leaderboard personal;
  35. if (leaderboardTab != LeaderboardTabs.Global)
  36. {
  37. if (leaderboardTab != LeaderboardTabs.Country)
  38. {
  39. UnityEngine.Debug.LogWarningFormat("Missing leaderboard top & personal for '{0}'", new object[]
  40. {
  41. leaderboardTab
  42. });
  43. return;
  44. }
  45. top = instance.GetCountryLeaderboard(level, globalPopulation, islandsUnlockedCount, score);
  46. personal = instance.GetPersonalCountryLeaderboard(level, globalPopulation, islandsUnlockedCount, score);
  47. }
  48. else
  49. {
  50. top = instance.GetGlobalLeaderboard(level, globalPopulation, islandsUnlockedCount, score);
  51. personal = instance.GetPersonalGlobalLeaderboard(level, globalPopulation, islandsUnlockedCount, score);
  52. }
  53. ((LeaderboardsPopupView)this.View).SwitchTab(leaderboardTab, top, personal);
  54. }
  55. public void OpenLoginPopup()
  56. {
  57. SingletonMonobehaviour<PopupManager>.Instance.RequestFirstPopup<SparkSocLoginPopupState>(null);
  58. base.ClosePopup();
  59. }
  60. private LeaderboardTabs _lastOpenedTab;
  61. private CIGGameState _state;
  62. }