Files
heros/assets/script/game/common/SingletonModuleComp.ts

140 lines
3.9 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 { BoxSet } from "./config/BoxSet";
import { Role } from "../Role/Role";
import { v3 } from "cc";
import { Skill } from "../skills/Skill";
// 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!;
cards: any = [
{uuid:9001,type:1},
];
item_list: any = [
{uuid:6005,type:2},{uuid:6006,type:2},{uuid:6101,type:2},{uuid:6102,type:2}, {uuid:6210,type:2},{uuid:6211,type:2},{uuid:6212,type:2},
// {uuid:6213,type:2},{uuid:6214,type:2},{uuid:6215,type:2},
// {uuid:6216,type:2},{uuid:6217,type:2},{uuid:6218,type:2}
];
items: any = []
sitems:any = []
player_skills: any = [
];
player_buffs: any = [
{x:-BoxSet.CSKILL_X,y:BoxSet.CSKILL_Y,eid:0},
{x:-BoxSet.CSKILL_X+55,y:BoxSet.CSKILL_Y,eid:0},
{x:-BoxSet.CSKILL_X+110,y:BoxSet.CSKILL_Y,eid:0},
{x:-BoxSet.CSKILL_X,y:BoxSet.CSKILL_Y,eid:0},
{x:-BoxSet.CSKILL_X,y:BoxSet.CSKILL_Y+55,eid:0},
{x:-BoxSet.CSKILL_X+55,y:BoxSet.CSKILL_Y+55,eid:0},
{x:-BoxSet.CSKILL_X+110,y:BoxSet.CSKILL_Y+55,eid:0},
{x:-BoxSet.CSKILL_X+165,y:BoxSet.CSKILL_Y+55,eid:0},
];
monster_buffs: any = [];
/** 游戏主角 */
Role: Role = null;
heros:any = [];
mheros:any = [];
monsters:any = [];
skills:any = []
sk_info:any = []
monsters_dead:any = []
heros_dead:any = []
hero_pos:any=[]
enemy_pos:any =[]
vmdata: any = {
name : "纸片精灵大乱斗",
game_over:false,
game_pause:false,
mission:{
play:false,
pause:false,
is_victory:false,
is_defeat:false,
lv:1,
victory:0,
once:6, //每波刷新怪物数量
total:1, //总怪物数
a_exp:0, //攻击经验
a_up_exp:10,
a_up:5, //每次增加的ap量
ap:0,
h_exp:0, //生命值经验
h_up_exp:10,
h_up:5, //每次增加的hp量
hp:0,
ma_exp:0, //敌方攻击经验
ma_up_exp:10,
ma_up:5,
map:0,
mh_exp:0, //敌方生命经验
mh_up_exp:10,
mh_up:5,
mhp:0,
reward_num:0, //怪物死亡数
reward_gold:0,
reward_exp:0,
},
role:{
gold:9999999,
gems:0,
energy:0,
},
fight_heros:[9001,9001],
items:{
1001:0,
1002:0,
1003:0,
1004:0,
1005:0,
1006:0,
1013:0,
1014:0,
1015:0,
},
heros:{
9001:{uuid:9001,lv:1,exp:0,slv:1,stone:0},
},
talent:{
1001:{uuid:1001,lv:0,},
},
item_box:{
hp:0,
atk:0,
atk_cd:0,
power:0,
name:"",
skillcd:0,
skillsd:0,
shield:0,
info:"",
}
};
vmAdd() {
VM.add(this.vmdata, "data");
}
reset() {
for (var key in this.vmdata) {
delete this.vmdata[key];
}
}
}
export var smc: SingletonModuleComp = ecs.getSingleton(SingletonModuleComp);