feat(gui): 优化角色界面Prefab结构与按钮交互

- 调整角色控制器Prefab中节点的组件ID引用
- 修正部分节点的激活状态与位置信息
- 更新按钮组件及点击事件绑定,改进英雄购买交互逻辑
- 替换文本标签组件,新增字体样式与阴影效果提升可读性
- 增加背景与装饰组件,优化界面视觉层次与布局
- 调整图片资源引用,修改部分Sprite颜色及灰度设置
- 优化UITransform组件配置,调整节点尺寸与锚点位置
- 引入新的Widget组件,完善布局自适应能力
- 增加输入事件阻断组件,防止界面误触操作
- 整体提升界面元素结构清晰度与交互体验一致性
This commit is contained in:
2025-10-20 23:37:38 +08:00
parent 5ce02c95f5
commit e011cba047
4 changed files with 833 additions and 252 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -23,15 +23,16 @@ export const HTypeName ={
} }
//fac:FacSet.HERO //fac:FacSet.HERO
export const getHeroList = (quality:number=0)=>{ export const getHeroList = ()=>{
const filteredHeros = Object.values(HeroInfo).filter(item=>{ const filteredHeros = Object.values(HeroInfo).filter(item=>{
const facMatch = item.fac === FacSet.HERO; const facMatch = item.fac === FacSet.HERO;
return facMatch; return facMatch;
}); });
// 分离拥有和未拥有的英雄 // 根据smc.heros中的数据分离拥有和未拥有的英雄
const ownedHeros = filteredHeros.filter(item => smc.heros.some(hero => hero.uuid === item.uuid)); // smc.heros是一个包含英雄ID的数组如[5001, 5002]
const unownedHeros = filteredHeros.filter(item => !smc.heros.some(hero => hero.uuid === item.uuid)); const ownedHeros = filteredHeros.filter(item => smc.heros.includes(item.uuid));
const unownedHeros = filteredHeros.filter(item => !smc.heros.includes(item.uuid));
// 合并列表:拥有的在前,未拥有的在后 // 合并列表:拥有的在前,未拥有的在后
return [...ownedHeros, ...unownedHeros].map(item => item.uuid); return [...ownedHeros, ...unownedHeros].map(item => item.uuid);

View File

@@ -66,7 +66,7 @@ export class HInfoComp extends CCComp {
// 清除之前的英雄节点 // 清除之前的英雄节点
this.claear_hero(); this.claear_hero();
// 获取英雄列表 // 获取英雄列表(优先显示拥有的英雄)
let heros = getHeroList(); let heros = getHeroList();
let currentIndex = heros.indexOf(uuid); let currentIndex = heros.indexOf(uuid);
@@ -89,6 +89,7 @@ export class HInfoComp extends CCComp {
// 载入英雄预制体并设置位置 // 载入英雄预制体并设置位置
this.heroNodes[i] = this.load_hui(heroUuid, i); this.heroNodes[i] = this.load_hui(heroUuid, i);
} }
this.is_lucky()
} }
load_hui(uuid:number, pos_index: number){ load_hui(uuid:number, pos_index: number){
var path = "game/gui/hui"; var path = "game/gui/hui";
@@ -119,6 +120,9 @@ export class HInfoComp extends CCComp {
mission_start(){ mission_start(){
this.claear_hero() this.claear_hero()
} }
is_lucky(){
this.node.getChildByName("buy").active=!smc.heros.includes(this.h_uuid)
}
claear_hero(){ claear_hero(){
for (let i = 0; i < this.heroNodes.length; i++) { for (let i = 0; i < this.heroNodes.length; i++) {
if (this.heroNodes[i]) { if (this.heroNodes[i]) {
@@ -132,7 +136,7 @@ export class HInfoComp extends CCComp {
// 检查是否正在动画中,防止快速点击导致的冲突 // 检查是否正在动画中,防止快速点击导致的冲突
if (this.isMoving) return; if (this.isMoving) return;
// 获取英雄列表 // 获取英雄列表(优先显示拥有的英雄)
let heros = getHeroList(); let heros = getHeroList();
let index = heros.indexOf(this.h_uuid); let index = heros.indexOf(this.h_uuid);
index++; index++;
@@ -143,16 +147,16 @@ export class HInfoComp extends CCComp {
this.h_uuid = nextHero; this.h_uuid = nextHero;
smc.updateFihgtHero(nextHero) smc.updateFihgtHero(nextHero)
this.update_data(nextHero); this.update_data(nextHero);
// 执行平滑移动动画 // 执行平滑移动动画
this.moveHeroesRight(); this.moveHeroesRight();
this.is_lucky()
} }
prev_hero(){ prev_hero(){
// 检查是否正在动画中,防止快速点击导致的冲突 // 检查是否正在动画中,防止快速点击导致的冲突
if (this.isMoving) return; if (this.isMoving) return;
// 获取英雄列表 // 获取英雄列表(优先显示拥有的英雄)
let heros = getHeroList(); let heros = getHeroList();
let index = heros.indexOf(this.h_uuid); let index = heros.indexOf(this.h_uuid);
index--; index--;
@@ -163,11 +167,21 @@ export class HInfoComp extends CCComp {
this.h_uuid = prevHero; this.h_uuid = prevHero;
smc.updateFihgtHero(prevHero) smc.updateFihgtHero(prevHero)
this.update_data(prevHero); this.update_data(prevHero);
// 执行平滑移动动画 // 执行平滑移动动画
this.moveHeroesLeft(); this.moveHeroesLeft();
this.is_lucky()
}
buy_hero(){
console.info("[HInfoComp]:buy_hero",this.h_uuid)
this.node.getChildByName("buy").active=false
smc.addHero(this.h_uuid)
this.load_all_hero(this.h_uuid)
this.is_lucky()
}
start_mission() {
oops.message.dispatchEvent(GameEvent.MissionStart, {})
this.node.active=false;
} }
moveHeroesLeft() { moveHeroesLeft() {
// 取消前一个待处理的异步操作 // 取消前一个待处理的异步操作
if (this.moveTimeoutId !== null) { if (this.moveTimeoutId !== null) {

View File

@@ -26,10 +26,7 @@ export class MissionHomeComp extends CCComp {
} }
start_mission() {
oops.message.dispatchEvent(GameEvent.MissionStart, {})
this.node.active=false;
}
mission_end(){ mission_end(){
console.log("[MissionHomeComp]=>mission_end") console.log("[MissionHomeComp]=>mission_end")
this.home_active() this.home_active()
@@ -37,8 +34,7 @@ export class MissionHomeComp extends CCComp {
home_active(){ home_active(){
this.uodate_data() this.uodate_data()
this.node.active=true this.node.active=true
this.btn_func("","fight")
oops.message.dispatchEvent(GameEvent.UpdateHero, {})
} }
uodate_data(){ uodate_data(){