229 lines
6.6 KiB
TypeScript
229 lines
6.6 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:9003,type:1},{uuid:9004,type:1},{uuid:9005,type:1},
|
|
{uuid:9012,type:1},{uuid:9013,type:1},
|
|
{uuid:9022,type:1},{uuid:9023,type:1},
|
|
{uuid:9032,type:1},{uuid:9033,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 = [];
|
|
monsters:any = [];
|
|
skills:any = []
|
|
sk_info:any = []
|
|
monsters_dead:any = []
|
|
heros_dead:any = []
|
|
hero_pos:any=[
|
|
{x:-320,y:BoxSet.GAME_LINE},
|
|
{x:-320,y:BoxSet.GAME_LINE},
|
|
{x:-320,y:BoxSet.GAME_LINE},
|
|
{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},
|
|
{x:320,y:BoxSet.GAME_LINE},
|
|
{x:320,y:BoxSet.GAME_LINE},
|
|
{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:{
|
|
play:false,
|
|
pause:false,
|
|
refresh_timer:3,
|
|
mission_lv:1,
|
|
boss_cd:10,
|
|
bboss_cd:10,
|
|
victory:0,
|
|
once:6, //每波刷新怪物数量
|
|
total:120, //总怪物数
|
|
m_less:0,
|
|
m_alive:120,
|
|
g_level:1,
|
|
g_time:0,
|
|
reward:20, //怪物死亡奖励数量
|
|
reward_num:0, //怪物死亡数
|
|
coin:200,
|
|
coin_add:1,
|
|
coin_reward_add:1,
|
|
normal_cost:10,
|
|
better_cost:20,
|
|
best_cost:30,
|
|
enhancement_cost:100,
|
|
normal_lv:1,
|
|
better_lv:1,
|
|
best_lv:1,
|
|
t_damge:0,
|
|
t_dps:0,
|
|
h_dps:0,
|
|
m_dps:0,
|
|
reward_gold:0,
|
|
reward_exp:0,
|
|
hero:{
|
|
atk:1,
|
|
atk_cd:1,
|
|
hp:1,
|
|
},
|
|
role:{
|
|
atk:1,
|
|
atk_cd:1,
|
|
hp:1,
|
|
}
|
|
},
|
|
role:{
|
|
gold:9999999,
|
|
gems:0,
|
|
energy:0,
|
|
mission:1,
|
|
mission_finish:false,
|
|
mission_num:0,
|
|
mission_num_max:5,
|
|
hero_num:12,
|
|
hp:300,
|
|
hp_max:300,
|
|
speed:0,
|
|
atk:10,
|
|
atk_dis:700,
|
|
buff_atk:0,
|
|
mission_atk:0,
|
|
atk_time:0,
|
|
atk_cd:1,
|
|
atk_base_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,
|
|
skill1:{uuid:1004,cd:3,cd_max:3,alive:true},
|
|
skill2:{uuid:1002,cd:3,cd_max:3,alive:true},
|
|
skill3:{uuid:1001,cd:3,cd_max:3,alive:false},
|
|
skill4:{uuid:1001,cd:3,cd_max:3,alive:false},
|
|
skill5:{uuid:1001,cd:3,cd_max:3,alive:false},
|
|
items:{
|
|
1001:{uuid: 1001,num:0},
|
|
1002:{uuid: 1002,num:0},
|
|
1003:{uuid: 1003,num:0},
|
|
1004:{uuid: 1004,num:0},
|
|
1005:{uuid: 1005,num:0},
|
|
1006:{uuid: 1006,num:0},
|
|
1007:{uuid: 1007,num:0},
|
|
1008:{uuid: 1008,num:0},
|
|
1009:{uuid: 1009,num:0},
|
|
1010:{uuid: 1010,num:0},
|
|
}
|
|
},
|
|
talent:{
|
|
1001:{uuid:1001,lv:0,},
|
|
1002:{uuid:1002,lv:0,},
|
|
1003:{uuid:1003,lv:0,},
|
|
1004:{uuid:1004,lv:0,},
|
|
1005:{uuid:1005,lv:0,},
|
|
1006:{uuid:1006,lv:0,},
|
|
1007:{uuid:1007,lv:0,},
|
|
1008:{uuid:1008,lv:0,},
|
|
1009:{uuid:1009,lv:0,},
|
|
1010:{uuid:1010,lv:0,},
|
|
1011:{uuid:1011,lv:0,},
|
|
1012:{uuid:1012,lv:0,},
|
|
1013:{uuid:1013,lv:0,},
|
|
1014:{uuid:1014,lv:0,},
|
|
1015:{uuid:1015,lv:0,},
|
|
1016:{uuid:1016,lv:0,},
|
|
},
|
|
monster:{
|
|
gold_add:1,
|
|
},
|
|
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); |