Files
heros/assets/script/game/common/SingletonModuleComp.ts
2024-08-08 10:44:58 +08:00

75 lines
1.8 KiB
TypeScript

/*
* @Author: dgflash
* @Date: 2021-11-18 14:20:46
* @LastEditors: dgflash
* @LastEditTime: 2022-08-04 15:46:16
*/
import { VM } from "../../../../extensions/oops-plugin-framework/assets/libs/model-view/ViewModel";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { Initialize } from "../initialize/Initialize";
import { GameMap } from "../map/GameMap";
import { Role } from "../role/Role";
// import { data } from "../data/data";
/** 游戏模块 */
@ecs.register('SingletonModule')
export class SingletonModuleComp extends ecs.Comp {
/** 游戏初始化模块 */
initialize: Initialize = null!;
/** 游戏地图 */
map: GameMap = null!;
/** 游戏主角 */
own: Role = null;
/** 游戏数据 */
// data:data = null!;
/**怪物数据 数组 */
monsters = []
/**heros 数据 */
heros = [];
monsters_in=[]
heros_in = []
monsters_dead = []
heros_dead = []
vm_data: any = {
name : "数据测试",
/** 当前等级 */
porwer: 0,
/** 当前经验 */
def : 0,
/** 下级经验 */
speed : 0,
hp: {
min:20,
max:30
},
power: {
min: 0,
max: 30
},
gold: {
min: 0,
max: 10
},
shuaxin: {
min: 0,
max: 2,
speed:1,
},
gold_add: {
min: 0,
max: 10,
speed:2,
},
};
vmAdd() {
console.log("smc vm_data vmAdd");
VM.add(this.vm_data, "data");
}
reset() {
for (var key in this.vm_data) {
delete this.vm_data[key];
}
}
}
export var smc: SingletonModuleComp = ecs.getSingleton(SingletonModuleComp);