// 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 User from "../../FrameWork/User/User"; import Common5 from "../../Platform/th/Common5"; import UiBase from "../GameBase/UiBase"; import MiShuManager from "../Manager/MiShuManager"; const { ccclass, property } = cc._decorator; @ccclass export default class JieSuoPro extends UiBase { @property(cc.Node) content: cc.Node = null; // LIFE-CYCLE CALLBACKS: // onLoad () {} dataPro = null //pro:[{isPic:false, name:'诗涵' }, {isPic:true, name:'调味盒', isShipu:false}] setViewData(dataPro) { this.dataPro = dataPro } start() { Common5.playRemoteAudioEffect("remotesound/effect/游戏点击音效") let closeClick = this.node.getChildByName('closeClick') let lab = this.node.getChildByName('lab') this.scheduleOnce(() => { closeClick.active = true lab.active = true cc.tween(lab) .to(0.2, { scale: 1 }) .start() }, 1.0) // if (this.dataPro.length > 2) { // this.content.getComponent(cc.Layout).type = cc.Layout.Type.GRID // this.content.getComponent(cc.Layout).spacingY = 100 // } else { // this.content.getComponent(cc.Layout).type = cc.Layout.Type.HORIZONTAL // } for (let i = 0; i < this.dataPro.length; i++) { let node = this.content.children[i] node.active = true let data = this.dataPro[i] let spine = node.getChildByName('spine') let picNode = node.getChildByName('picNode') let name = node.getChildByName('name') let labStr = node.getChildByName('lab') let guanyun = node.getChildByName('光晕') Common5.playRemoteSpine(guanyun, 'Spine/mishu', '光晕', '光晕') this.scheduleOnce(() => { Common5.playRemoteSpine(guanyun, 'Spine/mishu', '光晕', '持续') }, 1.0) if (data.name == '习婉工') { name.getComponent(cc.Label).string = '席婉工' } else { name.getComponent(cc.Label).string = data.name + '' } let str = '' if (data.isPic) { picNode.active = true spine.active = false let url = '' if (data.isShipu) { //'shipuIcon/' url = 'shipuIcon/' str = '前往面点解锁' } else { //'tanweiTexture/icon/' url = 'tanweiTexture/icon/' str = '前往摊位解锁' } Common5.addUrlSprite_custom(url + data.name, picNode.getComponent(cc.Sprite)) } else { picNode.active = false spine.active = true let mishuData = MiShuManager.getConfigDateByName(data.name) str = '前往助理解锁' Common5.playRemoteSpine(spine, 'Spine/mishu/人物解锁', mishuData.spineName, mishuData.spineName2) } labStr.getComponent(cc.Label).string = str } } // update (dt) {} }