Compare commits
4 Commits
3c4e1aad29
...
1437a7ee40
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1437a7ee40 | ||
|
|
9bd50d5a77 | ||
|
|
251cf715fb | ||
|
|
86cc55b226 |
File diff suppressed because it is too large
Load Diff
@@ -1290,7 +1290,7 @@
|
|||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": 0,
|
"x": -350,
|
||||||
"y": 93.364,
|
"y": 93.364,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
@@ -1345,7 +1345,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.PrefabInstance",
|
"__type__": "cc.PrefabInstance",
|
||||||
"fileId": "98sPdmBuhC94DR6vInBaLY",
|
"fileId": "b5euhUHTJKy51uYq8GiAyM",
|
||||||
"prefabRootNode": {
|
"prefabRootNode": {
|
||||||
"__id__": 1
|
"__id__": 1
|
||||||
},
|
},
|
||||||
@@ -1393,7 +1393,7 @@
|
|||||||
],
|
],
|
||||||
"value": {
|
"value": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": -290,
|
"x": 0,
|
||||||
"y": 0,
|
"y": 0,
|
||||||
"z": 0
|
"z": 0
|
||||||
}
|
}
|
||||||
@@ -1448,7 +1448,7 @@
|
|||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
"x": 0.5,
|
"x": 0,
|
||||||
"y": 0.5
|
"y": 0.5
|
||||||
},
|
},
|
||||||
"_id": ""
|
"_id": ""
|
||||||
@@ -1501,7 +1501,7 @@
|
|||||||
"node": {
|
"node": {
|
||||||
"__id__": 49
|
"__id__": 49
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": false,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 63
|
"__id__": 63
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ export const FormationPointX = {
|
|||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const HeroDisVal: Record<HType.Melee | HType.Mid | HType.Long, number> = {
|
export const HeroDisVal: Record<HType.Melee | HType.Mid | HType.Long, number> = {
|
||||||
[HType.Melee]: 360,
|
[HType.Melee]: 260,
|
||||||
[HType.Mid]: 400,
|
[HType.Mid]: 400,
|
||||||
[HType.Long]: 720,
|
[HType.Long]: 660,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const resolveFormationTargetX = (fac: FacSet, type: HType): number => {
|
export const resolveFormationTargetX = (fac: FacSet, type: HType): number => {
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ export class Monster extends ecs.Entity {
|
|||||||
const move = this.get(MoveComp);
|
const move = this.get(MoveComp);
|
||||||
move.reset();
|
move.reset();
|
||||||
move.direction = -1;
|
move.direction = -1;
|
||||||
move.targetX = Math.max(-320, Math.min(320, pos.x));
|
move.targetX = pos.x;
|
||||||
move.baseY = dropToY;
|
move.baseY = dropToY;
|
||||||
move.moving = false;
|
move.moving = false;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { HeroViewComp } from "./HeroViewComp";
|
|||||||
import { HeroAttrsComp } from "./HeroAttrsComp";
|
import { HeroAttrsComp } from "./HeroAttrsComp";
|
||||||
import { smc } from "../common/SingletonModuleComp";
|
import { smc } from "../common/SingletonModuleComp";
|
||||||
import { FacSet } from "../common/config/GameSet";
|
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";
|
import { BoxCollider2D, Node } from "cc";
|
||||||
|
|
||||||
@ecs.register('MoveComp')
|
@ecs.register('MoveComp')
|
||||||
@@ -49,6 +49,8 @@ interface MoveFacConfig {
|
|||||||
export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate {
|
export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate {
|
||||||
/** 近战判定射程(来自 heroSet) */
|
/** 近战判定射程(来自 heroSet) */
|
||||||
private readonly meleeAttackRange = HeroDisVal[HType.Melee];
|
private readonly meleeAttackRange = HeroDisVal[HType.Melee];
|
||||||
|
private readonly heroFrontAnchorX = -30;
|
||||||
|
private readonly monFrontAnchorX = 30;
|
||||||
/** 常规同阵营横向最小间距 */
|
/** 常规同阵营横向最小间距 */
|
||||||
private readonly allySpacingX = 60;
|
private readonly allySpacingX = 60;
|
||||||
/** 纵向判定为同排的最大 Y 差 */
|
/** 纵向判定为同排的最大 Y 差 */
|
||||||
@@ -67,16 +69,16 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
|||||||
*/
|
*/
|
||||||
private readonly facConfigs: Record<number, MoveFacConfig> = {
|
private readonly facConfigs: Record<number, MoveFacConfig> = {
|
||||||
[FacSet.HERO]: {
|
[FacSet.HERO]: {
|
||||||
moveFrontX: 320,
|
moveFrontX: 999999,
|
||||||
moveBackX: -320,
|
moveBackX: -999999,
|
||||||
retreatFrontX: 300,
|
retreatFrontX: 999999,
|
||||||
retreatBackX: -300,
|
retreatBackX: -999999,
|
||||||
},
|
},
|
||||||
[FacSet.MON]: {
|
[FacSet.MON]: {
|
||||||
moveFrontX: -320,
|
moveFrontX: -999999,
|
||||||
moveBackX: 320,
|
moveBackX: 999999,
|
||||||
retreatFrontX: -300,
|
retreatFrontX: -999999,
|
||||||
retreatBackX: 300,
|
retreatBackX: 999999,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -239,7 +241,7 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
|||||||
return a.eid - b.eid;
|
return a.eid - b.eid;
|
||||||
});
|
});
|
||||||
const slotIndex = Math.max(0, laneAllies.findIndex(entity => entity === self));
|
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;
|
const targetX = frontAnchorX - forwardDir * slotIndex * this.allySpacingX;
|
||||||
return Math.max(moveMinX, Math.min(moveMaxX, targetX));
|
return Math.max(moveMinX, Math.min(moveMaxX, targetX));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { smc } from "../common/SingletonModuleComp";
|
|||||||
import { HeroInfo, HType } from "../common/config/heroSet";
|
import { HeroInfo, HType } from "../common/config/heroSet";
|
||||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||||
import { FacSet } from "../common/config/GameSet";
|
import { FacSet } from "../common/config/GameSet";
|
||||||
|
import { MoveComp } from "../hero/MoveComp";
|
||||||
|
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@@ -60,7 +61,8 @@ export class MissionCardComp extends CCComp {
|
|||||||
private cardComps: CardComp[] = [];
|
private cardComps: CardComp[] = [];
|
||||||
/** 当前卡池等级(仅影响抽卡来源,不直接改卡槽现有内容) */
|
/** 当前卡池等级(仅影响抽卡来源,不直接改卡槽现有内容) */
|
||||||
private poolLv: number = CARD_POOL_INIT_LEVEL;
|
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 heroInfoSyncTimer: number = 0;
|
||||||
private hasCachedCardsBaseScale: boolean = false;
|
private hasCachedCardsBaseScale: boolean = false;
|
||||||
private cardsBaseScale: Vec3 = new Vec3(1, 1, 1);
|
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++) {
|
for (let i = 0; i < removeKeys.length; i++) {
|
||||||
this.heroInfoItems.delete(removeKeys[i]);
|
this.heroInfoItems.delete(removeKeys[i]);
|
||||||
}
|
}
|
||||||
if (removeKeys.length > 0) {
|
|
||||||
this.relayoutHeroInfoPanels();
|
this.relayoutHeroInfoPanels();
|
||||||
}
|
|
||||||
this.updateHeroNumUI(false, false);
|
this.updateHeroNumUI(false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -628,13 +628,30 @@ export class MissionCardComp extends CCComp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private relayoutHeroInfoPanels() {
|
private relayoutHeroInfoPanels() {
|
||||||
let index = 0;
|
const sortedItems = [...this.heroInfoItems.values()].sort((a, b) => {
|
||||||
this.heroInfoItems.forEach(item => {
|
const aEnt = (a.model as any)?.ent as ecs.Entity | undefined;
|
||||||
if (!item.node || !item.node.isValid) return;
|
const bEnt = (b.model as any)?.ent as ecs.Entity | undefined;
|
||||||
const pos = item.node.position;
|
const aView = aEnt?.get(HeroViewComp);
|
||||||
item.node.setPosition(pos.x, -index * this.heroInfoItemGap, pos.z);
|
const bView = bEnt?.get(HeroViewComp);
|
||||||
index += 1;
|
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() {
|
private clearHeroInfoPanels() {
|
||||||
|
|||||||
Reference in New Issue
Block a user