更新冻结门功能

This commit is contained in:
YZ\249929363 2025-07-23 18:50:23 +08:00
parent 0c1fa52444
commit e264a243ca
13 changed files with 2576 additions and 2818 deletions

View File

@ -169,7 +169,12 @@ export default class GameManager extends cc.Component {
startGame() { startGame() {
console.log("进入场景之前_____________", cc.fx.GameConfig.GM_INFO.first); console.log("进入场景之前_____________", cc.fx.GameConfig.GM_INFO.first);
console.log(cc.fx.GameConfig.GM_INFO.level); console.log(cc.fx.GameConfig.GM_INFO.level);
// 加载 music bundle cc.assetManager.loadBundle('shop', (err, bundle) => {
if (err) {
console.error('加载 shop 失败:', err);
} else {
console.log('shop加载成功');
// 加载成功后进入 HomeScene
cc.assetManager.loadBundle('music', (err, bundle) => { cc.assetManager.loadBundle('music', (err, bundle) => {
if (err) { if (err) {
console.error('加载 music bundle 失败:', err); console.error('加载 music bundle 失败:', err);
@ -177,18 +182,14 @@ export default class GameManager extends cc.Component {
cc.director.loadScene("HomeScene"); cc.director.loadScene("HomeScene");
} else { } else {
console.log('music bundle 加载成功'); console.log('music bundle 加载成功');
cc.assetManager.loadBundle('shop', (err, bundle) => {
if (err) {
console.error('加载 shop 失败:', err);
} else {
console.log('shop加载成功');
// 加载成功后进入 HomeScene
cc.director.loadScene("HomeScene");
} }
cc.director.loadScene("HomeScene");
}); });
} }
}); });
// 加载 music bundle
} }
returnHome() { returnHome() {
@ -431,7 +432,7 @@ export default class GameManager extends cc.Component {
"magicAmount": cc.fx.GameConfig.GM_INFO.magicAmoun, "magicAmount": cc.fx.GameConfig.GM_INFO.magicAmoun,
"timestamp": timestamp "timestamp": timestamp
} }
console.log("_______________上传道具信息:", propInfoNew); console.log("_______________1111上传道具信息:", propInfoNew);
cc.fx.StorageMessage.setStorage("prop", propInfoNew); cc.fx.StorageMessage.setStorage("prop", propInfoNew);
} }
else { else {
@ -491,7 +492,7 @@ export default class GameManager extends cc.Component {
} }
//旧用户,无本地缓存读取配置 //旧用户,无本地缓存读取配置
oldReadData(retryCount: number) { oldReadData(retryCount: number) {
console.log("读取旧信息"); console.log("________读取旧信息");
const MAX_RETRIES = 15; const MAX_RETRIES = 15;
const timestamp = Date.now(); const timestamp = Date.now();
// 读取用户数据 // 读取用户数据
@ -502,7 +503,7 @@ export default class GameManager extends cc.Component {
action: 'read' action: 'read'
}, },
success: res => { success: res => {
console.log('读取用户数据成功', res.result) console.log('11111111读取用户数据成功', res.result)
if (res.result.code == 404 && res.result.message == "未找到用户数据") { if (res.result.code == 404 && res.result.message == "未找到用户数据") {
if (res.result.openid) { if (res.result.openid) {
console.log("用户从未进入过第一次设置openid:"); console.log("用户从未进入过第一次设置openid:");
@ -521,11 +522,15 @@ export default class GameManager extends cc.Component {
console.log("33333333333"); console.log("33333333333");
cc.fx.StorageMessage.setStorage("coin", coinInfo); cc.fx.StorageMessage.setStorage("coin", coinInfo);
let propInfo = { let propInfo = {
"freezeAmount": 0, "freezeAmount": 3,
"hammerAmount": 0, "hammerAmount": 3,
"magicAmount": 0, "magicAmount": 3,
"timestamp": timestamp, "timestamp": timestamp,
} }
console.log("最新上传道具信息——————————:", propInfo);
cc.fx.GameConfig.GM_INFO.freezeAmount = 3;
cc.fx.GameConfig.GM_INFO.hammerAmount = 3;
cc.fx.GameConfig.GM_INFO.magicAmount = 3;
cc.fx.StorageMessage.setStorage("prop", propInfo); cc.fx.StorageMessage.setStorage("prop", propInfo);

View File

@ -700,9 +700,7 @@ export default class MapConroler extends cc.Component {
this.createTurn(dir, block, block.getComponent("MapBlock").posX, block.getComponent("MapBlock").posY); this.createTurn(dir, block, block.getComponent("MapBlock").posX, block.getComponent("MapBlock").posY);
} }
} }
} }
} }
createWall(direction, node) { createWall(direction, node) {
@ -1208,18 +1206,21 @@ export default class MapConroler extends cc.Component {
} }
if (wallArray[i].getComponent("Wall").special == 2 && wallArray[i].getComponent("Wall").open == false) { if (wallArray[i].getComponent("Wall").special == 2 && wallArray[i].getComponent("Wall").open == false) {
jg = false; jg = false;
break; return jg;
}
if (wallArray[i].getComponent("Wall").special == 3) {
jg = false;
return jg;
} }
//console.log(wallArray[i].getChildByName("wall").getComponent("Wall").color,node.getComponent("Block").color) //console.log(wallArray[i].getChildByName("wall").getComponent("Wall").color,node.getComponent("Block").color)
if (wallArray[i].getComponent("Wall").color != node.getComponent("Block").color) { if (wallArray[i].getComponent("Wall").color != node.getComponent("Block").color) {
jg = false; jg = false;
break; return jg;
} }
if (node.getComponent("Block").type == 5) { if (node.getComponent("Block").type == 5) {
if (wallArray[i].getComponent("Wall").special != 1) { if (wallArray[i].getComponent("Wall").special != 1) {
jg = false; jg = false;
break; return jg;
} }
} }
} }
@ -2545,56 +2546,56 @@ export default class MapConroler extends cc.Component {
// return; // return;
// } // }
} }
// else if (nomalArray.length == 1) { else if (nomalArray.length == 1) {
// nomalArray[0].getComponent("Block").eliminate(); nomalArray[0].getComponent("Block").eliminate();
// let time = 0; let time = 0;
// if (nomalArray[0].getComponent("Block").type == 1 || nomalArray[0].getComponent("Block").type == 9) { if (nomalArray[0].getComponent("Block").type == 1 || nomalArray[0].getComponent("Block").type == 9) {
// time = 200; time = 200;
// } }
// setTimeout(() => { setTimeout(() => {
// if (this.freezeArray.length == 0 && this.loackArray.length == 0) { if (this.freezeArray.length == 0 && this.loackArray.length == 0) {
// // console.log("只剩下一个块道具使用完毕"); // console.log("只剩下一个块道具使用完毕");
// } }
// else { else {
// if (this.loackArray.length != 0) { if (this.loackArray.length != 0) {
// // console.log("消除一个普通块后,消除一个带锁块"); // console.log("消除一个普通块后,消除一个带锁块");
// this.loackArray[0].getComponent("Block").eliminate(); this.loackArray[0].getComponent("Block").eliminate();
// return; return;
// } }
// else if (this.freezeArray.length != 0) { else if (this.freezeArray.length != 0) {
// // console.log("消除一个普通块后,消除一个冻结块"); // console.log("消除一个普通块后,消除一个冻结块");
// this.freezeArray[0].getComponent("Block").eliminate(); this.freezeArray[0].getComponent("Block").eliminate();
// return; return;
// } }
// } }
// }, 200 + time); }, 200 + time);
// } }
// else { else {
// let count = 2; let count = 2;
// if (this.loackArray.length != 0) { if (this.loackArray.length != 0) {
// for (let i = 0; i < this.loackArray.length; i++) { for (let i = 0; i < this.loackArray.length; i++) {
// // console.log("没有普通快,魔法消除一个带锁块"); // console.log("没有普通快,魔法消除一个带锁块");
// this.loackArray[i].getComponent("Block").eliminate(); this.loackArray[i].getComponent("Block").eliminate();
// count -= 1; count -= 1;
// if (count == 0) { if (count == 0) {
// break; break;
// } }
// } }
// } }
// setTimeout(() => { setTimeout(() => {
// if (count != 0) { if (count != 0) {
// for (let i = 0; i < this.freezeArray.length; i++) { for (let i = 0; i < this.freezeArray.length; i++) {
// // console.log("没有普通快,魔法消除一个冻结块"); // console.log("没有普通快,魔法消除一个冻结块");
// // this.freezeArray[i].getComponent("Block").eliminate(); // this.freezeArray[i].getComponent("Block").eliminate();
// count -= 1; count -= 1;
// if (count == 0) { if (count == 0) {
// break; break;
// } }
// } }
// } }
// }, 100); }, 100);
// } }
} }
} }
} }

View File

@ -36,7 +36,7 @@ export default class Reward extends cc.Component {
} }
else { else {
// 游戏整体加速 // 游戏整体加速
this.speedUpGame(); // this.speedUpGame();
} }
} }

View File

@ -6,6 +6,7 @@
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import MapConroler from "./Map"; import MapConroler from "./Map";
import NumberToImage from "./NumberToImage";
const { ccclass, property } = cc._decorator; const { ccclass, property } = cc._decorator;
@ -93,6 +94,9 @@ export default class Wall extends cc.Component {
@property(cc.SpriteAtlas) @property(cc.SpriteAtlas)
down_SpriteFrames: cc.SpriteAtlas = null; down_SpriteFrames: cc.SpriteAtlas = null;
@property(cc.Prefab)
freezeSpine: cc.Prefab = null;
posX: number; posX: number;
posY: number; posY: number;
@ -101,6 +105,7 @@ export default class Wall extends cc.Component {
openNode: cc.Node; openNode: cc.Node;
freezeNode: cc.Node; freezeNode: cc.Node;
open: boolean; open: boolean;
freezeNumber: number;
// LIFE-CYCLE CALLBACKS: // LIFE-CYCLE CALLBACKS:
@ -221,8 +226,10 @@ export default class Wall extends cc.Component {
let freeze = "freeze" + this.wall_Info.length; let freeze = "freeze" + this.wall_Info.length;
this.freezeNode = this.node.parent.getChildByName("freeze").getChildByName(freeze); this.freezeNode = this.node.parent.getChildByName("freeze").getChildByName(freeze);
this.freezeNode.active = true; this.freezeNode.active = true;
if (this.wall_Info.freeze) { if (this.wall_Info.freeze) {
this.freezeNode.getChildByName("num").getComponent(cc.Label).string = this.wall_Info.freeze+""; this.freezeNumber = this.wall_Info.freeze;
NumberToImage.numberToImageNodes(this.freezeNumber, 20, 8, "lock_", this.freezeNode.getChildByName("num"), false);
} }
break; break;
} }
@ -274,12 +281,15 @@ export default class Wall extends cc.Component {
} }
changeFreeze() { changeFreeze() {
let numStr = this.freezeNode.getChildByName("num").getComponent(cc.Label); this.freezeNumber -= 1;
let num = parseInt(numStr.string);
num -= 1; if (this.freezeNumber == 0) {
this.freezeNode.getChildByName("num").getComponent(cc.Label).string = num+""; console.log(this.node.uuid);
if(num == 0){ // this.freezeNode.parent.active = false;
this.freezeNode.parent.active = false; this.resetFreeze();
}
else {
NumberToImage.numberToImageNodes(this.freezeNumber, 20, 8, "lock_", this.freezeNode.getChildByName("num"), false);
} }
} }
@ -308,5 +318,20 @@ export default class Wall extends cc.Component {
this.node.opacity = 250; this.node.opacity = 250;
} }
resetFreeze() {
this.special = 0;
if (this.freezeNode) {
this.freezeNode.active = false;
}
// if (this.wall_Info.length != 0) {
// let spine = cc.instantiate(this.freezeSpine);
// spine.parent = this.node.parent;
// spine.setPosition(this.node.width / 2 + this.node.x + 60 / 2 * (this.wall_Info.length - 1), this.node.height / 2 + this.node.y);
// spine.getComponent(sp.Skeleton).setAnimation(1, "bingkuai", false);
// console.log("添加一个动画", spine.getPosition());
// }
}
// update (dt) {} // update (dt) {}
} }

View File

@ -572,8 +572,9 @@ export default class Utils {
let setData = { let setData = {
uid: cc.fx.GameConfig.GM_INFO.uid, uid: cc.fx.GameConfig.GM_INFO.uid,
action: 'save', action: 'save',
coinAmount: parseInt(cc.fx.GameConfig.GM_INFO.coin) coinAmount: Math.floor(cc.fx.GameConfig.GM_INFO.coin)
} }
console.log("服务器:上传金币", Math.floor(cc.fx.GameConfig.GM_INFO.coin));
Utils.POST("userCoin", setData, res => { Utils.POST("userCoin", setData, res => {
console.log("获得userCoin数据:", res); console.log("获得userCoin数据:", res);
if (res.code === 1) { if (res.code === 1) {

View File

@ -20,6 +20,9 @@ export default class Freeze extends cc.Component {
@property(cc.Material) @property(cc.Material)
freeze: cc.Material = null; freeze: cc.Material = null;
@property(cc.Prefab)
ice: cc.Prefab = null;
// mapInfo: number[][] = []; // mapInfo: number[][] = [];
onLoad() { onLoad() {

View File

@ -0,0 +1,129 @@
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "bingkuai",
"_objFlags": 0,
"_parent": null,
"_children": [],
"_active": true,
"_components": [
{
"__id__": 2
}
],
"_prefab": {
"__id__": 3
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
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__": "sp.Skeleton",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_materials": [
{
"__uuid__": "7afd064b-113f-480e-b793-8817d19f63c3"
}
],
"paused": false,
"defaultSkin": "default",
"defaultAnimation": "",
"_preCacheMode": 0,
"_cacheMode": 0,
"loop": false,
"premultipliedAlpha": false,
"timeScale": 1,
"_accTime": 0,
"_playCount": 0,
"_frameCache": null,
"_curFrame": null,
"_skeletonCache": null,
"_animationName": "",
"_animationQueue": [],
"_headAniInfo": null,
"_playTimes": 0,
"_isAniComplete": true,
"_N$skeletonData": {
"__uuid__": "b98ab73e-af9c-47fa-862c-144da3071249"
},
"_N$_defaultCacheMode": 0,
"_N$debugSlots": false,
"_N$debugBones": false,
"_N$debugMesh": false,
"_N$useTint": false,
"_N$enableBatch": false,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "",
"sync": false
}
]

View File

@ -0,0 +1,9 @@
{
"ver": "1.3.2",
"uuid": "f8f19cf0-280d-4872-a743-a54314eec6a8",
"importer": "prefab",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}

View File

@ -39,19 +39,12 @@
], ],
"WALL_INFO": [ "WALL_INFO": [
[ [
{
"id": 0,
"num": 8,
"color": 10,
"special": 0,
"length": 3
},
{ {
"id": 1, "id": 1,
"num": 10, "num": 10,
"color": 10, "color": 10,
"special": 0, "special": 0,
"length": 0 "length": 2
}, },
{ {
"id": 1, "id": 1,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff