// Learn TypeScript: // - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html // Learn Attribute: // - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html import AppPlatform from "../../FrameWork/Util/AppPlatform"; import Common5 from "../../Platform/th/Common5"; import UiBase from "../GameBase/UiBase"; const {ccclass, property} = cc._decorator; @ccclass export default class BoxTipScript extends UiBase { @property(cc.Node) commonBtn: cc.Node = null; @property(cc.Node) adBtn: cc.Node = null; @property(cc.Label) descLab: cc.Label = null; @property(cc.Node) titleNode: cc.Node = null; // LIFE-CYCLE CALLBACKS: // onLoad () {} sureCallFunc = null adCallFunc = null closeFunc = null start () { } setViewData(indexNum,contentStr,sureCallFunc?,adCallFunc?){ if(indexNum<=1){ this.commonBtn.active = true this.adBtn.active = false }else if(indexNum==2){ this.commonBtn.active = true this.adBtn.active = true } this.descLab.string = contentStr this.sureCallFunc = sureCallFunc this.adCallFunc = adCallFunc } setBtnStr(commonStr, adStr){ this.commonBtn.getChildByName('lab').getComponent(cc.Label).string = commonStr this.adBtn.getChildByName('lay').getChildByName('lab').getComponent(cc.Label).string = adStr } setTitleView(isShow){ this.titleNode.active = isShow this.node.getChildByName('关闭').active = !isShow } setCloseBtnView(isShow){ this.node.getChildByName('关闭').active = isShow } setCloseFunc(func){ this.closeFunc = func } closeUiView(): void { //Common5.playEffect("sound/按键点击") this.closeFunc && this.closeFunc(true) this.closeUi() } comBtnClick(){ //Common5.playEffect("sound/按键点击") this.sureCallFunc && this.sureCallFunc(false) this.closeUi() } adBtnClick(){ //Common5.playEffect("sound/按键点击") let tab = { onClose: (finish) => { if (finish) { this.adCallFunc && this.adCallFunc(true) this.closeUi() }else { } }, onFailed: () => { } } AppPlatform.playVideo_custom(tab) } // update (dt) {} }