装备特殊加成 继续完善
This commit is contained in:
@@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user