import { ryw_Event } from "../../FrameWork/Event/EventEnum"; import EventMgr from "../../FrameWork/Event/EventMgr"; const {ccclass, property} = cc._decorator; @ccclass export default class GameBase extends cc.Component { // startDaDianTime:number = 0//打点开始时间 curGameName:string = "" // GameScene:string = "" bundleName:string = '' isNeedReleaseBundle:boolean = false public onLoad () { // console.log(' 游戏初始化时间') // this.startDaDianTime = new Date().getTime(); } public onDestroy(): void { //GameReport.OUTReport(OUTTYPE.FANHUI, this.curGameName) //返回离开 // let endDaDianTime = new Date().getTime(); // let time_ = endDaDianTime - this.startDaDianTime // let times = Math.floor( time_/1000) // if(times > 0){ // //Common5.ReportDYTime("inLevel", this.curGameName, times); // GameReport.StayTimeReport(times, this.curGameName) // } // this.startDaDianTime = 0 EventMgr.emitEvent_custom(ryw_Event.ExitCurLayerEvent,{curGameName:this.curGameName}) console.log(this.curGameName,"游戏离开++++++====") //释放bundle(可多次使用的bundle不要释放,仅释放单次使用的bundle) if(this.isNeedReleaseBundle){ let bundle = cc.assetManager.getBundle(this.bundleName); if(bundle){ bundle.releaseAll() cc.assetManager.removeBundle(bundle); console.log('bundle所有资源已被释放==',this.bundleName) } } } public setCurGameName(gameName){ // console.log(gameName, 'set gameName+++==') // this.curGameName = gameName // this.GameScene = gameName; } public setCurGameBundle(bundleName,isNeedReleaseBundle){ this.bundleName = bundleName this.isNeedReleaseBundle = isNeedReleaseBundle } public reportKey(sendCall:Function){ // GameReport.SetCurGame(this.GameScene); // sendCall() } public enterReportKey(GameType){ // let name = PrefabManage.getPrefabNameByGameType(GameType) //GameReport.EnterReport(ENTERTYPE.XUANGUAN,name) } }