装备特殊加成 继续完善

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

View File

@@ -1,23 +1,26 @@
import { oops } from "db://oops-framework/core/Oops";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { VM } from "../../../../extensions/oops-plugin-framework/assets/libs/model-view/ViewModel";
import { GameEvent } from "../common/config/GameEvent";
/** 数据层对象 */
@ecs.register('FriendModel')
export class FriendModelComp 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, "FriendModel");
}
change_equip_special_attr(e:GameEvent,data:any){
console.log("[FriendModel]:change_equip_special_attr",data)
/** 显示数据从 MVVM 框架中移除 */
vmRemove() {
VM.remove("FriendModel");
}
/** 数据层组件移除时,重置所有数据为默认值 */
reset() {
for (var key in this.vm) {
delete this.vm[key];
}
}
}