融合后
This commit is contained in:
parent
1f943e53a5
commit
f85bde1784
|
|
@ -2445,91 +2445,103 @@ export default class JiaZai extends cc.Component {
|
||||||
|
|
||||||
//获取入职排行榜
|
//获取入职排行榜
|
||||||
getSRank() {
|
getSRank() {
|
||||||
this.LoadCareer(null);
|
console.log("_________________________重新获取排行");
|
||||||
console.log("重新获取排行");
|
if (this.RankNode == null && this.RankNode == undefined) {
|
||||||
Utils.getSRank(res => {
|
this.LoadCareer(() => {
|
||||||
let data = JSON.parse(res.data);
|
Utils.getSRank(res => {
|
||||||
let role = data.role;
|
console.log("_________________________得到接口返回");
|
||||||
let sortedArray = [];
|
let data = JSON.parse(res.data);
|
||||||
sortedArray = Object.entries(role)
|
let role = data.role;
|
||||||
//@ts-ignore
|
let sortedArray = [];
|
||||||
.sort((a, b) => b[1] - a[1]) // 按数值从大到小排序
|
sortedArray = Object.entries(role)
|
||||||
.map((item, index) => ({
|
//@ts-ignore
|
||||||
rank: index + 1, // 排名
|
.sort((a, b) => b[1] - a[1]) // 按数值从大到小排序
|
||||||
name: item[0], // 省份名称
|
.map((item, index) => ({
|
||||||
count: item[1] // 数值
|
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 = [];
|
// console.log("sortedArray", sortedArray);
|
||||||
for (let i = 0; i < sortedArray.length; i++) {
|
let city = JSON.parse(JSON.stringify(cc.fx.GameConfig.CITY));
|
||||||
// 检查sortedArray中的省份名称是否存在于原始data.role数据中
|
let rankData = [];
|
||||||
if (data && data[sortedArray[i].name] !== undefined) {
|
for (let i = 0; i < sortedArray.length; i++) {
|
||||||
// 如果存在,则将data中对应的键值对放入rankData
|
// 检查sortedArray中的省份名称是否存在于原始data.role数据中
|
||||||
if (data.role && data.role[sortedArray[i].name] !== undefined) {
|
if (data && data[sortedArray[i].name] !== undefined) {
|
||||||
rankData.push({
|
// 如果存在,则将data中对应的键值对放入rankData
|
||||||
rank: sortedArray[i].rank,
|
if (data.role && data.role[sortedArray[i].name] !== undefined) {
|
||||||
name: sortedArray[i].name,
|
rankData.push({
|
||||||
count: sortedArray[i].count,
|
rank: sortedArray[i].rank,
|
||||||
// 可以添加data2中对应的数据
|
name: sortedArray[i].name,
|
||||||
rankingData: data[sortedArray[i].name]
|
count: sortedArray[i].count,
|
||||||
});
|
// 可以添加data2中对应的数据
|
||||||
delete city[sortedArray[i].name];
|
rankingData: data[sortedArray[i].name]
|
||||||
|
});
|
||||||
|
delete city[sortedArray[i].name];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
// 循环完成后,将CITY中剩下的城市按顺序添加到rankData中
|
||||||
}
|
let nextRank = rankData.length + 1; // 获取下一个排名
|
||||||
// 循环完成后,将CITY中剩下的城市按顺序添加到rankData中
|
for (let cityName in city) {
|
||||||
let nextRank = rankData.length + 1; // 获取下一个排名
|
rankData.push({
|
||||||
for (let cityName in city) {
|
rank: nextRank++,
|
||||||
rankData.push({
|
name: cityName,
|
||||||
rank: nextRank++,
|
count: 0,
|
||||||
name: cityName,
|
rankingData: []
|
||||||
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) {
|
addSelfToRank(rankData) {
|
||||||
|
|
|
||||||
|
|
@ -2702,7 +2702,7 @@ export default class MapConroler extends cc.Component {
|
||||||
this.stopTimeCutDown();
|
this.stopTimeCutDown();
|
||||||
let time = 0;
|
let time = 0;
|
||||||
this.gameOver = true;
|
this.gameOver = true;
|
||||||
if (type == "boom" || type == "lock" || type == "revolving") {
|
if (type == "boom" || type == "lock" || type == "revolving" || type == "rotate") {
|
||||||
time = 2000;
|
time = 2000;
|
||||||
}
|
}
|
||||||
if (cc.fx.GameConfig.GM_INFO.otherLevel > 0) {
|
if (cc.fx.GameConfig.GM_INFO.otherLevel > 0) {
|
||||||
|
|
|
||||||
|
|
@ -426,8 +426,8 @@ var GameTool = {
|
||||||
//关卡上限
|
//关卡上限
|
||||||
maxLevel() {
|
maxLevel() {
|
||||||
let jg = false;
|
let jg = false;
|
||||||
if (cc.fx.GameConfig.GM_INFO.level > 729) {
|
if (cc.fx.GameConfig.GM_INFO.level > 799) {
|
||||||
cc.fx.GameConfig.GM_INFO.level = 730;
|
cc.fx.GameConfig.GM_INFO.level = 800;
|
||||||
jg = true;
|
jg = true;
|
||||||
}
|
}
|
||||||
return jg;
|
return jg;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user