UIDefine.ts 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. import { UICachePolicy, UILayer } from '../framework/ui/UILayer';
  2. // viewId.StoreView
  3. export const UIViewID = {
  4. LoginView: 'LoginView',
  5. HomeView: 'HomeView',
  6. LoadingView: "LoadingView",
  7. MailView: "MailView",
  8. StoreView: "StoreView",
  9. PlayHistory: "PlayHistory",
  10. GamePolicyView: "GamePolicyView",
  11. Register: "Register",
  12. ResetPsd: "ResetPsd",
  13. AutoLogin: "AutoLogin",
  14. RegisterSuccess: "RegisterSuccess",
  15. Support: "Support",
  16. OrderView: "OrderView",
  17. UIFirstPack: "UIFirstPack",
  18. UIWithdraw: "UIWithdraw",
  19. UIToast: "UIToast",
  20. UIDialog: "UIDialog",
  21. } as const;
  22. export type UIViewID = typeof UIViewID[keyof typeof UIViewID];
  23. export interface UIViewConfig {
  24. id: UIViewID;
  25. prefabPath: string;
  26. layer: UILayer;
  27. bundle?: string;
  28. cache?: UICachePolicy;
  29. mutexGroup?: string;
  30. /** true 时,打开该界面不自动显示 LoadingView,默认 false。 */
  31. ignoreLoading?: boolean;
  32. }
  33. /**
  34. * 项目全部 UIView 的静态配置。
  35. */
  36. export const UIViewConfigs: Record<string, UIViewConfig> = {
  37. [UIViewID.LoginView]: {
  38. id: UIViewID.LoginView,
  39. prefabPath: 'ui/login/LoginView',
  40. layer: UILayer.Page,
  41. },
  42. [UIViewID.HomeView]: {
  43. id: UIViewID.HomeView,
  44. prefabPath: 'ui/home/HomeView',
  45. layer: UILayer.Page,
  46. cache: UICachePolicy.Persist,
  47. },
  48. [UIViewID.LoadingView]: {
  49. id: UIViewID.LoadingView,
  50. prefabPath: 'ui/loading/LoadingView',
  51. layer: UILayer.Loading,
  52. cache: UICachePolicy.Persist,
  53. ignoreLoading: true,
  54. },
  55. [UIViewID.UIToast]: {
  56. id: UIViewID.UIToast,
  57. prefabPath: 'ui/toast/UIToast',
  58. layer: UILayer.Toast,
  59. cache: UICachePolicy.Persist,
  60. ignoreLoading: true,
  61. },
  62. [UIViewID.UIDialog]: {
  63. id: UIViewID.UIDialog,
  64. prefabPath: 'ui/dialog/UIDialog',
  65. layer: UILayer.System,
  66. cache: UICachePolicy.Persist,
  67. },
  68. [UIViewID.MailView]: {
  69. id: UIViewID.MailView,
  70. prefabPath: 'ui/mail/MailView',
  71. layer: UILayer.Popup
  72. },
  73. [UIViewID.StoreView]: {
  74. id: UIViewID.StoreView,
  75. prefabPath: 'ui/store/StoreView',
  76. layer: UILayer.Page,
  77. },
  78. [UIViewID.OrderView]: {
  79. id: UIViewID.OrderView,
  80. prefabPath: 'ui/store/OrderView',
  81. layer: UILayer.Popup,
  82. },
  83. [UIViewID.UIFirstPack]: {
  84. id: UIViewID.UIFirstPack,
  85. prefabPath: 'ui/store/UIFirstPack',
  86. layer: UILayer.Popup
  87. },
  88. [UIViewID.PlayHistory]: {
  89. id: UIViewID.PlayHistory,
  90. prefabPath: 'ui/playHistory/PlayHistory',
  91. layer: UILayer.Popup,
  92. },
  93. [UIViewID.GamePolicyView]: {
  94. id: UIViewID.GamePolicyView,
  95. prefabPath: 'ui/policy/GamePolicyView',
  96. layer: UILayer.Popup,
  97. },
  98. [UIViewID.Register]: {
  99. id: UIViewID.Register,
  100. prefabPath: 'ui/register/Register',
  101. layer: UILayer.Popup
  102. },
  103. [UIViewID.ResetPsd]: {
  104. id: UIViewID.ResetPsd,
  105. prefabPath: 'ui/resetPsd/ResetPsd',
  106. layer: UILayer.Popup
  107. },
  108. [UIViewID.AutoLogin]: {
  109. id: UIViewID.AutoLogin,
  110. prefabPath: 'ui/login/AutoLogin',
  111. layer: UILayer.Popup
  112. },
  113. [UIViewID.RegisterSuccess]: {
  114. id: UIViewID.RegisterSuccess,
  115. prefabPath: 'ui/register/RegisterSuccess',
  116. layer: UILayer.Popup
  117. },
  118. [UIViewID.Support]: {
  119. id: UIViewID.Support,
  120. prefabPath: 'ui/support/Support',
  121. layer: UILayer.Popup
  122. },
  123. [UIViewID.UIWithdraw]: {
  124. id: UIViewID.UIWithdraw,
  125. prefabPath: 'ui/withdraw/UIWithdraw',
  126. layer: UILayer.Popup
  127. },
  128. };
  129. export function getUIViewConfig(viewId: UIViewID): UIViewConfig {
  130. return UIViewConfigs[viewId];
  131. }