UIDefine.ts 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. } as const;
  17. export type UIViewID = typeof UIViewID[keyof typeof UIViewID];
  18. export interface UIViewConfig {
  19. id: UIViewID;
  20. prefabPath: string;
  21. layer: UILayer;
  22. bundle?: string;
  23. cache?: UICachePolicy;
  24. mutexGroup?: string;
  25. /** true 时,打开该界面不自动显示 LoadingView,默认 false。 */
  26. ignoreLoading?: boolean;
  27. }
  28. /**
  29. * 项目全部 UIView 的静态配置。
  30. */
  31. export const UIViewConfigs: Record<string, UIViewConfig> = {
  32. [UIViewID.LoginView]: {
  33. id: UIViewID.LoginView,
  34. prefabPath: 'ui/login/LoginView',
  35. layer: UILayer.Page,
  36. },
  37. [UIViewID.HomeView]: {
  38. id: UIViewID.HomeView,
  39. prefabPath: 'ui/home/HomeView',
  40. layer: UILayer.Page,
  41. cache: UICachePolicy.Persist,
  42. },
  43. [UIViewID.LoadingView]: {
  44. id: UIViewID.LoadingView,
  45. prefabPath: 'ui/loading/LoadingView',
  46. layer: UILayer.Loading,
  47. cache: UICachePolicy.Persist,
  48. ignoreLoading: true,
  49. },
  50. [UIViewID.MailView]: {
  51. id: UIViewID.MailView,
  52. prefabPath: 'ui/mail/MailView',
  53. layer: UILayer.Popup
  54. },
  55. [UIViewID.StoreView]: {
  56. id: UIViewID.StoreView,
  57. prefabPath: 'ui/store/StoreView',
  58. layer: UILayer.Page,
  59. },
  60. [UIViewID.PlayHistory]: {
  61. id: UIViewID.PlayHistory,
  62. prefabPath: 'ui/playHistory/PlayHistory',
  63. layer: UILayer.Popup,
  64. },
  65. [UIViewID.GamePolicyView]: {
  66. id: UIViewID.GamePolicyView,
  67. prefabPath: 'ui/policy/GamePolicyView',
  68. layer: UILayer.Popup,
  69. },
  70. [UIViewID.Register]: {
  71. id: UIViewID.Register,
  72. prefabPath: 'ui/register/Register',
  73. layer: UILayer.Popup
  74. },
  75. [UIViewID.ResetPsd]: {
  76. id: UIViewID.ResetPsd,
  77. prefabPath: 'ui/resetPsd/ResetPsd',
  78. layer: UILayer.Popup
  79. },
  80. [UIViewID.AutoLogin]: {
  81. id: UIViewID.AutoLogin,
  82. prefabPath: 'ui/login/AutoLogin',
  83. layer: UILayer.Popup
  84. },
  85. [UIViewID.RegisterSuccess]: {
  86. id: UIViewID.RegisterSuccess,
  87. prefabPath: 'ui/register/RegisterSuccess',
  88. layer: UILayer.Popup
  89. },
  90. [UIViewID.Support]: {
  91. id: UIViewID.Support,
  92. prefabPath: 'ui/support/Support',
  93. layer: UILayer.Popup
  94. }
  95. };
  96. export function getUIViewConfig(viewId: UIViewID): UIViewConfig {
  97. return UIViewConfigs[viewId];
  98. }