融合后
This commit is contained in:
parent
1f943e53a5
commit
f85bde1784
|
|
@ -2445,91 +2445,103 @@ export default class JiaZai extends cc.Component {
|
|||
|
||||
//获取入职排行榜
|
||||
getSRank() {
|
||||
this.LoadCareer(null);
|
||||
console.log("重新获取排行");
|
||||
Utils.getSRank(res => {
|
||||
let data = JSON.parse(res.data);
|
||||
let role = data.role;
|
||||
let sortedArray = [];
|
||||
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 = [];
|
||||
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];
|
||||
console.log("_________________________重新获取排行");
|
||||
if (this.RankNode == null && this.RankNode == undefined) {
|
||||
this.LoadCareer(() => {
|
||||
Utils.getSRank(res => {
|
||||
console.log("_________________________得到接口返回");
|
||||
let data = JSON.parse(res.data);
|
||||
let role = data.role;
|
||||
let sortedArray = [];
|
||||
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 = [];
|
||||
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: []
|
||||
// 循环完成后,将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 })
|
||||
.call(() => {
|
||||
console.log("_________________________渲染完成");
|
||||
})
|
||||
.start()
|
||||
} 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 })
|
||||
.call(() => {
|
||||
console.log("_________________________渲染完成");
|
||||
})
|
||||
.start()
|
||||
})
|
||||
}
|
||||
// console.log("rankingData_________", rankData);
|
||||
});
|
||||
}
|
||||
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) {
|
||||
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 })
|
||||
.start()
|
||||
} else {
|
||||
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 })
|
||||
.start()
|
||||
})
|
||||
}
|
||||
// console.log("rankingData_________", rankData);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
addSelfToRank(rankData) {
|
||||
|
|
|
|||
|
|
@ -2702,7 +2702,7 @@ export default class MapConroler extends cc.Component {
|
|||
this.stopTimeCutDown();
|
||||
let time = 0;
|
||||
this.gameOver = true;
|
||||
if (type == "boom" || type == "lock" || type == "revolving") {
|
||||
if (type == "boom" || type == "lock" || type == "revolving" || type == "rotate") {
|
||||
time = 2000;
|
||||
}
|
||||
if (cc.fx.GameConfig.GM_INFO.otherLevel > 0) {
|
||||
|
|
|
|||
|
|
@ -426,8 +426,8 @@ var GameTool = {
|
|||
//关卡上限
|
||||
maxLevel() {
|
||||
let jg = false;
|
||||
if (cc.fx.GameConfig.GM_INFO.level > 729) {
|
||||
cc.fx.GameConfig.GM_INFO.level = 730;
|
||||
if (cc.fx.GameConfig.GM_INFO.level > 799) {
|
||||
cc.fx.GameConfig.GM_INFO.level = 800;
|
||||
jg = true;
|
||||
}
|
||||
return jg;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user