修复902关 旋转门和带锁门冲突问题, 修复线上6种可能性报错
This commit is contained in:
parent
55f3fd6a49
commit
1dac0592e6
|
|
@ -302,146 +302,147 @@ export default class Block extends cc.Component {
|
||||||
|
|
||||||
//初始化方块类型
|
//初始化方块类型
|
||||||
initType() {
|
initType() {
|
||||||
let posConfig = cc.fx.GameConfig.PROP_INFO[this.block_Info.block];
|
if (MapConroler && MapConroler._instance) {
|
||||||
switch (this.type) {
|
let posConfig = cc.fx.GameConfig.PROP_INFO[this.block_Info.block];
|
||||||
case BlockType.炸弹块:
|
switch (this.type) {
|
||||||
let boom = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
|
case BlockType.炸弹块:
|
||||||
boom.parent = this.node;
|
let boom = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
|
||||||
boom.setPosition(posConfig.pos1.x, posConfig.pos1.y);
|
boom.parent = this.node;
|
||||||
if (this.block_Info?.boomTime)
|
boom.setPosition(posConfig.pos1.x, posConfig.pos1.y);
|
||||||
boom.getComponent("Boom").init(this.block_Info.boomTime);
|
if (this.block_Info?.boomTime)
|
||||||
break;
|
boom.getComponent("Boom").init(this.block_Info.boomTime);
|
||||||
case BlockType.消除炸弹块:
|
break;
|
||||||
MapConroler._instance.bombBlock = true;
|
case BlockType.消除炸弹块:
|
||||||
let boom2 = cc.instantiate(MapConroler._instance.Block_Prop[13]);
|
MapConroler._instance.bombBlock = true;
|
||||||
boom2.parent = this.node;
|
let boom2 = cc.instantiate(MapConroler._instance.Block_Prop[13]);
|
||||||
boom2.setPosition(posConfig.pos1.x, posConfig.pos1.y);
|
boom2.parent = this.node;
|
||||||
if (this.block_Info?.boomTime)
|
boom2.setPosition(posConfig.pos1.x, posConfig.pos1.y);
|
||||||
boom2.getComponent("Boom").init(this.block_Info.boomTime);
|
if (this.block_Info?.boomTime)
|
||||||
break;
|
boom2.getComponent("Boom").init(this.block_Info.boomTime);
|
||||||
case BlockType.星星块:
|
break;
|
||||||
let star = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
|
case BlockType.星星块:
|
||||||
star.anchorX = this.node.anchorX;
|
let star = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
|
||||||
star.anchorY = this.node.anchorY;
|
star.anchorX = this.node.anchorX;
|
||||||
star.getComponent(cc.Sprite).spriteFrame = star.getComponent("Star").star_SpriteFrame.getSpriteFrame("star_" + this.block_Info.block);
|
star.anchorY = this.node.anchorY;
|
||||||
star.parent = this.node;
|
star.getComponent(cc.Sprite).spriteFrame = star.getComponent("Star").star_SpriteFrame.getSpriteFrame("star_" + this.block_Info.block);
|
||||||
star.setPosition(posConfig.pos4.x - 10, posConfig.pos4.y);
|
star.parent = this.node;
|
||||||
case BlockType.钥匙块:
|
star.setPosition(posConfig.pos4.x - 10, posConfig.pos4.y);
|
||||||
let key = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
|
case BlockType.钥匙块:
|
||||||
key.parent = this.node;
|
let key = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
|
||||||
key.setPosition(posConfig.pos1.x, posConfig.pos1.y);
|
key.parent = this.node;
|
||||||
break;
|
key.setPosition(posConfig.pos1.x, posConfig.pos1.y);
|
||||||
case BlockType.第二钥匙块:
|
break;
|
||||||
let key2 = cc.instantiate(MapConroler._instance.Block_Prop[2]);
|
case BlockType.第二钥匙块:
|
||||||
key2.parent = this.node;
|
let key2 = cc.instantiate(MapConroler._instance.Block_Prop[2]);
|
||||||
key2.color = cc.color(255, 125, 0);
|
key2.parent = this.node;
|
||||||
key2.setPosition(posConfig.pos1.x, posConfig.pos1.y);
|
key2.color = cc.color(255, 125, 0);
|
||||||
break;
|
key2.setPosition(posConfig.pos1.x, posConfig.pos1.y);
|
||||||
case BlockType.门钥匙:
|
break;
|
||||||
let key3 = cc.instantiate(MapConroler._instance.Block_Prop[2]);
|
case BlockType.门钥匙:
|
||||||
key3.parent = this.node;
|
let key3 = cc.instantiate(MapConroler._instance.Block_Prop[2]);
|
||||||
key3.color = cc.color(251, 158, 7, 255);
|
key3.parent = this.node;
|
||||||
key3.setPosition(posConfig.pos1.x, posConfig.pos1.y);
|
key3.color = cc.color(251, 158, 7, 255);
|
||||||
break;
|
key3.setPosition(posConfig.pos1.x, posConfig.pos1.y);
|
||||||
case BlockType.上锁块:
|
break;
|
||||||
let lock = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
|
case BlockType.上锁块:
|
||||||
lock.parent = this.node;
|
let lock = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
|
||||||
lock.setPosition(posConfig.pos1.x, posConfig.pos1.y);
|
lock.parent = this.node;
|
||||||
lock.getComponent("Lock").init(this.block_Info.lockTime, "block");
|
lock.setPosition(posConfig.pos1.x, posConfig.pos1.y);
|
||||||
break;
|
lock.getComponent("Lock").init(this.block_Info.lockTime, "block");
|
||||||
case BlockType.第二上锁块:
|
break;
|
||||||
let lock2 = cc.instantiate(MapConroler._instance.Block_Prop[3]);
|
case BlockType.第二上锁块:
|
||||||
lock2.parent = this.node;
|
let lock2 = cc.instantiate(MapConroler._instance.Block_Prop[3]);
|
||||||
lock2.color = cc.color(255, 125, 0);
|
lock2.parent = this.node;
|
||||||
lock2.setPosition(posConfig.pos1.x, posConfig.pos1.y);
|
lock2.color = cc.color(255, 125, 0);
|
||||||
lock2.getComponent("Lock").init(this.block_Info.lockTime2, "block");
|
lock2.setPosition(posConfig.pos1.x, posConfig.pos1.y);
|
||||||
break;
|
lock2.getComponent("Lock").init(this.block_Info.lockTime2, "block");
|
||||||
case BlockType.冻结块:
|
break;
|
||||||
let freeze = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
|
case BlockType.冻结块:
|
||||||
freeze.parent = this.node;
|
let freeze = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
|
||||||
let name = "ice_" + this.block_Info.block;
|
freeze.parent = this.node;
|
||||||
let spriteFrame = this.ice_SpriteFrame._spriteFrames[name];
|
let name = "ice_" + this.block_Info.block;
|
||||||
freeze.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = spriteFrame;
|
let spriteFrame = this.ice_SpriteFrame._spriteFrames[name];
|
||||||
let freezeX = posConfig.pos6.x - (this.node.width * (this.node.anchorX - 0.5)); let freezeY = posConfig.pos6.y + this.node.height / 2;
|
freeze.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = spriteFrame;
|
||||||
if (this.block_Info.block == 2) {
|
let freezeX = posConfig.pos6.x - (this.node.width * (this.node.anchorX - 0.5)); let freezeY = posConfig.pos6.y + this.node.height / 2;
|
||||||
freeze.setPosition(freezeX + 4, freezeY - 10);
|
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);
|
else freeze.setPosition(freezeX, freezeY);
|
||||||
freeze.getChildByName("time").setPosition(posConfig.pos5.x - 10 - freezeX, posConfig.pos5.y - 2 - freezeY);
|
freeze.getComponent("Freeze").init(this.block_Info.freezeTime);
|
||||||
break;
|
freeze.getChildByName("time").setPosition(posConfig.pos5.x - 10 - freezeX, posConfig.pos5.y - 2 - freezeY);
|
||||||
case BlockType.水平块:
|
break;
|
||||||
let horizontal = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
|
case BlockType.水平块:
|
||||||
horizontal.parent = this.node;
|
let horizontal = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
|
||||||
let heng = "heng" + this.heng;
|
horizontal.parent = this.node;
|
||||||
horizontal.getChildByName(heng).active = true;
|
let heng = "heng" + this.heng;
|
||||||
horizontal.setPosition(posConfig.pos2.x - 3, posConfig.pos2.y);
|
horizontal.getChildByName(heng).active = true;
|
||||||
break;
|
horizontal.setPosition(posConfig.pos2.x - 3, posConfig.pos2.y);
|
||||||
case BlockType.垂直块:
|
break;
|
||||||
let vertical = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
|
case BlockType.垂直块:
|
||||||
vertical.parent = this.node;
|
let vertical = cc.instantiate(MapConroler._instance.Block_Prop[this.type]);
|
||||||
let shu = "shu" + this.shu;
|
vertical.parent = this.node;
|
||||||
vertical.getChildByName(shu).active = true;
|
let shu = "shu" + this.shu;
|
||||||
vertical.setPosition(posConfig.pos3.x, posConfig.pos3.y);
|
vertical.getChildByName(shu).active = true;
|
||||||
break;
|
vertical.setPosition(posConfig.pos3.x, posConfig.pos3.y);
|
||||||
case BlockType.叠加块上:
|
break;
|
||||||
this.moveStack = false;
|
case BlockType.叠加块上:
|
||||||
this.node.off(cc.Node.EventType.TOUCH_START);
|
this.moveStack = false;
|
||||||
this.node.off(cc.Node.EventType.TOUCH_MOVE);
|
this.node.off(cc.Node.EventType.TOUCH_START);
|
||||||
this.node.off(cc.Node.EventType.TOUCH_CANCEL);
|
this.node.off(cc.Node.EventType.TOUCH_MOVE);
|
||||||
this.node.off(cc.Node.EventType.TOUCH_END);
|
this.node.off(cc.Node.EventType.TOUCH_CANCEL);
|
||||||
// this.selfBoxColliders = [];
|
this.node.off(cc.Node.EventType.TOUCH_END);
|
||||||
this.node.zIndex = 201;
|
// this.selfBoxColliders = [];
|
||||||
let pos = this.getStackingPos();
|
this.node.zIndex = 201;
|
||||||
this.node.setPosition(this.node.x + pos.x, this.node.y + pos.y);
|
let pos = this.getStackingPos();
|
||||||
this.stacking = cc.v2(this.node.x - this.block_Info.node.x, this.node.y - this.block_Info.node.y);
|
this.node.setPosition(this.node.x + pos.x, this.node.y + pos.y);
|
||||||
this.block_Info.node.getComponent("Block").block_Info.node = this.node;
|
this.stacking = cc.v2(this.node.x - this.block_Info.node.x, this.node.y - this.block_Info.node.y);
|
||||||
this.node.scaleX *= 0.7;
|
this.block_Info.node.getComponent("Block").block_Info.node = this.node;
|
||||||
this.node.scaleY *= 0.7;
|
this.node.scaleX *= 0.7;
|
||||||
for (let i = 0; i < this.node.children.length; i++) {
|
this.node.scaleY *= 0.7;
|
||||||
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")
|
for (let i = 0; i < this.node.children.length; i++) {
|
||||||
this.node.children[i].active = false;
|
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.问号块:
|
break;
|
||||||
let question = cc.instantiate(MapConroler._instance.Block_Prop[12]);
|
case BlockType.问号块:
|
||||||
question.parent = this.node;
|
let question = cc.instantiate(MapConroler._instance.Block_Prop[12]);
|
||||||
let name2 = "10color" + this.block_Info.block;
|
question.parent = this.node;
|
||||||
let number = 5;
|
let name2 = "10color" + this.block_Info.block;
|
||||||
let blockSpriteFrame = MapConroler._instance.Block_Color[number]._spriteFrames;
|
let number = 5;
|
||||||
var spriteFrame2 = blockSpriteFrame[name2];
|
let blockSpriteFrame = MapConroler._instance.Block_Color[number]._spriteFrames;
|
||||||
question.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = spriteFrame2;
|
var spriteFrame2 = blockSpriteFrame[name2];
|
||||||
let freezeX2 = posConfig.pos6.x - (this.node.width * (this.node.anchorX - 0.5)); let freezeY2 = posConfig.pos6.y + this.node.height / 2;
|
question.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = spriteFrame2;
|
||||||
if (this.block_Info.block == 2) {
|
let freezeX2 = posConfig.pos6.x - (this.node.width * (this.node.anchorX - 0.5)); let freezeY2 = posConfig.pos6.y + this.node.height / 2;
|
||||||
question.setPosition(freezeX2 + 4, freezeY2 - 10);
|
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);
|
else question.setPosition(freezeX2, freezeY2);
|
||||||
question.getChildByName("time").setPosition(posConfig.pos5.x - 10 - freezeX2, posConfig.pos5.y - 2 - freezeY2);
|
question.getComponent("Question").init(this.block_Info.questionTime);
|
||||||
break;
|
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);
|
|
||||||
}
|
}
|
||||||
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;
|
// name = color + "color" + this.block_Info.block;
|
||||||
// number = Math.floor((color - 1) / 2);
|
// number = Math.floor((color - 1) / 2);
|
||||||
// }
|
// }
|
||||||
let blockSpriteFrame = MapConroler._instance.Block_Color[number]._spriteFrames;
|
if (MapConroler && MapConroler._instance) {
|
||||||
var spriteFrame = blockSpriteFrame[name];
|
let blockSpriteFrame = MapConroler._instance.Block_Color[number]._spriteFrames;
|
||||||
// if(this.type == BlockType.冻结块){
|
var spriteFrame = blockSpriteFrame[name];
|
||||||
// name = "ice_"+this.block_Info.block;
|
// if(this.type == BlockType.冻结块){
|
||||||
// spriteFrame = this.ice_SpriteFrame._spriteFrames[name];
|
// name = "ice_"+this.block_Info.block;
|
||||||
// }
|
// spriteFrame = this.ice_SpriteFrame._spriteFrames[name];
|
||||||
this.node.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = spriteFrame;
|
// }
|
||||||
|
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;
|
name = "0color" + this.block_Info.block;
|
||||||
number = 5;
|
number = 5;
|
||||||
}
|
}
|
||||||
let blockSpriteFrame = MapConroler._instance.Block_Color[number]._spriteFrames;
|
if (MapConroler && MapConroler._instance) {
|
||||||
var spriteFrame = blockSpriteFrame[name];
|
let blockSpriteFrame = MapConroler._instance.Block_Color[number]._spriteFrames;
|
||||||
this.node.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = spriteFrame;
|
var spriteFrame = blockSpriteFrame[name];
|
||||||
|
this.node.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = spriteFrame;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,8 @@ export default class JiaZai extends cc.Component {
|
||||||
}
|
}
|
||||||
// //console.log("加载关卡配置2");
|
// //console.log("加载关卡配置2");
|
||||||
// window.initMgr();
|
// 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();
|
let version = cc.fx.GameTool.getWechatGameVersion();
|
||||||
if (version == "开发版" || version == "体验版") {
|
if (version == "开发版" || version == "体验版") {
|
||||||
this.node.getChildByName("Load").getChildByName("New EditBox").active = true;
|
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) {
|
// if ((cc.fx.GameConfig.GM_INFO.level + 1) == otherInfo.otherLevel) {
|
||||||
// console.log("_______________有分享信息,并且符合条件");
|
// console.log("_______________有分享信息,并且符合条件");
|
||||||
Utils.getShareLevel((res) => {
|
Utils.getShareLevel((res) => {
|
||||||
if (res.code == 1) {
|
if (res.code == 1 && res.data) {
|
||||||
if ((cc.fx.GameConfig.GM_INFO.level + 1) == res.data[0].lv) {
|
if (res.data.length > 0) {
|
||||||
let title = "好友帮助通过第" + otherInfo.otherLevel + "关";
|
if (res.data[0].lv) {
|
||||||
MiniGameSdk.API.showToast(title);
|
if ((cc.fx.GameConfig.GM_INFO.level + 1) == res.data[0].lv) {
|
||||||
cc.fx.GameConfig.GM_INFO.level = otherInfo.otherLevel;
|
let title = "好友帮助通过第" + otherInfo.otherLevel + "关";
|
||||||
cc.fx.GameTool.maxLevel();
|
MiniGameSdk.API.showToast(title);
|
||||||
const timestamp = Date.now();
|
cc.fx.GameConfig.GM_INFO.level = otherInfo.otherLevel;
|
||||||
const levelInfo = {
|
cc.fx.GameTool.maxLevel();
|
||||||
level: cc.fx.GameConfig.GM_INFO.level, // 关卡
|
const timestamp = Date.now();
|
||||||
timestamp: timestamp, // 时间戳
|
const levelInfo = {
|
||||||
};
|
level: cc.fx.GameConfig.GM_INFO.level, // 关卡
|
||||||
cc.fx.StorageMessage.setStorage("level", levelInfo);
|
timestamp: timestamp, // 时间戳
|
||||||
NumberToImage.numberToImageNodesShop((cc.fx.GameConfig.GM_INFO.level + 1), 43, 15, "custom", this.level, true);
|
};
|
||||||
if (this.level.children) {
|
cc.fx.StorageMessage.setStorage("level", levelInfo);
|
||||||
for (let i = 0; i < this.level.children.length; i++) {
|
NumberToImage.numberToImageNodesShop((cc.fx.GameConfig.GM_INFO.level + 1), 43, 15, "custom", this.level, true);
|
||||||
this.level.children[i].color = cc.Color.BLACK;
|
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(() => {
|
this.LoadCareer(() => {
|
||||||
Utils.getSRank(res => {
|
Utils.getSRank(res => {
|
||||||
let data = JSON.parse(res.data);
|
let data = JSON.parse(res.data);
|
||||||
let role = data.role;
|
if (data && data.role) {
|
||||||
let sortedArray = [];
|
let role = data.role;
|
||||||
// console.log("_________________________得到接口返回", res.data);
|
let sortedArray = [];
|
||||||
sortedArray = Object.entries(role)
|
// console.log("_________________________得到接口返回", res.data);
|
||||||
//@ts-ignore
|
sortedArray = Object.entries(role)
|
||||||
.sort((a, b) => b[1] - a[1]) // 按数值从大到小排序
|
//@ts-ignore
|
||||||
.map((item, index) => ({
|
.sort((a, b) => b[1] - a[1]) // 按数值从大到小排序
|
||||||
rank: index + 1, // 排名
|
.map((item, index) => ({
|
||||||
name: item[0], // 省份名称
|
rank: index + 1, // 排名
|
||||||
count: item[1] // 数值
|
name: item[0], // 省份名称
|
||||||
}));
|
count: item[1] // 数值
|
||||||
// 排序后的结果
|
}));
|
||||||
// console.log("sortedArray", sortedArray);
|
// 排序后的结果
|
||||||
let city = JSON.parse(JSON.stringify(cc.fx.GameConfig.CITY));
|
// console.log("sortedArray", sortedArray);
|
||||||
let rankData = [];
|
let city = JSON.parse(JSON.stringify(cc.fx.GameConfig.CITY));
|
||||||
if (sortedArray) {
|
let rankData = [];
|
||||||
for (let i = 0; i < sortedArray.length; i++) {
|
if (sortedArray) {
|
||||||
// 检查sortedArray中的省份名称是否存在于原始data.role数据中
|
for (let i = 0; i < sortedArray.length; i++) {
|
||||||
if (data && data[sortedArray[i].name] !== undefined) {
|
// 检查sortedArray中的省份名称是否存在于原始data.role数据中
|
||||||
// 如果存在,则将data中对应的键值对放入rankData
|
if (data && data[sortedArray[i].name] !== undefined) {
|
||||||
if (data.role && data.role[sortedArray[i].name] !== undefined) {
|
// 如果存在,则将data中对应的键值对放入rankData
|
||||||
rankData.push({
|
if (data.role && data.role[sortedArray[i].name] !== undefined) {
|
||||||
rank: sortedArray[i].rank,
|
rankData.push({
|
||||||
name: sortedArray[i].name,
|
rank: sortedArray[i].rank,
|
||||||
count: sortedArray[i].count,
|
name: sortedArray[i].name,
|
||||||
// 可以添加data2中对应的数据
|
count: sortedArray[i].count,
|
||||||
rankingData: data[sortedArray[i].name]
|
// 可以添加data2中对应的数据
|
||||||
});
|
rankingData: data[sortedArray[i].name]
|
||||||
delete city[sortedArray[i].name];
|
});
|
||||||
|
delete city[sortedArray[i].name];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
// 循环完成后,将CITY中剩下的城市按顺序添加到rankData中
|
||||||
// 循环完成后,将CITY中剩下的城市按顺序添加到rankData中
|
let nextRank = rankData.length + 1; // 获取下一个排名
|
||||||
let nextRank = rankData.length + 1; // 获取下一个排名
|
for (let cityName in city) {
|
||||||
for (let cityName in city) {
|
rankData.push({
|
||||||
rankData.push({
|
rank: nextRank++,
|
||||||
rank: nextRank++,
|
name: cityName,
|
||||||
name: cityName,
|
count: 0,
|
||||||
count: 0,
|
rankingData: []
|
||||||
rankingData: []
|
});
|
||||||
});
|
}
|
||||||
}
|
let otherIndex = rankData.findIndex(item => item.name === "其他");
|
||||||
let otherIndex = rankData.findIndex(item => item.name === "其他");
|
if (otherIndex !== -1) {
|
||||||
if (otherIndex !== -1) {
|
let otherItem = rankData.splice(otherIndex, 1)[0];
|
||||||
let otherItem = rankData.splice(otherIndex, 1)[0];
|
rankData.push(otherItem);
|
||||||
rankData.push(otherItem);
|
}
|
||||||
}
|
let topData = data.all ? data.all : [];
|
||||||
let topData = data.all ? data.all : [];
|
this.careerRank = {
|
||||||
this.careerRank = {
|
rankData: JSON.parse(JSON.stringify(rankData)),
|
||||||
rankData: JSON.parse(JSON.stringify(rankData)),
|
topData: JSON.parse(JSON.stringify(topData))
|
||||||
topData: JSON.parse(JSON.stringify(topData))
|
}
|
||||||
}
|
console.log("自己的addLevel", cc.fx.GameConfig.GM_INFO.addLevel);
|
||||||
console.log("自己的addLevel", cc.fx.GameConfig.GM_INFO.addLevel);
|
if (cc.fx.GameConfig.GM_INFO.addLevel > 4) {
|
||||||
if (cc.fx.GameConfig.GM_INFO.addLevel > 4) {
|
console.log("______________自己入职了");
|
||||||
console.log("______________自己入职了");
|
this.addSelfToRank(rankData);
|
||||||
this.addSelfToRank(rankData);
|
}
|
||||||
}
|
for (let i = 0; i < rankData.length; i++) {
|
||||||
for (let i = 0; i < rankData.length; i++) {
|
rankData[i].rank = i + 1;
|
||||||
rankData[i].rank = i + 1;
|
}
|
||||||
}
|
if (this.RankNode != null && this.RankNode != undefined) {
|
||||||
if (this.RankNode != null && this.RankNode != undefined) {
|
console.log("_________________________预制体已经加载好了,准备渲染");
|
||||||
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(() => {
|
|
||||||
this.node.getChildByName("Career").addChild(this.RankNode);
|
this.node.getChildByName("Career").addChild(this.RankNode);
|
||||||
// this.node.getChildByName("Career").getChildByName("bg").parent = this.RankNode;
|
// this.node.getChildByName("Career").getChildByName("bg").parent = this.RankNode;
|
||||||
this.RankNode.opacity = 0;
|
this.RankNode.opacity = 0;
|
||||||
|
|
@ -2628,10 +2615,26 @@ export default class JiaZai extends cc.Component {
|
||||||
this.node.getChildByName("Snow").active = true;
|
this.node.getChildByName("Snow").active = true;
|
||||||
})
|
})
|
||||||
.start()
|
.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);
|
// console.log("rankingData_________", rankData);
|
||||||
});
|
});
|
||||||
}, isShow);
|
}, isShow);
|
||||||
|
|
|
||||||
|
|
@ -289,9 +289,12 @@ export default class MapConroler extends cc.Component {
|
||||||
});
|
});
|
||||||
}, 1000);
|
}, 1000);
|
||||||
// console.log("进入GameScene");
|
// console.log("进入GameScene");
|
||||||
this.Block_Array = GameManager._instance.Block_Array;
|
if (GameManager._instance) {
|
||||||
this.Wall_Prefab = GameManager._instance.Wall_Prefab;
|
this.Block_Array = GameManager._instance.Block_Array;
|
||||||
this.Block_Color = GameManager._instance.Block_Color;
|
this.Wall_Prefab = GameManager._instance.Wall_Prefab;
|
||||||
|
this.Block_Color = GameManager._instance.Block_Color;
|
||||||
|
}
|
||||||
|
|
||||||
// this.particleEffects = GameManager._instance.particleEffects;
|
// this.particleEffects = GameManager._instance.particleEffects;
|
||||||
this.initMap();
|
this.initMap();
|
||||||
|
|
||||||
|
|
@ -1658,21 +1661,27 @@ export default class MapConroler extends cc.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
changeFreeze() {
|
changeFreeze() {
|
||||||
if (this.freezeWall.length != 0) {
|
setTimeout(() => {
|
||||||
for (let i = 0; i < this.freezeWall.length; i++) {
|
if (this.freezeWall.length != 0) {
|
||||||
this.freezeWall[i].getChildByName("wall").getComponent("Wall").changeFreeze();
|
for (let i = 0; i < this.freezeWall.length; i++) {
|
||||||
|
this.freezeWall[i].getChildByName("wall").getComponent("Wall").changeFreeze();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
changeLock() {
|
changeLock() {
|
||||||
if (this.lockWall.length != 0) {
|
setTimeout(() => {
|
||||||
for (let i = 0; i < this.lockWall.length; i++) {
|
if (this.lockWall.length != 0) {
|
||||||
if (this.lockWall[i].getChildByName("lock")) {
|
for (let i = 0; i < this.lockWall.length; i++) {
|
||||||
this.lockWall[i].getChildByName("lock").getComponent("Lock").reduce();
|
if (this.lockWall[i].getChildByName("lock")) {
|
||||||
|
this.lockWall[i].getChildByName("lock").getComponent("Lock").reduce();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
changeAdhesive() {
|
changeAdhesive() {
|
||||||
|
|
@ -1685,13 +1694,16 @@ export default class MapConroler extends cc.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
changeLockWall() {
|
changeLockWall() {
|
||||||
//开关门的门统一处理
|
setTimeout(() => {
|
||||||
if (this.openWall.length != 0) {
|
if (this.openWall.length != 0) {
|
||||||
cc.fx.AudioManager._instance.playEffect("lockDoor", null);
|
cc.fx.AudioManager._instance.playEffect("lockDoor", null);
|
||||||
for (let i = 0; i < this.openWall.length; i++) {
|
for (let i = 0; i < this.openWall.length; i++) {
|
||||||
this.openWall[i].getChildByName("wall").getComponent("Wall").changeLock();
|
this.openWall[i].getChildByName("wall").getComponent("Wall").changeLock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}, 0);
|
||||||
|
//开关门的门统一处理
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
changeBoom(node) {
|
changeBoom(node) {
|
||||||
|
|
|
||||||
|
|
@ -63,9 +63,12 @@ export default class Revive extends cc.Component {
|
||||||
}
|
}
|
||||||
cc.fx.GameConfig.GM_INFO.iosReviveOrder = null;
|
cc.fx.GameConfig.GM_INFO.iosReviveOrder = null;
|
||||||
//console.log("充值成功获得金币");
|
//console.log("充值成功获得金币");
|
||||||
if (this.node.parent.parent.parent.parent.parent.getComponent("SceneManager")) {
|
if (this.node && this.node.parent) {
|
||||||
this.node.parent.parent.parent.parent.parent.getComponent("SceneManager").updateCoin();
|
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) {
|
else if (data.code == 0) {
|
||||||
console.log("用户自己取消充值");
|
console.log("用户自己取消充值");
|
||||||
|
|
@ -335,9 +338,10 @@ export default class Revive extends cc.Component {
|
||||||
}
|
}
|
||||||
cc.fx.GameTool.shushu_Track("payment_fail", dataFail4);
|
cc.fx.GameTool.shushu_Track("payment_fail", dataFail4);
|
||||||
}
|
}
|
||||||
|
if (this.node && this.node.parent) {
|
||||||
if (this.node.parent.parent.parent.parent.parent.getComponent("SceneManager")) {
|
if (this.node.parent.parent.parent.parent.parent.getComponent("SceneManager")) {
|
||||||
this.node.parent.parent.parent.parent.parent.getComponent("SceneManager").updateCoin();
|
this.node.parent.parent.parent.parent.parent.getComponent("SceneManager").updateCoin();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, Utils.outTradeNo)
|
}, Utils.outTradeNo)
|
||||||
}
|
}
|
||||||
|
|
@ -353,8 +357,10 @@ export default class Revive extends cc.Component {
|
||||||
}
|
}
|
||||||
cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
|
cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
|
||||||
this.btn_Touch = true;
|
this.btn_Touch = true;
|
||||||
if (this.node.parent.parent.parent.parent.parent.getComponent("SceneManager")) {
|
if (this.node && this.node.parent) {
|
||||||
this.node.parent.parent.parent.parent.parent.getComponent("SceneManager").updateCoin();
|
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() {
|
openLoad() {
|
||||||
this.node.parent.parent.parent.parent.parent.getChildByName("Loading").active = true;
|
if (this.node && this.node.parent) {
|
||||||
this.node.parent.parent.parent.parent.parent.getChildByName("Loading").getChildByName("load").stopAllActions();
|
this.node.parent.parent.parent.parent.parent.getChildByName("Loading").active = true;
|
||||||
this.node.parent.parent.parent.parent.parent.getChildByName("Loading").getChildByName("load").runAction(cc.rotateTo(2, 1080).repeatForever());
|
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() {
|
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() {
|
openConfirmBox() {
|
||||||
let ConfirmBox = this.node.parent.getChildByName("ConfirmBox");
|
if (this.node && this.node.parent) {
|
||||||
ConfirmBox.active = true;
|
let ConfirmBox = this.node.parent.getChildByName("ConfirmBox");
|
||||||
|
ConfirmBox.active = true;
|
||||||
|
}
|
||||||
this.closeLoad();
|
this.closeLoad();
|
||||||
}
|
}
|
||||||
|
|
||||||
closeConfirmBox() {
|
closeConfirmBox() {
|
||||||
let ConfirmBox = this.node.parent.getChildByName("ConfirmBox");
|
if (this.node && this.node.parent) {
|
||||||
ConfirmBox.active = false;
|
let ConfirmBox = this.node.parent.getChildByName("ConfirmBox");
|
||||||
|
ConfirmBox.active = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//再次领取奖励
|
//再次领取奖励
|
||||||
|
|
|
||||||
|
|
@ -352,8 +352,11 @@ export default class SceneManager extends cc.Component {
|
||||||
.start();
|
.start();
|
||||||
|
|
||||||
|
|
||||||
if (MapConroler && MapConroler._instance) MapConroler._instance.pause = true;
|
if (MapConroler && MapConroler._instance) {
|
||||||
MapConroler._instance.stopBoom();
|
MapConroler._instance.pause = true;
|
||||||
|
MapConroler._instance.stopBoom();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -380,8 +383,10 @@ export default class SceneManager extends cc.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
openPropBuy(name) {
|
openPropBuy(name) {
|
||||||
if (MapConroler && MapConroler._instance) MapConroler._instance.pause = true;
|
if (MapConroler && MapConroler._instance) {
|
||||||
MapConroler._instance.stopBoom();
|
MapConroler._instance.pause = true;
|
||||||
|
MapConroler._instance.stopBoom();
|
||||||
|
}
|
||||||
|
|
||||||
this.btnName = name;
|
this.btnName = name;
|
||||||
cc.fx.AudioManager._instance.playEffect("tanchuang", null);
|
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.GameTool.shushu_Track("interface_exposure", dataInfo);
|
||||||
cc.fx.GameConfig.GM_INFO.shopDouble = res.data.shopDouble;
|
cc.fx.GameConfig.GM_INFO.shopDouble = res.data.shopDouble;
|
||||||
if (MapConroler && MapConroler._instance) MapConroler._instance.pause = true;
|
if (MapConroler && MapConroler._instance) {
|
||||||
MapConroler._instance.stopBoom();
|
MapConroler._instance.pause = true;
|
||||||
|
MapConroler._instance.stopBoom();
|
||||||
|
}
|
||||||
if (!this.shopNode) {
|
if (!this.shopNode) {
|
||||||
// 第一次使用,创建节点
|
// 第一次使用,创建节点
|
||||||
this.shopNode = cc.instantiate(SceneManager.cachedShopPrefab);
|
this.shopNode = cc.instantiate(SceneManager.cachedShopPrefab);
|
||||||
|
|
|
||||||
|
|
@ -509,8 +509,10 @@ export default class Wall extends cc.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
resetFreeze() {
|
resetFreeze() {
|
||||||
this.special = 0;
|
|
||||||
this.specialBackup = 0;
|
this.specialBackup = 0;
|
||||||
|
if (this.special == WallSpecial.冻结门) {
|
||||||
|
this.special = 0;
|
||||||
|
}
|
||||||
if (this.freezeNode) {
|
if (this.freezeNode) {
|
||||||
cc.fx.AudioManager._instance.playEffect("freezeDoor", null);
|
cc.fx.AudioManager._instance.playEffect("freezeDoor", null);
|
||||||
this.freezeNode.active = false;
|
this.freezeNode.active = false;
|
||||||
|
|
|
||||||
|
|
@ -358,7 +358,9 @@ export default class scrollViewList extends cc.Component {
|
||||||
private clearContent() {
|
private clearContent() {
|
||||||
// 回收所有节点
|
// 回收所有节点
|
||||||
for (let i = 0; i < this.itemNodes.length; i++) {
|
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.itemNodes = [];
|
||||||
this.content.removeAllChildren();
|
this.content.removeAllChildren();
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ export default class NodePoolMgr extends cc.Component {
|
||||||
* @param itemNode 列表项节点
|
* @param itemNode 列表项节点
|
||||||
*/
|
*/
|
||||||
public putItem(itemNode: cc.Node) {
|
public putItem(itemNode: cc.Node) {
|
||||||
if (itemNode) {
|
if (itemNode && this.nodePool) {
|
||||||
this.nodePool.put(itemNode);
|
this.nodePool.put(itemNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -319,120 +319,29 @@ export default class Utils {
|
||||||
xhr.open("POST", url, true);
|
xhr.open("POST", url, true);
|
||||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||||
xhr.onreadystatechange = function () {
|
xhr.onreadystatechange = function () {
|
||||||
if (xhr.readyState === 4) {
|
if (xhr && xhr.readyState) {
|
||||||
let response: any = xhr.responseText;
|
if (xhr.readyState === 4 && xhr.responseText) {
|
||||||
if (xhr.status >= 200 && xhr.status < 300) {
|
let response: any = xhr.responseText;
|
||||||
let httpStatus = xhr.statusText;
|
if (xhr.status >= 200 && xhr.status < 300) {
|
||||||
// callback(true, JSON.parse(response));
|
// callback(true, JSON.parse(response));
|
||||||
try {
|
try {
|
||||||
response = JSON.parse(response);
|
response = JSON.parse(response);
|
||||||
} catch {
|
} catch {
|
||||||
response = { data: "数据有误", code: 0 };
|
response = { data: "数据有误", code: 0 };
|
||||||
}
|
}
|
||||||
callback(response);
|
callback(response);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
callback({ data: "网络请求失败,请检查网络连接", code: 0 });
|
callback({ data: "网络请求失败,请检查网络连接", code: 0 });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
xhr.send(dataStr);
|
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 获取用户数据
|
//#region 获取用户数据
|
||||||
|
|
|
||||||
|
|
@ -2058,6 +2058,9 @@ var GameTool = {
|
||||||
},
|
},
|
||||||
|
|
||||||
trackErrorToShushu(error: any) {
|
trackErrorToShushu(error: any) {
|
||||||
|
if (error.message == null || error.message == "null" || error.message == "" || error.message == undefined || error.message == "(null)") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
console.log("_____________________上报错误");
|
console.log("_____________________上报错误");
|
||||||
if (!cc.fx.GameConfig.GM_INFO.error_message.includes(error.message)) {
|
if (!cc.fx.GameConfig.GM_INFO.error_message.includes(error.message)) {
|
||||||
cc.fx.GameConfig.GM_INFO.error_message.push(error.message);
|
cc.fx.GameConfig.GM_INFO.error_message.push(error.message);
|
||||||
|
|
|
||||||
|
|
@ -75,11 +75,14 @@ export default class NewClass extends cc.Component {
|
||||||
if (iosID == "month_Card") {
|
if (iosID == "month_Card") {
|
||||||
this.setReward(iosID);
|
this.setReward(iosID);
|
||||||
}
|
}
|
||||||
if (this.node.parent.getComponent("JiaZai"))
|
if (this.node && this.node.parent) {
|
||||||
this.node.parent.getComponent("JiaZai").updateCoin();
|
if (this.node.parent.getComponent("JiaZai"))
|
||||||
else if (this.node.parent.getComponent("SceneManager")) {
|
this.node.parent.getComponent("JiaZai").updateCoin();
|
||||||
this.node.parent.getComponent("SceneManager").updateCoin();
|
else if (this.node.parent.getComponent("SceneManager")) {
|
||||||
|
this.node.parent.getComponent("SceneManager").updateCoin();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//console.log("充值成功获得金币");
|
//console.log("充值成功获得金币");
|
||||||
}
|
}
|
||||||
else if (data.code == 0) {
|
else if (data.code == 0) {
|
||||||
|
|
@ -421,11 +424,12 @@ export default class NewClass extends cc.Component {
|
||||||
}
|
}
|
||||||
cc.fx.GameTool.shushu_Track("payment_fail", dataFail4);
|
cc.fx.GameTool.shushu_Track("payment_fail", dataFail4);
|
||||||
}
|
}
|
||||||
|
if (this.node && this.node.parent) {
|
||||||
if (this.node.parent.getComponent("JiaZai"))
|
if (this.node.parent.getComponent("JiaZai"))
|
||||||
this.node.parent.getComponent("JiaZai").updateCoin();
|
this.node.parent.getComponent("JiaZai").updateCoin();
|
||||||
else if (this.node.parent.getComponent("SceneManager")) {
|
else if (this.node.parent.getComponent("SceneManager")) {
|
||||||
this.node.parent.getComponent("SceneManager").updateCoin();
|
this.node.parent.getComponent("SceneManager").updateCoin();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, Utils.outTradeNo)
|
}, Utils.outTradeNo)
|
||||||
}
|
}
|
||||||
|
|
@ -441,10 +445,12 @@ export default class NewClass extends cc.Component {
|
||||||
}
|
}
|
||||||
cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
|
cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
|
||||||
this.btn_Touch = true;
|
this.btn_Touch = true;
|
||||||
if (this.node.parent.getComponent("JiaZai"))
|
if (this.node && this.node.parent) {
|
||||||
this.node.parent.getComponent("JiaZai").updateCoin();
|
if (this.node.parent.getComponent("JiaZai"))
|
||||||
else if (this.node.parent.getComponent("SceneManager")) {
|
this.node.parent.getComponent("JiaZai").updateCoin();
|
||||||
this.node.parent.getComponent("SceneManager").updateCoin();
|
else if (this.node.parent.getComponent("SceneManager")) {
|
||||||
|
this.node.parent.getComponent("SceneManager").updateCoin();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -125,8 +125,13 @@ export default class Boom extends cc.Component {
|
||||||
|
|
||||||
|
|
||||||
updateTime() {
|
updateTime() {
|
||||||
if (MapConroler._instance.iceTrue() == true) return;
|
if (MapConroler._instance) {
|
||||||
if (MapConroler._instance.pause == true) return;
|
if (MapConroler._instance.iceTrue() == true) return;
|
||||||
|
if (MapConroler._instance.pause == true) return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (this.node.parent) {
|
if (this.node.parent) {
|
||||||
if (this.node.parent.getComponent("Block").block_Info.floor) {
|
if (this.node.parent.getComponent("Block").block_Info.floor) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -43,9 +43,11 @@ export default class Lock extends cc.Component {
|
||||||
if (this.node.parent) this.node.parent.getComponent("Block").type = 0;
|
if (this.node.parent) this.node.parent.getComponent("Block").type = 0;
|
||||||
}
|
}
|
||||||
else if (this.type == "wall") {
|
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.getChildByName("wall").getComponent("Wall").special == 6) {
|
||||||
if (this.node.parent) this.node.parent.getChildByName("wall").getComponent("Wall").special = 0;
|
if (this.node.parent) {
|
||||||
if (this.node.parent) this.node.parent.getChildByName("wall").getComponent("Wall").specialBackup = 0;
|
this.node.parent.getChildByName("wall").getComponent("Wall").special = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.node.destroy();
|
this.node.destroy();
|
||||||
|
|
|
||||||
|
|
@ -111,8 +111,11 @@ export default class NewbieGift extends cc.Component {
|
||||||
this.openConfirmBox();
|
this.openConfirmBox();
|
||||||
}
|
}
|
||||||
this.btn_Touch = true;
|
this.btn_Touch = true;
|
||||||
if (this.node.parent.getComponent("JiaZai"))
|
if (this.node && this.node.parent) {
|
||||||
this.node.parent.getComponent("JiaZai").updateCoin();
|
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);
|
cc.fx.GameTool.shushu_Track("payment_fail", dataFail4);
|
||||||
}
|
}
|
||||||
|
if (this.node && this.node.parent) {
|
||||||
if (this.node.parent.getComponent("JiaZai"))
|
if (this.node.parent.getComponent("JiaZai"))
|
||||||
this.node.parent.getComponent("JiaZai").updateCoin();
|
this.node.parent.getComponent("JiaZai").updateCoin();
|
||||||
|
}
|
||||||
}, Utils.outTradeNo)
|
}, Utils.outTradeNo)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -495,8 +499,10 @@ export default class NewbieGift extends cc.Component {
|
||||||
}
|
}
|
||||||
cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
|
cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
|
||||||
this.btn_Touch = true;
|
this.btn_Touch = true;
|
||||||
if (this.node.parent.getComponent("JiaZai"))
|
if (this.node && this.node.parent) {
|
||||||
this.node.parent.getComponent("JiaZai").updateCoin();
|
if (this.node.parent.getComponent("JiaZai"))
|
||||||
|
this.node.parent.getComponent("JiaZai").updateCoin();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -448,8 +448,16 @@ export default class CareerList extends cc.Component {
|
||||||
this.randerChildren.push(this.firstRender.children[i]);
|
this.randerChildren.push(this.firstRender.children[i]);
|
||||||
let username = cc.fx.GameTool.subName(this.topData[i - 3].username, 5);
|
let username = cc.fx.GameTool.subName(this.topData[i - 3].username, 5);
|
||||||
if (username == "user") username = "匿名玩家";
|
if (username == "user") username = "匿名玩家";
|
||||||
this.firstRender.children[i].getChildByName("name").getComponent(cc.Label).string = username + "";
|
if (this.firstRender.children[i]) {
|
||||||
this.firstRender.children[i].getChildByName("rank").getComponent(cc.Label).string = this.topData[i - 3].addLevel;
|
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
|
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;
|
// 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 useravatar = this.topData[i - 3].useravatar;
|
||||||
let useravatarTemp = "icon_" + useravatar;
|
let useravatarTemp = "icon_" + useravatar;
|
||||||
// console.log("222头像名称", useravatarTemp, "333用户名字:", username);
|
// console.log("222头像名称", useravatarTemp, "333用户名字:", username);
|
||||||
this.firstRender.children[i].getChildByName("mask").getChildByName("icon").getComponent(cc.Sprite).spriteFrame = this.UI.getSpriteFrame(useravatarTemp);
|
if (this.firstRender.children[i]) {
|
||||||
this.firstRender.children[i].getChildByName("mask").getChildByName("icon").width = 150;
|
this.firstRender.children[i].getChildByName("mask").getChildByName("icon").getComponent(cc.Sprite).spriteFrame = this.UI.getSpriteFrame(useravatarTemp);
|
||||||
this.firstRender.children[i].getChildByName("mask").getChildByName("icon").height = 150;
|
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"));
|
else this.setPic(this.topData[i - 3].useravatar, this.firstRender.children[i].getChildByName("mask").getChildByName("icon"));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,10 @@ export default class CareerManager extends cc.Component {
|
||||||
let currentDate = new Date();
|
let currentDate = new Date();
|
||||||
let month = currentDate.getMonth() + 1;
|
let month = currentDate.getMonth() + 1;
|
||||||
let day = currentDate.getDate();
|
let day = currentDate.getDate();
|
||||||
|
if (this.bg.getChildByName("month"))
|
||||||
this.bg.getChildByName("month").getComponent(cc.Label).string = month.toString();
|
this.bg.getChildByName("month").getComponent(cc.Label).string = month.toString();
|
||||||
this.bg.getChildByName("day").getComponent(cc.Label).string = day.toString();
|
if (this.bg.getChildByName("day"))
|
||||||
|
this.bg.getChildByName("day").getComponent(cc.Label).string = day.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
|
|
|
||||||
|
|
@ -19,14 +19,16 @@ export default class Item extends cc.Component {
|
||||||
public dataChanged() {
|
public dataChanged() {
|
||||||
let useravatarIcon = this.data.useravatarIcon;
|
let useravatarIcon = this.data.useravatarIcon;
|
||||||
useravatarIcon = "kuang_" + (parseInt(useravatarIcon) + 1);
|
useravatarIcon = "kuang_" + (parseInt(useravatarIcon) + 1);
|
||||||
this.node.getChildByName("icon").getComponent(cc.Sprite).spriteFrame =
|
if (this.node.getChildByName("icon"))
|
||||||
this.ui.getSpriteFrame(useravatarIcon);
|
this.node.getChildByName("icon").getComponent(cc.Sprite).spriteFrame =
|
||||||
|
this.ui.getSpriteFrame(useravatarIcon);
|
||||||
console.log("用户头像框:", this.data.useravatarIcon, useravatarIcon);
|
console.log("用户头像框:", this.data.useravatarIcon, useravatarIcon);
|
||||||
this.data.username = cc.fx.GameTool.subName(this.data.username, 7);
|
this.data.username = cc.fx.GameTool.subName(this.data.username, 7);
|
||||||
let name = this.data.username;
|
let name = this.data.username;
|
||||||
if (name == "user") name = "匿名玩家";
|
if (name == "user") name = "匿名玩家";
|
||||||
// this.node.getChildByName("rankLab").getComponent(cc.Label).string = this.data.rank + "";
|
// 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;
|
// this.node.getChildByName("totalLab").getComponent(cc.Label).string = this.data.levelAmount;
|
||||||
|
|
||||||
NumberToImage.numberToImageNodes3((this.data.rank), 43, 15, "rank_", this.node.getChildByName("rankLab"), true);
|
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
|
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"
|
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"
|
|| 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 useravatar = this.data.useravatar;
|
||||||
let useravatarTemp = "icon_" + useravatar;
|
let useravatarTemp = "icon_" + useravatar;
|
||||||
console.log("用户头像:", useravatarTemp);
|
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();
|
else this.setPic();
|
||||||
|
|
@ -79,8 +83,12 @@ export default class Item extends cc.Component {
|
||||||
cc.assetManager.loadRemote(url, { ext: '.png' }, (err, texture: cc.Texture2D) => {
|
cc.assetManager.loadRemote(url, { ext: '.png' }, (err, texture: cc.Texture2D) => {
|
||||||
if (texture) {
|
if (texture) {
|
||||||
this.node.getChildByName("pic").active = true;
|
this.node.getChildByName("pic").active = true;
|
||||||
var sprite = this.node.getChildByName("pic").getChildByName("pic").getComponent(cc.Sprite);
|
// console.log("设置头像成功",err);
|
||||||
sprite.spriteFrame = new cc.SpriteFrame(texture);
|
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);
|
// console.log(this.data.rank,"设置头像成功",err);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
11,
|
11,
|
||||||
11
|
11
|
||||||
],
|
],
|
||||||
"time": 190,
|
"time": 240,
|
||||||
"gap": [
|
"gap": [
|
||||||
{
|
{
|
||||||
"x": 4,
|
"x": 4,
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
10,
|
10,
|
||||||
12
|
12
|
||||||
],
|
],
|
||||||
"time": 130,
|
"time": 180,
|
||||||
"gap": []
|
"gap": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -228,13 +228,16 @@ export default class NewClass extends cc.Component {
|
||||||
wx.offShow(this.onShowListener);
|
wx.offShow(this.onShowListener);
|
||||||
}
|
}
|
||||||
Utils.outTradeNo = null;
|
Utils.outTradeNo = null;
|
||||||
//销毁预制体
|
if (this.node && this.node.parent) {
|
||||||
if (this.node.parent.getComponent("JiaZai")) {
|
//销毁预制体
|
||||||
this.node.parent.getComponent("JiaZai").closeShop();
|
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();
|
else if (this.node.parent.getComponent("SceneManager")) {
|
||||||
|
this.node.parent.getComponent("SceneManager").closeShop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this.shop.destroy();
|
// this.shop.destroy();
|
||||||
if (this.reward) {
|
if (this.reward) {
|
||||||
this.reward = false;
|
this.reward = false;
|
||||||
|
|
@ -307,10 +310,12 @@ export default class NewClass extends cc.Component {
|
||||||
}
|
}
|
||||||
cc.fx.GameConfig.GM_INFO.iosShopOrder = null;
|
cc.fx.GameConfig.GM_INFO.iosShopOrder = null;
|
||||||
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
||||||
if (this.node.parent.getComponent("JiaZai"))
|
if (this.node && this.node.parent) {
|
||||||
this.node.parent.getComponent("JiaZai").updateCoin();
|
if (this.node.parent.getComponent("JiaZai"))
|
||||||
else if (this.node.parent.getComponent("SceneManager")) {
|
this.node.parent.getComponent("JiaZai").updateCoin();
|
||||||
this.node.parent.getComponent("SceneManager").updateCoin();
|
else if (this.node.parent.getComponent("SceneManager")) {
|
||||||
|
this.node.parent.getComponent("SceneManager").updateCoin();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.closeLoad();
|
this.closeLoad();
|
||||||
this.btn_Touch = true;
|
this.btn_Touch = true;
|
||||||
|
|
@ -443,9 +448,14 @@ export default class NewClass extends cc.Component {
|
||||||
}, true)
|
}, true)
|
||||||
}
|
}
|
||||||
else {
|
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);
|
var timeTemp = cc.fx.GameTool.getTimeMargin(cc.fx.GameConfig.GM_INFO.min_Time);
|
||||||
// 同步显示
|
// 同步显示
|
||||||
if (this.Stamina && this.Stamina.getChildByName("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);
|
cc.fx.GameTool.shushu_Track("payment_fail", dataFail4);
|
||||||
}
|
}
|
||||||
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
||||||
if (this.node.parent.getComponent("JiaZai"))
|
if (this.node && this.node.parent) {
|
||||||
this.node.parent.getComponent("JiaZai").updateCoin();
|
if (this.node.parent.getComponent("JiaZai"))
|
||||||
else if (this.node.parent.getComponent("SceneManager")) {
|
this.node.parent.getComponent("JiaZai").updateCoin();
|
||||||
this.node.parent.getComponent("SceneManager").updateCoin();
|
else if (this.node.parent.getComponent("SceneManager")) {
|
||||||
|
this.node.parent.getComponent("SceneManager").updateCoin();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, Utils.outTradeNo)
|
}, Utils.outTradeNo)
|
||||||
}
|
}
|
||||||
|
|
@ -685,10 +697,12 @@ export default class NewClass extends cc.Component {
|
||||||
}
|
}
|
||||||
cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
|
cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
|
||||||
this.btn_Touch = true;
|
this.btn_Touch = true;
|
||||||
if (this.node.parent.getComponent("JiaZai"))
|
if (this.node && this.node.parent) {
|
||||||
this.node.parent.getComponent("JiaZai").updateCoin();
|
if (this.node.parent.getComponent("JiaZai"))
|
||||||
else if (this.node.parent.getComponent("SceneManager")) {
|
this.node.parent.getComponent("JiaZai").updateCoin();
|
||||||
this.node.parent.getComponent("SceneManager").updateCoin();
|
else if (this.node.parent.getComponent("SceneManager")) {
|
||||||
|
this.node.parent.getComponent("SceneManager").updateCoin();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user