12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- import ResMgr from "../base/ResMgr";
- import SoundMgr from "../base/SoundMgr";
- var baseLayer = require('BaseLayer');
- cc.Class({
- extends: baseLayer,
- properties: {
- atlasVIP: cc.SpriteAtlas, //vip图集
- spVIP: cc.Sprite,
- labUp: cc.Label,
- labAtk: cc.Label,
- spS: cc.Sprite,
- leftArrow: cc.Node,
- rightArrow: cc.Node,
- itemsNode: [cc.Node],
- labPay: cc.Label,
- togsNode: [cc.Node],
- },
- // LIFE-CYCLE CALLBACKS:
- // onLoad () {},
- start () {
- this.upvipLv = 1; //直升的VIP
- this.curIndex = 0; //当前项
- this.atkArr = [];
- this.selectToggle(null, 0);
- },
- selectToggle(event, index){
- if(index)
- this.curIndex = index;
- for(let i=0; i < this.togsNode.length; i++){
- this.togsNode[i].getChildByName('on').active = false;
- }
- this.togsNode[index].getChildByName('on').active = true;
- this.leftArrow.active = this.curIndex != 0;
- this.rightArrow.active = this.curIndex != 4;
- this.setInfos();
- },
- setInfos(){
- this.spVIP.spriteFrame = this.atlasVIP.getSpriteFrame(`VIP${this.upvipLv}`);
- this.labUp.string = `直升VIP${this.upvipLv}`;
- this.labAtk.string = '888';
- ResMgr.loadTexture('texture/vipIcon/s2', (spFrame)=>{
- this.spS.spriteFrame = spFrame;
- });
- this.labPay.string = `${123}元购买`;
- for(let i=0; i < this.itemsNode.length; i++){
- let sp = this.itemsNode[i].getChildByName('sp').getComponent(cc.Sprite);
- ResMgr.loadTexture('texture/resIcon/9005', (spFrame)=>{
- sp.spriteFrame = spFrame;
- });
- this.itemsNode[i].getChildByName('zeng').active = false;
- this.itemsNode[i].getChildByName('labDes').getComponent(cc.Label).string = 'x112233';
- }
- },
- onClickLeft(){
- SoundMgr.playClick();
- this.selectToggle(null, this.curIndex - 1);
- },
- onClickRight(){
- SoundMgr.playClick();
- this.selectToggle(null, this.curIndex + 1);
- },
- onClickPay(){
- SoundMgr.playClick();
- },
- });
|