This commit is contained in:
COMPUTER\EDY 2025-10-22 18:10:51 +08:00
parent 7fb40063b4
commit 60275b790a
5 changed files with 71 additions and 68 deletions

View File

@ -722,12 +722,11 @@ export default class Block extends cc.Component {
this.isTouch = false;
MapConroler._instance.hammerMask.active = false;
MapConroler._instance.node.parent.getChildByName("Bottom").getChildByName("destroyBtn").getComponent("btnControl").setTouch(true);
console.log("222使用特殊锤子", MapConroler._instance.hammerSpecial);
if (MapConroler._instance.hammerSpecial == true) {
MapConroler._instance.hammerSpecial = false;
}
else {
console.log("222使用普通锤子");
MapConroler._instance.costHammer();
}
MapConroler._instance.usePause();
@ -962,9 +961,9 @@ export default class Block extends cc.Component {
}
MapConroler._instance.nextLevel(0);
let colorTemp = this.color;
MapConroler._instance.checkColor(colorTemp, true);
this.node.active = false;
this.node.removeFromParent();
MapConroler._instance.checkColor(colorTemp, true);
setTimeout(() => {
if (MapConroler._instance.blockNum != 0 && (MapConroler._instance.openWall.length > 0 ||
MapConroler._instance.revolving_state != 0)
@ -1118,10 +1117,11 @@ export default class Block extends cc.Component {
cc.fx.AudioManager._instance.playEffect("lockBlock2", null);
}
let colorTemp = this.color;
MapConroler._instance.checkColor(colorTemp, true);
MapConroler._instance.nextLevel(0);
this.node.active = false;
this.node.removeFromParent();
MapConroler._instance.checkColor(colorTemp, true);
setTimeout(() => {
if (MapConroler._instance.blockNum != 0 && (MapConroler._instance.openWall.length > 0 ||
MapConroler._instance.revolving_state != 0)

View File

@ -1500,6 +1500,7 @@ export default class MapConroler extends cc.Component {
if (upWalls.length != 0) {
let result = this.detectingBlock("up", node.getComponent("Block").posX, node.getComponent("Block").posY, allBlocks);
if (result == true) result = this.passWall(result, upWalls, node);
// console.log("碰到上边缘结果:", result);
if (result) {
@ -1595,7 +1596,6 @@ export default class MapConroler extends cc.Component {
}
// const date8 = new Date().getTime();
// console.log("检测颜色是否能够通过门",date8);
if (jg == true) {
this.checkColor(node.getComponent("Block").color, false);
if (wallArray[0].getComponent("Wall").colorArray.length > 0) {
@ -1607,23 +1607,30 @@ export default class MapConroler extends cc.Component {
checkColor(colorTemp, type) {
let colorArray = [];
let number = 1;
if (type) number = 0;
for (let i = 0; i < this.colorDoors.length; i++) {
if (this.colorDoors[i].colorArray.length > 0) {
colorArray.push(this.colorDoors[i]);
}
// if (this.colorDoors[i].colorArray.length > 0) {
colorArray.push(this.colorDoors[i]);
// }
}
let colorOver = true;
let count = 0;
for (let i = 0; i < this.blocks.length; i++) {
let color = this.blocks[i].getComponent("Block").color;
if (color == colorTemp) {
count += 1;
if (this.blocks[i]) {
if (this.blocks[i].active) {
let color = this.blocks[i].getComponent("Block").color;
if (color == colorTemp) {
count += 1;
}
}
}
}
if (count > 1) {
if (count > number) {
colorOver = false;
}
//是变色门关卡,并且消除的块是当前颜色最后一个,对变色门中该颜色做消除处理 3 1 2 4 5 6
if (colorOver == true && colorArray.length > 0) {
for (let j = 0; j < colorArray.length; j++) {
@ -2123,7 +2130,7 @@ export default class MapConroler extends cc.Component {
//执行复活函数
runRewive(data) {
console.log("复活回调函数内", data);
// console.log("复活回调函数内", data);
this.isreview = true;
cc.fx.GameTool.changeCoin(data.coin);
const dataTemp = {
@ -2370,7 +2377,7 @@ export default class MapConroler extends cc.Component {
this.node.parent.parent.getChildByName("Lose").getChildByName("share").active = false;
}
else {
console.log("有分享按钮");
setTimeout(() => {
this.node.parent.parent.getChildByName("Lose").getChildByName("share").active = true;
}, 350);
@ -2531,7 +2538,7 @@ export default class MapConroler extends cc.Component {
return;
}
var pause = this.iceTrue();
console.log("冰冻状态:", pause);
// console.log("冰冻状态:", pause);
if (pause == true) {
return;
}
@ -2678,7 +2685,7 @@ export default class MapConroler extends cc.Component {
{ type: "freeze", count: 3 },
]
MapConroler._instance.SceneManager.openRewardWindow(data, () => {
console.log("_________恢复游戏");
var pause2 = this.iceTrue();
if (pause2 == false) {
this.pause = false;
@ -2704,7 +2711,7 @@ export default class MapConroler extends cc.Component {
{ type: "magic", count: 3 },
]
MapConroler._instance.SceneManager.openRewardWindow(data, () => {
console.log("_________恢复游戏");
var pause2 = this.iceTrue();
if (pause2 == false) {
this.pause = false;
@ -2729,7 +2736,7 @@ export default class MapConroler extends cc.Component {
{ type: "hammer", count: 1 },
]
MapConroler._instance.SceneManager.openRewardWindow(data, () => {
console.log("_________恢复游戏");
var pause2 = this.iceTrue();
if (pause2 == false) {
this.pause = false;
@ -2813,7 +2820,7 @@ export default class MapConroler extends cc.Component {
cc.fx.GameConfig.GM_INFO.hammerAmount = 0;
this.setPropNum();
let propInfo = cc.fx.StorageMessage.getStorage("prop");
console.log("锤子道具信息:", propInfo);
propInfo.hammerAmount = cc.fx.GameConfig.GM_INFO.hammerAmount;
propInfo.timestamp = timestamp;
cc.fx.StorageMessage.setStorage("prop", propInfo);
@ -2824,7 +2831,6 @@ export default class MapConroler extends cc.Component {
id: "2002",
num: -1
}
console.log("____________消耗锤子cost");
cc.fx.GameTool.shushu_Track("resource_cost", data);
}
@ -3301,7 +3307,6 @@ export default class MapConroler extends cc.Component {
nomalArray.push(this.blocks[i].getComponent("Block").block_Info.node);
}
}
// else nomalArray.push(this.blocks[i]);
}
else {
if (!this.blocks[i].getComponent("Block").isEliminatedByHammer) {
@ -3612,17 +3617,21 @@ export default class MapConroler extends cc.Component {
predict_End(colorTemp: number) {
//return true;
// console.log("提前判断游戏结束");
if (this.gameOver || this.gameWin || this.changeColor) {
if (this.gameOver || this.gameWin) {
return true;
}
//有变色门,且无开关门
if (this.changeColor == true && this.openWall.length == 0) {
return true;
}
let result = false;
if (this.blocks.length == 0) {
return true;
}
let result = false;
let colorOver = true;
let openResult = true;
for (let i = 0; i < this.blocks.length; i++) {
let color = this.blocks[i].getComponent("Block").color;
if (color == colorTemp) colorOver = false;
//确保方块是可移动状态下再做判断
if (this.blockCanMove(this.blocks[i])) {
for (let j = 0; j < this.wall_Pass.length; j++) {
@ -3651,6 +3660,9 @@ export default class MapConroler extends cc.Component {
return result;
}
else {
if (this.blockCanPass(this.blocks[i], this.wall_Pass[j])) {
openResult = false;
}
// console.log("开关门并且关着,________不可通行");
continue;
}
@ -3671,9 +3683,9 @@ export default class MapConroler extends cc.Component {
}
}
//是变色门关卡,并且消除的块是当前颜色最后一个,对变色门中该颜色做消除处理
// if (colorOver == true && this.changeColor == true) {
// }
if (openResult == true && this.changeColor == true) {
result = true;
}
return result;
}

View File

@ -455,7 +455,7 @@ export default class SceneManager extends cc.Component {
}
openRewardWindow(data, callBack) {
console.log("_____________________打开奖励弹窗", data);
// console.log("_____________________打开奖励弹窗", data);
if (!SceneManager.cachedRewardPrefab) {
cc.error('Reward prefab is not loaded yet.');
return;

View File

@ -227,11 +227,6 @@ export default class Wall extends cc.Component {
double = 3;
}
// if (this.colorArray.length > 1) {
// let firstItem = this.colorArray.shift(); // 移除第一项
// this.colorArray.push(firstItem); // 将第一项添加到数组末尾
// }
if (this.wall_SpriteFrames) {
let name = this.color + "color" + (length + double);
var spriteFrame = this.wall_SpriteFrames._spriteFrames[name];
@ -329,24 +324,6 @@ export default class Wall extends cc.Component {
this.maskNode.active = true;
this.setMask();
}
// let color = cc.instantiate(MapConroler._instance.Block_Prop[4]);
// color.parent = this.node.parent;
// if (this.wall_Info.length == 0) {
// color.opacity = 0;
// }
// color.scaleX = color.scaleY = 0.65;
// if (this.direction == "up") {
// color.setPosition((this.wall_Info.length - 1) * 60 - 10, 38);
// if (this.wall_Info.length == 1) color.x += 5;
// }
// else if (this.direction == "down") {
// color.setPosition((this.wall_Info.length - 1) * 60 - 10, -38);
// if (this.wall_Info.length == 1) color.x += 5;
// }
// if (this.direction == "right") {
// color.setPosition(30, (this.wall_Info.length - 1) * 60);
// }
}
}
@ -476,11 +453,16 @@ export default class Wall extends cc.Component {
if (direction == "left" || direction == "right") {
double = 3;
}
let color = this.colorArray[1];
if (this.wall_SpriteFrames) {
let name = color + "color" + (this.wall_Info.length + double);
var spriteFrame = this.wall_SpriteFrames._spriteFrames[name];
this.maskNode.getChildByName("color_icon").getComponent(cc.Sprite).spriteFrame = spriteFrame;
if (this.colorArray.length > 1) {
let color = this.colorArray[1];
if (this.wall_SpriteFrames) {
let name = color + "color" + (this.wall_Info.length + double);
var spriteFrame = this.wall_SpriteFrames._spriteFrames[name];
this.maskNode.getChildByName("color_icon").getComponent(cc.Sprite).spriteFrame = spriteFrame;
}
}
else {
this.maskNode.getChildByName("color_icon").opacity = 0;
}
}
@ -531,8 +513,11 @@ export default class Wall extends cc.Component {
if (this.colorArray.length > 1 && this.color == this.colorArray[0]) {
let firstItem = this.colorArray.shift(); // 移除第一项
this.colorArray.push(firstItem); // 将第一项添加到数组末尾
this.updateColor();
}
else if (this.colorArray.length == 1 && this.color != this.colorArray[0]) {
this.updateColor();
}
this.updateColor();
}
updateColor() {
@ -575,7 +560,7 @@ export default class Wall extends cc.Component {
//变色门删除颜色
removeColor(color, type) {
if (this.colorArray.length > 2) {
if (this.colorArray.length > 1) {
let index = this.colorArray.indexOf(color);
if (index !== -1) {
this.colorArray.splice(index, 1);
@ -591,15 +576,20 @@ export default class Wall extends cc.Component {
if (direction == "left" || direction == "right") {
double = 3;
}
let color = this.colorArray[1];
if (this.wall_SpriteFrames) {
let name = color + "color" + (this.wall_Info.length + double);
var spriteFrame = this.wall_SpriteFrames._spriteFrames[name];
this.maskNode.getChildByName("color_icon").getComponent(cc.Sprite).spriteFrame = spriteFrame;
this.maskNode.getChildByName("color_icon").getComponent(cc.Sprite).fillRange = 0;
cc.tween(this.maskNode.getChildByName("color_icon").getComponent(cc.Sprite))
.to(0.2, { fillRange: 1 })
.start();
if (this.colorArray.length > 1) {
let color = this.colorArray[1];
if (this.wall_SpriteFrames) {
let name = color + "color" + (this.wall_Info.length + double);
var spriteFrame = this.wall_SpriteFrames._spriteFrames[name];
this.maskNode.getChildByName("color_icon").getComponent(cc.Sprite).spriteFrame = spriteFrame;
this.maskNode.getChildByName("color_icon").getComponent(cc.Sprite).fillRange = 0;
cc.tween(this.maskNode.getChildByName("color_icon").getComponent(cc.Sprite))
.to(0.2, { fillRange: 1 })
.start();
}
}
else {
this.maskNode.getChildByName("color_icon").opacity = 0;
}
// 设置遮罩节点大小和位置
if (this.node.parent.name == "down") {

View File

@ -1168,7 +1168,8 @@ var GameTool = {
// MiniGameSdk.API.showToast("准备上报完成游戏");
}
if (name == "finish_stage") {
MiniGameSdk.API.yinli_FinishiStage();
if (data.result)
MiniGameSdk.API.yinli_FinishiStage();
}
// MiniGameSdk.API.shushu_Track(name,eventData);
MiniGameSdk.API.shushu_Track(name, eventData);