添加老虎机/水果机轮转动画

This commit is contained in:
leo
2019-12-24 15:16:59 +08:00
parent a22cdf60e5
commit 0fafa426cc
6 changed files with 1590 additions and 0 deletions

View File

@@ -0,0 +1,76 @@
cc.Class({
extends: cc.Component,
properties: {
list: [cc.Node],
loopTimes: 4,
awardTime: 1,
loopTimeList: [cc.Float]
},
onLoad() {
this.flickerTime = 0.15;
// this.loopTimeList = [0.04, 0.04, 0.12, 0.2, 0.2];
},
registerEvent() {
},
init(data) {
},
play(index, fn) {
let seqList = [], len = this.list.length, i = 0, deltaTime = 0;
let realTimes = len * this.loopTimes + index;
for (i = 0; i <= realTimes; i++) {
if (realTimes - i < 3) {
deltaTime += this.loopTimeList[this.loopTimeList.length - 1];
}
let item = this.list[i % len];
seqList.push(this.createAction(item, this.loopTimeList[Math.floor(i / len)] + deltaTime, true));
}
for (i = 0; i < 3; i++) {
let item = this.list[index];
seqList.push(this.createAction(item, this.flickerTime, false));
seqList.push(cc.delayTime(this.flickerTime));
}
seqList.push(cc.delayTime(this.awardTime));
seqList.push(cc.callFunc(() => {
fn && fn();
}));
this.node.runAction(cc.sequence(seqList));
},
createAction(item, time, isShow) {
let seq = cc.sequence(cc.callFunc((data) => {
item.active = isShow;
}), cc.delayTime(time), cc.callFunc((data) => {
item.active = !isShow;
}));
return seq;
},
update(dt) {
},
onEnable() {
this.registerEvent();
},
onDisable() {
this.offEvent();
},
offEvent() {
cc.emitter.offThis(this);
},
onDestroy() {
}
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "1d222780-1af2-440a-8e0b-749bd8755e19",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
{
"ver": "1.0.0",
"uuid": "31bca123-0de6-409a-94d8-28d1b2634535",
"asyncLoadAssets": false,
"autoReleaseAssets": false,
"subMetas": {}
}

View File

@@ -0,0 +1,44 @@
cc.Class({
extends: cc.Component,
properties: {
rolling: cc.Node,
},
onLoad() {
this.rollingMachine = this.rolling.getComponent('RollingMachine');
},
registerEvent() {
},
init(data) {
},
onEventClicked_play() {
let index = 2
this.rollingMachine.play(index);
},
update(dt) {
},
onEnable() {
this.registerEvent();
},
onDisable() {
this.offEvent();
},
offEvent() {
cc.emitter.offThis(this);
},
onDestroy() {
}
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "1af8a771-dc51-43ab-a95f-2c295b365ef0",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}