UIDefine.ts 4.7 KB

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