Files
heros/assets/script/game/common/SingletonModuleComp.ts
2024-08-16 10:36:45 +08:00

85 lines
2.0 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 : "数据测试",
/**宝石数量 */
gems: 10,
game:{
t_damge:0,
t_dps:0,
h_dps:0,
m_dps:0,
g_level:1,
g_time:0,
},
/** 当前等级 */
cards:{
level:1,
level_max:10,
eid:0,
},
hp: {
min:20,
max:30
},
power: {
min: 10,
max: 30
},
gold: {
min: 3,
max: 3,
max_limit:10,
time:0,
cd:10,
ref_cost:0,
up_cost:6,
},
shuaxin: {
min: 0,
max: 5,
speed:1,
},
};
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);