12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- import SoundMgr from "../base/SoundMgr";
- var baseLayer = require('BaseLayer');
- cc.Class({
- extends: baseLayer,
- properties: {
- gunNodes: [cc.Node],
- togNodes: [cc.Node],
- labNum: cc.Label,
- labLv: cc.Label,
- labNaxia: cc.Label,
- acNode: cc.Node,
- },
- // LIFE-CYCLE CALLBACKS:
- // onLoad () {},
- start () {
- this.init();
- this.beginGun();
- this.selectToggle(null, 0);
- },
- init(){
- for(let i=0; i< this.togNodes.length; i++){
- cc.find('off/labzi', this.togNodes[i]).getComponent(cc.Label).string = `${80}元`;
- cc.find('on/labzi', this.togNodes[i]).getComponent(cc.Label).string = `${80}元`;
- }
- this.acNode.getComponent('RechargeActivity').setType(0, this);
- },
- beginGun(){
- for(let i=0; i < this.gunNodes.length; i++){
- cc.tween(this.gunNodes[i])
- .sequence(
- cc.tween().by(0.5, {y: 30}),
- cc.tween().call(()=>{
- if(this.gunNodes[i].y == 45){ //重置
- this.gunNodes[i].y = -45;
- let str = `<color=#F6ECD8>恭喜“</c><color=#E9E61E>${123}</c><color=#F6ECD8>”购买</c><color=#C45558>"${2000}元鸿运礼包</c><color=#F6ECD8>幸运得</c><color=#E9E61E>${88888888}</c>`;
- this.gunNodes[i].getComponent(cc.RichText).string = str;
-
- }
- }),
- // cc.tween().delay(1)
- )
- .repeatForever()
- .start()
- }
- },
- selectToggle(event, index){ //0 1 2 3 4 5
- for(let i=0; i < this.togNodes.length; i++){
- this.togNodes[i].getChildByName('on').active = false;
- }
- this.togNodes[index].getChildByName('on').active = true;
- this.labNum.string = '2万~4万';
- this.labLv.string = '200%';
- this.labNaxia.string = `${234}元立即拿下`;
- },
- onClickNaxia(){
- SoundMgr.playClick();
- }
- });
|