UIDefine.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. } as const;
  12. export type UIViewID = typeof UIViewID[keyof typeof UIViewID];
  13. export interface UIViewConfig {
  14. id: UIViewID;
  15. prefabPath: string;
  16. layer: UILayer;
  17. bundle?: string;
  18. cache?: UICachePolicy;
  19. mutexGroup?: string;
  20. /** true 时,打开该界面不自动显示 LoadingView,默认 false。 */
  21. ignoreLoading?: boolean;
  22. }
  23. /**
  24. * 项目全部 UIView 的静态配置。
  25. */
  26. export const UIViewConfigs: Record<string, UIViewConfig> = {
  27. [UIViewID.LoginView]: {
  28. id: UIViewID.LoginView,
  29. prefabPath: 'ui/login/LoginView',
  30. layer: UILayer.Page,
  31. },
  32. [UIViewID.HomeView]: {
  33. id: UIViewID.HomeView,
  34. prefabPath: 'ui/home/HomeView',
  35. layer: UILayer.Page,
  36. cache: UICachePolicy.Persist,
  37. },
  38. [UIViewID.LoadingView]: {
  39. id: UIViewID.LoadingView,
  40. prefabPath: 'ui/loading/LoadingView',
  41. layer: UILayer.Loading,
  42. cache: UICachePolicy.Persist,
  43. ignoreLoading: true,
  44. },
  45. [UIViewID.MailView]: {
  46. id: UIViewID.MailView,
  47. prefabPath: 'ui/mail/MailView',
  48. layer: UILayer.Popup
  49. },
  50. [UIViewID.StoreView]: {
  51. id: UIViewID.StoreView,
  52. prefabPath: 'ui/store/StoreView',
  53. layer: UILayer.Page,
  54. },
  55. [UIViewID.PlayHistory]: {
  56. id: UIViewID.PlayHistory,
  57. prefabPath: 'ui/playHistory/PlayHistory',
  58. layer: UILayer.Popup,
  59. },
  60. [UIViewID.GamePolicyView]: {
  61. id: UIViewID.GamePolicyView,
  62. prefabPath: 'ui/policy/GamePolicyView',
  63. layer: UILayer.Popup,
  64. },
  65. };
  66. export function getUIViewConfig(viewId: UIViewID): UIViewConfig {
  67. return UIViewConfigs[viewId];
  68. }