Commit 9c475095 authored by 范雪寒's avatar 范雪寒

feat: 修改了判定范围、画笔的宽度,现在可以连笔了

parent 9194730d
......@@ -13,6 +13,7 @@ import {
asyncPlayDragonBoneAnimation,
asyncPlayEffectByUrl,
RandomInt,
Between,
http,
dateFormat,
formatSeconds,
......@@ -633,7 +634,7 @@ cc.Class({
.start();
}
if (this.checkPointInCircle(this.sharkNode, pos2, 50)) {
if (this.checkPointInCircle(this.sharkNode, pos2, 130)) {
this._status.currentStrokeStageIdx++
if (this.getCurrentCheckPos() === null) {
this.drawCompleteLine(this._status.currentStrokeIdx);
......@@ -644,7 +645,7 @@ cc.Class({
this.showOver();
}
this.updateArrows(this._status.currentStrokeIdx);
this.onSharkMoveEnd(event);
// this.onSharkMoveEnd(event);
}
}
......@@ -909,8 +910,21 @@ cc.Class({
this._moveCount = 0
const drawGraphyNode = cc.find('Canvas/letterNodeBase/DrawMaskNode/DrawGraphyNodeCurrent')
const graph = drawGraphyNode.getComponent(cc.Graphics);
graph.lineWidth = 120;
const location = event.getLocation();
const pos = drawGraphyNode.convertToNodeSpaceAR(location);
if (!this._lastPos) {
this._lastPos = { x: pos.x, y: pos.y };
} else {
const offsetX = pos.x - this._lastPos.x;
const offsetY = pos.y - this._lastPos.y;
if ((-10 < offsetX && offsetX < 10) && (-10 < offsetY && offsetY < 10)) {
return;
}
this._lastPos = { x: pos.x, y: pos.y };
}
graph.lineTo(pos.x, pos.y);
graph.stroke();
},
......@@ -919,6 +933,7 @@ cc.Class({
const drawGraphyNode = cc.find('Canvas/letterNodeBase/DrawMaskNode/DrawGraphyNodeCurrent')
const graph = drawGraphyNode.getComponent(cc.Graphics);
graph.clear();
this._lastPos = null;
},
addDrawListeners() {
......
......@@ -52,6 +52,10 @@ export function RandomInt(a, b = 0) {
return Math.floor(Math.random() * (max - min) + min);
}
export function Between(a, b, c) {
return [a, b, c].sort((a, b) => a - b)[1];
}
export function randomSortByArr(arr) {
const newArr = [];
const tmpArr = arr.concat();
......@@ -138,14 +142,14 @@ export function formatSeconds(value) {
theTime1 = parseInt(theTime1 % 60);
}
}
var result = "" + parseInt(theTime);//秒
if (10 > theTime > 0) {
result = "0" + parseInt(theTime);//秒
} else {
result = "" + parseInt(theTime);//秒
}
if (10 > theTime1 > 0) {
result = "0" + parseInt(theTime1) + ":" + result;//分,不足两位数,首位补充0,
} else {
......@@ -162,9 +166,9 @@ export async function http(type, url, data) {
console.log(' type: ', type);
console.log(' url: ', url);
console.log(' data: ', data);
return new Promise((resolve, reject) => {
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && (xhr.status >= 200 && xhr.status < 400)) {
......@@ -176,7 +180,7 @@ export async function http(type, url, data) {
}
};
xhr.open(type, url, true);
xhr.setRequestHeader("Content-Type","application/json; charset=utf-8");
xhr.setRequestHeader("Content-Type", "application/json; charset=utf-8");
xhr.send(JSON.stringify(data));
});
}
......@@ -37,5 +37,5 @@
"enable": false
}
},
"last-module-event-record-time": 1600849290448
"last-module-event-record-time": 1602228291878
}
{
"appid": "wxe5b8afe35e915c1c",
"appid": "wxa082c58c5b503561",
"orientation": "landscape",
"separate_engine": false,
"REMOTE_SERVER_ROOT": "",
......
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