UIDefine.ts 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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. UserInfoView: "UserInfoView",
  22. AccountUnlink: "AccountUnlink",
  23. ChangeName: "ChangeName",
  24. ChangeAvatar: "ChangeAvatar",
  25. BindPhone: "BindPhone",
  26. BindEmail: "BindEmail",
  27. UIInvite: "UIInvite",
  28. } as const;
  29. export type UIViewID = typeof UIViewID[keyof typeof UIViewID];
  30. export interface UIViewConfig {
  31. id: UIViewID;
  32. prefabPath: string;
  33. layer: UILayer;
  34. bundle?: string;
  35. cache?: UICachePolicy;
  36. mutexGroup?: string;
  37. /** true 时,打开该界面不自动显示 LoadingView,默认 false。 */
  38. ignoreLoading?: boolean;
  39. }
  40. /**
  41. * 项目全部 UIView 的静态配置。
  42. */
  43. export const UIViewConfigs: Record<string, UIViewConfig> = {
  44. [UIViewID.LoginView]: {
  45. id: UIViewID.LoginView,
  46. prefabPath: 'ui/login/LoginView',
  47. layer: UILayer.Page,
  48. },
  49. [UIViewID.HomeView]: {
  50. id: UIViewID.HomeView,
  51. prefabPath: 'ui/home/HomeView',
  52. layer: UILayer.Page,
  53. cache: UICachePolicy.Persist,
  54. },
  55. [UIViewID.LoadingView]: {
  56. id: UIViewID.LoadingView,
  57. prefabPath: 'ui/loading/LoadingView',
  58. layer: UILayer.Loading,
  59. cache: UICachePolicy.Persist,
  60. ignoreLoading: true,
  61. },
  62. [UIViewID.UIToast]: {
  63. id: UIViewID.UIToast,
  64. prefabPath: 'ui/toast/UIToast',
  65. layer: UILayer.Toast,
  66. cache: UICachePolicy.Persist,
  67. ignoreLoading: true,
  68. },
  69. [UIViewID.UIDialog]: {
  70. id: UIViewID.UIDialog,
  71. prefabPath: 'ui/dialog/UIDialog',
  72. ignoreLoading: true,
  73. layer: UILayer.System,
  74. cache: UICachePolicy.Persist,
  75. },
  76. [UIViewID.MailView]: {
  77. id: UIViewID.MailView,
  78. prefabPath: 'ui/mail/MailView',
  79. layer: UILayer.Popup
  80. },
  81. [UIViewID.StoreView]: {
  82. id: UIViewID.StoreView,
  83. prefabPath: 'ui/store/StoreView',
  84. layer: UILayer.Page,
  85. },
  86. [UIViewID.OrderView]: {
  87. id: UIViewID.OrderView,
  88. prefabPath: 'ui/store/OrderView',
  89. layer: UILayer.Popup,
  90. },
  91. [UIViewID.UIFirstPack]: {
  92. id: UIViewID.UIFirstPack,
  93. prefabPath: 'ui/store/UIFirstPack',
  94. layer: UILayer.Popup
  95. },
  96. [UIViewID.PlayHistory]: {
  97. id: UIViewID.PlayHistory,
  98. prefabPath: 'ui/playHistory/PlayHistory',
  99. layer: UILayer.Popup,
  100. },
  101. [UIViewID.GamePolicyView]: {
  102. id: UIViewID.GamePolicyView,
  103. prefabPath: 'ui/policy/GamePolicyView',
  104. layer: UILayer.Popup,
  105. },
  106. [UIViewID.Register]: {
  107. id: UIViewID.Register,
  108. prefabPath: 'ui/register/Register',
  109. layer: UILayer.Popup
  110. },
  111. [UIViewID.ResetPsd]: {
  112. id: UIViewID.ResetPsd,
  113. prefabPath: 'ui/resetPsd/ResetPsd',
  114. layer: UILayer.Popup
  115. },
  116. [UIViewID.AutoLogin]: {
  117. id: UIViewID.AutoLogin,
  118. prefabPath: 'ui/login/AutoLogin',
  119. layer: UILayer.Popup
  120. },
  121. [UIViewID.RegisterSuccess]: {
  122. id: UIViewID.RegisterSuccess,
  123. prefabPath: 'ui/register/RegisterSuccess',
  124. layer: UILayer.Popup
  125. },
  126. [UIViewID.Support]: {
  127. id: UIViewID.Support,
  128. prefabPath: 'ui/support/Support',
  129. layer: UILayer.Popup
  130. },
  131. [UIViewID.UIWithdraw]: {
  132. id: UIViewID.UIWithdraw,
  133. prefabPath: 'ui/withdraw/UIWithdraw',
  134. layer: UILayer.Popup
  135. },
  136. [UIViewID.UserInfoView]: {
  137. id: UIViewID.UserInfoView,
  138. prefabPath: 'ui/userInfo/UserInfoView',
  139. layer: UILayer.Page
  140. },
  141. [UIViewID.AccountUnlink]: {
  142. id: UIViewID.AccountUnlink,
  143. prefabPath: 'ui/userInfo/AccountUnlink',
  144. layer: UILayer.Popup
  145. },
  146. [UIViewID.ChangeName]: {
  147. id: UIViewID.ChangeName,
  148. prefabPath: 'ui/userInfo/ChangeName',
  149. layer: UILayer.Popup
  150. },
  151. [UIViewID.ChangeAvatar]: {
  152. id: UIViewID.ChangeAvatar,
  153. prefabPath: 'ui/userInfo/ChangeAvatar',
  154. layer: UILayer.Popup
  155. },
  156. [UIViewID.BindPhone]: {
  157. id: UIViewID.BindPhone,
  158. prefabPath: 'ui/userInfo/BindPhone',
  159. layer: UILayer.Popup
  160. },
  161. [UIViewID.BindEmail]: {
  162. id: UIViewID.BindEmail,
  163. prefabPath: 'ui/userInfo/BindEmail',
  164. layer: UILayer.Popup
  165. },
  166. [UIViewID.UIInvite]: {
  167. id: UIViewID.UIInvite,
  168. prefabPath: 'ui/invite/UIInvite',
  169. layer: UILayer.Popup
  170. },
  171. };
  172. export function getUIViewConfig(viewId: UIViewID): UIViewConfig {
  173. return UIViewConfigs[viewId];
  174. }