Commit 11779dfa authored by limingzhe's avatar limingzhe

fix: debug

parent c483cfac
...@@ -1152,22 +1152,25 @@ cc.Class({ ...@@ -1152,22 +1152,25 @@ cc.Class({
this.scoreNum = 0; this.scoreNum = 0;
const scoreLabel = this.getRichText("Score: " + this.scoreNum, 100, "#ffffff", 6, "#111111", true); const scoreLabel = this.getRichText("Score: " + this.scoreNum, 100, "#ffffff", 6, "#111111", true);
this.canvas.addChild(scoreLabel, 2) this.canvas.addChild(scoreLabel, 2)
scoreLabel.x = this.canvas.width / 2 - 150 * this._mapScaleMin;
scoreLabel.y = this.canvas.height / 2 - 50 * this._mapScaleMin; scoreLabel.scale = 0.5 * 1 / this.jellyLayer.scale;
scoreLabel.x = this.canvas.width / 2 - 270 * scoreLabel.scale;
scoreLabel.y = this.canvas.height / 2 - 50 * scoreLabel.scale;
// scoreLabel.anchorX = 1; // scoreLabel.anchorX = 1;
// scoreLabel.anchorY = 1; // scoreLabel.anchorY = 1;
scoreLabel.scale = 0.5;
this.scoreLabel = scoreLabel; this.scoreLabel = scoreLabel;
}, },
initStepLabel() { initStepLabel() {
this.stepNum = 10; this.stepNum = 20;
const stepLabel = this.getRichText("Step: " + this.stepNum, 50, "#ffffff", 3, "#111111", true); const stepLabel = this.getRichText("Step: " + this.stepNum, 100, "#ffffff", 6, "#111111", true);
this.canvas.addChild(stepLabel, 2) this.canvas.addChild(stepLabel, 2)
stepLabel.x = this.scoreLabel.x; stepLabel.x = this.scoreLabel.x;
stepLabel.y = this.scoreLabel.y - 20 * this._mapScaleMin; stepLabel.y = this.scoreLabel.y - 25 * this.scoreLabel.scale;
// stepLabel.anchorX = 1; // stepLabel.anchorX = 1;
stepLabel.anchorY = 1; stepLabel.anchorY = 1;
stepLabel.scale = this.scoreLabel.scale;
this.stepLabel = stepLabel; this.stepLabel = stepLabel;
}, },
...@@ -1221,7 +1224,7 @@ cc.Class({ ...@@ -1221,7 +1224,7 @@ cc.Class({
const baseX = -this.canvas.height / 2 + edge + dis / 2; const baseX = -this.canvas.height / 2 + edge + dis / 2;
const baseY = -this.canvas.height / 2 + edge + dis / 2 - 30 * this._mapScaleMin; const baseY = -this.canvas.height / 2 + edge + dis / 2 - 20 * this._mapScaleMin;
const disX = dis; const disX = dis;
const disY = dis; const disY = dis;
...@@ -1229,6 +1232,9 @@ cc.Class({ ...@@ -1229,6 +1232,9 @@ cc.Class({
this.baseX = baseX; this.baseX = baseX;
this.baseY = baseY; this.baseY = baseY;
for (let i=0; i<col; i++) { for (let i=0; i<col; i++) {
const logicX = i.toString(); const logicX = i.toString();
...@@ -1248,17 +1254,17 @@ cc.Class({ ...@@ -1248,17 +1254,17 @@ cc.Class({
node.x = baseX + disX * i; node.x = baseX + disX * i;
node.y = baseY + disY * j; node.y = baseY + disY * j;
node.scale = len / 512 node.scale = len / 512
this.canvas.addChild(node); this.jellyLayer.addChild(node);
node.addChild(jellyBg); node.addChild(jellyBg);
const jelly = this.getOneJelly(i, j); const jelly = this.getOneJelly(i, j);
jelly.x = node.x; jelly.x = node.x;
jelly.y = node.y; jelly.y = node.y;
jelly.scale = 512 * 0.8 * node.scaleX / jelly.width; jelly.scale = 512 * 0.8 * node.scaleX / jelly.width;
this.canvas.addChild(jelly, 2); this.jellyLayer.addChild(jelly, 2);
console.log('jelly.width: ', jelly.width); // console.log('jelly.width: ', jelly.width);
console.log('jellyBg.width: ', jellyBg.width); // console.log('jellyBg.width: ', jellyBg.width);
this.itemBgObj[logicX][logicY] = node; this.itemBgObj[logicX][logicY] = node;
this.blockArray[i][j] = jelly; this.blockArray[i][j] = jelly;
...@@ -1352,6 +1358,8 @@ cc.Class({ ...@@ -1352,6 +1358,8 @@ cc.Class({
playAudio(this.finishClip); playAudio(this.finishClip);
}) })
this.showRestart();
}, },
refreshRichText(labelNode, text) { refreshRichText(labelNode, text) {
...@@ -1449,7 +1457,7 @@ cc.Class({ ...@@ -1449,7 +1457,7 @@ cc.Class({
jelly.x = xPos; jelly.x = xPos;
jelly.y = curY; jelly.y = curY;
jelly.scale =512 * 0.8 * (this.blockLen / 512) / jelly.width; jelly.scale =512 * 0.8 * (this.blockLen / 512) / jelly.width;
this.canvas.addChild(jelly, 2); this.jellyLayer.addChild(jelly, 2);
this.blockArray[col][this.gridSize - emptyBlocksCount - 1] = jelly; this.blockArray[col][this.gridSize - emptyBlocksCount - 1] = jelly;
...@@ -1477,10 +1485,10 @@ cc.Class({ ...@@ -1477,10 +1485,10 @@ cc.Class({
const blockScript = this.blockArray[col][row]; const blockScript = this.blockArray[col][row];
if (!blockScript || blockScript.colorId !== colorId || blockScript.isVisited) { if (!blockScript || blockScript.colorId !== colorId || blockScript.isVisited) {
console.log("blockScript: ", blockScript); // console.log("blockScript: ", blockScript);
console.log("blockScript colorId: ", blockScript.colorId); // console.log("blockScript colorId: ", blockScript.colorId);
console.log("blockScript isVisited: ", blockScript.isVisited); // console.log("blockScript isVisited: ", blockScript.isVisited);
console.log("return 2"); // console.log("return 2");
return; return;
} }
...@@ -1517,15 +1525,17 @@ cc.Class({ ...@@ -1517,15 +1525,17 @@ cc.Class({
}, },
addScore(jelly, score) { addScore(jelly, score) {
const richText = this.getRichText("+" + score, "40", "#ffffff", "3", "111111"); const richText = this.getRichText("+" + score, "60", "#ffffff", "5", "111111");
richText.x = jelly.x; richText.x = jelly.x;
richText.y = jelly.y; richText.y = jelly.y;
richText.parent = jelly.parent; richText.parent = jelly.parent;
richText.zIndex = 5; richText.zIndex = 5;
richText.opacity = 0; richText.opacity = 0;
richText.scale = 1 / this.jellyLayer.scale;
cc.tween(richText) cc.tween(richText)
.to(1, {opacity: 255}, {easing: "cubicOut"}) .to(1, {opacity: 255}, {easing: "cubicOut"})
.delay(0.5)
.to(0.1, {opacity: 0}, {easing: "cubicOut"}) .to(0.1, {opacity: 0}, {easing: "cubicOut"})
.call(() => { .call(() => {
richText.destroy(); richText.destroy();
...@@ -8009,6 +8019,7 @@ cc.Class({ ...@@ -8009,6 +8019,7 @@ cc.Class({
this.showResultLayer(); this.showResultLayer();
this.endTesting(); this.endTesting();
// this.showRestart();
// playAudioByUrl(this.data.finish_right_audio_url, () => { // playAudioByUrl(this.data.finish_right_audio_url, () => {
// delayCall(0.5, () => { // delayCall(0.5, () => {
...@@ -8097,28 +8108,31 @@ cc.Class({ ...@@ -8097,28 +8108,31 @@ cc.Class({
showRestart() { showRestart() {
const btn = getSprNode("btn_restart"); const btn = getSprNode("btn");
btn.scale = this._mapScaleMin; btn.scale = this.jellyLayer.scale;
btn.baseS = btn.scale; btn.baseS = btn.scale * 0.5;
btn.y = -100 * btn.scale;
this.canvas.addChild(btn, 21); this.canvas.addChild(btn, 21);
const rt = this.getRichText("Replay", 70, "#ffffff", 5, "#111111", true);
rt.y = 10;
btn.addChild(rt);
btn.on(cc.Node.EventType.TOUCH_START, () => { btn.on(cc.Node.EventType.TOUCH_START, () => {
// btn.removeFromParent();
// this.initData();
// this.initStar();
// this.showChangeQuesAnim();
// playAudio(this.btnClip);
const middleLayer = cc.find('middleLayer'); cc.director.loadScene(cc.director.getScene().name);
if (middleLayer) {
middleLayer.getComponent('middleLayer').reloadBundle(); // const middleLayer = cc.find('middleLayer');
} // if (middleLayer) {
// middleLayer.getComponent('middleLayer').reloadBundle();
// }
}) })
const time = 0.9; const time = 0.9;
btn.scale = 0; btn.scale = 0;
cc.tween(btn) cc.tween(btn)
.delay(2.5) // .delay(2.5)
.to(time, {scale: btn.baseS}, {easing: "elasticOut"}) .to(time, {scale: btn.baseS}, {easing: "elasticOut"})
.start(); .start();
...@@ -8279,6 +8293,25 @@ cc.Class({ ...@@ -8279,6 +8293,25 @@ cc.Class({
const sy = this.canvas.height / bg.height; const sy = this.canvas.height / bg.height;
bg.scale = Math.max(sx, sy); bg.scale = Math.max(sx, sy);
if (this.canvas.width < this.canvas.height) {
this.isVertical = true;
}
console.log("this.canvas.width: ", this.canvas.width);
console.log("this.canvas.height: ", this.canvas.height);
this.jellyLayer = new cc.Node();
if (this.isVertical) {
this.jellyLayer.scale = 1920 / this.canvas.height ;
} else {
// this.jellyLayer.scale = this.canvas.height / 1080;
this.jellyLayer.scale = this.canvas.width / 1920;
}
this.canvas.addChild(this.jellyLayer, 1);
}, },
initVerticalBg() { initVerticalBg() {
......
{
"ver": "2.3.5",
"uuid": "5c2fe851-1332-47d0-836f-2319c32b7a4b",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 661,
"height": 230,
"platformSettings": {},
"subMetas": {
"btn": {
"ver": "1.0.4",
"uuid": "7c9f1d61-512c-40af-8ba7-c5987e4f6bd8",
"rawTextureUuid": "5c2fe851-1332-47d0-836f-2319c32b7a4b",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 661,
"height": 230,
"rawWidth": 661,
"rawHeight": 230,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{ {
"title": "play", "title": "play",
"packageName": "org.cocos2d.demo", "packageName": "org.cocos2d.demo",
"startScene": "0737ce42-24f0-45c6-8e1a-8bdab4f74ba3", "startScene": "1545f2b8-c734-4b0a-9cdb-51218dc4602b",
"excludeScenes": [], "excludeScenes": [],
"includeSDKBox": false, "includeSDKBox": false,
"orientation": { "orientation": {
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
}, },
"ios": { "ios": {
"REMOTE_SERVER_ROOT": "", "REMOTE_SERVER_ROOT": "",
"packageName": "org.cocos2d.demo" "packageName": "org.cocos2d.demo",
"ios_enable_jit": true
}, },
"mac": { "mac": {
"REMOTE_SERVER_ROOT": "", "REMOTE_SERVER_ROOT": "",
...@@ -50,5 +51,6 @@ ...@@ -50,5 +51,6 @@
"scheme": "https", "scheme": "https",
"skipRecord": false "skipRecord": false
}, },
"appBundle": false "appBundle": false,
"agreements": {}
} }
{ {
"last-module-event-record-time": 1600677246969, "last-module-event-record-time": 1684763325695,
"migrate-history": [ "migrate-history": [
"cloud-function" "cloud-function"
] ]
......
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