import { UICachePolicy, UILayer } from '../framework/ui/UILayer'; // viewId.StoreView export const UIViewID = { LoginView: 'LoginView', HomeView: 'HomeView', LoadingView: "LoadingView", MailView: "MailView", StoreView: "StoreView", PlayHistory: "PlayHistory", GamePolicyView: "GamePolicyView", Register: "Register", ResetPsd: "ResetPsd", AutoLogin: "AutoLogin", RegisterSuccess: "RegisterSuccess", Support: "Support", OrderView: "OrderView", UIFirstPack: "UIFirstPack", UIWithdraw: "UIWithdraw", UIToast: "UIToast", UIDialog: "UIDialog", } as const; export type UIViewID = typeof UIViewID[keyof typeof UIViewID]; export interface UIViewConfig { id: UIViewID; prefabPath: string; layer: UILayer; bundle?: string; cache?: UICachePolicy; mutexGroup?: string; /** true 时,打开该界面不自动显示 LoadingView,默认 false。 */ ignoreLoading?: boolean; } /** * 项目全部 UIView 的静态配置。 */ export const UIViewConfigs: Record = { [UIViewID.LoginView]: { id: UIViewID.LoginView, prefabPath: 'ui/login/LoginView', layer: UILayer.Page, }, [UIViewID.HomeView]: { id: UIViewID.HomeView, prefabPath: 'ui/home/HomeView', layer: UILayer.Page, cache: UICachePolicy.Persist, }, [UIViewID.LoadingView]: { id: UIViewID.LoadingView, prefabPath: 'ui/loading/LoadingView', layer: UILayer.Loading, cache: UICachePolicy.Persist, ignoreLoading: true, }, [UIViewID.UIToast]: { id: UIViewID.UIToast, prefabPath: 'ui/toast/UIToast', layer: UILayer.Toast, cache: UICachePolicy.Persist, ignoreLoading: true, }, [UIViewID.UIDialog]: { id: UIViewID.UIDialog, prefabPath: 'ui/dialog/UIDialog', layer: UILayer.System, cache: UICachePolicy.Persist, }, [UIViewID.MailView]: { id: UIViewID.MailView, prefabPath: 'ui/mail/MailView', layer: UILayer.Popup }, [UIViewID.StoreView]: { id: UIViewID.StoreView, prefabPath: 'ui/store/StoreView', layer: UILayer.Page, }, [UIViewID.OrderView]: { id: UIViewID.OrderView, prefabPath: 'ui/store/OrderView', layer: UILayer.Popup, }, [UIViewID.UIFirstPack]: { id: UIViewID.UIFirstPack, prefabPath: 'ui/store/UIFirstPack', layer: UILayer.Popup }, [UIViewID.PlayHistory]: { id: UIViewID.PlayHistory, prefabPath: 'ui/playHistory/PlayHistory', layer: UILayer.Popup, }, [UIViewID.GamePolicyView]: { id: UIViewID.GamePolicyView, prefabPath: 'ui/policy/GamePolicyView', layer: UILayer.Popup, }, [UIViewID.Register]: { id: UIViewID.Register, prefabPath: 'ui/register/Register', layer: UILayer.Popup }, [UIViewID.ResetPsd]: { id: UIViewID.ResetPsd, prefabPath: 'ui/resetPsd/ResetPsd', layer: UILayer.Popup }, [UIViewID.AutoLogin]: { id: UIViewID.AutoLogin, prefabPath: 'ui/login/AutoLogin', layer: UILayer.Popup }, [UIViewID.RegisterSuccess]: { id: UIViewID.RegisterSuccess, prefabPath: 'ui/register/RegisterSuccess', layer: UILayer.Popup }, [UIViewID.Support]: { id: UIViewID.Support, prefabPath: 'ui/support/Support', layer: UILayer.Popup }, [UIViewID.UIWithdraw]: { id: UIViewID.UIWithdraw, prefabPath: 'ui/withdraw/UIWithdraw', layer: UILayer.Popup }, }; export function getUIViewConfig(viewId: UIViewID): UIViewConfig { return UIViewConfigs[viewId]; }