1050关卡版本

This commit is contained in:
COMPUTER\EDY 2026-01-27 16:09:55 +08:00
parent 230fd53604
commit ffe40e4873
7 changed files with 171 additions and 105 deletions

View File

@ -644,14 +644,19 @@ export default class JiaZai extends cc.Component {
"kuang"
]
rightElements.forEach(elementName => {
if (this.node) {
let element;
if (elementName === "Pause") {
if (this.node.getChildByName(elementName))
element = this.node.getChildByName(elementName);
} else if (elementName === "popRank") {
if (this.node.getChildByName("rank"))
element = this.node.getChildByName("rank");
} else if (elementName === "tiaodik" || elementName === "shezhiBtn") {
if (loadNode)
element = loadNode.getChildByName(elementName);
} else {
if (loadNode)
element = loadNode.getChildByName("Top").getChildByName(elementName);
}
@ -662,6 +667,8 @@ export default class JiaZai extends cc.Component {
element.x = designSize.width / 2 - element.originalRightOffset + barWidth / scale;
element.scale = hmScale;
}
}
});
rightElements2.forEach(elementName => {
let element;

View File

@ -676,7 +676,16 @@ export default class MapConroler extends cc.Component {
blockInit() {
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);
// this.floorSort(blockArray);
//console.log("创建方块", blockArray);
let index = 0; // 当前要创建的方块索引
let BLOCKS_PER_FRAME = 1; // 初始每帧创建的方块数量
@ -687,11 +696,7 @@ export default class MapConroler extends cc.Component {
const startTime = performance.now();
for (let i = 0; i < BLOCKS_PER_FRAME && index < blockArray.length; i++) {
let blockInfo = blockArray[index];
if (blockInfo.floorMove != null && blockInfo.floorMove != undefined) {
if (blockInfo.floorMove) {
this.floorMove = true;
}
}
// 缓存 Block_Array 访问
const blockPrefab = this.Block_Array[blockInfo.block];
let block = cc.instantiate(blockPrefab);
@ -793,8 +798,35 @@ export default class MapConroler extends cc.Component {
createBlocks();
}
//给创建方块排序用来降低drawcall 合批
sortBlock(allBlocks: { color: number; block: number; type: number }[]) {
sortBlock(allBlocks: { color: number; block: number; type: number; floor: number }[]) {
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 的情况,将其放到最后
if (a.type === 1 && b.type !== 1) {
return 1;
@ -827,6 +859,9 @@ export default class MapConroler extends cc.Component {
});
}
//创建墙壁
wallInit() {
@ -837,6 +872,7 @@ export default class MapConroler extends cc.Component {
const createWalls = () => {
const startTime = performance.now();
if (this.wallInfo) {
for (let i = 0; i < WALLS_PER_FRAME && index < this.wallInfo.length; i++) {
let block = this.wallInfo[index];
let dir = this.getWllDiraction("wall", cc.v2(block.getComponent("MapBlock").posX, block.getComponent("MapBlock").posY));
@ -867,6 +903,8 @@ export default class MapConroler extends cc.Component {
this.createRevolvingWall();
}
}
}
};
// 开始分帧创建墙壁
@ -2689,6 +2727,7 @@ export default class MapConroler extends cc.Component {
for (let i = 0; i < this.blocks.length; i++) {
if (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 == true) {
if (this.teamBlocks.length == 0) {
@ -2745,7 +2784,7 @@ export default class MapConroler extends cc.Component {
}
removeFloor() {
// console.log("结束");
console.log("结束__________");
if (this.teamBlocks.length > 0) {
for (let j = 0; j < this.teamBlocks.length; j++) {
this.teamBlocks[j].getComponent("Block").setMoveFloor();

View File

@ -135,6 +135,7 @@ export default class CareerList extends cc.Component {
this.randerChildren = [];
this.itemHeight = this.itemRender.height;
this.itemWidth = this.itemRender.width;
if (this.node)
this.scrollView = this.node.getComponent(cc.ScrollView);
this.content = this.scrollView.content;
this.content.anchorX = 0;
@ -232,11 +233,13 @@ export default class CareerList extends cc.Component {
continue;
}
if (item) {
let itemRender: CareerItem = item.getComponent(CareerItem);
itemRender.itemIndex = i + startIndex;
itemRender.data = this.itemDataList[i + startIndex];
itemRender.dataChanged();
}
// 计算firstRender的高度偏移
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) => {
if (texture && node) {
// node.getChildByName("pic").active = true;
if (node.getComponent(cc.Sprite)) {
var sprite = node.getComponent(cc.Sprite);
sprite.spriteFrame = new cc.SpriteFrame(texture);
}
}
else {

View File

@ -22,22 +22,29 @@ export default class CareerManager extends cc.Component {
}
//初始化数据
init(data, topData) {
this.rankList = cc.find("ScrollView", this.node).getComponent(CareerList);
this.listData = data;
this.selfData = null;
this.rankNumber = 100;
this.rankTotal = 100;
if (this.node) {
this.rankList = cc.find("ScrollView", this.node).getComponent(CareerList);
this.rankList.setData(data, topData);
}
// 获取当前日期
let currentDate = new Date();
let month = currentDate.getMonth() + 1;
let day = currentDate.getDate();
if (this.bg) {
if (this.bg.getChildByName("month"))
this.bg.getChildByName("month").getComponent(cc.Label).string = month.toString();
if (this.bg.getChildByName("day"))
this.bg.getChildByName("day").getComponent(cc.Label).string = day.toString();
}
}
start() {
}

View File

@ -396,9 +396,12 @@ export default class PassCheckItem extends cc.Component {
private setNodeGray(node: cc.Node, color?: cc.Color) {
let setColor = color || cc.color(190, 190, 190, 255);
if (node) {
for (let i = 0; i < node.children.length; i++) {
// console.log("设置子节点颜色", node.children[i]);
node.children[i].color = setColor;
}
}
}
}

View File

@ -143,6 +143,7 @@ export default class NewClass extends cc.Component {
{ product_id: "gold_5", price: 32800, coin: 100000, title: "" },
{ product_id: "gold_6", price: 64800, coin: 240000, title: "" },
];
if (this.itemList) {
for (let i = 2; i <= 7 && i < this.itemList.children.length; i++) {
const spriteComp = this.itemList.children[i].children[0].getComponent(cc.Sprite);
const price = this.itemList.children[i].children[1];
@ -185,6 +186,8 @@ export default class NewClass extends cc.Component {
}
}
}
startCoinAnim(target: number) {
@ -838,6 +841,7 @@ export default class NewClass extends cc.Component {
this.monthCardTime.active = false;
}
if (this.monthCardTime)
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.monthTime, 35, 15, "button_", this.monthCardTime.children[1], true);
}

View File

@ -1,5 +1,5 @@
{
"last-module-event-record-time": 1768881764145,
"last-module-event-record-time": 1769499063709,
"group-list": [
"default",
"Map"