feat(ui): 添加加载界面并集成到胜利场景中

在胜利场景中添加新的加载界面元素,包括:
1. 创建loading.prefab资源文件
2. 在MissionHomeComp中处理MissionStart事件
3. 在VictoryComp中控制loading节点的显示逻辑
4. 更新victory.prefab结构以包含loading节点
This commit is contained in:
walkpan
2026-01-03 20:21:00 +08:00
parent 2d79e9d064
commit 1c36718876
5 changed files with 766 additions and 12 deletions

View File

@@ -14,6 +14,7 @@ const { ccclass, property } = _decorator;
export class MissionHomeComp extends CCComp {
protected onLoad(): void {
this.on(GameEvent.MissionEnd,this.mission_end,this)
this.on(GameEvent.MissionStart,this.mission_start,this)
}
/** 视图层逻辑代码分离演示 */
start() {
@@ -31,6 +32,9 @@ export class MissionHomeComp extends CCComp {
console.log("[MissionHomeComp]=>mission_end")
this.home_active()
}
mission_start(){
this.node.active=false
}
home_active(){
this.uodate_data()
this.node.active=true

View File

@@ -32,11 +32,13 @@ export class VictoryComp extends CCComp {
/** 视图层逻辑代码分离演示 */
protected onLoad(): void {
this.node.getChildByName("loading").active=false
// this.canRevive = true;
// this.reviveCount = 0;
}
onAdded(args: any) {
this.node.getChildByName("loading").active=false
console.log("[VictoryComp] onAdded",args)
if(args.game_data){
this.game_data=args.game_data
@@ -142,8 +144,10 @@ export class VictoryComp extends CCComp {
this.clear_data()
// 确保游戏结束事件被触发,以便重置状态
oops.message.dispatchEvent(GameEvent.MissionEnd)
this.node.getChildByName("loading").active=true
this.scheduleOnce(()=>{
oops.message.dispatchEvent(GameEvent.MissionStart)
this.node.getChildByName("loading").active=false
oops.gui.removeByNode(this.node)
},0.5)
}