Commit fe60e12a authored by limingzhe's avatar limingzhe

fix: debug

parent 1908d8af
......@@ -979,6 +979,7 @@ cc.Class({
initData() {
console.log(' in initData');
this.poolData = {}
this.canTouch = true;
const rows = [];
......@@ -1462,13 +1463,19 @@ cc.Class({
getOneLetterItem(isAnim=false) {
// const id = this.getRandomDataFromArray([1,2,3,4,5,6,7,8,9,10]);
const id = this.getRandomDataFromArray(this.colorIdArr);
const letter = this.itemLetterObj[id];
let item = this.getPoolItem(id);
if (!item) {
const resName = 'item_' + id;
const item = getSprNode(resName);
item = getSprNode(resName);
this.itemBg.addChild(item);
const rtNode = this.getRichText(letter, 100, "#ffffff", 0, "#000000", false)
rtNode.y = 15;
......@@ -1483,12 +1490,18 @@ cc.Class({
item.rtNode = rtNode;
item.rtNodeShadow = rtNodeShadow;
item.letter = letter;
item.colorId = id;
item.on('touchstart', () => {
this.itemClick(item);
})
} else {
item.opacity = 255;
this.resetOneLetterItem(item, false)
}
item.letter = letter;
if (isAnim) {
......@@ -1527,6 +1540,11 @@ cc.Class({
if (!this.canTouch) {
return;
}
if (item.opacity < 1) {
return
}
console.log('item.letter: ', item.letter);
this.canTouch = false;
......@@ -1627,7 +1645,7 @@ cc.Class({
}
},
resetOneLetterItem(item) {
resetOneLetterItem(item, isAnim=true) {
// const id = this.getRandomDataFromArray([1,2,3,4,5,6,7,8,9,10]);
const id = item.colorId;
const letter = this.itemLetterObj[id];
......@@ -1636,27 +1654,47 @@ cc.Class({
// const item = getSprNode(resName);
// this.itemBg.addChild(item);
this.delayCall(1 + Math.random() * 0.5, () => {
const {rtNode, rtNodeShadow} = item;
item.letter = letter;
if (!isAnim) {
cc.tween(rtNode)
.to(0.5, {opacity: 0}, {easing:"cubicIn"})
.call(() => {
this.refreshRichText(rtNode, letter);
})
.to(0.5, {opacity: 255}, {easing:"cubicOut"})
.start();
this.refreshRichText(rtNodeShadow, letter);
cc.tween(rtNodeShadow)
.to(0.5, {opacity: 0}, {easing:"cubicIn"})
.call(() => {
return;
}
this.refreshRichText(rtNode, letter);
this.refreshRichText(rtNodeShadow, letter);
})
.to(0.5, {opacity: rtNodeShadow.baseOpacity}, {easing:"cubicOut"})
rtNodeShadow.opacity = 0;
cc.tween(rtNodeShadow)
.to(1, {opacity: rtNodeShadow.baseOpacity}, {easing:"cubicOut"})
.start();
})
item.letter = letter;
// this.delayCall(1 + Math.random() * 0, () => {
// cc.tween(rtNode)
// .to(0.5, {opacity: 0}, {easing:"cubicIn"})
// .call(() => {
// this.refreshRichText(rtNode, letter);
// })
// .to(0.5, {opacity: 255}, {easing:"cubicOut"})
// .start();
// cc.tween(rtNodeShadow)
// .to(0.5, {opacity: 0}, {easing:"cubicIn"})
// .call(() => {
// this.refreshRichText(rtNodeShadow, letter);
// })
// .to(0.5, {opacity: rtNodeShadow.baseOpacity}, {easing:"cubicOut"})
// .start();
// })
},
......@@ -1852,8 +1890,30 @@ cc.Class({
this.addScore(item, score);
this.playSpineEffect(item, "light");
item.removeFromParent();
this.removeOneItem(item);
},
removeOneItem(item) {
item.opacity = 0;
item.x = -this.canvas.width;
this.addPoolItem(item, item.colorId);
},
addPoolItem(item, id) {
if (!this.poolData[id]) {
this.poolData[id] = [];
}
this.poolData[id].push(item);
},
getPoolItem(id) {
if (this.poolData[id] && this.poolData[id].length > 0) {
return this.poolData[id].pop();
}
},
addScore(item, score) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment