Commit e6eca39c authored by 范雪寒's avatar 范雪寒

feat: 点击空白处开写

parent ae67e23f
......@@ -137,7 +137,7 @@ cc.Class({
this.initView();
this.initListener();
this.showLetterAnimation();
// this.showLetterAnimation();
this.startEditMode();
},
......@@ -253,6 +253,12 @@ cc.Class({
return pos1.sub(pos2).mag();
},
drawALineLast(drawNode, fromPos, toPos, color, drawIdx) {
if (drawIdx == this._writingIdx) {
this.drawALine(drawNode, fromPos, toPos, color);
}
},
drawALine(drawNode, fromPos, toPos, color) {
const graph = drawNode.getComponent(cc.Graphics);
if (color) {
......@@ -293,7 +299,10 @@ cc.Class({
letterBg.x = 0;
letterBg.y = 0;
letterBg.parent = letterBaseNode;
cc.find('LetterMask/bg', letterBg).active = false;
const bg = cc.find('LetterMask/bg', letterBg);
bg.active = true;
bg.opacity = 255;
// cc.find('LetterMask/bg', letterBg).active = false;
return letterBg;
},
......@@ -305,6 +314,11 @@ cc.Class({
const BtnBigLetter = cc.find('Canvas/bg/BtnBigLetter');
const BtnSmallLetter = cc.find('Canvas/bg/BtnSmallLetter');
const bgBtn = cc.find('Canvas/bg/Img_letter_bg');
bgBtn.on('click', () => {
this.showLetterAnimation();
});
BtnBigLetter.on('click', () => {
BtnBigLetter.getChildByName('Img_normal').active = false;
BtnSmallLetter.getChildByName('Img_normal').active = true;
......@@ -316,7 +330,7 @@ cc.Class({
cc.audioEngine.play(this.switchAudio, false, 0.8);
this.setLetter(this.letter.toUpperCase());
this.showLetterAnimation();
// this.showLetterAnimation();
this.startEditMode();
});
BtnSmallLetter.on('click', () => {
......@@ -330,7 +344,7 @@ cc.Class({
cc.audioEngine.play(this.switchAudio, false, 0.8);
this.setLetter(this.letter.toLowerCase());
this.showLetterAnimation();
// this.showLetterAnimation();
this.startEditMode();
});
......@@ -373,7 +387,7 @@ cc.Class({
this._writingIdx++;
const writingIdx = this._writingIdx;
console.log('set writingIdx = ' + writingIdx);
// cc.find(`Canvas/bg/Img_letter_bg/Img_letter_bg_${this.letter}/LetterMask/bg`).active = true;
cc.find(`Canvas/bg/Img_letter_bg/Img_letter_bg_${this.letter}/LetterMask/bg`).active = false;
const drawNode = cc.find(`Canvas/bg/Img_letter_bg/Img_letter_bg_${this.letter}/LetterMask/DrawNode`);
const graph = drawNode.getComponent(cc.Graphics);
graph.clear();
......@@ -382,7 +396,7 @@ cc.Class({
const lienList = this.getLineList(posList);
for (const pen of lienList) {
for (const line of pen) {
this.drawALine(drawNode, line.startPos, line.endPos, cc.color(181, 39, 48));
this.drawALineLast(drawNode, line.startPos, line.endPos, cc.color(181, 39, 48), writingIdx);
await asyncDelay(0.02);
}
await asyncDelay(0.1);
......
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