This commit is contained in:
YZ\249929363 2025-07-18 17:41:57 +08:00
commit 36924eed8a
7 changed files with 2002 additions and 1121 deletions

File diff suppressed because it is too large Load Diff

View File

@ -786,57 +786,63 @@ export default class Block extends cc.Component {
this.node.active = false; this.node.active = false;
this.node.removeFromParent(); this.node.removeFromParent();
//如果是锤子状态消除 //如果是锤子状态消除
// if (!MapConroler._instance.ishammer) {
// // 记录添加magic时的锚点
// this.node.anchorX = 0.5;
// this.node.anchorY = 0.5;
// this.node.addChild(new cc.Node("magic"));
// let effectNode = this.node.getChildByName("magic");
// effectNode.setPosition(0, 0);
// // 改锚点后修正magic的位置
// this.node.anchorX = 1;
// this.node.anchorY = 0;
// // 重新设置magic的位置使其视觉上不变
// let parentSize = this.node.getContentSize();
// effectNode.setPosition(
// effectNode.x + parentSize.width * (0.5 - 1),
// effectNode.y + parentSize.height * (0.5 - 0)
// );
// switch (this.node.name) {
// case "block14":
// this.node.anchorX = 0.66;
// this.node.anchorY = 0;
// effectNode.setPosition(-50, 120);
// break;
// case "block18":
// this.node.anchorX = 0.66;
// this.node.anchorY = 0;
// effectNode.setPosition(-50, 200);
// break;
// case "block10":
// effectNode.setPosition(0, 200);
// break;
// case "block21":
// effectNode.setPosition(0, 130);
// break;
// case "block16":
// effectNode.setPosition(0, 180);
// break;
// default:
// break;
// }
// effectNode.addComponent(sp.Skeleton);
// effectNode.getComponent(sp.Skeleton).skeletonData = this.magic_SkeletonData;
// effectNode.getComponent(sp.Skeleton).setAnimation(0, "play", false);
// }
// MapConroler._instance.ishammer = false;
}, 200); }, 200);
// console.log("消除", this.node.name, this.node.children);
// //延时1.8秒
// setTimeout(() => {
// if (!MapConroler._instance.ishammer) {
// // 记录添加magic时的锚点
// this.node.anchorX = 0.5;
// this.node.anchorY = 0.5;
// this.node.addChild(new cc.Node("magic"));
// let effectNode = this.node.getChildByName("magic");
// effectNode.setPosition(0, 0);
// // 改锚点后修正magic的位置
// this.node.anchorX = 1;
// this.node.anchorY = 0;
// // 重新设置magic的位置使其视觉上不变
// let parentSize = this.node.getContentSize();
// effectNode.setPosition(
// effectNode.x + parentSize.width * (0.5 - 1),
// effectNode.y + parentSize.height * (0.5 - 0)
// );
// switch (this.node.name) {
// case "block14":
// this.node.anchorX = 0.66;
// this.node.anchorY = 0;
// effectNode.setPosition(-50, 120);
// break;
// case "block18":
// this.node.anchorX = 0.66;
// this.node.anchorY = 0;
// effectNode.setPosition(-50, 200);
// break;
// case "block10":
// effectNode.setPosition(0, 200);
// break;
// case "block21":
// effectNode.setPosition(0, 130);
// break;
// case "block16":
// effectNode.setPosition(0, 180);
// break;
// default:
// break;
// }
// effectNode.addComponent(sp.Skeleton);
// effectNode.getComponent(sp.Skeleton).skeletonData = this.magic_SkeletonData;
// effectNode.getComponent(sp.Skeleton).setAnimation(0, "play", false);
// }
// }, 1800);
// MapConroler._instance.ishammer = false;
} }
setVibrate(type, count) { setVibrate(type, count) {

View File

@ -51,21 +51,34 @@ export default class ItemGuide extends cc.Component {
//获取目标节点的位置并且转换到itemGuide的位置的层级 //获取目标节点的位置并且转换到itemGuide的位置的层级
let index = 0; let index = 0;
if (cc.fx.GameConfig.GM_INFO.level + 1 == 8) { if (cc.fx.GameConfig.GM_INFO.level + 1 == 8) {
cc.fx.GameConfig.GM_INFO.hammerFirst = false;
index = 0; index = 0;
} else if (cc.fx.GameConfig.GM_INFO.level + 1 == 11) { } else if (cc.fx.GameConfig.GM_INFO.level + 1 == 11) {
cc.fx.GameConfig.GM_INFO.freezeFirst = false;
index = 1; index = 1;
} else if (cc.fx.GameConfig.GM_INFO.level + 1 == 16) { } else if (cc.fx.GameConfig.GM_INFO.level + 1 == 16) {
cc.fx.GameConfig.GM_INFO.magicAFirst = false;
index = 2; index = 2;
} }
let pos = this.targetNode[index].convertToWorldSpaceAR(cc.Vec3.ZERO); let pos = this.targetNode[index].convertToWorldSpaceAR(cc.Vec3.ZERO);
pos = this.node.convertToNodeSpaceAR(pos); pos = this.node.convertToNodeSpaceAR(pos);
this.itemGuide.zIndex = 1000; this.itemGuide.zIndex = 1000;
//同时改变大小和位置 //同时改变大小和位置
MapConroler._instance.setPropNum();
// if (this.itemGuide.active == true) {
cc.tween(this.itemGuide) cc.tween(this.itemGuide)
.to(1.3, { scale: 0.3, position: pos }) // 同时执行 .to(1.3, { scale: 0.3, position: pos }) // 同时执行
.call(() => { this.node.active = false; }) .call(() => { this.node.active = false; })
.start(); .start();
// } // }
}
//显示引导
showGuide() {
this.node.active = true;
this.node.children[0].active = true;
} }
// update (dt) {} // update (dt) {}

View File

@ -91,6 +91,7 @@ export default class MapConroler extends cc.Component {
coin: cc.Node = null; coin: cc.Node = null;
new_mode: number = 0; new_mode: number = 0;
new_item: number = 0;
mapWidth: number = 0; mapWidth: number = 0;
mapHeight: number = 0; mapHeight: number = 0;
wallNum: number = 0; wallNum: number = 0;
@ -161,6 +162,7 @@ export default class MapConroler extends cc.Component {
this.againCanTouch = true; this.againCanTouch = true;
this.powerState = false; this.powerState = false;
this.new_mode = 0; this.new_mode = 0;
this.new_item = 0;
this.count_Time = 0; this.count_Time = 0;
this.add_Time = 0; this.add_Time = 0;
@ -288,6 +290,23 @@ export default class MapConroler extends cc.Component {
this.itemLock[0].active = lock0Active; this.itemLock[0].active = lock0Active;
this.itemLock[1].active = lock1Active; this.itemLock[1].active = lock1Active;
this.itemLock[2].active = lock2Active; this.itemLock[2].active = lock2Active;
if (cc.fx.GameConfig.GM_INFO.magicAFirst == true) {
this.magicNode.children[0].active = true;
this.magicNode.children[1].active = false;
this.magicNode.children[2].active = false;
}
if (cc.fx.GameConfig.GM_INFO.hammerFirst== true) {
this.hammerNode.children[0].active = true;
this.hammerNode.children[1].active = false;
this.hammerNode.children[2].active = false;
}
if (cc.fx.GameConfig.GM_INFO.freezeFirst == true ) {
this.iceNode.children[0].active = true;
this.iceNode.children[1].active = false;
this.iceNode.children[2].active = false;
}
} }
startUpdate() { startUpdate() {
@ -407,9 +426,20 @@ export default class MapConroler extends cc.Component {
this.guideNode.zIndex = 1000; this.guideNode.zIndex = 1000;
this.guideNode.getComponent(Animation).play(); this.guideNode.getComponent(Animation).play();
} }
if (cc.fx.GameConfig.GM_INFO.level + 1 == 8 || cc.fx.GameConfig.GM_INFO.level + 1 == 11 || cc.fx.GameConfig.GM_INFO.level + 1 == 16) {
if (cc.fx.GameConfig.GM_INFO.hammerFirst== true ) {
this.guideItem.active = true; this.guideItem.active = true;
this.setPropNum();
} }
if ( cc.fx.GameConfig.GM_INFO.freezeFirst == true ) {
this.guideItem.active = true;
this.setPropNum();
}
if ( cc.fx.GameConfig.GM_INFO.magicAFirst == true) {
this.guideItem.active = true;
this.setPropNum();
}
} }
//创建方块 //创建方块
@ -1491,6 +1521,12 @@ export default class MapConroler extends cc.Component {
this.new_mode = 3; this.new_mode = 3;
} }
} }
for (let i = 0; i < cc.fx.GameConfig.NEW_GUIDE.length; i++) {
if ((cc.fx.GameConfig.GM_INFO.level + 1) == cc.fx.GameConfig.NEW_GUIDE[i].level) {
this.new_item = 3;
}
}
} }
winLevel() { winLevel() {
@ -1521,6 +1557,20 @@ export default class MapConroler extends cc.Component {
cc.fx.GameConfig.LEVEL_INFO_init(false, 0); cc.fx.GameConfig.LEVEL_INFO_init(false, 0);
return; return;
} }
if (this.new_item == 3) {
if (cc.fx.GameConfig.GM_INFO.level + 1 == 8) {
console.log("新手引导开启");
cc.fx.GameConfig.GM_INFO.hammerFirst = true;
}
if (cc.fx.GameConfig.GM_INFO.level +1== 11) {
cc.fx.GameConfig.GM_INFO.freezeFirst = true;
}
if (cc.fx.GameConfig.GM_INFO.level+1 == 16) {
cc.fx.GameConfig.GM_INFO.magicAFirst = true;
}
}
cc.fx.AudioManager._instance.playEffect("zhuan1", null); cc.fx.AudioManager._instance.playEffect("zhuan1", null);
this.node.parent.parent.parent.getChildByName("zhuanchang").active = true; this.node.parent.parent.parent.getChildByName("zhuanchang").active = true;
this.node.parent.parent.parent.getChildByName("zhuanchang").getComponent(sp.Skeleton).setAnimation(1, "up", false); this.node.parent.parent.parent.getChildByName("zhuanchang").getComponent(sp.Skeleton).setAnimation(1, "up", false);
@ -1684,6 +1734,19 @@ export default class MapConroler extends cc.Component {
this.openNewMode(1); this.openNewMode(1);
return; return;
} }
if (this.new_item == 3) {
if (cc.fx.GameConfig.GM_INFO.level+1 == 8) {
cc.fx.GameConfig.GM_INFO.hammerFirst = true;
}
if (cc.fx.GameConfig.GM_INFO.level+1 == 11) {
cc.fx.GameConfig.GM_INFO.freezeFirst = true;
}
if (cc.fx.GameConfig.GM_INFO.level+1 == 16) {
cc.fx.GameConfig.GM_INFO.magicAFirst = true;
}
}
cc.fx.AudioManager._instance.playEffect("zhuan1", null); cc.fx.AudioManager._instance.playEffect("zhuan1", null);
this.node.parent.parent.parent.getChildByName("zhuanchang").active = true; this.node.parent.parent.parent.getChildByName("zhuanchang").active = true;
this.node.parent.parent.parent.getChildByName("zhuanchang").getComponent(sp.Skeleton).setAnimation(1, "up", false); this.node.parent.parent.parent.getChildByName("zhuanchang").getComponent(sp.Skeleton).setAnimation(1, "up", false);

View File

@ -54,6 +54,8 @@ export class GameConfig {
static WALL_INFO: (({ id: number; num: number; block: number; color: number; special: number; length: number; lock?: undefined; } | { id: number; num: number; block: number; color: number; special: number; length: number; lock: boolean; })[] | ({ id: number; num: number; block: number; color: number; special: number; length: number; freeze?: undefined; } | { id: number; num: number; block: number; color: number; special: number; length: number; freeze: number; })[])[]; static WALL_INFO: (({ id: number; num: number; block: number; color: number; special: number; length: number; lock?: undefined; } | { id: number; num: number; block: number; color: number; special: number; length: number; lock: boolean; })[] | ({ id: number; num: number; block: number; color: number; special: number; length: number; freeze?: undefined; } | { id: number; num: number; block: number; color: number; special: number; length: number; freeze: number; })[])[];
static PROP_INFO: ({ pos1: { x: number; y: number; z: number; }; pos2: { x: number; y: number; z: number; }; pos3: { x: number; y: number; z: number; }; pos4: { x: number; y: number; z: number; }; pos5: { x: number; y: number; z: number; }; pos6: { x: number; y: number; z: number; }; } | { pos1: { x: number; y: number; z: number; }; pos2: { x: number; y: number; z: number; }; pos3: { x: number; y: number; z: number; }; pos4: { x: number; y: number; z: number; }; pos5: { x: number; y: number; z: number; }; pos6?: undefined; })[]; static PROP_INFO: ({ pos1: { x: number; y: number; z: number; }; pos2: { x: number; y: number; z: number; }; pos3: { x: number; y: number; z: number; }; pos4: { x: number; y: number; z: number; }; pos5: { x: number; y: number; z: number; }; pos6: { x: number; y: number; z: number; }; } | { pos1: { x: number; y: number; z: number; }; pos2: { x: number; y: number; z: number; }; pos3: { x: number; y: number; z: number; }; pos4: { x: number; y: number; z: number; }; pos5: { x: number; y: number; z: number; }; pos6?: undefined; })[];
static NEW_LEVEL: any; static NEW_LEVEL: any;
static NEW_GUIDE: any;
static TA: any; static TA: any;
static GE: any; static GE: any;
static GM_INFO: { static GM_INFO: {
@ -245,6 +247,7 @@ export class GameConfig {
uid: "", //用户和后端唯一id uid: "", //用户和后端唯一id
userPowerTime: 0, //用户体力恢复时间 userPowerTime: 0, //用户体力恢复时间
freezeFirst: false, freezeFirst: false,
hammerFirst: false, hammerFirst: false,
magicAFirst: false, magicAFirst: false,
}; };
@ -262,6 +265,16 @@ export class GameConfig {
// 可以根据需求对 newLevelData 进行处理 // 可以根据需求对 newLevelData 进行处理
// //console.log("NEW_LEVEL.JSON 加载成功:", newLevelData); // //console.log("NEW_LEVEL.JSON 加载成功:", newLevelData);
}) })
cc.resources.load("Json/NEW_GUIDE", (err: any, res: cc.JsonAsset) => {
if (err) {
console.error("加载 NEW_GUIDE.JSON 失败:", err);
return;
}
const newLevelData = res.json;
this.NEW_GUIDE = newLevelData.NEW_GUIDE;
// 可以根据需求对 newLevelData 进行处理
// //console.log("NEW_GUIDE.JSON 加载成功:", newLevelData);
})
} }

View File

@ -0,0 +1,19 @@
{
"NEW_GUIDE": [
{
"level": 8,
"name": "hammer",
"tips": "锤子道具"
},
{
"level": 11,
"name": "time",
"tips": "时间道具"
},
{
"level": 16,
"name": "magic",
"tips": "魔法道具"
}
]}

View File

@ -0,0 +1,6 @@
{
"ver": "1.0.2",
"uuid": "37dcff18-2691-4552-9c14-4a50a7a60496",
"importer": "json",
"subMetas": {}
}