fix(game): 调整怪物生成逻辑和UI尺寸,优化资源图集
- 修复怪物生成时近战/远程类型与槽位不匹配的问题,增加槽位类型限制 - 调整加载界面进度条尺寸和颜色,优化视觉表现 - 修改任务主页组件,注释掉未使用的标签切换功能 - 更新资源图集布局,修正精灵帧坐标和旋转状态 - 调整英雄界面预制件的部分UI元素尺寸
This commit is contained in:
@@ -55,7 +55,7 @@ export class MissionHomeComp extends CCComp {
|
||||
home_active(){
|
||||
this.uodate_data()
|
||||
this.node.active=true
|
||||
this.switch_tab('home')
|
||||
// this.switch_tab('home')
|
||||
}
|
||||
uodate_data(){
|
||||
|
||||
@@ -63,25 +63,25 @@ export class MissionHomeComp extends CCComp {
|
||||
isWxClient(){
|
||||
return typeof wx !== 'undefined' && typeof (wx as any).getSystemInfoSync === 'function';
|
||||
}
|
||||
btn_func(e: any, data: string){
|
||||
if (['home', 'hero', 'rank'].includes(data)) {
|
||||
this.switch_tab(data);
|
||||
}
|
||||
}
|
||||
// btn_func(e: any, data: string){
|
||||
// if (['home', 'hero', 'rank'].includes(data)) {
|
||||
// this.switch_tab(data);
|
||||
// }
|
||||
// }
|
||||
|
||||
switch_tab(tab: string) {
|
||||
if (this.heros_page) this.heros_page.active = tab === 'hero';
|
||||
if (this.rank_page) this.rank_page.active = tab === 'rank';
|
||||
// switch_tab(tab: string) {
|
||||
// if (this.heros_page) this.heros_page.active = tab === 'hero';
|
||||
// if (this.rank_page) this.rank_page.active = tab === 'rank';
|
||||
|
||||
const setBtnActive = (btn: Node, isActive: boolean) => {
|
||||
const activeNode = btn?.getChildByName('active');
|
||||
if (activeNode) activeNode.active = isActive;
|
||||
}
|
||||
// const setBtnActive = (btn: Node, isActive: boolean) => {
|
||||
// const activeNode = btn?.getChildByName('active');
|
||||
// if (activeNode) activeNode.active = isActive;
|
||||
// }
|
||||
|
||||
setBtnActive(this.home_btn, tab === 'home');
|
||||
setBtnActive(this.hero_btn, tab === 'hero');
|
||||
setBtnActive(this.rank_btn, tab === 'rank');
|
||||
}
|
||||
// setBtnActive(this.home_btn, tab === 'home');
|
||||
// setBtnActive(this.hero_btn, tab === 'hero');
|
||||
// setBtnActive(this.rank_btn, tab === 'rank');
|
||||
// }
|
||||
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
|
||||
@@ -19,6 +19,7 @@ const { ccclass, property } = _decorator;
|
||||
export class MissionMonCompComp extends CCComp {
|
||||
private static readonly BOSS_RENDER_PRIORITY = 1000000;
|
||||
private static readonly MON_SLOT_COUNT = 6;
|
||||
private static readonly MON_FRONT_SLOT_COUNT = 3;
|
||||
private static readonly MON_SLOT_START_X = 30;
|
||||
private static readonly MON_SLOT_X_INTERVAL = 60;
|
||||
private static readonly MON_DROP_HEIGHT = 280;
|
||||
@@ -47,6 +48,7 @@ export class MissionMonCompComp extends CCComp {
|
||||
monLv: number,
|
||||
}>> = [];
|
||||
private slotOccupiedEids: Array<number | null> = [];
|
||||
private slotRangeTypes: Array<HType.Melee | HType.Long> = [];
|
||||
/** 全局生成顺序计数器,用于层级管理(预留) */
|
||||
private globalSpawnOrder: number = 0;
|
||||
/** 插队刷怪处理计时器 */
|
||||
@@ -148,6 +150,7 @@ export class MissionMonCompComp extends CCComp {
|
||||
this.waveSpawnedCount = 0;
|
||||
this.bossSpawnedInWave = false;
|
||||
this.waveSpawnTimer = this.waveSpawnCd;
|
||||
this.confirmWaveSlotTypes();
|
||||
this.primeWaveInitialBurst();
|
||||
oops.message.dispatchEvent(GameEvent.NewWave, {
|
||||
wave: this.currentWave,
|
||||
@@ -231,6 +234,14 @@ export class MissionMonCompComp extends CCComp {
|
||||
{ length: MissionMonCompComp.MON_SLOT_COUNT },
|
||||
() => null
|
||||
);
|
||||
this.confirmWaveSlotTypes();
|
||||
}
|
||||
|
||||
private confirmWaveSlotTypes() {
|
||||
this.slotRangeTypes = Array.from(
|
||||
{ length: MissionMonCompComp.MON_SLOT_COUNT },
|
||||
(_, index) => index < MissionMonCompComp.MON_FRONT_SLOT_COUNT ? HType.Melee : HType.Long
|
||||
);
|
||||
}
|
||||
|
||||
private hasPendingSlotQueue() {
|
||||
@@ -268,18 +279,34 @@ export class MissionMonCompComp extends CCComp {
|
||||
return occupied + this.slotSpawnQueues[slotIndex].length;
|
||||
}
|
||||
|
||||
private resolveSlotPriorityIndexes(uuid: number): number[] {
|
||||
private resolveMonsterSlotRange(uuid: number): HType.Melee | HType.Long {
|
||||
const type = HeroInfo[uuid]?.type;
|
||||
if (type === HType.Melee) {
|
||||
if (type === HType.Melee) return HType.Melee;
|
||||
return HType.Long;
|
||||
}
|
||||
|
||||
private resolveSlotPriorityIndexes(uuid: number): number[] {
|
||||
if (this.resolveMonsterSlotRange(uuid) === HType.Melee) {
|
||||
return [0, 1, 2, 3, 4, 5];
|
||||
}
|
||||
return [5, 4, 3, 2, 1, 0];
|
||||
}
|
||||
|
||||
private pickAssignSlotIndex(uuid: number): number {
|
||||
const expectedRange = this.resolveMonsterSlotRange(uuid);
|
||||
const slotPriority = this.resolveSlotPriorityIndexes(uuid);
|
||||
let bestLoad = Number.MAX_SAFE_INTEGER;
|
||||
let bestIndex = slotPriority[0] ?? 0;
|
||||
let bestIndex = -1;
|
||||
for (let i = 0; i < slotPriority.length; i++) {
|
||||
const index = slotPriority[i];
|
||||
if (this.slotRangeTypes[index] !== expectedRange) continue;
|
||||
const load = this.getSlotQueueLoad(index);
|
||||
if (load < bestLoad) {
|
||||
bestLoad = load;
|
||||
bestIndex = index;
|
||||
}
|
||||
}
|
||||
if (bestIndex >= 0) return bestIndex;
|
||||
for (let i = 0; i < slotPriority.length; i++) {
|
||||
const index = slotPriority[i];
|
||||
const load = this.getSlotQueueLoad(index);
|
||||
@@ -288,6 +315,7 @@ export class MissionMonCompComp extends CCComp {
|
||||
bestIndex = index;
|
||||
}
|
||||
}
|
||||
if (bestIndex >= 0) return bestIndex;
|
||||
return bestIndex;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user