refactor(hero/map): 重命名MissionHeroCompComp为MissionHeroComp
修改所有引用该组件的文件,统一组件命名,包括导入语句、类定义、静态属性调用以及相关注释,未变更原有业务逻辑。
This commit is contained in:
@@ -46,7 +46,7 @@ interface MoveFacConfig {
|
|||||||
retreatBackX: number;
|
retreatBackX: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
import { MissionHeroCompComp } from "../map/MissionHeroComp";
|
import { MissionHeroComp } from "../map/MissionHeroComp";
|
||||||
|
|
||||||
@ecs.register('MoveSystem')
|
@ecs.register('MoveSystem')
|
||||||
export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate {
|
export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate {
|
||||||
@@ -253,7 +253,7 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
|||||||
// 优先中前(1) -> 上前(0) -> 下前(2) -> 中后(4) -> 上后(3) -> 下后(5)
|
// 优先中前(1) -> 上前(0) -> 下前(2) -> 中后(4) -> 上后(3) -> 下后(5)
|
||||||
const slotPriority = [1, 0, 2, 4, 3, 5];
|
const slotPriority = [1, 0, 2, 4, 3, 5];
|
||||||
const posIndex = slotPriority[slotIndex % 6];
|
const posIndex = slotPriority[slotIndex % 6];
|
||||||
const pos = MissionHeroCompComp.HERO_POSITIONS[posIndex];
|
const pos = MissionHeroComp.HERO_POSITIONS[posIndex];
|
||||||
|
|
||||||
return { targetX: pos.x, targetY: pos.y };
|
return { targetX: pos.x, targetY: pos.y };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import { GameEvent } from "../common/config/GameEvent";
|
|||||||
import { oops } from "db://oops-framework/core/Oops";
|
import { oops } from "db://oops-framework/core/Oops";
|
||||||
import { UIID } from "../common/config/GameUIConfig";
|
import { UIID } from "../common/config/GameUIConfig";
|
||||||
import { mLogger } from "../common/Logger";
|
import { mLogger } from "../common/Logger";
|
||||||
import { MissionHeroCompComp } from "./MissionHeroComp";
|
import { MissionHeroComp } from "./MissionHeroComp";
|
||||||
import { MoveComp } from "../hero/MoveComp";
|
import { MoveComp } from "../hero/MoveComp";
|
||||||
import { FacSet } from "../common/config/GameSet";
|
import { FacSet } from "../common/config/GameSet";
|
||||||
import { MissionEconomy } from "./MissionEconomy";
|
import { MissionEconomy } from "./MissionEconomy";
|
||||||
@@ -107,7 +107,7 @@ export class HInfoComp extends CCComp {
|
|||||||
*/
|
*/
|
||||||
refreshByNodeIndex() {
|
refreshByNodeIndex() {
|
||||||
if (this.node_index < 1 || this.node_index > 6) return;
|
if (this.node_index < 1 || this.node_index > 6) return;
|
||||||
const targetPos = MissionHeroCompComp.HERO_POSITIONS[this.node_index - 1];
|
const targetPos = MissionHeroComp.HERO_POSITIONS[this.node_index - 1];
|
||||||
|
|
||||||
let foundModel: HeroAttrsComp | null = null;
|
let foundModel: HeroAttrsComp | null = null;
|
||||||
let foundEid: number = 0;
|
let foundEid: number = 0;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
* - HInfoComp —— 英雄信息面板
|
* - HInfoComp —— 英雄信息面板
|
||||||
* - CardSet 模块 —— 卡池配置、抽卡规则、特殊卡数据
|
* - CardSet 模块 —— 卡池配置、抽卡规则、特殊卡数据
|
||||||
* - HeroAttrsComp —— 英雄属性(合成校验 / 升级)
|
* - HeroAttrsComp —— 英雄属性(合成校验 / 升级)
|
||||||
* - MissionHeroCompComp —— 获取合成规则(needCount / maxLv)
|
* - MissionHeroComp —— 获取合成规则(needCount / maxLv)
|
||||||
* - smc.vmdata.mission_data —— 局内数据(coin / hero_num / hero_max_num)
|
* - smc.vmdata.mission_data —— 局内数据(coin / hero_num / hero_max_num)
|
||||||
*/
|
*/
|
||||||
import { mLogger } from "../common/Logger";
|
import { mLogger } from "../common/Logger";
|
||||||
@@ -47,7 +47,7 @@ import { HeroInfo, HType } from "../common/config/heroSet";
|
|||||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||||
import { FacSet, FightSet } from "../common/config/GameSet";
|
import { FacSet, FightSet } from "../common/config/GameSet";
|
||||||
import { MoveComp } from "../hero/MoveComp";
|
import { MoveComp } from "../hero/MoveComp";
|
||||||
import { MissionHeroCompComp } from "./MissionHeroComp";
|
import { MissionHeroComp } from "./MissionHeroComp";
|
||||||
import { TalentType } from "../common/config/TalentSet";
|
import { TalentType } from "../common/config/TalentSet";
|
||||||
import { MissionEconomy } from "./MissionEconomy";
|
import { MissionEconomy } from "./MissionEconomy";
|
||||||
|
|
||||||
@@ -479,15 +479,15 @@ export class MissionCardComp extends CCComp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 从 MissionHeroCompComp 实时读取合成规则。
|
* 从 MissionHeroComp 实时读取合成规则。
|
||||||
* 通过 ECS 查询获取,避免硬编码与 MissionHeroComp 不一致。
|
* 通过 ECS 查询获取,避免硬编码与 MissionHeroComp 不一致。
|
||||||
* @returns { needCount: 合成所需数量, maxLv: 最大合成等级 }
|
* @returns { needCount: 合成所需数量, maxLv: 最大合成等级 }
|
||||||
*/
|
*/
|
||||||
private getMergeRule(): { needCount: number, maxLv: number } {
|
private getMergeRule(): { needCount: number, maxLv: number } {
|
||||||
let needCount = FightSet.MERGE_NEED ? FightSet.MERGE_NEED:2
|
let needCount = FightSet.MERGE_NEED ? FightSet.MERGE_NEED:2
|
||||||
let maxLv = Math.max(1, Math.floor(FightSet.MERGE_MAX ?? 3));
|
let maxLv = Math.max(1, Math.floor(FightSet.MERGE_MAX ?? 3));
|
||||||
ecs.query(ecs.allOf(MissionHeroCompComp)).forEach((entity: ecs.Entity) => {
|
ecs.query(ecs.allOf(MissionHeroComp)).forEach((entity: ecs.Entity) => {
|
||||||
const comp = entity.get(MissionHeroCompComp);
|
const comp = entity.get(MissionHeroComp);
|
||||||
if (!comp) return;
|
if (!comp) return;
|
||||||
needCount = comp.merge_need_count === 2 ? 2 : 3;
|
needCount = comp.merge_need_count === 2 ? 2 : 3;
|
||||||
maxLv = Math.max(1, Math.floor(comp.merge_max_lv ?? 3));
|
maxLv = Math.max(1, Math.floor(comp.merge_max_lv ?? 3));
|
||||||
|
|||||||
@@ -43,14 +43,14 @@ import { MoveComp } from "../hero/MoveComp";
|
|||||||
const { ccclass } = _decorator;
|
const { ccclass } = _decorator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MissionHeroCompComp —— 英雄召唤与合成管理器
|
* MissionHeroComp —— 英雄召唤与合成管理器
|
||||||
*
|
*
|
||||||
* 管理英雄的召唤请求队列、出生动画和合成系统。
|
* 管理英雄的召唤请求队列、出生动画和合成系统。
|
||||||
* 合成支持 2 合 1 或 3 合 1,且可链式合成至上限等级。
|
* 合成支持 2 合 1 或 3 合 1,且可链式合成至上限等级。
|
||||||
*/
|
*/
|
||||||
@ccclass('MissionHeroCompComp')
|
@ccclass('MissionHeroComp')
|
||||||
@ecs.register('MissionHeroComp', false)
|
@ecs.register('MissionHeroComp', false)
|
||||||
export class MissionHeroCompComp extends CCComp {
|
export class MissionHeroComp extends CCComp {
|
||||||
// ======================== 常量 ========================
|
// ======================== 常量 ========================
|
||||||
|
|
||||||
/** 硬编码的6个英雄占位点 */
|
/** 硬编码的6个英雄占位点 */
|
||||||
@@ -135,7 +135,7 @@ export class MissionHeroCompComp extends CCComp {
|
|||||||
const landingPos = this.pickPositionForHero([hero.eid]);
|
const landingPos = this.pickPositionForHero([hero.eid]);
|
||||||
// 不再直接设置位置,而是播放下落入场动画
|
// 不再直接设置位置,而是播放下落入场动画
|
||||||
// 计算出出生点(空中)
|
// 计算出出生点(空中)
|
||||||
const spawnPos: Vec3 = v3(landingPos.x, landingPos.y + MissionHeroCompComp.HERO_DROP_HEIGHT, 0);
|
const spawnPos: Vec3 = v3(landingPos.x, landingPos.y + MissionHeroComp.HERO_DROP_HEIGHT, 0);
|
||||||
view.node.setPosition(spawnPos);
|
view.node.setPosition(spawnPos);
|
||||||
hero.playDropAnim(spawnPos, landingPos.y);
|
hero.playDropAnim(spawnPos, landingPos.y);
|
||||||
}
|
}
|
||||||
@@ -181,8 +181,8 @@ export class MissionHeroCompComp extends CCComp {
|
|||||||
for (const h of heroes) {
|
for (const h of heroes) {
|
||||||
const move = h.get(MoveComp); // MoveComp 记录了英雄当前的目标位置
|
const move = h.get(MoveComp); // MoveComp 记录了英雄当前的目标位置
|
||||||
if (move) {
|
if (move) {
|
||||||
for (let i = 0; i < MissionHeroCompComp.HERO_POSITIONS.length; i++) {
|
for (let i = 0; i < MissionHeroComp.HERO_POSITIONS.length; i++) {
|
||||||
const pos = MissionHeroCompComp.HERO_POSITIONS[i];
|
const pos = MissionHeroComp.HERO_POSITIONS[i];
|
||||||
if (Math.abs(move.targetX - pos.x) < 2 && Math.abs(move.baseY - pos.y) < 2) {
|
if (Math.abs(move.targetX - pos.x) < 2 && Math.abs(move.baseY - pos.y) < 2) {
|
||||||
occupied.add(i);
|
occupied.add(i);
|
||||||
break;
|
break;
|
||||||
@@ -195,12 +195,12 @@ export class MissionHeroCompComp extends CCComp {
|
|||||||
const slotPriority = [1, 0, 2, 4, 3, 5];
|
const slotPriority = [1, 0, 2, 4, 3, 5];
|
||||||
for (const idx of slotPriority) {
|
for (const idx of slotPriority) {
|
||||||
if (!occupied.has(idx)) {
|
if (!occupied.has(idx)) {
|
||||||
return MissionHeroCompComp.HERO_POSITIONS[idx];
|
return MissionHeroComp.HERO_POSITIONS[idx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 溢出:默认中前
|
// 溢出:默认中前
|
||||||
return MissionHeroCompComp.HERO_POSITIONS[1];
|
return MissionHeroComp.HERO_POSITIONS[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -218,7 +218,7 @@ export class MissionHeroCompComp extends CCComp {
|
|||||||
let hero = ecs.getEntity<Hero>(Hero);
|
let hero = ecs.getEntity<Hero>(Hero);
|
||||||
let scale = 1
|
let scale = 1
|
||||||
const landingPos = this.pickPositionForHero();
|
const landingPos = this.pickPositionForHero();
|
||||||
let spawnPos:Vec3 = v3(landingPos.x, landingPos.y + MissionHeroCompComp.HERO_DROP_HEIGHT, 0);
|
let spawnPos:Vec3 = v3(landingPos.x, landingPos.y + MissionHeroComp.HERO_DROP_HEIGHT, 0);
|
||||||
hero.load(spawnPos,scale,uuid,landingPos.y,hero_lv,pool_lv);
|
hero.load(spawnPos,scale,uuid,landingPos.y,hero_lv,pool_lv);
|
||||||
|
|
||||||
// 召唤完成后,派发事件以更新英雄面板
|
// 召唤完成后,派发事件以更新英雄面板
|
||||||
@@ -252,7 +252,7 @@ export class MissionHeroCompComp extends CCComp {
|
|||||||
let scale = 1
|
let scale = 1
|
||||||
|
|
||||||
const landingPos = targetPos || this.pickPositionForHero();
|
const landingPos = targetPos || this.pickPositionForHero();
|
||||||
let spawnPos:Vec3 = v3(landingPos.x, landingPos.y + MissionHeroCompComp.HERO_DROP_HEIGHT, 0);
|
let spawnPos:Vec3 = v3(landingPos.x, landingPos.y + MissionHeroComp.HERO_DROP_HEIGHT, 0);
|
||||||
hero.load(spawnPos,scale,uuid,landingPos.y,hero_lv,pool_lv);
|
hero.load(spawnPos,scale,uuid,landingPos.y,hero_lv,pool_lv);
|
||||||
|
|
||||||
// 召唤完成后,派发事件以更新英雄面板
|
// 召唤完成后,派发事件以更新英雄面板
|
||||||
@@ -501,7 +501,7 @@ export class MissionHeroCompComp extends CCComp {
|
|||||||
|
|
||||||
// 计算目标出生点(提前排除素材英雄所占的位置)
|
// 计算目标出生点(提前排除素材英雄所占的位置)
|
||||||
const landingPos = this.pickPositionForHero(mergeEids);
|
const landingPos = this.pickPositionForHero(mergeEids);
|
||||||
const spawnPos:Vec3 = v3(landingPos.x, landingPos.y + MissionHeroCompComp.HERO_DROP_HEIGHT, 0);
|
const spawnPos:Vec3 = v3(landingPos.x, landingPos.y + MissionHeroComp.HERO_DROP_HEIGHT, 0);
|
||||||
|
|
||||||
// 汇聚 → 特效 → 生成
|
// 汇聚 → 特效 → 生成
|
||||||
await this.mergeDestroyAtBirth(mergeHeroes, spawnPos);
|
await this.mergeDestroyAtBirth(mergeHeroes, spawnPos);
|
||||||
|
|||||||
Reference in New Issue
Block a user