修复902关 旋转门和带锁门冲突问题, 修复线上6种可能性报错

This commit is contained in:
COMPUTER\EDY 2026-01-07 16:25:56 +08:00
parent 55f3fd6a49
commit 1dac0592e6
20 changed files with 469 additions and 458 deletions

View File

@ -302,6 +302,7 @@ export default class Block extends cc.Component {
//初始化方块类型
initType() {
if (MapConroler && MapConroler._instance) {
let posConfig = cc.fx.GameConfig.PROP_INFO[this.block_Info.block];
switch (this.type) {
case BlockType.:
@ -441,7 +442,7 @@ export default class Block extends cc.Component {
else switchs.setPosition(swtichsX, swtichsY);
switchs.getComponent("Switchs").init(this.block_Info.swichs);
}
}
}
//初始化方块颜色
@ -462,6 +463,7 @@ export default class Block extends cc.Component {
// name = color + "color" + this.block_Info.block;
// number = Math.floor((color - 1) / 2);
// }
if (MapConroler && MapConroler._instance) {
let blockSpriteFrame = MapConroler._instance.Block_Color[number]._spriteFrames;
var spriteFrame = blockSpriteFrame[name];
// if(this.type == BlockType.冻结块){
@ -470,6 +472,7 @@ export default class Block extends cc.Component {
// }
this.node.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = spriteFrame;
}
}
//创建粘合快连接处
createAdhesive() {
@ -1402,9 +1405,12 @@ export default class Block extends cc.Component {
name = "0color" + this.block_Info.block;
number = 5;
}
if (MapConroler && MapConroler._instance) {
let blockSpriteFrame = MapConroler._instance.Block_Color[number]._spriteFrames;
var spriteFrame = blockSpriteFrame[name];
this.node.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = spriteFrame;
}
}

View File

@ -155,6 +155,7 @@ export default class JiaZai extends cc.Component {
}
// //console.log("加载关卡配置2");
// window.initMgr();
if (GameManager._instance)
GameManager._instance.Block_Color = this.Block_Color;
let version = cc.fx.GameTool.getWechatGameVersion();
if (version == "开发版" || version == "体验版") {
@ -1834,7 +1835,9 @@ export default class JiaZai extends cc.Component {
// if ((cc.fx.GameConfig.GM_INFO.level + 1) == otherInfo.otherLevel) {
// console.log("_______________有分享信息并且符合条件");
Utils.getShareLevel((res) => {
if (res.code == 1) {
if (res.code == 1 && res.data) {
if (res.data.length > 0) {
if (res.data[0].lv) {
if ((cc.fx.GameConfig.GM_INFO.level + 1) == res.data[0].lv) {
let title = "好友帮助通过第" + otherInfo.otherLevel + "关";
MiniGameSdk.API.showToast(title);
@ -1856,11 +1859,10 @@ export default class JiaZai extends cc.Component {
Utils.setUserLevel((data) => {
})
}
}
}
}
})
// }
}
}
@ -2537,6 +2539,7 @@ export default class JiaZai extends cc.Component {
this.LoadCareer(() => {
Utils.getSRank(res => {
let data = JSON.parse(res.data);
if (data && data.role) {
let role = data.role;
let sortedArray = [];
// console.log("_________________________得到接口返回", res.data);
@ -2631,7 +2634,7 @@ export default class JiaZai extends cc.Component {
}, true)
}
}
}
// console.log("rankingData_________", rankData);
});
}, isShow);

View File

@ -289,9 +289,12 @@ export default class MapConroler extends cc.Component {
});
}, 1000);
// console.log("进入GameScene");
if (GameManager._instance) {
this.Block_Array = GameManager._instance.Block_Array;
this.Wall_Prefab = GameManager._instance.Wall_Prefab;
this.Block_Color = GameManager._instance.Block_Color;
}
// this.particleEffects = GameManager._instance.particleEffects;
this.initMap();
@ -1658,14 +1661,18 @@ export default class MapConroler extends cc.Component {
}
changeFreeze() {
setTimeout(() => {
if (this.freezeWall.length != 0) {
for (let i = 0; i < this.freezeWall.length; i++) {
this.freezeWall[i].getChildByName("wall").getComponent("Wall").changeFreeze();
}
}
}, 0);
}
changeLock() {
setTimeout(() => {
if (this.lockWall.length != 0) {
for (let i = 0; i < this.lockWall.length; i++) {
if (this.lockWall[i].getChildByName("lock")) {
@ -1673,6 +1680,8 @@ export default class MapConroler extends cc.Component {
}
}
}
}, 0);
}
changeAdhesive() {
@ -1685,13 +1694,16 @@ export default class MapConroler extends cc.Component {
}
changeLockWall() {
//开关门的门统一处理
setTimeout(() => {
if (this.openWall.length != 0) {
cc.fx.AudioManager._instance.playEffect("lockDoor", null);
for (let i = 0; i < this.openWall.length; i++) {
this.openWall[i].getChildByName("wall").getComponent("Wall").changeLock();
}
}
}, 0);
//开关门的门统一处理
}
changeBoom(node) {

View File

@ -63,10 +63,13 @@ export default class Revive extends cc.Component {
}
cc.fx.GameConfig.GM_INFO.iosReviveOrder = null;
//console.log("充值成功获得金币");
if (this.node && this.node.parent) {
if (this.node.parent.parent.parent.parent.parent.getComponent("SceneManager")) {
this.node.parent.parent.parent.parent.parent.getComponent("SceneManager").updateCoin();
}
}
}
else if (data.code == 0) {
console.log("用户自己取消充值");
MiniGameSdk.API.showToast("充值失败");
@ -335,10 +338,11 @@ export default class Revive extends cc.Component {
}
cc.fx.GameTool.shushu_Track("payment_fail", dataFail4);
}
if (this.node && this.node.parent) {
if (this.node.parent.parent.parent.parent.parent.getComponent("SceneManager")) {
this.node.parent.parent.parent.parent.parent.getComponent("SceneManager").updateCoin();
}
}
}, Utils.outTradeNo)
}
else {
@ -353,24 +357,30 @@ export default class Revive extends cc.Component {
}
cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
this.btn_Touch = true;
if (this.node && this.node.parent) {
if (this.node.parent.parent.parent.parent.parent.getComponent("SceneManager")) {
this.node.parent.parent.parent.parent.parent.getComponent("SceneManager").updateCoin();
}
}
}
})
}
});
}
}
openLoad() {
if (this.node && this.node.parent) {
this.node.parent.parent.parent.parent.parent.getChildByName("Loading").active = true;
this.node.parent.parent.parent.parent.parent.getChildByName("Loading").getChildByName("load").stopAllActions();
this.node.parent.parent.parent.parent.parent.getChildByName("Loading").getChildByName("load").runAction(cc.rotateTo(2, 1080).repeatForever());
}
}
closeLoad() {
if (this.node && this.node.parent) {
this.node.parent.parent.parent.parent.parent.getChildByName("Loading").active = false;
}
}
offShow() {
@ -389,15 +399,19 @@ export default class Revive extends cc.Component {
}
openConfirmBox() {
if (this.node && this.node.parent) {
let ConfirmBox = this.node.parent.getChildByName("ConfirmBox");
ConfirmBox.active = true;
}
this.closeLoad();
}
closeConfirmBox() {
if (this.node && this.node.parent) {
let ConfirmBox = this.node.parent.getChildByName("ConfirmBox");
ConfirmBox.active = false;
}
}
//再次领取奖励
againGet() {

View File

@ -352,9 +352,12 @@ export default class SceneManager extends cc.Component {
.start();
if (MapConroler && MapConroler._instance) MapConroler._instance.pause = true;
if (MapConroler && MapConroler._instance) {
MapConroler._instance.pause = true;
MapConroler._instance.stopBoom();
}
}
}
closeShop() {
@ -380,8 +383,10 @@ export default class SceneManager extends cc.Component {
}
openPropBuy(name) {
if (MapConroler && MapConroler._instance) MapConroler._instance.pause = true;
if (MapConroler && MapConroler._instance) {
MapConroler._instance.pause = true;
MapConroler._instance.stopBoom();
}
this.btnName = name;
cc.fx.AudioManager._instance.playEffect("tanchuang", null);
@ -458,8 +463,10 @@ export default class SceneManager extends cc.Component {
}
cc.fx.GameTool.shushu_Track("interface_exposure", dataInfo);
cc.fx.GameConfig.GM_INFO.shopDouble = res.data.shopDouble;
if (MapConroler && MapConroler._instance) MapConroler._instance.pause = true;
if (MapConroler && MapConroler._instance) {
MapConroler._instance.pause = true;
MapConroler._instance.stopBoom();
}
if (!this.shopNode) {
// 第一次使用,创建节点
this.shopNode = cc.instantiate(SceneManager.cachedShopPrefab);

View File

@ -509,8 +509,10 @@ export default class Wall extends cc.Component {
}
resetFreeze() {
this.special = 0;
this.specialBackup = 0;
if (this.special == WallSpecial.) {
this.special = 0;
}
if (this.freezeNode) {
cc.fx.AudioManager._instance.playEffect("freezeDoor", null);
this.freezeNode.active = false;

View File

@ -358,8 +358,10 @@ export default class scrollViewList extends cc.Component {
private clearContent() {
// 回收所有节点
for (let i = 0; i < this.itemNodes.length; i++) {
if (this.nodePoolMgr && this.itemNodes[i]) {
this.nodePoolMgr.putItem(this.itemNodes[i]);
}
}
this.itemNodes = [];
this.content.removeAllChildren();
}

View File

@ -44,7 +44,7 @@ export default class NodePoolMgr extends cc.Component {
* @param itemNode
*/
public putItem(itemNode: cc.Node) {
if (itemNode) {
if (itemNode && this.nodePool) {
this.nodePool.put(itemNode);
}
}

View File

@ -319,10 +319,10 @@ export default class Utils {
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
if (xhr && xhr.readyState) {
if (xhr.readyState === 4 && xhr.responseText) {
let response: any = xhr.responseText;
if (xhr.status >= 200 && xhr.status < 300) {
let httpStatus = xhr.statusText;
// callback(true, JSON.parse(response));
try {
response = JSON.parse(response);
@ -335,104 +335,13 @@ export default class Utils {
callback({ data: "网络请求失败,请检查网络连接", code: 0 });
}
}
}
};
xhr.send(dataStr);
}
static http_sendRequest(path, data, handler, extraUrl = null) {
let xhr = cc.loader.getXMLHttpRequest();
xhr.timeout = 5000;//超时时间
if (data == null) {
data = {};
}
if (extraUrl == null) {
//@ts-ignore
if (Utils.isDebug) {
extraUrl = "http://localhost:9003";
} else {
extraUrl = this.httpip;
}
}
//解析请求路由以及格式化请求参数
let sendtext = "?";
for (let k in data) {
if (sendtext != "?") {
sendtext += "&";
}
sendtext += (k + '=' + data[k]);
}
//组装完整的URL
let requestURL = extraUrl + "/" + path + encodeURI(sendtext);
// //console.log("发送请求:");
// //console.log(requestURL);
//发送请求 Get形式发送请求
xhr.open("GET", requestURL, true);
if (cc.sys.isNative) {//如果是手机就设置请求头
xhr.setRequestHeader("Accept-Encoding", "gzip,deflate");
}
//计时判断是否超时
let hasRetried = false;
let timer = setTimeout(function () {
//xhr.hasRetried=true;
hasRetried = true;
xhr.abort();
//console.log("http timeOut......");
retryFun();
}, 5000);
//重新发送请求
let retryFun = function () {
Utils.http_sendRequest(path, data, handler, extraUrl);
}
//监听反馈
xhr.onreadystatechange = function () {
clearTimeout(timer);
if (xhr.readyState === 4 && (xhr.status >= 200 && xhr.status < 300)) {
let ret = null;
let respText = xhr.responseText;
try {
ret = JSON.parse(respText);
} catch (e) {
//console.log("http error:" + e);
ret = {
code: 1,
msg: e
}
}
if (handler) {
handler(ret);
}
handler = null;
} else if (xhr.readyState === 4) {
// if(xhr.hasRetried){
// return;
// }
if (hasRetried) {
return;
}
//console.log('other readystate ==' + xhr.readyState + ', status:' + xhr.status);
if (xhr.readyState == 4 && xhr.status == 0) {
handler({
err: 1,
msg: "网络连接失败,请稍后再试"
});
return;
}
setTimeout(function () {
retryFun();
}, 5000);
} else {
//console.log('other readystate:' + xhr.readyState + ', status:' + xhr.status);
}
}
try {
xhr.send();
} catch (e) {
retryFun();
}
return xhr;
}
//#region 获取用户数据

View File

@ -2058,6 +2058,9 @@ var GameTool = {
},
trackErrorToShushu(error: any) {
if (error.message == null || error.message == "null" || error.message == "" || error.message == undefined || error.message == "(null)") {
return;
}
console.log("_____________________上报错误");
if (!cc.fx.GameConfig.GM_INFO.error_message.includes(error.message)) {
cc.fx.GameConfig.GM_INFO.error_message.push(error.message);

View File

@ -75,11 +75,14 @@ export default class NewClass extends cc.Component {
if (iosID == "month_Card") {
this.setReward(iosID);
}
if (this.node && this.node.parent) {
if (this.node.parent.getComponent("JiaZai"))
this.node.parent.getComponent("JiaZai").updateCoin();
else if (this.node.parent.getComponent("SceneManager")) {
this.node.parent.getComponent("SceneManager").updateCoin();
}
}
//console.log("充值成功获得金币");
}
else if (data.code == 0) {
@ -421,12 +424,13 @@ export default class NewClass extends cc.Component {
}
cc.fx.GameTool.shushu_Track("payment_fail", dataFail4);
}
if (this.node && this.node.parent) {
if (this.node.parent.getComponent("JiaZai"))
this.node.parent.getComponent("JiaZai").updateCoin();
else if (this.node.parent.getComponent("SceneManager")) {
this.node.parent.getComponent("SceneManager").updateCoin();
}
}
}, Utils.outTradeNo)
}
else {
@ -441,12 +445,14 @@ export default class NewClass extends cc.Component {
}
cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
this.btn_Touch = true;
if (this.node && this.node.parent) {
if (this.node.parent.getComponent("JiaZai"))
this.node.parent.getComponent("JiaZai").updateCoin();
else if (this.node.parent.getComponent("SceneManager")) {
this.node.parent.getComponent("SceneManager").updateCoin();
}
}
}
})
}
});

View File

@ -125,8 +125,13 @@ export default class Boom extends cc.Component {
updateTime() {
if (MapConroler._instance) {
if (MapConroler._instance.iceTrue() == true) return;
if (MapConroler._instance.pause == true) return;
}
else {
return;
}
if (this.node.parent) {
if (this.node.parent.getComponent("Block").block_Info.floor) {
return;

View File

@ -43,9 +43,11 @@ export default class Lock extends cc.Component {
if (this.node.parent) this.node.parent.getComponent("Block").type = 0;
}
else if (this.type == "wall") {
this.node.parent.getChildByName("wall").getComponent("Wall").specialBackup = 0;
if (this.node.parent.getChildByName("wall").getComponent("Wall").special == 6) {
if (this.node.parent) this.node.parent.getChildByName("wall").getComponent("Wall").special = 0;
if (this.node.parent) this.node.parent.getChildByName("wall").getComponent("Wall").specialBackup = 0;
if (this.node.parent) {
this.node.parent.getChildByName("wall").getComponent("Wall").special = 0;
}
}
}
this.node.destroy();

View File

@ -111,8 +111,11 @@ export default class NewbieGift extends cc.Component {
this.openConfirmBox();
}
this.btn_Touch = true;
if (this.node && this.node.parent) {
if (this.node.parent.getComponent("JiaZai"))
this.node.parent.getComponent("JiaZai").updateCoin();
}
})
}
}
@ -478,9 +481,10 @@ export default class NewbieGift extends cc.Component {
}
cc.fx.GameTool.shushu_Track("payment_fail", dataFail4);
}
if (this.node && this.node.parent) {
if (this.node.parent.getComponent("JiaZai"))
this.node.parent.getComponent("JiaZai").updateCoin();
}
}, Utils.outTradeNo)
}
else {
@ -495,9 +499,11 @@ export default class NewbieGift extends cc.Component {
}
cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
this.btn_Touch = true;
if (this.node && this.node.parent) {
if (this.node.parent.getComponent("JiaZai"))
this.node.parent.getComponent("JiaZai").updateCoin();
}
}
})
}
});

View File

@ -448,8 +448,16 @@ export default class CareerList extends cc.Component {
this.randerChildren.push(this.firstRender.children[i]);
let username = cc.fx.GameTool.subName(this.topData[i - 3].username, 5);
if (username == "user") username = "匿名玩家";
if (this.firstRender.children[i]) {
if (this.firstRender.children[i].getChildByName("name")) {
this.firstRender.children[i].getChildByName("name").getComponent(cc.Label).string = username + "";
}
if (this.firstRender.children[i].getChildByName("rank")) {
this.firstRender.children[i].getChildByName("rank").getComponent(cc.Label).string = this.topData[i - 3].addLevel;
}
}
if (this.topData[i - 3].useravatar == "" || this.topData[i - 3].useravatar == null || this.topData[i - 3].useravatar == undefined
) {
// this.firstRender.children[i].getChildByName("icon").getComponent(cc.Sprite).spriteFrame = this.defaultsprite;
@ -464,10 +472,13 @@ export default class CareerList extends cc.Component {
let useravatar = this.topData[i - 3].useravatar;
let useravatarTemp = "icon_" + useravatar;
// console.log("222头像名称", useravatarTemp, "333用户名字:", username);
if (this.firstRender.children[i]) {
this.firstRender.children[i].getChildByName("mask").getChildByName("icon").getComponent(cc.Sprite).spriteFrame = this.UI.getSpriteFrame(useravatarTemp);
this.firstRender.children[i].getChildByName("mask").getChildByName("icon").width = 150;
this.firstRender.children[i].getChildByName("mask").getChildByName("icon").height = 150;
}
}
else this.setPic(this.topData[i - 3].useravatar, this.firstRender.children[i].getChildByName("mask").getChildByName("icon"));
}
}

View File

@ -32,8 +32,9 @@ export default class CareerManager extends cc.Component {
let currentDate = new Date();
let month = currentDate.getMonth() + 1;
let day = currentDate.getDate();
if (this.bg.getChildByName("month"))
this.bg.getChildByName("month").getComponent(cc.Label).string = month.toString();
if (this.bg.getChildByName("day"))
this.bg.getChildByName("day").getComponent(cc.Label).string = day.toString();
}

View File

@ -19,6 +19,7 @@ export default class Item extends cc.Component {
public dataChanged() {
let useravatarIcon = this.data.useravatarIcon;
useravatarIcon = "kuang_" + (parseInt(useravatarIcon) + 1);
if (this.node.getChildByName("icon"))
this.node.getChildByName("icon").getComponent(cc.Sprite).spriteFrame =
this.ui.getSpriteFrame(useravatarIcon);
console.log("用户头像框:", this.data.useravatarIcon, useravatarIcon);
@ -26,6 +27,7 @@ export default class Item extends cc.Component {
let name = this.data.username;
if (name == "user") name = "匿名玩家";
// this.node.getChildByName("rankLab").getComponent(cc.Label).string = this.data.rank + "";
if (this.node.getChildByName("nameLab"))
this.node.getChildByName("nameLab").getComponent(cc.Label).string = name + "";
// this.node.getChildByName("totalLab").getComponent(cc.Label).string = this.data.levelAmount;
@ -52,6 +54,7 @@ export default class Item extends cc.Component {
}
if (this.data.useravatar == "" || this.data.useravatar == null || this.data.useravatar == undefined
) {
if (this.node.getChildByName("pic"))
this.node.getChildByName("pic").getChildByName("pic").getComponent(cc.Sprite).spriteFrame = this.defaultsprite;
}
else if (this.data.useravatar == "0" || this.data.useravatar == "1" || this.data.useravatar == "2"
@ -63,6 +66,7 @@ export default class Item extends cc.Component {
let useravatar = this.data.useravatar;
let useravatarTemp = "icon_" + useravatar;
console.log("用户头像:", useravatarTemp);
if (this.node.getChildByName("pic"))
this.node.getChildByName("pic").getChildByName("pic").getComponent(cc.Sprite).spriteFrame = this.ui.getSpriteFrame(useravatarTemp);
}
@ -79,8 +83,12 @@ export default class Item extends cc.Component {
cc.assetManager.loadRemote(url, { ext: '.png' }, (err, texture: cc.Texture2D) => {
if (texture) {
this.node.getChildByName("pic").active = true;
// console.log("设置头像成功",err);
if (this.node.getChildByName("pic")) {
var sprite = this.node.getChildByName("pic").getChildByName("pic").getComponent(cc.Sprite);
sprite.spriteFrame = new cc.SpriteFrame(texture);
}
// console.log(this.data.rank,"设置头像成功",err);
}
else {

View File

@ -7,7 +7,7 @@
11,
11
],
"time": 190,
"time": 240,
"gap": [
{
"x": 4,

View File

@ -6,7 +6,7 @@
10,
12
],
"time": 130,
"time": 180,
"gap": []
}
],

View File

@ -228,6 +228,7 @@ export default class NewClass extends cc.Component {
wx.offShow(this.onShowListener);
}
Utils.outTradeNo = null;
if (this.node && this.node.parent) {
//销毁预制体
if (this.node.parent.getComponent("JiaZai")) {
this.node.parent.getComponent("JiaZai").closeShop();
@ -235,6 +236,8 @@ export default class NewClass extends cc.Component {
else if (this.node.parent.getComponent("SceneManager")) {
this.node.parent.getComponent("SceneManager").closeShop();
}
}
// this.shop.destroy();
if (this.reward) {
this.reward = false;
@ -307,11 +310,13 @@ export default class NewClass extends cc.Component {
}
cc.fx.GameConfig.GM_INFO.iosShopOrder = null;
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
if (this.node && this.node.parent) {
if (this.node.parent.getComponent("JiaZai"))
this.node.parent.getComponent("JiaZai").updateCoin();
else if (this.node.parent.getComponent("SceneManager")) {
this.node.parent.getComponent("SceneManager").updateCoin();
}
}
this.closeLoad();
this.btn_Touch = true;
//console.log("充值成功获得金币");
@ -443,9 +448,14 @@ export default class NewClass extends cc.Component {
}, true)
}
else {
if (this.node && this.node.parent) {
if (this.node.parent.getComponent("JiaZai")) {
}
else cc.fx.GameConfig.GM_INFO.min_Time -= 1;
}
else {
cc.fx.GameConfig.GM_INFO.min_Time -= 1;
}
var timeTemp = cc.fx.GameTool.getTimeMargin(cc.fx.GameConfig.GM_INFO.min_Time);
// 同步显示
if (this.Stamina && this.Stamina.getChildByName("time")) {
@ -666,11 +676,13 @@ export default class NewClass extends cc.Component {
cc.fx.GameTool.shushu_Track("payment_fail", dataFail4);
}
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
if (this.node && this.node.parent) {
if (this.node.parent.getComponent("JiaZai"))
this.node.parent.getComponent("JiaZai").updateCoin();
else if (this.node.parent.getComponent("SceneManager")) {
this.node.parent.getComponent("SceneManager").updateCoin();
}
}
}, Utils.outTradeNo)
}
else {
@ -685,12 +697,14 @@ export default class NewClass extends cc.Component {
}
cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
this.btn_Touch = true;
if (this.node && this.node.parent) {
if (this.node.parent.getComponent("JiaZai"))
this.node.parent.getComponent("JiaZai").updateCoin();
else if (this.node.parent.getComponent("SceneManager")) {
this.node.parent.getComponent("SceneManager").updateCoin();
}
}
}
})
}
});