Commit 095ffe42 authored by 李维's avatar 李维

dev commit

parent b3fd9cc8
...@@ -27,17 +27,17 @@ ...@@ -27,17 +27,17 @@
"__id__": 17 "__id__": 17
}, },
{ {
"__id__": 82 "__id__": 88
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 92 "__id__": 98
} }
], ],
"_prefab": { "_prefab": {
"__id__": 93 "__id__": 99
}, },
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
...@@ -693,12 +693,18 @@ ...@@ -693,12 +693,18 @@
}, },
{ {
"__id__": 78 "__id__": 78
},
{
"__id__": 81
},
{
"__id__": 84
} }
], ],
"_active": true, "_active": true,
"_components": [], "_components": [],
"_prefab": { "_prefab": {
"__id__": 81 "__id__": 87
}, },
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
...@@ -2926,8 +2932,8 @@ ...@@ -2926,8 +2932,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
196.003, 59.104,
-275.341, -118.396,
0, 0,
0, 0,
0, 0,
...@@ -2983,6 +2989,113 @@ ...@@ -2983,6 +2989,113 @@
"_atlas": null, "_atlas": null,
"_id": "" "_id": ""
}, },
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "b4c5d143-107d-475f-b4ad-5a33353cf432"
},
"fileId": "f1Yb+nzbtIILUk5VP0gQ7U",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "NodePos_1_2",
"_objFlags": 0,
"_parent": {
"__id__": 17
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 82
}
],
"_prefab": {
"__id__": 83
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 53,
"height": 53
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
140.483,
-207.054,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 81
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "d7334742-bf52-402e-9edd-34ec180bf4cb"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
...@@ -2994,6 +3107,113 @@ ...@@ -2994,6 +3107,113 @@
"fileId": "c7V/Z6N0dMg7oeIBEPHi/J", "fileId": "c7V/Z6N0dMg7oeIBEPHi/J",
"sync": false "sync": false
}, },
{
"__type__": "cc.Node",
"_name": "NodePos_1_3",
"_objFlags": 0,
"_parent": {
"__id__": 17
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 85
}
],
"_prefab": {
"__id__": 86
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 53,
"height": 53
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
186.861,
-256.86,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 84
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "d7334742-bf52-402e-9edd-34ec180bf4cb"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "b4c5d143-107d-475f-b4ad-5a33353cf432"
},
"fileId": "b6SVzkfcNJPI5Idg4x2/ya",
"sync": false
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
...@@ -3014,17 +3234,17 @@ ...@@ -3014,17 +3234,17 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 83 "__id__": 89
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 90 "__id__": 96
} }
], ],
"_prefab": { "_prefab": {
"__id__": 91 "__id__": 97
}, },
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
...@@ -3078,24 +3298,24 @@ ...@@ -3078,24 +3298,24 @@
"_name": "Background", "_name": "Background",
"_objFlags": 512, "_objFlags": 512,
"_parent": { "_parent": {
"__id__": 82 "__id__": 88
}, },
"_children": [ "_children": [
{ {
"__id__": 84 "__id__": 90
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 87 "__id__": 93
}, },
{ {
"__id__": 88 "__id__": 94
} }
], ],
"_prefab": { "_prefab": {
"__id__": 89 "__id__": 95
}, },
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
...@@ -3149,17 +3369,17 @@ ...@@ -3149,17 +3369,17 @@
"_name": "Label", "_name": "Label",
"_objFlags": 512, "_objFlags": 512,
"_parent": { "_parent": {
"__id__": 83 "__id__": 89
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 85 "__id__": 91
} }
], ],
"_prefab": { "_prefab": {
"__id__": 86 "__id__": 92
}, },
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
...@@ -3213,7 +3433,7 @@ ...@@ -3213,7 +3433,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 84 "__id__": 90
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -3258,7 +3478,7 @@ ...@@ -3258,7 +3478,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 83 "__id__": 89
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -3290,7 +3510,7 @@ ...@@ -3290,7 +3510,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 83 "__id__": 89
}, },
"_enabled": true, "_enabled": true,
"alignMode": 0, "alignMode": 0,
...@@ -3328,7 +3548,7 @@ ...@@ -3328,7 +3548,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 82 "__id__": 88
}, },
"_enabled": true, "_enabled": true,
"_normalMaterial": null, "_normalMaterial": null,
...@@ -3401,7 +3621,7 @@ ...@@ -3401,7 +3621,7 @@
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e" "__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
}, },
"_N$target": { "_N$target": {
"__id__": 83 "__id__": 89
}, },
"_id": "" "_id": ""
}, },
......
...@@ -279,6 +279,7 @@ cc.Class({ ...@@ -279,6 +279,7 @@ cc.Class({
ctor() { ctor() {
this._imageResList = []; this._imageResList = [];
this._audioResList = []; this._audioResList = [];
this._lastDrawPos = -1;
}, },
start() { start() {
...@@ -543,7 +544,6 @@ cc.Class({ ...@@ -543,7 +544,6 @@ cc.Class({
letterNodeBase.zIndex = -1 letterNodeBase.zIndex = -1
const btnUpdate = letterNodeBase.getChildByName('BtnUpdate'); const btnUpdate = letterNodeBase.getChildByName('BtnUpdate');
btnUpdate.on('click', () => { btnUpdate.on('click', () => {
this.fireworks()
this.drawCompleteLine(this._status.currentStrokeIdx); this.drawCompleteLine(this._status.currentStrokeIdx);
this._status.currentStrokeIdx++; this._status.currentStrokeIdx++;
if (this._status.currentStrokeIdx >= 4) { if (this._status.currentStrokeIdx >= 4) {
...@@ -1037,14 +1037,43 @@ cc.Class({ ...@@ -1037,14 +1037,43 @@ cc.Class({
.start(); .start();
} }
}, },
drawCompleteLine(strokeIdx, ) { drawCompleteLine(strokeIdx, ) {
const drawGraphyNode = cc.find('Canvas/letterNodeBase/DrawMaskNode/DrawGraphyNodeBase'); const drawGraphyNode = cc.find('Canvas/letterNodeBase/DrawMaskNode/DrawGraphyNodeBase');
this.drawLines(drawGraphyNode, this.getPosListByStrokeIdx(strokeIdx)); this.drawLines(drawGraphyNode, this.getPosListByStrokeIdx(strokeIdx));
}, },
drawCompleteLine_new(strokeIdx, location) {
const drawGraphyNode = cc.find('Canvas/letterNodeBase/DrawMaskNode/DrawGraphyNodeBase');
const pos = this.getPosListByStrokeIdx(strokeIdx)
const index = this.checkNearPosIndex(pos, location)
if(index>=1) {
this.drawLines(drawGraphyNode, pos.slice(0, index));
}
},
checkNearPosIndex(posList, location) {
let minIndex = -1
let minDis = 10000
posList.forEach((p, index)=>{
let p1 = cc.v2(p.x, p.y)
let p2 = cc.v2(location.x, location.y)
let dis = p1.sub(p2).mag()
if(dis<minDis) {
minDis = dis
minIndex = index
}
})
if((this._lastDrawPos+3) >= minIndex) {
this._lastDrawPos = minIndex;
}
return this._lastDrawPos;
},
drawLines(drawNode, posList) { drawLines(drawNode, posList) {
const graph = drawNode.getComponent(cc.Graphics); const graph = drawNode.getComponent(cc.Graphics);
graph.strokeColor = "#ffd02f"
posList.forEach((pos, idx) => { posList.forEach((pos, idx) => {
if (idx == 0) { if (idx == 0) {
graph.moveTo(pos.x, pos.y); graph.moveTo(pos.x, pos.y);
...@@ -1060,6 +1089,7 @@ cc.Class({ ...@@ -1060,6 +1089,7 @@ cc.Class({
const graph = drawGraphyNode.getComponent(cc.Graphics); const graph = drawGraphyNode.getComponent(cc.Graphics);
const location = event.getLocation(); const location = event.getLocation();
const pos = drawGraphyNode.convertToNodeSpaceAR(location); const pos = drawGraphyNode.convertToNodeSpaceAR(location);
this._lastDrawPos = -1;
graph.moveTo(pos.x, pos.y); graph.moveTo(pos.x, pos.y);
}, },
...@@ -1072,18 +1102,21 @@ cc.Class({ ...@@ -1072,18 +1102,21 @@ cc.Class({
return; return;
} }
this._moveCount = 0 this._moveCount = 0
const drawGraphyNode = cc.find('Canvas/letterNodeBase/DrawMaskNode/DrawGraphyNodeCurrent') const drawGraphyNode = cc.find('Canvas/letterNodeBase/DrawMaskNode/DrawGraphyNodeCurrent')
const graph = drawGraphyNode.getComponent(cc.Graphics); // const graph = drawGraphyNode.getComponent(cc.Graphics);
const location = event.getLocation(); const location = event.getLocation();
const pos = drawGraphyNode.convertToNodeSpaceAR(location); const pos = drawGraphyNode.convertToNodeSpaceAR(location);
graph.lineTo(pos.x, pos.y); this.drawCompleteLine_new(this._status.currentStrokeIdx, pos)
graph.stroke(); // graph.lineTo(pos.x, pos.y);
// graph.stroke();
}, },
onDrawEnd(event) { onDrawEnd(event) {
const drawGraphyNode = cc.find('Canvas/letterNodeBase/DrawMaskNode/DrawGraphyNodeCurrent') const drawGraphyNode = cc.find('Canvas/letterNodeBase/DrawMaskNode/DrawGraphyNodeCurrent')
const graph = drawGraphyNode.getComponent(cc.Graphics); const graph = drawGraphyNode.getComponent(cc.Graphics);
graph.clear(); graph.clear();
console.log("Clear")
}, },
addDrawListeners() { addDrawListeners() {
......
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