SkiptoHelper.cs 4.6 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 || skiptoConfig.SkipID == 5)
  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. //
  73. //
  74. // await MainPanel.OpenPanel();
  75. UIManager.Instance.GetComponent<AppBarPanel>().Bnt_ShengShi_Click();
  76. return;
  77. //命运峰
  78. case 6:
  79. TowerPanel.OpenPanel(1);
  80. return;
  81. //神识背包
  82. case 7:
  83. DivineSenceEventPreviewPanel.OpenPanel();
  84. return;
  85. //探宝
  86. case 8:
  87. BoxPanel.OpenBoxPanel();
  88. return;
  89. //岁酬
  90. case 9:
  91. QiankundaiPanel.OpenPanel();
  92. return;
  93. default:
  94. return;
  95. }
  96. }
  97. public static bool IsSkipto(int skiptoId)
  98. {
  99. SkiptoConfig skiptoConfig = ConfigComponent.Instance.Get<SkiptoConfig>(skiptoId);
  100. if (skiptoConfig.UnlockType == 1 && skiptoConfig.UnlockPara1 != null)
  101. {
  102. if (!ULockManager.Instance.IsULock(skiptoConfig.UnlockPara1[0]))
  103. {
  104. return false;
  105. }
  106. }
  107. switch (skiptoConfig.SkipID)
  108. {
  109. //不跳转
  110. case 0:
  111. return false;
  112. default:
  113. return true;
  114. }
  115. }
  116. public static string SkiptoTips(int skiptoId)
  117. {
  118. SkiptoConfig skiptoConfig = ConfigComponent.Instance.Get<SkiptoConfig>(skiptoId);
  119. if (skiptoConfig.UnlockType == 1 && skiptoConfig.UnlockPara1 != null)
  120. {
  121. return ULockManager.Instance.ShowUnlockTips(skiptoConfig.UnlockPara1[0]);
  122. }
  123. return "";
  124. }
  125. }
  126. }