Files
heros/assets/script/game/common/SingletonModuleComp.ts
2024-09-23 23:29:36 +08:00

189 lines
5.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 { 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},{uuid:9002,type:1},{uuid:9011,type:1},{uuid:9021,type:1},{uuid:9031,type:1},{uuid:9041,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 = []
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 = [];
monsters:any = [];
skills:any = []
sk_info:any = []
monsters_dead:any = []
heros_dead:any = []
hero_pos:any=[
{x:-320,y:BoxSet.GAME_LINE+70},
{x:-320,y:BoxSet.GAME_LINE},
{x:-320,y:BoxSet.GAME_LINE-70},
{x:-320,y:BoxSet.GAME_LINE},
{x:-320,y:BoxSet.GAME_LINE},
{x:-320,y:BoxSet.GAME_LINE},
]
enemy_pos:any =[
{x:320,y:BoxSet.GAME_LINE+70},
{x:320,y:BoxSet.GAME_LINE},
{x:320,y:BoxSet.GAME_LINE-70},
{x:320,y:BoxSet.GAME_LINE},
{x:320,y:BoxSet.GAME_LINE},
{x:320,y:BoxSet.GAME_LINE},
]
vm_data: any = {
name : "纸片精灵大乱斗",
game_over:false,
game_pause:false,
gems: 4,
unlock:5,
mission:{
once:6, //每波刷新怪物数量
total:120, //总怪物数
reward:12, //怪物死亡奖励数量
reward_num:0, //怪物死亡数
t_damge:0,
t_dps:0,
h_dps:0,
m_dps:0,
g_level:1,
g_time:0,
m_less:0,
hero:{
atk:1,
atk_cd:1,
hp:1,
},
role:{
atk:1,
atk_cd:1,
hp:1,
}
},
role:{
hp:3000,
hp_max:3000,
speed:0,
atk:10,
buff_atk:0,
mission_atk:0,
atk_cd:1,
atk_cd_up:0,
mission_atk_cd_up:0,
atk_range:400,
lv:1,
exp:0,
next_exp:100,
power:300,
skill:1004,
skills:[
{uuid:0,cd:2,alive:false },
{uuid:0,cd:3,alive:false},
{uuid:0,cd:4,alive:false},
{uuid:0,cd:0,alive:false},
{uuid:0,cd:0,alive:false},
],
},
talent:{
1:{bonus:3,lv:0,lv_max:5,info:"英雄血量加成",name:""},
2:{bonus:3,lv:0,lv_max:5,info:"英雄攻击加成",name:""},
3:{bonus:3,lv:0,lv_max:5,info:"英雄攻击加速",name:""},
4:{bonus:3,lv:0,lv_max:5,info:"英雄技能cd加速",name:""},
5:{bonus:3,lv:0,lv_max:5,info:"英雄技能效果加强",name:""},
6:{bonus:3,lv:0,lv_max:5,info:"",name:""},
7:{bonus:3,lv:0,lv_max:5,info:"",name:""},
8:{bonus:3,lv:0,lv_max:5,info:"",name:""},
9:{bonus:3,lv:0,lv_max:5,info:"",name:""},
10:{bonus:3,lv:0,lv_max:5,info:"",name:""},
11:{bonus:3,lv:0,lv_max:5,info:"血量加成",name:""},
12:{bonus:3,lv:0,lv_max:5,info:"攻击加成",name:""},
13:{bonus:3,lv:0,lv_max:5,info:"攻击加速",name:""},
14:{bonus:3,lv:0,lv_max:5,info:"技能cd加速",name:""},
15:{bonus:3,lv:0,lv_max:5,info:"技能效果加强",name:""},
16:{bonus:3,lv:0,lv_max:5,info:"技能持续时间",name:""},
},
/** 当前等级 */
cards:{
level:1,
level_max:4,
eid:0,
ref_cost:1,
up_cost:4,
},
gold: {
min: 200,
max: 200,
max_limit:200,
time:0,
cd:1,
},
shuaxin: {
min: 0,
max: 5,
speed:1,
},
item_box:{
hp:0,
atk:0,
atk_cd:0,
power:0,
name:"",
skillcd:0,
skillsd:0,
shield:0,
info:"",
}
};
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);