This commit is contained in:
2024-12-11 16:55:06 +08:00
parent eab71044d0
commit de39c74d4a
17 changed files with 3434 additions and 4543 deletions

View File

@@ -2,6 +2,9 @@ import { _decorator } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { smc } from "../common/SingletonModuleComp";
import { MissionHomeComp } from "./MissionHomeComp";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { GameEvent } from "../common/config/GameEvent";
const { ccclass, property } = _decorator;
@@ -9,12 +12,16 @@ const { ccclass, property } = _decorator;
@ccclass('MSCardComp')
@ecs.register('MSCardComp', false)
export class MSCardComp extends CCComp {
mhc:MissionHomeComp
s_uuid: number = 0;
is_update: boolean = false;
is_select: boolean = false;
is_selected: boolean = false;
/** 视图层逻辑代码分离演示 */
start() {
oops.message.on(GameEvent.MSSelected, this.update_select, this);
this.mhc=this.node.parent.parent.parent.parent.getComponent(MissionHomeComp)
console.log("MSCardComp start");
if(this.is_update){
this.node.getChildByName("update").active=true
@@ -30,9 +37,17 @@ export class MSCardComp extends CCComp {
}
select(){
smc.mission.mskill=this.s_uuid
oops.message.dispatchEvent(GameEvent.MSSelected,{uuid:this.s_uuid})
}
update_select(){
if(smc.mskill ==this.s_uuid){ this.node.getChildByName("btn").active=false }else{ this.node.getChildByName("btn").active=true }
console.log("update_select",smc.mission.mskill,this.s_uuid)
if(smc.mission.mskill ==this.s_uuid){
this.node.getChildByName("set").getChildByName("btn").active=false
}else{
this.node.getChildByName("set").getChildByName("btn").active=true
}
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */