feat(界面): 添加排行榜界面的打开与关闭功能

- 在 MissionHomeComp 中添加 openRanks 方法以打开排行榜界面
- 在 RanksComp 中添加 closeRanks 方法以关闭排行榜界面
- 调整 ranks.prefab 布局并添加关闭按钮的事件绑定
- 移除 MissionHomeComp 中未使用的页面节点引用和废弃代码
This commit is contained in:
panw
2026-04-02 11:15:12 +08:00
parent 85d9e7c55a
commit 0f602e7e45
5 changed files with 5301 additions and 1637 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -37,22 +37,22 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 154 "__id__": 157
}, },
{ {
"__id__": 156 "__id__": 159
}, },
{ {
"__id__": 158 "__id__": 161
} }
], ],
"_prefab": { "_prefab": {
"__id__": 160 "__id__": 163
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 640, "y": 0,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -3247,17 +3247,17 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 147 "__id__": 150
}, },
{ {
"__id__": 149 "__id__": 152
}, },
{ {
"__id__": 151 "__id__": 154
} }
], ],
"_prefab": { "_prefab": {
"__id__": 153 "__id__": 156
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -3304,10 +3304,13 @@
}, },
{ {
"__id__": 144 "__id__": 144
},
{
"__id__": 146
} }
], ],
"_prefab": { "_prefab": {
"__id__": 146 "__id__": 149
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -3411,6 +3414,76 @@
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "7d68k5bgtC2Ykasy8w3ODg" "fileId": "7d68k5bgtC2Ykasy8w3ODg"
}, },
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 141
},
"_enabled": true,
"__prefab": {
"__id__": 147
},
"clickEvents": [
{
"__id__": 148
}
],
"_interactable": true,
"_transition": 3,
"_normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_hoverColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_pressedColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_normalSprite": null,
"_hoverSprite": null,
"_pressedSprite": null,
"_disabledSprite": null,
"_duration": 0.1,
"_zoomScale": 1.2,
"_target": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "afCUCqD2FJ2ZfriNs8+Exg"
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 1
},
"component": "",
"_componentId": "9eafef++95DEqB78hMPCmU5",
"handler": "closeRanks",
"customEventData": ""
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
@@ -3434,7 +3507,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 148 "__id__": 151
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -3462,7 +3535,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 150 "__id__": 153
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@@ -3507,7 +3580,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 152 "__id__": 155
}, },
"_alignFlags": 44, "_alignFlags": 44,
"_target": null, "_target": null,
@@ -3556,7 +3629,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 155 "__id__": 158
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -3584,7 +3657,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 157 "__id__": 160
}, },
"_alignFlags": 45, "_alignFlags": 45,
"_target": null, "_target": null,
@@ -3620,7 +3693,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 159 "__id__": 162
}, },
"top1_node": { "top1_node": {
"__id__": 41 "__id__": 41
@@ -3657,6 +3730,7 @@
"__id__": 0 "__id__": 0
}, },
"fileId": "84hrfbDo1AOq3VROGZvWWt", "fileId": "84hrfbDo1AOq3VROGZvWWt",
"instance": null,
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": [ "nestedPrefabInstanceRoots": [
{ {

File diff suppressed because it is too large Load Diff

View File

@@ -6,6 +6,7 @@ import { smc } from "../common/SingletonModuleComp";
import { GameEvent } from "../common/config/GameEvent"; import { GameEvent } from "../common/config/GameEvent";
import { Timer } from "db://oops-framework/core/common/timer/Timer"; import { Timer } from "db://oops-framework/core/common/timer/Timer";
import { mLogger } from "../common/Logger"; import { mLogger } from "../common/Logger";
import { UIID } from "../common/config/GameUIConfig";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@@ -15,10 +16,6 @@ const { ccclass, property } = _decorator;
export class MissionHomeComp extends CCComp { export class MissionHomeComp extends CCComp {
debugMode: boolean = false; debugMode: boolean = false;
@property(Node)
heros_page=null!
@property(Node)
rank_page=null!
@property(Node) @property(Node)
home_btn=null! home_btn=null!
@@ -42,11 +39,13 @@ export class MissionHomeComp extends CCComp {
} }
start_mission() { start_mission() {
mLogger.log(this.debugMode, 'MissionHomeComp', "start_mission") mLogger.log(this.debugMode, 'MissionHomeComp', "start_mission")
oops.message.dispatchEvent(GameEvent.MissionStart, {}) oops.message.dispatchEvent(GameEvent.MissionStart, {})
this.node.active=false; this.node.active=false;
}
openRanks(){
oops.gui.open(UIID.Ranks)
} }
mission_end(){ mission_end(){
mLogger.log(this.debugMode, 'MissionHomeComp', "[MissionHomeComp]=>mission_end") mLogger.log(this.debugMode, 'MissionHomeComp', "[MissionHomeComp]=>mission_end")
this.home_active() this.home_active()
@@ -55,7 +54,6 @@ export class MissionHomeComp extends CCComp {
home_active(){ home_active(){
this.uodate_data() this.uodate_data()
this.node.active=true this.node.active=true
// this.switch_tab('home')
} }
uodate_data(){ uodate_data(){
@@ -63,25 +61,7 @@ export class MissionHomeComp extends CCComp {
isWxClient(){ isWxClient(){
return typeof wx !== 'undefined' && typeof (wx as any).getSystemInfoSync === 'function'; 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);
// }
// }
// 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;
// }
// setBtnActive(this.home_btn, tab === 'home');
// setBtnActive(this.hero_btn, tab === 'hero');
// setBtnActive(this.rank_btn, tab === 'rank');
// }
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */ /** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */

View File

@@ -36,7 +36,9 @@ export class RanksComp extends CCComp {
onDestroy() { onDestroy() {
} }
closeRanks(){
oops.gui.remove(UIID.Ranks)
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */ /** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() { reset() {