4 Commits

Author SHA1 Message Date
panw
1437a7ee40 feat(ui): 调整英雄信息面板布局和排序逻辑
- 将英雄信息面板从垂直排列改为水平排列,增加间距
- 实现按英雄位置、生成顺序和实体ID的排序逻辑
- 调整相关UI元素的锚点、位置和组件状态
- 更新预制体引用和布局参数以支持新的排列方式
2026-03-31 16:00:28 +08:00
panw
9bd50d5a77 fix: 调整近战与远程英雄的初始站位距离
将近战英雄的初始站位距离从360减少至260,远程英雄从720减少至660,以优化阵型布局和战斗初始位置。
2026-03-31 15:21:10 +08:00
panw
251cf715fb refactor(game): 移除resolveFormationTargetX依赖并内联阵型锚点计算
简化阵型目标X坐标的计算逻辑,直接根据阵营使用预定义的锚点值,避免导入和调用额外的工具函数。
2026-03-31 15:19:03 +08:00
panw
86cc55b226 fix: 移除怪物移动位置限制并扩大移动边界
移除怪物移动目标位置的水平坐标限制,使其可以移动到任意X坐标。
同时将英雄和怪物的移动边界值扩大到极大值,以消除移动范围限制。
2026-03-31 15:10:13 +08:00
6 changed files with 322 additions and 186 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1290,7 +1290,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"x": -350,
"y": 93.364,
"z": 0
},
@@ -1345,7 +1345,7 @@
},
{
"__type__": "cc.PrefabInstance",
"fileId": "98sPdmBuhC94DR6vInBaLY",
"fileId": "b5euhUHTJKy51uYq8GiAyM",
"prefabRootNode": {
"__id__": 1
},
@@ -1393,7 +1393,7 @@
],
"value": {
"__type__": "cc.Vec3",
"x": -290,
"x": 0,
"y": 0,
"z": 0
}
@@ -1448,7 +1448,7 @@
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"x": 0,
"y": 0.5
},
"_id": ""
@@ -1501,7 +1501,7 @@
"node": {
"__id__": 49
},
"_enabled": true,
"_enabled": false,
"__prefab": {
"__id__": 63
},

View File

@@ -26,9 +26,9 @@ export const FormationPointX = {
} as const;
export const HeroDisVal: Record<HType.Melee | HType.Mid | HType.Long, number> = {
[HType.Melee]: 360,
[HType.Melee]: 260,
[HType.Mid]: 400,
[HType.Long]: 720,
[HType.Long]: 660,
}
export const resolveFormationTargetX = (fac: FacSet, type: HType): number => {

View File

@@ -189,7 +189,7 @@ export class Monster extends ecs.Entity {
const move = this.get(MoveComp);
move.reset();
move.direction = -1;
move.targetX = Math.max(-320, Math.min(320, pos.x));
move.targetX = pos.x;
move.baseY = dropToY;
move.moving = false;

View File

@@ -3,7 +3,7 @@ import { HeroViewComp } from "./HeroViewComp";
import { HeroAttrsComp } from "./HeroAttrsComp";
import { smc } from "../common/SingletonModuleComp";
import { FacSet } from "../common/config/GameSet";
import { HeroDisVal, HType, resolveFormationTargetX } from "../common/config/heroSet";
import { HeroDisVal, HType } from "../common/config/heroSet";
import { BoxCollider2D, Node } from "cc";
@ecs.register('MoveComp')
@@ -49,6 +49,8 @@ interface MoveFacConfig {
export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate {
/** 近战判定射程(来自 heroSet */
private readonly meleeAttackRange = HeroDisVal[HType.Melee];
private readonly heroFrontAnchorX = -30;
private readonly monFrontAnchorX = 30;
/** 常规同阵营横向最小间距 */
private readonly allySpacingX = 60;
/** 纵向判定为同排的最大 Y 差 */
@@ -67,16 +69,16 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
*/
private readonly facConfigs: Record<number, MoveFacConfig> = {
[FacSet.HERO]: {
moveFrontX: 320,
moveBackX: -320,
retreatFrontX: 300,
retreatBackX: -300,
moveFrontX: 999999,
moveBackX: -999999,
retreatFrontX: 999999,
retreatBackX: -999999,
},
[FacSet.MON]: {
moveFrontX: -320,
moveBackX: 320,
retreatFrontX: -300,
retreatBackX: 300,
moveFrontX: -999999,
moveBackX: 999999,
retreatFrontX: -999999,
retreatBackX: 999999,
}
};
@@ -239,7 +241,7 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
return a.eid - b.eid;
});
const slotIndex = Math.max(0, laneAllies.findIndex(entity => entity === self));
const frontAnchorX = resolveFormationTargetX(model.fac, HType.Melee);
const frontAnchorX = model.fac === FacSet.MON ? this.monFrontAnchorX : this.heroFrontAnchorX;
const targetX = frontAnchorX - forwardDir * slotIndex * this.allySpacingX;
return Math.max(moveMinX, Math.min(moveMaxX, targetX));
}

View File

@@ -12,6 +12,7 @@ import { smc } from "../common/SingletonModuleComp";
import { HeroInfo, HType } from "../common/config/heroSet";
import { HeroViewComp } from "../hero/HeroViewComp";
import { FacSet } from "../common/config/GameSet";
import { MoveComp } from "../hero/MoveComp";
const { ccclass, property } = _decorator;
@@ -60,7 +61,8 @@ export class MissionCardComp extends CCComp {
private cardComps: CardComp[] = [];
/** 当前卡池等级(仅影响抽卡来源,不直接改卡槽现有内容) */
private poolLv: number = CARD_POOL_INIT_LEVEL;
private readonly heroInfoItemGap: number = 86;
private readonly heroInfoItemGap: number = 110;
private readonly heroInfoItemSpacing: number = 10;
private heroInfoSyncTimer: number = 0;
private hasCachedCardsBaseScale: boolean = false;
private cardsBaseScale: Vec3 = new Vec3(1, 1, 1);
@@ -613,9 +615,7 @@ export class MissionCardComp extends CCComp {
for (let i = 0; i < removeKeys.length; i++) {
this.heroInfoItems.delete(removeKeys[i]);
}
if (removeKeys.length > 0) {
this.relayoutHeroInfoPanels();
}
this.relayoutHeroInfoPanels();
this.updateHeroNumUI(false, false);
}
@@ -628,13 +628,30 @@ export class MissionCardComp extends CCComp {
}
private relayoutHeroInfoPanels() {
let index = 0;
this.heroInfoItems.forEach(item => {
if (!item.node || !item.node.isValid) return;
const pos = item.node.position;
item.node.setPosition(pos.x, -index * this.heroInfoItemGap, pos.z);
index += 1;
const sortedItems = [...this.heroInfoItems.values()].sort((a, b) => {
const aEnt = (a.model as any)?.ent as ecs.Entity | undefined;
const bEnt = (b.model as any)?.ent as ecs.Entity | undefined;
const aView = aEnt?.get(HeroViewComp);
const bView = bEnt?.get(HeroViewComp);
const aMove = aEnt?.get(MoveComp);
const bMove = bEnt?.get(MoveComp);
const aFrontScore = aView?.node?.position?.x ?? -999999;
const bFrontScore = bView?.node?.position?.x ?? -999999;
if (aFrontScore !== bFrontScore) return aFrontScore - bFrontScore;
const aSpawnOrder = aMove?.spawnOrder ?? 0;
const bSpawnOrder = bMove?.spawnOrder ?? 0;
if (aSpawnOrder !== bSpawnOrder) return aSpawnOrder - bSpawnOrder;
const aEid = aEnt?.eid ?? 0;
const bEid = bEnt?.eid ?? 0;
return aEid - bEid;
});
for (let index = 0; index < sortedItems.length; index++) {
const item = sortedItems[index];
if (!item.node || !item.node.isValid) continue;
const pos = item.node.position;
item.node.setPosition(index * (this.heroInfoItemGap + this.heroInfoItemSpacing), pos.y, pos.z);
item.node.setSiblingIndex(index);
}
}
private clearHeroInfoPanels() {