觉醒时刻
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
juexingshike/assets/FrameWork/View/PersistRootNode.ts

49 lines
1.4 KiB

1 week ago
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()
}
})
}
}