修复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,146 +302,147 @@ export default class Block extends cc.Component {
//初始化方块类型
initType() {
let posConfig = cc.fx.GameConfig.PROP_INFO[this.block_Info.block];
switch (this.type) {
case BlockType.:
let boom = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
boom.parent = this.node;
boom.setPosition(posConfig.pos1.x, posConfig.pos1.y);
if (this.block_Info?.boomTime)
boom.getComponent("Boom").init(this.block_Info.boomTime);
break;
case BlockType.:
MapConroler._instance.bombBlock = true;
let boom2 = cc.instantiate(MapConroler._instance.Block_Prop[13]);
boom2.parent = this.node;
boom2.setPosition(posConfig.pos1.x, posConfig.pos1.y);
if (this.block_Info?.boomTime)
boom2.getComponent("Boom").init(this.block_Info.boomTime);
break;
case BlockType.:
let star = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
star.anchorX = this.node.anchorX;
star.anchorY = this.node.anchorY;
star.getComponent(cc.Sprite).spriteFrame = star.getComponent("Star").star_SpriteFrame.getSpriteFrame("star_" + this.block_Info.block);
star.parent = this.node;
star.setPosition(posConfig.pos4.x - 10, posConfig.pos4.y);
case BlockType.:
let key = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
key.parent = this.node;
key.setPosition(posConfig.pos1.x, posConfig.pos1.y);
break;
case BlockType.:
let key2 = cc.instantiate(MapConroler._instance.Block_Prop[2]);
key2.parent = this.node;
key2.color = cc.color(255, 125, 0);
key2.setPosition(posConfig.pos1.x, posConfig.pos1.y);
break;
case BlockType.:
let key3 = cc.instantiate(MapConroler._instance.Block_Prop[2]);
key3.parent = this.node;
key3.color = cc.color(251, 158, 7, 255);
key3.setPosition(posConfig.pos1.x, posConfig.pos1.y);
break;
case BlockType.:
let lock = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
lock.parent = this.node;
lock.setPosition(posConfig.pos1.x, posConfig.pos1.y);
lock.getComponent("Lock").init(this.block_Info.lockTime, "block");
break;
case BlockType.:
let lock2 = cc.instantiate(MapConroler._instance.Block_Prop[3]);
lock2.parent = this.node;
lock2.color = cc.color(255, 125, 0);
lock2.setPosition(posConfig.pos1.x, posConfig.pos1.y);
lock2.getComponent("Lock").init(this.block_Info.lockTime2, "block");
break;
case BlockType.:
let freeze = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
freeze.parent = this.node;
let name = "ice_" + this.block_Info.block;
let spriteFrame = this.ice_SpriteFrame._spriteFrames[name];
freeze.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = spriteFrame;
let freezeX = posConfig.pos6.x - (this.node.width * (this.node.anchorX - 0.5)); let freezeY = posConfig.pos6.y + this.node.height / 2;
if (this.block_Info.block == 2) {
freeze.setPosition(freezeX + 4, freezeY - 10);
}
else freeze.setPosition(freezeX, freezeY);
freeze.getComponent("Freeze").init(this.block_Info.freezeTime);
freeze.getChildByName("time").setPosition(posConfig.pos5.x - 10 - freezeX, posConfig.pos5.y - 2 - freezeY);
break;
case BlockType.:
let horizontal = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
horizontal.parent = this.node;
let heng = "heng" + this.heng;
horizontal.getChildByName(heng).active = true;
horizontal.setPosition(posConfig.pos2.x - 3, posConfig.pos2.y);
break;
case BlockType.:
let vertical = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
vertical.parent = this.node;
let shu = "shu" + this.shu;
vertical.getChildByName(shu).active = true;
vertical.setPosition(posConfig.pos3.x, posConfig.pos3.y);
break;
case BlockType.:
this.moveStack = false;
this.node.off(cc.Node.EventType.TOUCH_START);
this.node.off(cc.Node.EventType.TOUCH_MOVE);
this.node.off(cc.Node.EventType.TOUCH_CANCEL);
this.node.off(cc.Node.EventType.TOUCH_END);
// this.selfBoxColliders = [];
this.node.zIndex = 201;
let pos = this.getStackingPos();
this.node.setPosition(this.node.x + pos.x, this.node.y + pos.y);
this.stacking = cc.v2(this.node.x - this.block_Info.node.x, this.node.y - this.block_Info.node.y);
this.block_Info.node.getComponent("Block").block_Info.node = this.node;
this.node.scaleX *= 0.7;
this.node.scaleY *= 0.7;
for (let i = 0; i < this.node.children.length; i++) {
if (this.node.children[i].name == "left" || this.node.children[i].name == "right" || this.node.children[i].name == "top" || this.node.children[i].name == "down")
this.node.children[i].active = false;
}
break;
case BlockType.:
let question = cc.instantiate(MapConroler._instance.Block_Prop[12]);
question.parent = this.node;
let name2 = "10color" + this.block_Info.block;
let number = 5;
let blockSpriteFrame = MapConroler._instance.Block_Color[number]._spriteFrames;
var spriteFrame2 = blockSpriteFrame[name2];
question.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = spriteFrame2;
let freezeX2 = posConfig.pos6.x - (this.node.width * (this.node.anchorX - 0.5)); let freezeY2 = posConfig.pos6.y + this.node.height / 2;
if (this.block_Info.block == 2) {
question.setPosition(freezeX2 + 4, freezeY2 - 10);
}
else question.setPosition(freezeX2, freezeY2);
question.getComponent("Question").init(this.block_Info.questionTime);
question.getChildByName("time").setPosition(posConfig.pos5.x - 10 - freezeX2, posConfig.pos5.y - 2 - freezeY2);
break;
}
//开关方块,后添加兼容其他类型
if (this.block_Info.lock != undefined && this.block_Info.lock != null) {
let switchs = cc.instantiate(MapConroler._instance.Block_Prop[14]);
switchs.parent = this.node;
switchs.getChildByName("open").active = !this.block_Info.lock;
switchs.getChildByName("lock").active = this.block_Info.lock;
let name1 = 12 + "color" + this.block_Info.block;
let openSpriteFrame = MapConroler._instance.Block_Color[6]._spriteFrames[name1];
switchs.getChildByName("open").getComponent(cc.Sprite).spriteFrame = openSpriteFrame;
let name2 = 11 + "color" + this.block_Info.block;
let lockSpriteFrame = MapConroler._instance.Block_Color[6]._spriteFrames[name2];
switchs.getChildByName("lock").getComponent(cc.Sprite).spriteFrame = lockSpriteFrame;
let swtichsX = posConfig.pos6.x - (this.node.width * (this.node.anchorX - 0.5)); let swtichsY = posConfig.pos6.y + this.node.height / 2;
if (this.block_Info.block == 2) {
switchs.setPosition(swtichsX + 4, swtichsY - 10);
if (MapConroler && MapConroler._instance) {
let posConfig = cc.fx.GameConfig.PROP_INFO[this.block_Info.block];
switch (this.type) {
case BlockType.:
let boom = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
boom.parent = this.node;
boom.setPosition(posConfig.pos1.x, posConfig.pos1.y);
if (this.block_Info?.boomTime)
boom.getComponent("Boom").init(this.block_Info.boomTime);
break;
case BlockType.:
MapConroler._instance.bombBlock = true;
let boom2 = cc.instantiate(MapConroler._instance.Block_Prop[13]);
boom2.parent = this.node;
boom2.setPosition(posConfig.pos1.x, posConfig.pos1.y);
if (this.block_Info?.boomTime)
boom2.getComponent("Boom").init(this.block_Info.boomTime);
break;
case BlockType.:
let star = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
star.anchorX = this.node.anchorX;
star.anchorY = this.node.anchorY;
star.getComponent(cc.Sprite).spriteFrame = star.getComponent("Star").star_SpriteFrame.getSpriteFrame("star_" + this.block_Info.block);
star.parent = this.node;
star.setPosition(posConfig.pos4.x - 10, posConfig.pos4.y);
case BlockType.:
let key = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
key.parent = this.node;
key.setPosition(posConfig.pos1.x, posConfig.pos1.y);
break;
case BlockType.:
let key2 = cc.instantiate(MapConroler._instance.Block_Prop[2]);
key2.parent = this.node;
key2.color = cc.color(255, 125, 0);
key2.setPosition(posConfig.pos1.x, posConfig.pos1.y);
break;
case BlockType.:
let key3 = cc.instantiate(MapConroler._instance.Block_Prop[2]);
key3.parent = this.node;
key3.color = cc.color(251, 158, 7, 255);
key3.setPosition(posConfig.pos1.x, posConfig.pos1.y);
break;
case BlockType.:
let lock = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
lock.parent = this.node;
lock.setPosition(posConfig.pos1.x, posConfig.pos1.y);
lock.getComponent("Lock").init(this.block_Info.lockTime, "block");
break;
case BlockType.:
let lock2 = cc.instantiate(MapConroler._instance.Block_Prop[3]);
lock2.parent = this.node;
lock2.color = cc.color(255, 125, 0);
lock2.setPosition(posConfig.pos1.x, posConfig.pos1.y);
lock2.getComponent("Lock").init(this.block_Info.lockTime2, "block");
break;
case BlockType.:
let freeze = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
freeze.parent = this.node;
let name = "ice_" + this.block_Info.block;
let spriteFrame = this.ice_SpriteFrame._spriteFrames[name];
freeze.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = spriteFrame;
let freezeX = posConfig.pos6.x - (this.node.width * (this.node.anchorX - 0.5)); let freezeY = posConfig.pos6.y + this.node.height / 2;
if (this.block_Info.block == 2) {
freeze.setPosition(freezeX + 4, freezeY - 10);
}
else freeze.setPosition(freezeX, freezeY);
freeze.getComponent("Freeze").init(this.block_Info.freezeTime);
freeze.getChildByName("time").setPosition(posConfig.pos5.x - 10 - freezeX, posConfig.pos5.y - 2 - freezeY);
break;
case BlockType.:
let horizontal = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
horizontal.parent = this.node;
let heng = "heng" + this.heng;
horizontal.getChildByName(heng).active = true;
horizontal.setPosition(posConfig.pos2.x - 3, posConfig.pos2.y);
break;
case BlockType.:
let vertical = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
vertical.parent = this.node;
let shu = "shu" + this.shu;
vertical.getChildByName(shu).active = true;
vertical.setPosition(posConfig.pos3.x, posConfig.pos3.y);
break;
case BlockType.:
this.moveStack = false;
this.node.off(cc.Node.EventType.TOUCH_START);
this.node.off(cc.Node.EventType.TOUCH_MOVE);
this.node.off(cc.Node.EventType.TOUCH_CANCEL);
this.node.off(cc.Node.EventType.TOUCH_END);
// this.selfBoxColliders = [];
this.node.zIndex = 201;
let pos = this.getStackingPos();
this.node.setPosition(this.node.x + pos.x, this.node.y + pos.y);
this.stacking = cc.v2(this.node.x - this.block_Info.node.x, this.node.y - this.block_Info.node.y);
this.block_Info.node.getComponent("Block").block_Info.node = this.node;
this.node.scaleX *= 0.7;
this.node.scaleY *= 0.7;
for (let i = 0; i < this.node.children.length; i++) {
if (this.node.children[i].name == "left" || this.node.children[i].name == "right" || this.node.children[i].name == "top" || this.node.children[i].name == "down")
this.node.children[i].active = false;
}
break;
case BlockType.:
let question = cc.instantiate(MapConroler._instance.Block_Prop[12]);
question.parent = this.node;
let name2 = "10color" + this.block_Info.block;
let number = 5;
let blockSpriteFrame = MapConroler._instance.Block_Color[number]._spriteFrames;
var spriteFrame2 = blockSpriteFrame[name2];
question.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = spriteFrame2;
let freezeX2 = posConfig.pos6.x - (this.node.width * (this.node.anchorX - 0.5)); let freezeY2 = posConfig.pos6.y + this.node.height / 2;
if (this.block_Info.block == 2) {
question.setPosition(freezeX2 + 4, freezeY2 - 10);
}
else question.setPosition(freezeX2, freezeY2);
question.getComponent("Question").init(this.block_Info.questionTime);
question.getChildByName("time").setPosition(posConfig.pos5.x - 10 - freezeX2, posConfig.pos5.y - 2 - freezeY2);
break;
}
else switchs.setPosition(swtichsX, swtichsY);
switchs.getComponent("Switchs").init(this.block_Info.swichs);
}
//开关方块,后添加兼容其他类型
if (this.block_Info.lock != undefined && this.block_Info.lock != null) {
let switchs = cc.instantiate(MapConroler._instance.Block_Prop[14]);
switchs.parent = this.node;
switchs.getChildByName("open").active = !this.block_Info.lock;
switchs.getChildByName("lock").active = this.block_Info.lock;
let name1 = 12 + "color" + this.block_Info.block;
let openSpriteFrame = MapConroler._instance.Block_Color[6]._spriteFrames[name1];
switchs.getChildByName("open").getComponent(cc.Sprite).spriteFrame = openSpriteFrame;
let name2 = 11 + "color" + this.block_Info.block;
let lockSpriteFrame = MapConroler._instance.Block_Color[6]._spriteFrames[name2];
switchs.getChildByName("lock").getComponent(cc.Sprite).spriteFrame = lockSpriteFrame;
let swtichsX = posConfig.pos6.x - (this.node.width * (this.node.anchorX - 0.5)); let swtichsY = posConfig.pos6.y + this.node.height / 2;
if (this.block_Info.block == 2) {
switchs.setPosition(swtichsX + 4, swtichsY - 10);
}
else switchs.setPosition(swtichsX, swtichsY);
switchs.getComponent("Switchs").init(this.block_Info.swichs);
}
}
}
//初始化方块颜色
@ -462,13 +463,15 @@ export default class Block extends cc.Component {
// name = color + "color" + this.block_Info.block;
// number = Math.floor((color - 1) / 2);
// }
let blockSpriteFrame = MapConroler._instance.Block_Color[number]._spriteFrames;
var spriteFrame = blockSpriteFrame[name];
// if(this.type == BlockType.冻结块){
// name = "ice_"+this.block_Info.block;
// spriteFrame = this.ice_SpriteFrame._spriteFrames[name];
// }
this.node.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = spriteFrame;
if (MapConroler && MapConroler._instance) {
let blockSpriteFrame = MapConroler._instance.Block_Color[number]._spriteFrames;
var spriteFrame = blockSpriteFrame[name];
// if(this.type == BlockType.冻结块){
// name = "ice_"+this.block_Info.block;
// spriteFrame = this.ice_SpriteFrame._spriteFrames[name];
// }
this.node.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = spriteFrame;
}
}
//创建粘合快连接处
@ -1402,9 +1405,12 @@ export default class Block extends cc.Component {
name = "0color" + this.block_Info.block;
number = 5;
}
let blockSpriteFrame = MapConroler._instance.Block_Color[number]._spriteFrames;
var spriteFrame = blockSpriteFrame[name];
this.node.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = spriteFrame;
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,7 +155,8 @@ export default class JiaZai extends cc.Component {
}
// //console.log("加载关卡配置2");
// window.initMgr();
GameManager._instance.Block_Color = this.Block_Color;
if (GameManager._instance)
GameManager._instance.Block_Color = this.Block_Color;
let version = cc.fx.GameTool.getWechatGameVersion();
if (version == "开发版" || version == "体验版") {
this.node.getChildByName("Load").getChildByName("New EditBox").active = true;
@ -1834,33 +1835,34 @@ 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 ((cc.fx.GameConfig.GM_INFO.level + 1) == res.data[0].lv) {
let title = "好友帮助通过第" + otherInfo.otherLevel + "关";
MiniGameSdk.API.showToast(title);
cc.fx.GameConfig.GM_INFO.level = otherInfo.otherLevel;
cc.fx.GameTool.maxLevel();
const timestamp = Date.now();
const levelInfo = {
level: cc.fx.GameConfig.GM_INFO.level, // 关卡
timestamp: timestamp, // 时间戳
};
cc.fx.StorageMessage.setStorage("level", levelInfo);
NumberToImage.numberToImageNodesShop((cc.fx.GameConfig.GM_INFO.level + 1), 43, 15, "custom", this.level, true);
if (this.level.children) {
for (let i = 0; i < this.level.children.length; i++) {
this.level.children[i].color = cc.Color.BLACK;
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);
cc.fx.GameConfig.GM_INFO.level = otherInfo.otherLevel;
cc.fx.GameTool.maxLevel();
const timestamp = Date.now();
const levelInfo = {
level: cc.fx.GameConfig.GM_INFO.level, // 关卡
timestamp: timestamp, // 时间戳
};
cc.fx.StorageMessage.setStorage("level", levelInfo);
NumberToImage.numberToImageNodesShop((cc.fx.GameConfig.GM_INFO.level + 1), 43, 15, "custom", this.level, true);
if (this.level.children) {
for (let i = 0; i < this.level.children.length; i++) {
this.level.children[i].color = cc.Color.BLACK;
}
}
Utils.setUserLevel((data) => {
})
}
}
Utils.setUserLevel((data) => {
})
}
}
})
// }
}
}
@ -2537,84 +2539,69 @@ export default class JiaZai extends cc.Component {
this.LoadCareer(() => {
Utils.getSRank(res => {
let data = JSON.parse(res.data);
let role = data.role;
let sortedArray = [];
// console.log("_________________________得到接口返回", res.data);
sortedArray = Object.entries(role)
//@ts-ignore
.sort((a, b) => b[1] - a[1]) // 按数值从大到小排序
.map((item, index) => ({
rank: index + 1, // 排名
name: item[0], // 省份名称
count: item[1] // 数值
}));
// 排序后的结果
// console.log("sortedArray", sortedArray);
let city = JSON.parse(JSON.stringify(cc.fx.GameConfig.CITY));
let rankData = [];
if (sortedArray) {
for (let i = 0; i < sortedArray.length; i++) {
// 检查sortedArray中的省份名称是否存在于原始data.role数据中
if (data && data[sortedArray[i].name] !== undefined) {
// 如果存在则将data中对应的键值对放入rankData
if (data.role && data.role[sortedArray[i].name] !== undefined) {
rankData.push({
rank: sortedArray[i].rank,
name: sortedArray[i].name,
count: sortedArray[i].count,
// 可以添加data2中对应的数据
rankingData: data[sortedArray[i].name]
});
delete city[sortedArray[i].name];
if (data && data.role) {
let role = data.role;
let sortedArray = [];
// console.log("_________________________得到接口返回", res.data);
sortedArray = Object.entries(role)
//@ts-ignore
.sort((a, b) => b[1] - a[1]) // 按数值从大到小排序
.map((item, index) => ({
rank: index + 1, // 排名
name: item[0], // 省份名称
count: item[1] // 数值
}));
// 排序后的结果
// console.log("sortedArray", sortedArray);
let city = JSON.parse(JSON.stringify(cc.fx.GameConfig.CITY));
let rankData = [];
if (sortedArray) {
for (let i = 0; i < sortedArray.length; i++) {
// 检查sortedArray中的省份名称是否存在于原始data.role数据中
if (data && data[sortedArray[i].name] !== undefined) {
// 如果存在则将data中对应的键值对放入rankData
if (data.role && data.role[sortedArray[i].name] !== undefined) {
rankData.push({
rank: sortedArray[i].rank,
name: sortedArray[i].name,
count: sortedArray[i].count,
// 可以添加data2中对应的数据
rankingData: data[sortedArray[i].name]
});
delete city[sortedArray[i].name];
}
}
}
}
// 循环完成后将CITY中剩下的城市按顺序添加到rankData中
let nextRank = rankData.length + 1; // 获取下一个排名
for (let cityName in city) {
rankData.push({
rank: nextRank++,
name: cityName,
count: 0,
rankingData: []
});
}
let otherIndex = rankData.findIndex(item => item.name === "其他");
if (otherIndex !== -1) {
let otherItem = rankData.splice(otherIndex, 1)[0];
rankData.push(otherItem);
}
let topData = data.all ? data.all : [];
this.careerRank = {
rankData: JSON.parse(JSON.stringify(rankData)),
topData: JSON.parse(JSON.stringify(topData))
}
console.log("自己的addLevel", cc.fx.GameConfig.GM_INFO.addLevel);
if (cc.fx.GameConfig.GM_INFO.addLevel > 4) {
console.log("______________自己入职了");
this.addSelfToRank(rankData);
}
for (let i = 0; i < rankData.length; i++) {
rankData[i].rank = i + 1;
}
if (this.RankNode != null && this.RankNode != undefined) {
console.log("_________________________预制体已经加载好了准备渲染");
this.node.getChildByName("Career").addChild(this.RankNode);
// this.node.getChildByName("Career").getChildByName("bg").parent = this.RankNode;
this.RankNode.opacity = 0;
this.RankNode.zIndex = 3;
this.RankNode.getComponent("CareerManager").init(rankData, topData);
cc.tween(this.RankNode)
.to(0.3, { opacity: 255 })
.delay(0.2)
.call(() => {
console.log("_________________________渲染完成");
this.node.getChildByName("Snow").active = true;
})
.start()
} else {
console.log("_________________________预制体已经加载好了准备渲染");
this.LoadCareer(() => {
// 循环完成后将CITY中剩下的城市按顺序添加到rankData中
let nextRank = rankData.length + 1; // 获取下一个排名
for (let cityName in city) {
rankData.push({
rank: nextRank++,
name: cityName,
count: 0,
rankingData: []
});
}
let otherIndex = rankData.findIndex(item => item.name === "其他");
if (otherIndex !== -1) {
let otherItem = rankData.splice(otherIndex, 1)[0];
rankData.push(otherItem);
}
let topData = data.all ? data.all : [];
this.careerRank = {
rankData: JSON.parse(JSON.stringify(rankData)),
topData: JSON.parse(JSON.stringify(topData))
}
console.log("自己的addLevel", cc.fx.GameConfig.GM_INFO.addLevel);
if (cc.fx.GameConfig.GM_INFO.addLevel > 4) {
console.log("______________自己入职了");
this.addSelfToRank(rankData);
}
for (let i = 0; i < rankData.length; i++) {
rankData[i].rank = i + 1;
}
if (this.RankNode != null && this.RankNode != undefined) {
console.log("_________________________预制体已经加载好了准备渲染");
this.node.getChildByName("Career").addChild(this.RankNode);
// this.node.getChildByName("Career").getChildByName("bg").parent = this.RankNode;
this.RankNode.opacity = 0;
@ -2628,10 +2615,26 @@ export default class JiaZai extends cc.Component {
this.node.getChildByName("Snow").active = true;
})
.start()
}, true)
} else {
console.log("_________________________预制体已经加载好了准备渲染");
this.LoadCareer(() => {
this.node.getChildByName("Career").addChild(this.RankNode);
// this.node.getChildByName("Career").getChildByName("bg").parent = this.RankNode;
this.RankNode.opacity = 0;
this.RankNode.zIndex = 3;
this.RankNode.getComponent("CareerManager").init(rankData, topData);
cc.tween(this.RankNode)
.to(0.3, { opacity: 255 })
.delay(0.2)
.call(() => {
console.log("_________________________渲染完成");
this.node.getChildByName("Snow").active = true;
})
.start()
}, true)
}
}
}
// console.log("rankingData_________", rankData);
});
}, isShow);

View File

@ -289,9 +289,12 @@ export default class MapConroler extends cc.Component {
});
}, 1000);
// console.log("进入GameScene");
this.Block_Array = GameManager._instance.Block_Array;
this.Wall_Prefab = GameManager._instance.Wall_Prefab;
this.Block_Color = GameManager._instance.Block_Color;
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,21 +1661,27 @@ export default class MapConroler extends cc.Component {
}
changeFreeze() {
if (this.freezeWall.length != 0) {
for (let i = 0; i < this.freezeWall.length; i++) {
this.freezeWall[i].getChildByName("wall").getComponent("Wall").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() {
if (this.lockWall.length != 0) {
for (let i = 0; i < this.lockWall.length; i++) {
if (this.lockWall[i].getChildByName("lock")) {
this.lockWall[i].getChildByName("lock").getComponent("Lock").reduce();
setTimeout(() => {
if (this.lockWall.length != 0) {
for (let i = 0; i < this.lockWall.length; i++) {
if (this.lockWall[i].getChildByName("lock")) {
this.lockWall[i].getChildByName("lock").getComponent("Lock").reduce();
}
}
}
}
}, 0);
}
changeAdhesive() {
@ -1685,13 +1694,16 @@ export default class MapConroler extends cc.Component {
}
changeLockWall() {
//开关门的门统一处理
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();
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,9 +63,12 @@ export default class Revive extends cc.Component {
}
cc.fx.GameConfig.GM_INFO.iosReviveOrder = null;
//console.log("充值成功获得金币");
if (this.node.parent.parent.parent.parent.parent.getComponent("SceneManager")) {
this.node.parent.parent.parent.parent.parent.getComponent("SceneManager").updateCoin();
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("用户自己取消充值");
@ -335,9 +338,10 @@ export default class Revive extends cc.Component {
}
cc.fx.GameTool.shushu_Track("payment_fail", dataFail4);
}
if (this.node.parent.parent.parent.parent.parent.getComponent("SceneManager")) {
this.node.parent.parent.parent.parent.parent.getComponent("SceneManager").updateCoin();
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)
}
@ -353,8 +357,10 @@ export default class Revive extends cc.Component {
}
cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
this.btn_Touch = true;
if (this.node.parent.parent.parent.parent.parent.getComponent("SceneManager")) {
this.node.parent.parent.parent.parent.parent.getComponent("SceneManager").updateCoin();
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();
}
}
}
})
@ -363,13 +369,17 @@ export default class Revive extends cc.Component {
}
}
openLoad() {
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());
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() {
this.node.parent.parent.parent.parent.parent.getChildByName("Loading").active = false;
if (this.node && this.node.parent) {
this.node.parent.parent.parent.parent.parent.getChildByName("Loading").active = false;
}
}
@ -389,14 +399,18 @@ export default class Revive extends cc.Component {
}
openConfirmBox() {
let ConfirmBox = this.node.parent.getChildByName("ConfirmBox");
ConfirmBox.active = true;
if (this.node && this.node.parent) {
let ConfirmBox = this.node.parent.getChildByName("ConfirmBox");
ConfirmBox.active = true;
}
this.closeLoad();
}
closeConfirmBox() {
let ConfirmBox = this.node.parent.getChildByName("ConfirmBox");
ConfirmBox.active = false;
if (this.node && this.node.parent) {
let ConfirmBox = this.node.parent.getChildByName("ConfirmBox");
ConfirmBox.active = false;
}
}
//再次领取奖励

View File

@ -352,8 +352,11 @@ export default class SceneManager extends cc.Component {
.start();
if (MapConroler && MapConroler._instance) MapConroler._instance.pause = true;
MapConroler._instance.stopBoom();
if (MapConroler && MapConroler._instance) {
MapConroler._instance.pause = true;
MapConroler._instance.stopBoom();
}
}
}
@ -380,8 +383,10 @@ export default class SceneManager extends cc.Component {
}
openPropBuy(name) {
if (MapConroler && MapConroler._instance) MapConroler._instance.pause = true;
MapConroler._instance.stopBoom();
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;
MapConroler._instance.stopBoom();
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,7 +358,9 @@ export default class scrollViewList extends cc.Component {
private clearContent() {
// 回收所有节点
for (let i = 0; i < this.itemNodes.length; i++) {
this.nodePoolMgr.putItem(this.itemNodes[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,120 +319,29 @@ 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) {
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);
} catch {
response = { data: "数据有误", code: 0 };
}
callback(response);
if (xhr && xhr.readyState) {
if (xhr.readyState === 4 && xhr.responseText) {
let response: any = xhr.responseText;
if (xhr.status >= 200 && xhr.status < 300) {
// callback(true, JSON.parse(response));
try {
response = JSON.parse(response);
} catch {
response = { data: "数据有误", code: 0 };
}
callback(response);
} else {
callback({ data: "网络请求失败,请检查网络连接", code: 0 });
} else {
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.parent.getComponent("JiaZai"))
this.node.parent.getComponent("JiaZai").updateCoin();
else if (this.node.parent.getComponent("SceneManager")) {
this.node.parent.getComponent("SceneManager").updateCoin();
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,11 +424,12 @@ export default class NewClass extends cc.Component {
}
cc.fx.GameTool.shushu_Track("payment_fail", dataFail4);
}
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();
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)
}
@ -441,10 +445,12 @@ export default class NewClass extends cc.Component {
}
cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
this.btn_Touch = true;
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();
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.iceTrue() == true) return;
if (MapConroler._instance.pause == true) return;
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.parent.getComponent("JiaZai"))
this.node.parent.getComponent("JiaZai").updateCoin();
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.parent.getComponent("JiaZai"))
this.node.parent.getComponent("JiaZai").updateCoin();
if (this.node && this.node.parent) {
if (this.node.parent.getComponent("JiaZai"))
this.node.parent.getComponent("JiaZai").updateCoin();
}
}, Utils.outTradeNo)
}
else {
@ -495,8 +499,10 @@ export default class NewbieGift extends cc.Component {
}
cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
this.btn_Touch = true;
if (this.node.parent.getComponent("JiaZai"))
this.node.parent.getComponent("JiaZai").updateCoin();
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 = "匿名玩家";
this.firstRender.children[i].getChildByName("name").getComponent(cc.Label).string = username + "";
this.firstRender.children[i].getChildByName("rank").getComponent(cc.Label).string = this.topData[i - 3].addLevel;
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,9 +472,12 @@ export default class CareerList extends cc.Component {
let useravatar = this.topData[i - 3].useravatar;
let useravatarTemp = "icon_" + useravatar;
// console.log("222头像名称", useravatarTemp, "333用户名字:", username);
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;
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,9 +32,10 @@ export default class CareerManager extends cc.Component {
let currentDate = new Date();
let month = currentDate.getMonth() + 1;
let day = currentDate.getDate();
this.bg.getChildByName("month").getComponent(cc.Label).string = month.toString();
this.bg.getChildByName("day").getComponent(cc.Label).string = day.toString();
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();
}
start() {

View File

@ -19,14 +19,16 @@ export default class Item extends cc.Component {
public dataChanged() {
let useravatarIcon = this.data.useravatarIcon;
useravatarIcon = "kuang_" + (parseInt(useravatarIcon) + 1);
this.node.getChildByName("icon").getComponent(cc.Sprite).spriteFrame =
this.ui.getSpriteFrame(useravatarIcon);
if (this.node.getChildByName("icon"))
this.node.getChildByName("icon").getComponent(cc.Sprite).spriteFrame =
this.ui.getSpriteFrame(useravatarIcon);
console.log("用户头像框:", this.data.useravatarIcon, useravatarIcon);
this.data.username = cc.fx.GameTool.subName(this.data.username, 7);
let name = this.data.username;
if (name == "user") name = "匿名玩家";
// this.node.getChildByName("rankLab").getComponent(cc.Label).string = this.data.rank + "";
this.node.getChildByName("nameLab").getComponent(cc.Label).string = name + "";
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;
NumberToImage.numberToImageNodes3((this.data.rank), 43, 15, "rank_", this.node.getChildByName("rankLab"), true);
@ -52,7 +54,8 @@ export default class Item extends cc.Component {
}
if (this.data.useravatar == "" || this.data.useravatar == null || this.data.useravatar == undefined
) {
this.node.getChildByName("pic").getChildByName("pic").getComponent(cc.Sprite).spriteFrame = this.defaultsprite;
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"
|| this.data.useravatar == "3" || this.data.useravatar == "4" || this.data.useravatar == "5"
@ -63,7 +66,8 @@ export default class Item extends cc.Component {
let useravatar = this.data.useravatar;
let useravatarTemp = "icon_" + useravatar;
console.log("用户头像:", useravatarTemp);
this.node.getChildByName("pic").getChildByName("pic").getComponent(cc.Sprite).spriteFrame = this.ui.getSpriteFrame(useravatarTemp);
if (this.node.getChildByName("pic"))
this.node.getChildByName("pic").getChildByName("pic").getComponent(cc.Sprite).spriteFrame = this.ui.getSpriteFrame(useravatarTemp);
}
else this.setPic();
@ -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;
var sprite = this.node.getChildByName("pic").getChildByName("pic").getComponent(cc.Sprite);
sprite.spriteFrame = new cc.SpriteFrame(texture);
// 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,13 +228,16 @@ export default class NewClass extends cc.Component {
wx.offShow(this.onShowListener);
}
Utils.outTradeNo = null;
//销毁预制体
if (this.node.parent.getComponent("JiaZai")) {
this.node.parent.getComponent("JiaZai").closeShop();
}
else if (this.node.parent.getComponent("SceneManager")) {
this.node.parent.getComponent("SceneManager").closeShop();
if (this.node && this.node.parent) {
//销毁预制体
if (this.node.parent.getComponent("JiaZai")) {
this.node.parent.getComponent("JiaZai").closeShop();
}
else if (this.node.parent.getComponent("SceneManager")) {
this.node.parent.getComponent("SceneManager").closeShop();
}
}
// this.shop.destroy();
if (this.reward) {
this.reward = false;
@ -307,10 +310,12 @@ 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.parent.getComponent("JiaZai"))
this.node.parent.getComponent("JiaZai").updateCoin();
else if (this.node.parent.getComponent("SceneManager")) {
this.node.parent.getComponent("SceneManager").updateCoin();
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;
@ -443,9 +448,14 @@ export default class NewClass extends cc.Component {
}, true)
}
else {
if (this.node.parent.getComponent("JiaZai")) {
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;
}
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,10 +676,12 @@ 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.parent.getComponent("JiaZai"))
this.node.parent.getComponent("JiaZai").updateCoin();
else if (this.node.parent.getComponent("SceneManager")) {
this.node.parent.getComponent("SceneManager").updateCoin();
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)
}
@ -685,10 +697,12 @@ export default class NewClass extends cc.Component {
}
cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
this.btn_Touch = true;
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();
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();
}
}
}
})