FMSGameInit.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import { assetManager, director, Sprite } from "cc";
  2. import { FMSRegister, IFMS } from "db://assets/core_tgx/util_class/FMS";
  3. import { aa } from "db://assets/scripts/aa";
  4. import { UI_Loading } from "db://assets/module_extra/ui_loading/UI_Loading";
  5. import { UI_Game } from "../../ui/ui_game/UI_Game";
  6. import { UI_Home } from "../../ui/ui_home/UI_Home";
  7. import { BgmName } from "db://assets/scripts/Audio/BgmName";
  8. import { Container } from "../../element/container/Container";
  9. export enum FMSType {
  10. home = "Init",
  11. Start = "Start",
  12. // Restart = "Restart",
  13. }
  14. @FMSRegister(FMSType.home)
  15. export class FMSInit implements IFMS {
  16. type: string;
  17. onExit(): void {
  18. aa.audio.stop()
  19. aa.uIMgr.closeUI(UI_Home);
  20. }
  21. onEntry(): void {
  22. aa.uIMgr.showUI(UI_Home);
  23. aa.audio.play(BgmName.BGM)
  24. }
  25. }
  26. @FMSRegister(FMSType.Start)
  27. export class FMSStart implements IFMS {
  28. type: string;
  29. onExit(): void {
  30. aa.audio.stop()
  31. aa.Util.resMgr.clearAll()
  32. aa.uIMgr.closeUI(UI_Game)
  33. }
  34. onEntry(): void {
  35. // 清空已完成瓶子的位置记录
  36. // Container.clearFinishedPositions();
  37. aa.audio.play(BgmName.BGM)
  38. aa.uIMgr.showUI(UI_Loading, (ui) => {
  39. ui.Init({ bundle: 'module_basic', url: [aa.uIMgr.getPageInfo(UI_Game).path] }, () => {
  40. aa.uIMgr.showUI(UI_Game)
  41. })
  42. })
  43. }
  44. }