Game.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. AudioMgr.backMusic()
  19. Game.Ins = this ;
  20. if (!PanelMgr.INS) {
  21. Emit.instance().on(EventCode.PanelMgrInitOK, this.do_after_panelMgr_initOK, this)
  22. } else {
  23. this.do_after_panelMgr_initOK()
  24. }
  25. }
  26. //PanelMgr 初始化完成之后执行的方法
  27. do_after_panelMgr_initOK() {
  28. this.banner = this.node.getChildByName('bannerLayer').children[0];
  29. if (Global.isVivo) {
  30. QgApi.createBanner() ;
  31. ShowConfig.initEmit() ;
  32. }
  33. PanelMgr.INS.openPanel({
  34. layer: Layer.gameLayer,
  35. panel: HomeView,
  36. })
  37. }
  38. }