装备特殊加成 继续完善

This commit is contained in:
panw
2025-06-17 16:19:02 +08:00
parent 0a1e2b7813
commit d7b6dd375a
11 changed files with 171 additions and 113 deletions

View File

@@ -1,25 +1,26 @@
import { _decorator, Component, Node } from 'cc';
import { GameEvent } from '../common/config/GameEvent';
import { oops } from 'db://oops-framework/core/Oops';
import { ecs } from 'db://oops-framework/libs/ecs/ECS';
const { ccclass, property } = _decorator;
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { VM } from "../../../../extensions/oops-plugin-framework/assets/libs/model-view/ViewModel";
/** 数据层对象 */
@ecs.register('MasterModel')
export class MasterModelComp extends ecs.Comp {
/** 提供 MVVM 组件使用的数据 */
private vm: any = {};
onLoad(){
oops.message.on(GameEvent.ChangeATK_EQUIP_SPECIAL_ATTR,this.change_equip_special_attr,this)
/** 显示数据添加到 MVVM 框架中监视 */
vmAdd() {
VM.add(this.vm, "MasterModel");
}
change_equip_special_attr(e:GameEvent,data:any){
console.log("[MasterModel]:change_equip_special_attr",data)
/** 显示数据从 MVVM 框架中移除 */
vmRemove() {
VM.remove("MasterModel");
}
update(deltaTime: number) {
}
reset(): void {
}
}
/** 数据层组件移除时,重置所有数据为默认值 */
reset() {
for (var key in this.vm) {
delete this.vm[key];
}
}
}