import { ryw_Event } from "../FrameWork/Event/EventEnum"; import EventMgr from "../FrameWork/Event/EventMgr"; import GameReport, { ENTERTYPE, OUTTYPE } from "../FrameWork/Report/ZyZyReport"; import User from "../FrameWork/User/User"; import AppPlatform from "../FrameWork/Util/AppPlatform"; import Utilit from "../FrameWork/Util/Utilit"; import Common5 from "../Platform/th/Common5"; import TTAPI from "../Platform/tt/TTAPI"; import WXAPI from "../Platform/weixin/WXAPI"; import Game from "../Scripts/Game"; import PhysicalPowerManger from "../ttFrame/manager/PhysicalPowerManger"; import MainScene from "./MainSceneScript"; const { ccclass, property } = cc._decorator; @ccclass export default class GameFailUI extends cc.Component { protected showNode: cc.Node = null; protected btnRestart: cc.Node = null; protected btnBack: cc.Node = null; protected btnShare: cc.Node = null; protected fireworksNode: cc.Node = null; protected fuhuoBtn: cc.Node = null; @property(cc.RichText) timeLabel: cc.RichText = null; fuhuoCall = null protected onLoad(): void { this.fuhuoCall = null } protected start(): void { TTAPI.stopRecord_custom(); // Common5.stopMusic(); if (! Common5.isNoMusic) { Common5.playEffect("fail"); } Common5.stopMusic(); // Common5.playMusic("bg"); this.showNode = this.node.getChildByName("game"); this.btnRestart = this.showNode.getChildByName("btnRestart"); this.btnBack = this.showNode.getChildByName("btnBack"); this.btnShare = this.showNode.getChildByName("btnShare"); this.btnRestart.on("click", () => { GameReport.EnterReport(ENTERTYPE.CHONGWAN,Common5.selectGameInfo.title2) Game.ins.onRestartCallFunc() this.node.removeFromParent(); }, this); this.btnBack.on("click", () => { GameReport.OUTReport(OUTTYPE.SHIBAI,Common5.selectGameInfo.title2) this.btnBackFunc2(); }, this); this.btnShare.on("click", () => { console.log("share"); WXAPI.share_custom((finish)=>{ if(finish){ //this.btnBackFunc(); }else{ //this.btnBackFunc(); } }, '',''); TTAPI.shareRecord_custom(() => { //this.btnBackFunc(); // cc.director.loadScene("MainScene"); }, () => { Common5.showTips_custom("录屏分享失败,请稍后再试!"); //this.btnBackFunc(); // cc.director.loadScene("MainScene"); }) }, this); if (this.timeLabel != null){ this.timeLabel.string = "还差一点就成功了
看个视频立即加"+Common5.selectGameInfo.timeInit+"秒" } } btnBackFunc2(){ Game.ins.exitGame() this.node.removeFromParent(); } btnBackFunc() { Game.ins.clickBack(null,true); this.node.removeFromParent(); } setFuhuoActive(){ let showNode = this.node.getChildByName("game"); let fuhuoBtn = showNode.getChildByName("复活"); let btnRestart = showNode.getChildByName("btnRestart"); let btnShare = showNode.getChildByName("btnShare"); btnShare.active = false fuhuoBtn.active = true btnRestart.active = true } btnClickEventFuHuoFunc() { let tab = { onClose: (finish) => { if (finish) { if(Common5.selectGameInfo){ Common5.ReportDY("inLevel", Common5.selectGameInfo.title2 + "-AD-复活"); GameReport.ADReport('复活',Common5.selectGameInfo.title2,1) } EventMgr.emitEvent_custom(ryw_Event.WordGameRevive); this.node.removeFromParent(); }else { GameReport.ADReport('复活',Common5.selectGameInfo.title2,0) Common5.showTips_custom("广告未看完"); } }, onFailed: () => { } } AppPlatform.playVideo_custom(tab); } }