1050关卡版本
This commit is contained in:
parent
230fd53604
commit
ffe40e4873
|
|
@ -644,24 +644,31 @@ export default class JiaZai extends cc.Component {
|
||||||
"kuang"
|
"kuang"
|
||||||
]
|
]
|
||||||
rightElements.forEach(elementName => {
|
rightElements.forEach(elementName => {
|
||||||
let element;
|
if (this.node) {
|
||||||
if (elementName === "Pause") {
|
let element;
|
||||||
element = this.node.getChildByName(elementName);
|
if (elementName === "Pause") {
|
||||||
} else if (elementName === "popRank") {
|
if (this.node.getChildByName(elementName))
|
||||||
element = this.node.getChildByName("rank");
|
element = this.node.getChildByName(elementName);
|
||||||
} else if (elementName === "tiaodik" || elementName === "shezhiBtn") {
|
} else if (elementName === "popRank") {
|
||||||
element = loadNode.getChildByName(elementName);
|
if (this.node.getChildByName("rank"))
|
||||||
} else {
|
element = this.node.getChildByName("rank");
|
||||||
element = loadNode.getChildByName("Top").getChildByName(elementName);
|
} else if (elementName === "tiaodik" || elementName === "shezhiBtn") {
|
||||||
|
if (loadNode)
|
||||||
|
element = loadNode.getChildByName(elementName);
|
||||||
|
} else {
|
||||||
|
if (loadNode)
|
||||||
|
element = loadNode.getChildByName("Top").getChildByName(elementName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (element) {
|
||||||
|
if (!element.originalRightOffset) {
|
||||||
|
element.originalRightOffset = designSize.width / 2 - element.x;
|
||||||
|
}
|
||||||
|
element.x = designSize.width / 2 - element.originalRightOffset + barWidth / scale;
|
||||||
|
element.scale = hmScale;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (element) {
|
|
||||||
if (!element.originalRightOffset) {
|
|
||||||
element.originalRightOffset = designSize.width / 2 - element.x;
|
|
||||||
}
|
|
||||||
element.x = designSize.width / 2 - element.originalRightOffset + barWidth / scale;
|
|
||||||
element.scale = hmScale;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
rightElements2.forEach(elementName => {
|
rightElements2.forEach(elementName => {
|
||||||
let element;
|
let element;
|
||||||
|
|
|
||||||
|
|
@ -676,7 +676,16 @@ export default class MapConroler extends cc.Component {
|
||||||
|
|
||||||
blockInit() {
|
blockInit() {
|
||||||
let blockArray = cc.fx.GameConfig.BLOCK_INFO[0];
|
let blockArray = cc.fx.GameConfig.BLOCK_INFO[0];
|
||||||
|
for (let i = 0; i < blockArray.length; i++) {
|
||||||
|
let blockInfo = blockArray[i];
|
||||||
|
if (blockInfo.floorMove != null && blockInfo.floorMove != undefined) {
|
||||||
|
if (blockInfo.floorMove) {
|
||||||
|
this.floorMove = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
blockArray = this.sortBlock(blockArray);
|
blockArray = this.sortBlock(blockArray);
|
||||||
|
// this.floorSort(blockArray);
|
||||||
//console.log("创建方块", blockArray);
|
//console.log("创建方块", blockArray);
|
||||||
let index = 0; // 当前要创建的方块索引
|
let index = 0; // 当前要创建的方块索引
|
||||||
let BLOCKS_PER_FRAME = 1; // 初始每帧创建的方块数量
|
let BLOCKS_PER_FRAME = 1; // 初始每帧创建的方块数量
|
||||||
|
|
@ -687,11 +696,7 @@ export default class MapConroler extends cc.Component {
|
||||||
const startTime = performance.now();
|
const startTime = performance.now();
|
||||||
for (let i = 0; i < BLOCKS_PER_FRAME && index < blockArray.length; i++) {
|
for (let i = 0; i < BLOCKS_PER_FRAME && index < blockArray.length; i++) {
|
||||||
let blockInfo = blockArray[index];
|
let blockInfo = blockArray[index];
|
||||||
if (blockInfo.floorMove != null && blockInfo.floorMove != undefined) {
|
|
||||||
if (blockInfo.floorMove) {
|
|
||||||
this.floorMove = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 缓存 Block_Array 访问
|
// 缓存 Block_Array 访问
|
||||||
const blockPrefab = this.Block_Array[blockInfo.block];
|
const blockPrefab = this.Block_Array[blockInfo.block];
|
||||||
let block = cc.instantiate(blockPrefab);
|
let block = cc.instantiate(blockPrefab);
|
||||||
|
|
@ -793,8 +798,35 @@ export default class MapConroler extends cc.Component {
|
||||||
createBlocks();
|
createBlocks();
|
||||||
}
|
}
|
||||||
//给创建方块排序,用来降低drawcall 合批
|
//给创建方块排序,用来降低drawcall 合批
|
||||||
sortBlock(allBlocks: { color: number; block: number; type: number }[]) {
|
sortBlock(allBlocks: { color: number; block: number; type: number; floor: number }[]) {
|
||||||
return allBlocks.sort((a, b) => {
|
return allBlocks.sort((a, b) => {
|
||||||
|
// 最高优先级:如果a或者b有一个有floor,则不打乱有floor的排序
|
||||||
|
if (this.floorMove == true) {
|
||||||
|
// console.log("可移动地板关");
|
||||||
|
if (a.floor !== undefined || b.floor !== undefined) {
|
||||||
|
// 如果a和b都有floor且相同,保持相对顺序
|
||||||
|
if (a.floor !== undefined && b.floor !== undefined && a.floor === b.floor) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
// 如果a有floor而b没有,a排在b前面
|
||||||
|
if (a.floor !== undefined && b.floor === undefined) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
// 如果b有floor而a没有,b排在a前面
|
||||||
|
if (a.floor === undefined && b.floor !== undefined) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
// 如果a和b都有floor但不同,保持相对顺序
|
||||||
|
if (a.floor !== undefined && b.floor !== undefined && a.floor !== b.floor) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// console.log("________无可移动地板关");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 先处理 type 为 1 的情况,将其放到最后
|
// 先处理 type 为 1 的情况,将其放到最后
|
||||||
if (a.type === 1 && b.type !== 1) {
|
if (a.type === 1 && b.type !== 1) {
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -827,6 +859,9 @@ export default class MapConroler extends cc.Component {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//创建墙壁
|
//创建墙壁
|
||||||
|
|
||||||
wallInit() {
|
wallInit() {
|
||||||
|
|
@ -837,36 +872,39 @@ export default class MapConroler extends cc.Component {
|
||||||
|
|
||||||
const createWalls = () => {
|
const createWalls = () => {
|
||||||
const startTime = performance.now();
|
const startTime = performance.now();
|
||||||
for (let i = 0; i < WALLS_PER_FRAME && index < this.wallInfo.length; i++) {
|
if (this.wallInfo) {
|
||||||
let block = this.wallInfo[index];
|
for (let i = 0; i < WALLS_PER_FRAME && index < this.wallInfo.length; i++) {
|
||||||
let dir = this.getWllDiraction("wall", cc.v2(block.getComponent("MapBlock").posX, block.getComponent("MapBlock").posY));
|
let block = this.wallInfo[index];
|
||||||
if (dir != null) {
|
let dir = this.getWllDiraction("wall", cc.v2(block.getComponent("MapBlock").posX, block.getComponent("MapBlock").posY));
|
||||||
this.createWall(dir, block);
|
if (dir != null) {
|
||||||
|
this.createWall(dir, block);
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
const endTime = performance.now();
|
||||||
|
const frameTime = endTime - startTime;
|
||||||
|
// 如果当前帧执行时间过长,减少每帧创建数量
|
||||||
|
if (frameTime > 16) {
|
||||||
|
WALLS_PER_FRAME = Math.max(WALLS_PER_FRAME - 1, MIN_PER_FRAME);
|
||||||
|
} else {
|
||||||
|
WALLS_PER_FRAME = Math.min(WALLS_PER_FRAME + 1, MAX_PER_FRAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果还有墙壁未创建,下一帧继续创建
|
||||||
|
if (index < this.wallInfo.length) {
|
||||||
|
this.scheduleOnce(() => {
|
||||||
|
createWalls();
|
||||||
|
}, 0);
|
||||||
|
} else {
|
||||||
|
// 所有墙壁创建完成后,创建拐角节点
|
||||||
|
this.createCornerNodes();
|
||||||
|
this.sortWall();
|
||||||
|
if (this.revolving_state != 0) {
|
||||||
|
this.createRevolvingWall();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
index++;
|
|
||||||
}
|
|
||||||
const endTime = performance.now();
|
|
||||||
const frameTime = endTime - startTime;
|
|
||||||
// 如果当前帧执行时间过长,减少每帧创建数量
|
|
||||||
if (frameTime > 16) {
|
|
||||||
WALLS_PER_FRAME = Math.max(WALLS_PER_FRAME - 1, MIN_PER_FRAME);
|
|
||||||
} else {
|
|
||||||
WALLS_PER_FRAME = Math.min(WALLS_PER_FRAME + 1, MAX_PER_FRAME);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果还有墙壁未创建,下一帧继续创建
|
|
||||||
if (index < this.wallInfo.length) {
|
|
||||||
this.scheduleOnce(() => {
|
|
||||||
createWalls();
|
|
||||||
}, 0);
|
|
||||||
} else {
|
|
||||||
// 所有墙壁创建完成后,创建拐角节点
|
|
||||||
this.createCornerNodes();
|
|
||||||
this.sortWall();
|
|
||||||
if (this.revolving_state != 0) {
|
|
||||||
this.createRevolvingWall();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 开始分帧创建墙壁
|
// 开始分帧创建墙壁
|
||||||
|
|
@ -2689,6 +2727,7 @@ export default class MapConroler extends cc.Component {
|
||||||
for (let i = 0; i < this.blocks.length; i++) {
|
for (let i = 0; i < this.blocks.length; i++) {
|
||||||
if (this.blocks[i].getComponent("Block").block_Info) {
|
if (this.blocks[i].getComponent("Block").block_Info) {
|
||||||
let blockInfo = this.blocks[i].getComponent("Block").block_Info;
|
let blockInfo = this.blocks[i].getComponent("Block").block_Info;
|
||||||
|
console.log("floorMove", blockInfo.floor);
|
||||||
if (blockInfo.floorMove != undefined) {
|
if (blockInfo.floorMove != undefined) {
|
||||||
if (blockInfo.floorMove == true) {
|
if (blockInfo.floorMove == true) {
|
||||||
if (this.teamBlocks.length == 0) {
|
if (this.teamBlocks.length == 0) {
|
||||||
|
|
@ -2745,7 +2784,7 @@ export default class MapConroler extends cc.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
removeFloor() {
|
removeFloor() {
|
||||||
// console.log("结束");
|
console.log("结束__________");
|
||||||
if (this.teamBlocks.length > 0) {
|
if (this.teamBlocks.length > 0) {
|
||||||
for (let j = 0; j < this.teamBlocks.length; j++) {
|
for (let j = 0; j < this.teamBlocks.length; j++) {
|
||||||
this.teamBlocks[j].getComponent("Block").setMoveFloor();
|
this.teamBlocks[j].getComponent("Block").setMoveFloor();
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,8 @@ export default class CareerList extends cc.Component {
|
||||||
this.randerChildren = [];
|
this.randerChildren = [];
|
||||||
this.itemHeight = this.itemRender.height;
|
this.itemHeight = this.itemRender.height;
|
||||||
this.itemWidth = this.itemRender.width;
|
this.itemWidth = this.itemRender.width;
|
||||||
this.scrollView = this.node.getComponent(cc.ScrollView);
|
if (this.node)
|
||||||
|
this.scrollView = this.node.getComponent(cc.ScrollView);
|
||||||
this.content = this.scrollView.content;
|
this.content = this.scrollView.content;
|
||||||
this.content.anchorX = 0;
|
this.content.anchorX = 0;
|
||||||
this.content.anchorY = 1;
|
this.content.anchorY = 1;
|
||||||
|
|
@ -232,11 +233,13 @@ export default class CareerList extends cc.Component {
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (item) {
|
||||||
|
let itemRender: CareerItem = item.getComponent(CareerItem);
|
||||||
|
itemRender.itemIndex = i + startIndex;
|
||||||
|
itemRender.data = this.itemDataList[i + startIndex];
|
||||||
|
itemRender.dataChanged();
|
||||||
|
}
|
||||||
|
|
||||||
let itemRender: CareerItem = item.getComponent(CareerItem);
|
|
||||||
itemRender.itemIndex = i + startIndex;
|
|
||||||
itemRender.data = this.itemDataList[i + startIndex];
|
|
||||||
itemRender.dataChanged();
|
|
||||||
|
|
||||||
// 计算firstRender的高度偏移
|
// 计算firstRender的高度偏移
|
||||||
let firstRenderHeight = this.firstRender ? this.firstRender.height : 0;
|
let firstRenderHeight = this.firstRender ? this.firstRender.height : 0;
|
||||||
|
|
@ -523,8 +526,11 @@ export default class CareerList 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 && node) {
|
if (texture && node) {
|
||||||
// node.getChildByName("pic").active = true;
|
// node.getChildByName("pic").active = true;
|
||||||
var sprite = node.getComponent(cc.Sprite);
|
if (node.getComponent(cc.Sprite)) {
|
||||||
sprite.spriteFrame = new cc.SpriteFrame(texture);
|
var sprite = node.getComponent(cc.Sprite);
|
||||||
|
sprite.spriteFrame = new cc.SpriteFrame(texture);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
|
|
@ -22,20 +22,27 @@ export default class CareerManager extends cc.Component {
|
||||||
}
|
}
|
||||||
//初始化数据
|
//初始化数据
|
||||||
init(data, topData) {
|
init(data, topData) {
|
||||||
this.rankList = cc.find("ScrollView", this.node).getComponent(CareerList);
|
|
||||||
this.listData = data;
|
this.listData = data;
|
||||||
this.selfData = null;
|
this.selfData = null;
|
||||||
this.rankNumber = 100;
|
this.rankNumber = 100;
|
||||||
this.rankTotal = 100;
|
this.rankTotal = 100;
|
||||||
this.rankList.setData(data, topData);
|
|
||||||
|
if (this.node) {
|
||||||
|
this.rankList = cc.find("ScrollView", this.node).getComponent(CareerList);
|
||||||
|
this.rankList.setData(data, topData);
|
||||||
|
}
|
||||||
|
|
||||||
// 获取当前日期
|
// 获取当前日期
|
||||||
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"))
|
if (this.bg) {
|
||||||
this.bg.getChildByName("month").getComponent(cc.Label).string = month.toString();
|
if (this.bg.getChildByName("month"))
|
||||||
if (this.bg.getChildByName("day"))
|
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() {
|
||||||
|
|
|
||||||
|
|
@ -396,9 +396,12 @@ export default class PassCheckItem extends cc.Component {
|
||||||
|
|
||||||
private setNodeGray(node: cc.Node, color?: cc.Color) {
|
private setNodeGray(node: cc.Node, color?: cc.Color) {
|
||||||
let setColor = color || cc.color(190, 190, 190, 255);
|
let setColor = color || cc.color(190, 190, 190, 255);
|
||||||
for (let i = 0; i < node.children.length; i++) {
|
if (node) {
|
||||||
// console.log("设置子节点颜色", node.children[i]);
|
for (let i = 0; i < node.children.length; i++) {
|
||||||
node.children[i].color = setColor;
|
// console.log("设置子节点颜色", node.children[i]);
|
||||||
|
node.children[i].color = setColor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -143,46 +143,49 @@ export default class NewClass extends cc.Component {
|
||||||
{ product_id: "gold_5", price: 32800, coin: 100000, title: "" },
|
{ product_id: "gold_5", price: 32800, coin: 100000, title: "" },
|
||||||
{ product_id: "gold_6", price: 64800, coin: 240000, title: "" },
|
{ product_id: "gold_6", price: 64800, coin: 240000, title: "" },
|
||||||
];
|
];
|
||||||
for (let i = 2; i <= 7 && i < this.itemList.children.length; i++) {
|
if (this.itemList) {
|
||||||
const spriteComp = this.itemList.children[i].children[0].getComponent(cc.Sprite);
|
for (let i = 2; i <= 7 && i < this.itemList.children.length; i++) {
|
||||||
const price = this.itemList.children[i].children[1];
|
const spriteComp = this.itemList.children[i].children[0].getComponent(cc.Sprite);
|
||||||
const title = this.itemList.children[i].children[2];
|
const price = this.itemList.children[i].children[1];
|
||||||
const discount = this.itemList.children[i].children[4];
|
const title = this.itemList.children[i].children[2];
|
||||||
const add = this.itemList.children[i].children[5];
|
const discount = this.itemList.children[i].children[4];
|
||||||
this.itemList.children[i].children[4].active = false;
|
const add = this.itemList.children[i].children[5];
|
||||||
this.itemList.children[i].children[5].active = false;
|
this.itemList.children[i].children[4].active = false;
|
||||||
this.itemList.children[i].children[6].active = false;
|
this.itemList.children[i].children[5].active = false;
|
||||||
const product = products[i - 1];
|
this.itemList.children[i].children[6].active = false;
|
||||||
let name = "gold_" + (i - 1)
|
const product = products[i - 1];
|
||||||
if (this.doubleInfo) {
|
let name = "gold_" + (i - 1)
|
||||||
console.log(name);
|
if (this.doubleInfo) {
|
||||||
console.log(this.doubleInfo[name]);
|
console.log(name);
|
||||||
if (this.doubleInfo[name] == false) {
|
console.log(this.doubleInfo[name]);
|
||||||
this.itemList.children[i].children[4].active = true;
|
if (this.doubleInfo[name] == false) {
|
||||||
this.itemList.children[i].children[5].active = true;
|
this.itemList.children[i].children[4].active = true;
|
||||||
this.itemList.children[i].children[6].active = true;
|
this.itemList.children[i].children[5].active = true;
|
||||||
|
this.itemList.children[i].children[6].active = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (spriteComp && product) {
|
||||||
|
// TODO: 根据 product_id 或 name 设置 spriteComp.spriteFrame
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (price && product) {
|
||||||
|
NumberToImage.numberToImageNodesShop(product.price / 100, 37, 20, "resultBlack_", price, false)
|
||||||
|
}
|
||||||
|
if (title && product) {
|
||||||
|
NumberToImage.numberToImageNodes(product.coin, 40, 25, "scoin_", title, true)
|
||||||
|
}
|
||||||
|
if (discount && product) {
|
||||||
|
NumberToImage.numberToImageNodesShop(product.coin, 40, 25, "new_coin_", discount, true)
|
||||||
|
let pos = cc.v2(discount.children[0].position.x, discount.children[0].position.y);
|
||||||
|
let number = i % 2 == 0 ? 34 : 42
|
||||||
|
add.x = pos.x + discount.x - number; add.y = pos.y + discount.y;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spriteComp && product) {
|
|
||||||
// TODO: 根据 product_id 或 name 设置 spriteComp.spriteFrame
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (price && product) {
|
|
||||||
NumberToImage.numberToImageNodesShop(product.price / 100, 37, 20, "resultBlack_", price, false)
|
|
||||||
}
|
|
||||||
if (title && product) {
|
|
||||||
NumberToImage.numberToImageNodes(product.coin, 40, 25, "scoin_", title, true)
|
|
||||||
}
|
|
||||||
if (discount && product) {
|
|
||||||
NumberToImage.numberToImageNodesShop(product.coin, 40, 25, "new_coin_", discount, true)
|
|
||||||
let pos = cc.v2(discount.children[0].position.x, discount.children[0].position.y);
|
|
||||||
let number = i % 2 == 0 ? 34 : 42
|
|
||||||
add.x = pos.x + discount.x - number; add.y = pos.y + discount.y;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -838,7 +841,8 @@ export default class NewClass extends cc.Component {
|
||||||
this.monthCardTime.active = false;
|
this.monthCardTime.active = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.monthTime, 35, 15, "button_", this.monthCardTime.children[1], true);
|
if (this.monthCardTime)
|
||||||
|
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.monthTime, 35, 15, "button_", this.monthCardTime.children[1], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
openConfirmBox() {
|
openConfirmBox() {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"last-module-event-record-time": 1768881764145,
|
"last-module-event-record-time": 1769499063709,
|
||||||
"group-list": [
|
"group-list": [
|
||||||
"default",
|
"default",
|
||||||
"Map"
|
"Map"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user