This commit is contained in:
2025-06-17 00:00:56 +08:00
parent 843d03ac20
commit 3ad905cd59
5 changed files with 83 additions and 17 deletions

View File

@@ -0,0 +1,26 @@
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('FriendModel')
export class FriendModelComp extends ecs.Comp {
/** 提供 MVVM 组件使用的数据 */
private vm: any = {};
/** 显示数据添加到 MVVM 框架中监视 */
vmAdd() {
VM.add(this.vm, "FriendModel");
}
/** 显示数据从 MVVM 框架中移除 */
vmRemove() {
VM.remove("FriendModel");
}
/** 数据层组件移除时,重置所有数据为默认值 */
reset() {
for (var key in this.vm) {
delete this.vm[key];
}
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "8f0b0fe4-fa69-4f5b-95d1-833eaafa2103",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -8,6 +8,7 @@ import { BoxSet, FacSet } from "../common/config/BoxSet";
import { HeroInfo } from "../common/config/heroSet";
import { BattleMoveComp } from "../common/ecs/position/BattleMoveComp";
import { SkillConComp } from "./SkillConComp";
import { FriendModelComp } from "./FriendModel";
/** 角色实体 */
@ecs.register(`Hero`)
@@ -72,6 +73,7 @@ export class Hero extends ecs.Entity {
node.parent = scene.entityLayer!.node!
node.setPosition(pos)
// console.log("hero load",pos)
this.addComponents<ecs.Comp>(FriendModelComp);
var hv = node.getComponent(HeroViewComp)!;
let hero= HeroInfo[uuid] // 共用英雄数据
hv.scale = scale;

View File

@@ -11,6 +11,8 @@ import { oops } from "db://oops-framework/core/Oops";
import { GameEvent } from "../common/config/GameEvent";
import { FightConComp } from "../map/FightConComp";
import { EquipSpecialAttr } from "../common/config/Equips";
import { FightSet } from "../common/config/Mission";
import { HeroPos } from "../common/config/heroSet";
const { ccclass, property } = _decorator;
@@ -308,7 +310,10 @@ export class HeroViewComp extends CCComp {
this.to_drop()
}
to_alive(){
this.is_dead=false
this.node.setPosition(HeroPos[0].pos)
}
//掉落物品
to_drop(){
// let Drops = getMonsterDrops(1, MonsterType.Normal, 1.2);