复活完成

This commit is contained in:
2025-06-17 10:58:13 +08:00
parent 5af0a314a6
commit d02482a591
12 changed files with 205 additions and 114 deletions

View File

@@ -1,26 +1,23 @@
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 = {};
/** 显示数据添加到 MVVM 框架中监视 */
vmAdd() {
VM.add(this.vm, "FriendModel");
onLoad(){
oops.message.on(GameEvent.ChangeATK_EQUIP_SPECIAL_ATTR,this.change_equip_special_attr,this)
}
/** 显示数据从 MVVM 框架中移除 */
vmRemove() {
VM.remove("FriendModel");
change_equip_special_attr(e:GameEvent,data:any){
console.log("[FriendModel]:change_equip_special_attr",data)
}
/** 数据层组件移除时,重置所有数据为默认值 */
reset() {
for (var key in this.vm) {
delete this.vm[key];
}
}
}