import GameResMgr, { uiPreName } from "../../Tools/GameResMgr"; import AdsApiMgr from "../../Tools/Sdk/ads/AdsApiMgr"; import Utils from "../../Tools/Utils"; //import gameNetWorkControl from "../../Tools/gameNetWorkControl"; //import gameStorage from "../../Tools/gameStorage"; const {ccclass, property} = cc._decorator; @ccclass export default class NumLevelUpPanelSc extends cc.Component { @property(cc.Node) levelupNode:cc.Node = null @property(cc.Node) winNode:cc.Node = null gamesc = null nextnum = 0 onLoad () { this.levelupNode.active = !1 this.winNode.active = !1 } start () { AdsApiMgr.Instance.recording_Video_End() this.schedule(()=>{ this.addYanHua() }, 0.5, cc.macro.REPEAT_FOREVER) } /** * 展示界面 * @param _type 0 1 */ showPanel(_type, nextnum?){ if(_type == 0){ if(nextnum > 6){ this.nextnum = nextnum } this.levelupNode.active = !0 }else if(_type == 1){ this.winNode.active = !0 } } /** * 设置 * @param sc */ setGameSc(sc){ this.gamesc = sc } /** * 按钮点击事件 * @param t * @param e */ btnClickCallBack(t, e){ if(e == 'share'){ var self = this AdsApiMgr.Instance.recording_Video_Share(()=>{ self.node.destroy() }, ()=>{}) }else if(e == 'continue'){ // if(this.nextnum > 6){ // let randshu = Utils.getRangeRandom(1,3) // if(randshu == 2 && gameNetWorkControl.Instance.getShowState()){ // AdsApiMgr.Instance.motivational_Video_Show(()=>{ // gameStorage.Instance.setEnergy(gameStorage.Instance.getEnergy()+2) // cc.director.emit('updateengry') // AdsApiMgr.Instance.showToast('体力奖励已发放') // }, ()=>{}) // } // } this.node.destroy() AdsApiMgr.Instance.recording_Video_Start() } else if(e == 'next'){ this.node.destroy() AdsApiMgr.Instance.recording_Video_Start() this.gamesc.nextCheck() }else if(e == 'next_share'){ var self = this AdsApiMgr.Instance.recording_Video_Share(()=>{ self.node.destroy() AdsApiMgr.Instance.recording_Video_Start() self.gamesc.nextCheck() }, ()=>{}) } } /** * 添加烟花 */ addYanHua(){ let winSize = cc.winSize let xx = Utils.getRangeRandom(-winSize.width/2+50, winSize.width/2-50) let yy = Utils.getRangeRandom(-winSize.height/2+50, winSize.height/2-50) let newyanhua:cc.Node = cc.instantiate(GameResMgr.Instance.uiPre[uiPreName.yanhua]) newyanhua.position = cc.v3(xx, yy, 0) newyanhua.parent = this.node // let ani = newyanhua.getComponent(sp.Skeleton) // let skinid = Utils.getRangeRandom(1, 5) // ani.setSkin('' + skinid) cc.tween(newyanhua) .delay(0.8) .removeSelf() .start() } // update (dt) {} }