SkiptoHelper.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using Excel2Json;
  4. using Fort23.Core;
  5. using Fort23.Mono;
  6. using Fort23.UTool;
  7. namespace Mono.Utility
  8. {
  9. public static class SkiptoHelper
  10. {
  11. public async static CTask Skipto(int skiptoId,bool isMainOpen = false)
  12. {
  13. SkiptoConfig skiptoConfig = ConfigComponent.Instance.Get<SkiptoConfig>(skiptoId);
  14. if (skiptoConfig.UnlockPara1 != null)
  15. {
  16. if (!ULockManager.Instance.IsULock(skiptoConfig.UnlockPara1[0]))
  17. {
  18. return;
  19. }
  20. }
  21. if (isMainOpen)
  22. {
  23. List<UIPanel> TopUIPanels = UIManager.Instance.TopUIPanels.ToList();
  24. for (var i = TopUIPanels.Count - 1; i >= 0; i--)
  25. {
  26. if (!(TopUIPanels[i] is MainPanel))
  27. {
  28. await UIManager.Instance.HideUIUIPanel(TopUIPanels[i], isBreadcrumbBarPanel: false);
  29. }
  30. }
  31. await MainPanel.OpenPanel();
  32. }
  33. switch (skiptoConfig.SkipID)
  34. {
  35. //不跳转
  36. case 0:
  37. return;
  38. //功法界面
  39. case 1:
  40. UIManager.Instance.GetComponent<AppBarPanel>().Btn_GongFa_Click();
  41. return;
  42. //法宝界面
  43. case 2:
  44. UIManager.Instance.GetComponent<AppBarPanel>().Btn_HeroInfomation_Click();
  45. return;
  46. //洞府界面
  47. case 3:
  48. UIManager.Instance.GetComponent<AppBarPanel>().Bne_dongfu_Click();
  49. return;
  50. //商店界面
  51. case 4:
  52. ShopPanel shopPanel = UIManager.Instance.GetComponent<ShopPanel>();
  53. if (shopPanel != null && !shopPanel.IsClose)
  54. {
  55. shopPanel.SelectWidget(skiptoConfig.SkipArguments[0]);
  56. }
  57. else
  58. {
  59. UIManager.Instance.GetComponent<AppBarPanel>().Btn_Shop_Click(skiptoConfig.SkipArguments[0]);
  60. }
  61. return;
  62. //实用神识界面
  63. case 5:
  64. List<UIPanel> TopUIPanels = UIManager.Instance.TopUIPanels.ToList();
  65. for (var i = TopUIPanels.Count - 1; i >= 0; i--)
  66. {
  67. if (!(TopUIPanels[i] is MainPanel))
  68. {
  69. await UIManager.Instance.HideUIUIPanel(TopUIPanels[i], isBreadcrumbBarPanel: false);
  70. }
  71. }
  72. await MainPanel.OpenPanel();
  73. UIManager.Instance.GetComponent<AppBarPanel>().Bnt_ShengShi_Click();
  74. return;
  75. //命运峰
  76. case 6:
  77. TowerPanel.OpenPanel(1);
  78. return;
  79. //神识背包
  80. case 7:
  81. DivineSenceEventPreviewPanel.OpenPanel();
  82. return;
  83. //探宝
  84. case 8:
  85. BoxPanel.OpenBoxPanel();
  86. return;
  87. //岁酬
  88. case 9:
  89. QiankundaiPanel.OpenPanel();
  90. return;
  91. default:
  92. return;
  93. }
  94. }
  95. public static bool IsSkipto(int skiptoId)
  96. {
  97. SkiptoConfig skiptoConfig = ConfigComponent.Instance.Get<SkiptoConfig>(skiptoId);
  98. if (skiptoConfig.UnlockType == 1 && skiptoConfig.UnlockPara1 != null)
  99. {
  100. if (!ULockManager.Instance.IsULock(skiptoConfig.UnlockPara1[0]))
  101. {
  102. return false;
  103. }
  104. }
  105. switch (skiptoConfig.SkipID)
  106. {
  107. //不跳转
  108. case 0:
  109. return false;
  110. default:
  111. return true;
  112. }
  113. }
  114. public static string SkiptoTips(int skiptoId)
  115. {
  116. SkiptoConfig skiptoConfig = ConfigComponent.Instance.Get<SkiptoConfig>(skiptoId);
  117. if (skiptoConfig.UnlockType == 1 && skiptoConfig.UnlockPara1 != null)
  118. {
  119. return ULockManager.Instance.ShowUnlockTips(skiptoConfig.UnlockPara1[0]);
  120. }
  121. return "";
  122. }
  123. }
  124. }