UIDefine.ts 1.6 KB

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