Game.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import PanelMgr, {Layer, View} from "../Common/manage/PanelMgr";
  2. import Emit from "../Common/manage/Emit/Emit";
  3. import {EventCode} from "../Common/manage/Emit/EmitData";
  4. import HomeView from "../Moudle/View/HomeView";
  5. import Global from "../Common/Global";
  6. import AudioMgr from "../Common/manage/AudioMgr";
  7. //import QgApi from "../Common/manage/Api/QgApi";
  8. import ShowConfig from "../Common/ShowConfig";
  9. // cc.macro.CLEANUP_IMAGE_CACHE = false;
  10. // cc.dynamicAtlasManager.enabled = true;
  11. const {ccclass, property} = cc._decorator;
  12. @ccclass
  13. export default class Game extends cc.Component {
  14. banner: cc.Node = null
  15. //Game实例
  16. public static Ins: Game = null;
  17. onLoad() {
  18. console.log('zh:game.ts onLoad')
  19. AudioMgr.backMusic()
  20. Game.Ins = this ;
  21. if (!PanelMgr.INS) {
  22. Emit.instance().on(EventCode.PanelMgrInitOK, this.do_after_panelMgr_initOK, this)
  23. } else {
  24. this.do_after_panelMgr_initOK()
  25. }
  26. console.log('zh:game.ts end')
  27. }
  28. //PanelMgr 初始化完成之后执行的方法
  29. do_after_panelMgr_initOK() {
  30. this.banner = this.node.getChildByName('bannerLayer').children[0];
  31. if (Global.isVivo) {
  32. // QgApi.createBanner() ;
  33. ShowConfig.initEmit() ;
  34. }
  35. PanelMgr.INS.openPanel({
  36. layer: Layer.gameLayer,
  37. panel: HomeView,
  38. })
  39. }
  40. }