3 Commits

Author SHA1 Message Date
panw
bfafdbabeb feat(missionHome): 添加天赋按钮并优化底部栏选中状态
1. 新增天赋按钮节点引用与相关页面切换逻辑
2. 封装setBarActive方法统一处理按钮选中态显示
3. 调整页面切换时的按钮状态更新逻辑
2026-05-27 16:42:34 +08:00
panw
ad0539d238 refactor(ui): 调整UI页面管理方式,改为节点显隐控制
1. 注释并禁用了Ranks、Heros、Talents三个UIID的全局弹窗配置
2. 将三个页面改为通过MissionHomeComp控制节点显隐切换
3. 移除了原有的gui.open/remove弹窗调用逻辑,改为设置active状态
4. 调整了组件生命周期,改用onEnable替代onAdded处理显示逻辑
5. 更新了对应组件的注释和文档说明
2026-05-27 16:18:26 +08:00
panw
3c78acde78 refactor: 整理多页面UI预制体并调整布局
1. 关闭排行榜、天赋页面默认激活状态
2. 调整英雄页面布局偏移与容器尺寸
3. 清理天赋页面冗余的预制体实例配置
4. 新增英雄、天赋、排行榜页面的节点引用
2026-05-27 15:54:22 +08:00
10 changed files with 6097 additions and 3584 deletions

View File

@@ -46,7 +46,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 70, "y": 0,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -102,7 +102,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 366, "y": 296,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -308,7 +308,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 400, "y": 470,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -7029,7 +7029,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 425, "y": 495,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -7130,7 +7130,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 700, "width": 700,
"height": 850 "height": 990
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -7403,7 +7403,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 700, "width": 700,
"height": 850 "height": 990
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -7525,7 +7525,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 700, "width": 700,
"height": 850 "height": 990
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -7602,7 +7602,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 720, "width": 720,
"height": 1140 "height": 1280
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -7632,7 +7632,7 @@
"_left": 0, "_left": 0,
"_right": 0, "_right": 0,
"_top": 0, "_top": 0,
"_bottom": 140, "_bottom": 0,
"_horizontalCenter": 0, "_horizontalCenter": 0,
"_verticalCenter": 0, "_verticalCenter": 0,
"_isAbsLeft": true, "_isAbsLeft": true,

File diff suppressed because it is too large Load Diff

View File

@@ -3848,7 +3848,7 @@
"__id__": 1 "__id__": 1
}, },
"_children": [], "_children": [],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 167 "__id__": 167
@@ -3984,7 +3984,7 @@
"__id__": 1 "__id__": 1
}, },
"_children": [], "_children": [],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 173 "__id__": 173

View File

@@ -38,25 +38,22 @@
}, },
{ {
"__id__": 154 "__id__": 154
},
{
"__id__": 165
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 176 "__id__": 165
}, },
{ {
"__id__": 178 "__id__": 167
}, },
{ {
"__id__": 180 "__id__": 169
} }
], ],
"_prefab": { "_prefab": {
"__id__": 182 "__id__": 171
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -3428,7 +3425,7 @@
"__id__": 1 "__id__": 1
}, },
"_children": [], "_children": [],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 147 "__id__": 147
@@ -3603,7 +3600,7 @@
"__id__": 1 "__id__": 1
}, },
"_children": [], "_children": [],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 155 "__id__": 155
@@ -3842,150 +3839,6 @@
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{
"__type__": "cc.Node",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_prefab": {
"__id__": 166
},
"__editorExtras__": {}
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 165
},
"asset": {
"__uuid__": "56aee962-4a5e-45ae-a779-999444d06d18",
"__expectedType__": "cc.Prefab"
},
"fileId": "cboM54s0hM07XCtrpFp0/b",
"instance": {
"__id__": 167
},
"targetOverrides": null
},
{
"__type__": "cc.PrefabInstance",
"fileId": "64iUo2urJCyZ8BM9W4shK0",
"prefabRootNode": {
"__id__": 1
},
"mountedChildren": [],
"mountedComponents": [],
"propertyOverrides": [
{
"__id__": 168
},
{
"__id__": 170
},
{
"__id__": 171
},
{
"__id__": 172
},
{
"__id__": 173
},
{
"__id__": 175
}
],
"removedComponents": []
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 169
},
"propertyPath": [
"_name"
],
"value": "top"
},
{
"__type__": "cc.TargetInfo",
"localID": [
"cboM54s0hM07XCtrpFp0/b"
]
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 169
},
"propertyPath": [
"_lpos"
],
"value": {
"__type__": "cc.Vec3",
"x": 528.069,
"y": -574.7269999999999,
"z": 0
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 169
},
"propertyPath": [
"_lrot"
],
"value": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 169
},
"propertyPath": [
"_euler"
],
"value": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 174
},
"propertyPath": [
"_top"
],
"value": 1179.7269999999999
},
{
"__type__": "cc.TargetInfo",
"localID": [
"52mhkKH89DVKECWS3HY4Qh"
]
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 174
},
"propertyPath": [
"_horizontalCenter"
],
"value": 528.069
},
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
@@ -3996,7 +3849,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 177 "__id__": 166
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -4024,7 +3877,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 179 "__id__": 168
}, },
"_alignFlags": 45, "_alignFlags": 45,
"_target": null, "_target": null,
@@ -4060,7 +3913,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 181 "__id__": 170
}, },
"title_node": { "title_node": {
"__id__": 12 "__id__": 12
@@ -4106,11 +3959,6 @@
}, },
"fileId": "f2zPd6AOdBrIgj89xLzmRM", "fileId": "f2zPd6AOdBrIgj89xLzmRM",
"instance": null, "instance": null,
"targetOverrides": null, "targetOverrides": null
"nestedPrefabInstanceRoots": [
{
"__id__": 165
}
]
} }
] ]

File diff suppressed because it is too large Load Diff

View File

@@ -17,9 +17,9 @@ export enum UIID {
Victory, Victory,
IBox, IBox,
Notity, Notity,
Ranks, // Ranks,
Heros, // Heros,
Talents, // Talents,
Mission, Mission,
HInfo, HInfo,
} }
@@ -32,9 +32,9 @@ export var UIConfigData: { [key: number]: UIConfig } = {
[UIID.Victory]: { layer: LayerType.UI, prefab: "gui/element/victory" }, [UIID.Victory]: { layer: LayerType.UI, prefab: "gui/element/victory" },
[UIID.IBox]: { layer: LayerType.UI, prefab: "gui/element/ibox" }, [UIID.IBox]: { layer: LayerType.UI, prefab: "gui/element/ibox" },
[UIID.Notity]: { layer: LayerType.UI, prefab: "gui/element/notity" }, [UIID.Notity]: { layer: LayerType.UI, prefab: "gui/element/notity" },
[UIID.Ranks]: { layer: LayerType.UI, prefab: "gui/element/ranks" }, // [UIID.Ranks]: { layer: LayerType.UI, prefab: "gui/element/ranks" },
[UIID.Heros]: { layer: LayerType.UI, prefab: "gui/element/heros" }, // [UIID.Heros]: { layer: LayerType.UI, prefab: "gui/element/heros" },
[UIID.Talents]: { layer: LayerType.UI, prefab: "gui/element/talents" }, // [UIID.Talents]: { layer: LayerType.UI, prefab: "gui/element/talents" },
[UIID.Mission]: { layer: LayerType.UI, prefab: "gui/element/mission" }, [UIID.Mission]: { layer: LayerType.UI, prefab: "gui/element/mission" },
[UIID.HInfo]: { layer: LayerType.UI, prefab: "gui/element/hnode" }, [UIID.HInfo]: { layer: LayerType.UI, prefab: "gui/element/hnode" },
} }

View File

@@ -22,7 +22,6 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp"; import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { oops } from "db://oops-framework/core/Oops"; import { oops } from "db://oops-framework/core/Oops";
import { mLogger } from "../common/Logger"; import { mLogger } from "../common/Logger";
import { UIID } from "../common/config/GameUIConfig";
import { HeroInfo, HeroList } from "../common/config/heroSet"; import { HeroInfo, HeroList } from "../common/config/heroSet";
import { buildSkillDesc } from "../common/config/HeroSkillDesc"; import { buildSkillDesc } from "../common/config/HeroSkillDesc";
import { CardLiteComp } from "./CardLiteComp"; import { CardLiteComp } from "./CardLiteComp";
@@ -71,10 +70,6 @@ export class HerosListComp extends CCComp {
private selectNode: Node | null = null private selectNode: Node | null = null
debugMode: boolean = false debugMode: boolean = false
onAdded(args: any) {
}
start() { start() {
this.initCardList() this.initCardList()
if (HeroList.length > 0) { if (HeroList.length > 0) {
@@ -82,8 +77,14 @@ export class HerosListComp extends CCComp {
} }
} }
protected onEnable(): void {
if (this.cards_node && this.cards_node.children.length > 0) {
this.onCardSelect(this.huuid || HeroList[0])
}
}
closeHeros() { closeHeros() {
oops.gui.remove(UIID.Heros) this.node.active = false
} }
// ======================== 卡片列表 ======================== // ======================== 卡片列表 ========================

View File

@@ -15,7 +15,7 @@
* *
* 依赖: * 依赖:
* - GameEvent.MissionStart / MissionEnd —— 游戏生命周期事件 * - GameEvent.MissionStart / MissionEnd —— 游戏生命周期事件
* - UIID.Ranks —— 排行榜弹窗 ID * - UIID.Mission —— 战斗界面 ID
*/ */
import { _decorator, instantiate, Prefab, resources, Sprite, SpriteAtlas, UITransform ,Node} from "cc"; import { _decorator, instantiate, Prefab, resources, Sprite, SpriteAtlas, UITransform ,Node} from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
@@ -49,6 +49,18 @@ export class MissionHomeComp extends CCComp {
/** 排行榜按钮节点 */ /** 排行榜按钮节点 */
@property(Node) @property(Node)
rank_btn=null! rank_btn=null!
/** 天赋按钮节点 */
@property(Node)
tals_btn=null!
@property(Node)
heros_page=null!
@property(Node)
talents_page=null!
@property(Node)
ranks_page=null!
/** 注册任务结束事件 */ /** 注册任务结束事件 */
protected onLoad(): void { protected onLoad(): void {
@@ -84,15 +96,42 @@ export class MissionHomeComp extends CCComp {
} }
/** 打开排行榜弹窗 */ private showPage(page: Node) {
this.heros_page.active = (page === this.heros_page)
this.talents_page.active = (page === this.talents_page)
this.ranks_page.active = (page === this.ranks_page)
this.setBarActive(this.hero_btn, page === this.heros_page)
this.setBarActive(this.tals_btn, page === this.talents_page)
this.setBarActive(this.rank_btn, page === this.ranks_page)
this.setBarActive(this.home_btn, false)
}
private hideAllPages() {
this.heros_page.active = false
this.talents_page.active = false
this.ranks_page.active = false
this.setBarActive(this.home_btn, true)
this.setBarActive(this.hero_btn, false)
this.setBarActive(this.tals_btn, false)
this.setBarActive(this.rank_btn, false)
}
private setBarActive(btn: Node, active: boolean) {
if (!btn) return
const child = btn.getChildByName("active")
if (child) child.active = active
}
openRanks() { openRanks() {
oops.gui.open(UIID.Ranks) this.showPage(this.ranks_page)
} }
openHero() { openHero() {
oops.gui.open(UIID.Heros) this.showPage(this.heros_page)
} }
openTalents() { openTalents() {
oops.gui.open(UIID.Talents) this.showPage(this.talents_page)
} }
/** 任务结束回调:重新显示主页 */ /** 任务结束回调:重新显示主页 */
mission_end(){ mission_end(){
@@ -103,8 +142,8 @@ export class MissionHomeComp extends CCComp {
/** 激活主页显示:刷新数据并显示节点 */ /** 激活主页显示:刷新数据并显示节点 */
home_active(){ home_active(){
this.uodate_data() this.uodate_data()
this.hideAllPages()
this.node.active=true this.node.active=true
} }
/** 更新主页显示数据(预留) */ /** 更新主页显示数据(预留) */

View File

@@ -1,19 +1,18 @@
/** /**
* @file RanksComp.ts * @file RanksComp.ts
* @description 排行榜弹窗组件UI 视图层) * @description 排行榜页面组件UI 视图层)
* *
* 职责: * 职责:
* 1. 展示排行榜界面,包含 Top1~Top3 特殊位和通用列表区域。 * 1. 展示排行榜界面,包含 Top1~Top3 特殊位和通用列表区域。
* 2. 提供关闭排行榜弹窗的按钮回调。 * 2. 提供关闭排行榜页面的按钮回调。
* *
* 关键设计: * 关键设计:
* - top1_node / top2_node / top3_node 用于展示前三名玩家的特殊样式。 * - top1_node / top2_node / top3_node 用于展示前三名玩家的特殊样式。
* - lists_node 为滚动列表的容器节点。 * - lists_node 为滚动列表的容器节点。
* - list_prefab / melist_prefab 分别为普通排名项和"我的排名"项的预制体。 * - list_prefab / melist_prefab 分别为普通排名项和"我的排名"项的预制体。
* - 当前 onLoad / onAdded 未实现具体逻辑,预留后期接入排行数据。
* *
* 依赖: * 依赖:
* - UIID.Ranks —— 在 oops.gui 系统中注册的弹窗 ID * - MissionHomeComp —— 通过节点 active 显隐控制页面切换
*/ */
import { _decorator, Animation, AnimationClip, Button, Event, Label, Node, NodeEventType, Sprite, resources, Prefab } from "cc"; import { _decorator, Animation, AnimationClip, Button, Event, Label, Node, NodeEventType, Sprite, resources, Prefab } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
@@ -21,8 +20,6 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
import { HeroInfo } from "../common/config/heroSet"; import { HeroInfo } from "../common/config/heroSet";
import { HeroAttrsComp } from "../hero/HeroAttrsComp"; import { HeroAttrsComp } from "../hero/HeroAttrsComp";
import { Hero } from "../hero/Hero"; import { Hero } from "../hero/Hero";
import { oops } from "db://oops-framework/core/Oops";
import { UIID } from "../common/config/GameUIConfig";
import { mLogger } from "../common/Logger"; import { mLogger } from "../common/Logger";
const {property, ccclass } = _decorator; const {property, ccclass } = _decorator;
@@ -30,7 +27,7 @@ const {property, ccclass } = _decorator;
/** /**
* RanksComp —— 排行榜视图组件 * RanksComp —— 排行榜视图组件
* *
* 通过 oops.gui.open(UIID.Ranks) 打开 * 通过 MissionHomeComp 页面切换显示
* 展示 Top3 + 通用列表 + 我的排名。 * 展示 Top3 + 通用列表 + 我的排名。
*/ */
@ccclass('RanksComp') @ccclass('RanksComp')
@@ -55,13 +52,11 @@ export class RanksComp extends CCComp {
@property(Prefab) @property(Prefab)
melist_prefab=null! melist_prefab=null!
/** 预留:加载排行数据 */
onLoad() { onLoad() {
} }
/** 预留:弹窗打开时接收参数 */ protected onEnable(): void {
onAdded(args: any) {
} }
@@ -69,9 +64,9 @@ export class RanksComp extends CCComp {
super.onDestroy(); super.onDestroy();
} }
/** 关闭排行榜弹窗 */ /** 关闭排行榜页面 */
closeRanks(){ closeRanks(){
oops.gui.remove(UIID.Ranks) this.node.active = false
} }
/** ECS 组件移除时销毁节点 */ /** ECS 组件移除时销毁节点 */

View File

@@ -1,22 +1,21 @@
/** /**
* @file TalentsComp.ts * @file TalentsComp.ts
* @description 战斗结算弹窗组件UI 视图层) * @description 天赋系统页面组件UI 视图层)
* *
* 职责: * 职责:
* 1. 在战斗结束时弹出,展示结算信息(得分、奖励) * 1. 展示玩家等级、当前经验、进度条、金币
* 2. 根据传入参数判断是否可复活,切换"下一步"或"复活"按钮 * 2. 展示天赋列表及每个天赋的当前等级
* 3. 计算单局总分并存储到 smc.vmdata.scores.score * 3. 处理天赋升级点击事件,扣除金币并保存
* 4. 提供"重新开始"和"退出"两个操作入口 * 4. 处理重置天赋(看广告)功能
* *
* 关键设计: * 关键设计:
* - onAdded(args) 接收战斗结果参数Talents / rewards / game_data / can_revive * - 通过 MissionHomeComp 页面切换显示,节点 active 控制显隐
* - calculateTotalScore() 根据 ScoreWeights 配置加权计算各项得分 * - onAdded(args) 接收参数时刷新界面
* - restart() 和 Talents_end() 通过分发 MissionEnd / MissionStart 事件驱动游戏状态切换。
* *
* 依赖: * 依赖:
* - smc.vmdata.scores —— 全局战斗统计数据 * - MissionHomeComp —— 通过节点 active 显隐控制页面切换
* - ScoreWeightsScoreSet—— 得分权重配置 * - smc.collection —— 玩家数据
* - GameEvent.MissionEnd / MissionStart —— 游戏生命周期事件 * - TalentConfigTalentSet—— 天赋配置
*/ */
import { _decorator, Node, Label, Button, ProgressBar, instantiate, Prefab } from "cc"; import { _decorator, Node, Label, Button, ProgressBar, instantiate, Prefab } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
@@ -78,7 +77,6 @@ export class TalentsComp extends CCComp {
private readonly MAX_PLAYER_LEVEL = 30; private readonly MAX_PLAYER_LEVEL = 30;
protected onLoad(): void { protected onLoad(): void {
// 绑定按钮事件
if (this.btn_reset && this.btn_reset.node) { if (this.btn_reset && this.btn_reset.node) {
this.btn_reset.node.on(Button.EventType.CLICK, this.onResetClicked, this); this.btn_reset.node.on(Button.EventType.CLICK, this.onResetClicked, this);
} }
@@ -87,8 +85,7 @@ export class TalentsComp extends CCComp {
} }
} }
onAdded(args: any) { protected onEnable(): void {
// 直接刷新界面,因为图集已经在游戏启动时被 smc 预加载并缓存
this.refreshUI(); this.refreshUI();
} }
@@ -250,7 +247,7 @@ export class TalentsComp extends CCComp {
/** 点击返回按钮 */ /** 点击返回按钮 */
private onCloseClicked() { private onCloseClicked() {
oops.gui.removeByNode(this.node); // this.node.active = false
} }
protected onDestroy(): void { protected onDestroy(): void {