feat(gui): 优化角色界面Prefab结构与按钮交互
- 调整角色控制器Prefab中节点的组件ID引用 - 修正部分节点的激活状态与位置信息 - 更新按钮组件及点击事件绑定,改进英雄购买交互逻辑 - 替换文本标签组件,新增字体样式与阴影效果提升可读性 - 增加背景与装饰组件,优化界面视觉层次与布局 - 调整图片资源引用,修改部分Sprite颜色及灰度设置 - 优化UITransform组件配置,调整节点尺寸与锚点位置 - 引入新的Widget组件,完善布局自适应能力 - 增加输入事件阻断组件,防止界面误触操作 - 整体提升界面元素结构清晰度与交互体验一致性
This commit is contained in:
@@ -66,7 +66,7 @@ export class HInfoComp extends CCComp {
|
||||
// 清除之前的英雄节点
|
||||
this.claear_hero();
|
||||
|
||||
// 获取英雄列表
|
||||
// 获取英雄列表(优先显示拥有的英雄)
|
||||
let heros = getHeroList();
|
||||
let currentIndex = heros.indexOf(uuid);
|
||||
|
||||
@@ -89,6 +89,7 @@ export class HInfoComp extends CCComp {
|
||||
// 载入英雄预制体并设置位置
|
||||
this.heroNodes[i] = this.load_hui(heroUuid, i);
|
||||
}
|
||||
this.is_lucky()
|
||||
}
|
||||
load_hui(uuid:number, pos_index: number){
|
||||
var path = "game/gui/hui";
|
||||
@@ -119,6 +120,9 @@ export class HInfoComp extends CCComp {
|
||||
mission_start(){
|
||||
this.claear_hero()
|
||||
}
|
||||
is_lucky(){
|
||||
this.node.getChildByName("buy").active=!smc.heros.includes(this.h_uuid)
|
||||
}
|
||||
claear_hero(){
|
||||
for (let i = 0; i < this.heroNodes.length; i++) {
|
||||
if (this.heroNodes[i]) {
|
||||
@@ -132,7 +136,7 @@ export class HInfoComp extends CCComp {
|
||||
// 检查是否正在动画中,防止快速点击导致的冲突
|
||||
if (this.isMoving) return;
|
||||
|
||||
// 获取英雄列表
|
||||
// 获取英雄列表(优先显示拥有的英雄)
|
||||
let heros = getHeroList();
|
||||
let index = heros.indexOf(this.h_uuid);
|
||||
index++;
|
||||
@@ -143,16 +147,16 @@ export class HInfoComp extends CCComp {
|
||||
this.h_uuid = nextHero;
|
||||
smc.updateFihgtHero(nextHero)
|
||||
this.update_data(nextHero);
|
||||
|
||||
// 执行平滑移动动画
|
||||
this.moveHeroesRight();
|
||||
this.is_lucky()
|
||||
}
|
||||
|
||||
prev_hero(){
|
||||
// 检查是否正在动画中,防止快速点击导致的冲突
|
||||
if (this.isMoving) return;
|
||||
|
||||
// 获取英雄列表
|
||||
// 获取英雄列表(优先显示拥有的英雄)
|
||||
let heros = getHeroList();
|
||||
let index = heros.indexOf(this.h_uuid);
|
||||
index--;
|
||||
@@ -163,11 +167,21 @@ export class HInfoComp extends CCComp {
|
||||
this.h_uuid = prevHero;
|
||||
smc.updateFihgtHero(prevHero)
|
||||
this.update_data(prevHero);
|
||||
|
||||
// 执行平滑移动动画
|
||||
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() {
|
||||
// 取消前一个待处理的异步操作
|
||||
if (this.moveTimeoutId !== null) {
|
||||
|
||||
@@ -26,10 +26,7 @@ export class MissionHomeComp extends CCComp {
|
||||
}
|
||||
|
||||
|
||||
start_mission() {
|
||||
oops.message.dispatchEvent(GameEvent.MissionStart, {})
|
||||
this.node.active=false;
|
||||
}
|
||||
|
||||
mission_end(){
|
||||
console.log("[MissionHomeComp]=>mission_end")
|
||||
this.home_active()
|
||||
@@ -37,8 +34,7 @@ export class MissionHomeComp extends CCComp {
|
||||
home_active(){
|
||||
this.uodate_data()
|
||||
this.node.active=true
|
||||
this.btn_func("","fight")
|
||||
oops.message.dispatchEvent(GameEvent.UpdateHero, {})
|
||||
|
||||
}
|
||||
uodate_data(){
|
||||
|
||||
|
||||
Reference in New Issue
Block a user