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.
53 lines
1.6 KiB
53 lines
1.6 KiB
import { ryw_Event } from "../../FrameWork/Event/EventEnum";
|
|
import EventMgr from "../../FrameWork/Event/EventMgr";
|
|
import GameReport from "../../FrameWork/Report/ZyZyReport";
|
|
import PrefabManage from "../PrefabManager/PrefabManage";
|
|
|
|
const {ccclass, property} = cc._decorator;
|
|
|
|
@ccclass
|
|
export default class GameBase extends cc.Component {
|
|
startDaDianTime:number = 0//打点开始时间
|
|
curGameName:string = ""
|
|
GameScene:string = ""
|
|
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,"游戏离开++++++====")
|
|
|
|
}
|
|
|
|
public setCurGameName(gameName){
|
|
console.log(gameName, 'set gameName+++==')
|
|
this.curGameName = gameName
|
|
|
|
this.GameScene = gameName;
|
|
}
|
|
|
|
public reportKey(sendCall:Function){
|
|
GameReport.SetCurGame(this.GameScene);
|
|
sendCall()
|
|
}
|
|
|
|
public enterReportKey(GameType){
|
|
let name = PrefabManage.getPrefabNameByGameType(GameType)
|
|
//GameReport.EnterReport(ENTERTYPE.XUANGUAN,name)
|
|
|
|
}
|
|
|
|
}
|
|
|