import Common5 from "../../Platform/th/Common5"; import CommonDefine from "../../Platform/th/CommonDefine"; import InterfaceManager from "../../Scripts/Manager/InterfaceManager"; import { ryw_Event } from "../Event/EventEnum"; import EventMgr from "../Event/EventMgr"; import GameMgr from "../Mgr/GameMgr"; import AppPlatform from "../Util/AppPlatform"; const {ccclass, property} = cc._decorator; @ccclass export default class PersistRootNode extends cc.Component { // LIFE-CYCLE CALLBACKS: // onLoad () {} onLoad () { console.log('激活常驻节点') AppPlatform.PlatformOnHide(() => { console.log("退入后台onHide"); if (cc.isValid(this.node)) { cc.audioEngine.pauseMusic() InterfaceManager.saveData() } }) AppPlatform.PlatformOnShow((res) => { console.log("进入前台onShow",res); if (res.launch_from == 'homepage' && res.location == 'sidebar_card') { Common5.isCeBianLanEnter = true EventMgr.emitEvent_custom(ryw_Event.CheckIsEnterFromCeBianLan) //快手 }else if (res.from == 'sidebar_new') { Common5.isCeBianLanEnter = true EventMgr.emitEvent_custom(ryw_Event.CheckIsEnterFromCeBianLan) } if (!Common5.isNoMusic) { cc.audioEngine.resumeMusic() } }) } }