UIDefine.ts 5.8 KB

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