技能ui完成, todo 技能执行

This commit is contained in:
2024-12-16 16:18:37 +08:00
parent b9a188a7bb
commit 70cac957a9
19 changed files with 4310 additions and 25074 deletions

View File

@@ -223,12 +223,12 @@ export class BossViewComp extends CCComp {
shoot(skill_uuid:number,y:number=0,x:number=0){
// console.log("mon shoot");
let skill = ecs.getEntity<Skill>(Skill);
let atk = smc.skills[skill_uuid].atk+this.atk+this.buff_atk;
let atk = SkillSet[skill_uuid].atk+this.atk+this.buff_atk;
let {pos,t_pos}=this.get_enemy_pos()
pos.y=pos.y + y
pos.x=pos.x + x
skill.load(pos,this.box_group,this.node,skill_uuid,atk,t_pos);
// this.tooltip(3,smc.skills[skill_uuid].name,this.skill_uuid);
// this.tooltip(3,SkillSet[skill_uuid].name,this.skill_uuid);
}
//使用max_skill

View File

@@ -30,17 +30,6 @@ export class SingletonModuleComp extends ecs.Comp {
// {uuid:6213,type:2},{uuid:6214,type:2},{uuid:6215,type:2},
// {uuid:6216,type:2},{uuid:6217,type:2},{uuid:6218,type:2}
];
skills: any = [
{uuid:1001,type:3,lv:0},
{uuid:1002,type:3,lv:0},
{uuid:1003,type:3,lv:0},
{uuid:1004,type:3,lv:0},
{uuid:1005,type:3,lv:0},
{uuid:1006,type:3,lv:0},
{uuid:1007,type:3,lv:0},
{uuid:1008,type:3,lv:0},
{uuid:1009,type:3,lv:0},
]
mission:any={
play:false,
pause:false,
@@ -52,13 +41,31 @@ export class SingletonModuleComp extends ecs.Comp {
mskill:1001,
mmskill:1002,
}
};
skills: any = {
1001:{lv:0,num:4,x1:0,x10:0},
1002:{lv:0,num:3,x1:0,x10:0},
1003:{lv:0,num:0,x1:0,x10:0},
1004:{lv:0,num:0,x1:0,x10:0},
1005:{lv:0,num:0,x1:0,x10:0},
1006:{lv:0,num:0,x1:0,x10:0},
1007:{lv:0,num:0,x1:0,x10:0},
1008:{lv:0,num:0,x1:0,x10:0},
1009:{lv:0,num:0,x1:0,x10:0},
};
/** 游戏主角 */
heros:any={
9001:{uuid:9001,lv:1,exp:0,slv:0,stone:0},
9002:{uuid:9002,lv:2,exp:0,slv:1,stone:0},
9003:{uuid:9003,lv:3,exp:0,slv:2,stone:0},
9001:{uuid:9001,lv:1,exp:0,slv:0,stone:0,num:0,x1:0,x10:0},
9002:{uuid:9002,lv:2,exp:0,slv:1,stone:0,num:0,x1:0,x10:0},
9003:{uuid:9003,lv:3,exp:0,slv:2,stone:0,num:0,x1:0,x10:0},
};
goods:any={
free: [ {uuid:9001,num:100000}, {uuid:1001,num:10}, {uuid:1002,num:10}, {uuid:1007,num:10},],
goods1:[ {uuid:1001,num:100}, {uuid:9002,num:1} ],
goods2:[ {uuid:1002,num:100}, {uuid:9002,num:1} ],
goods3:[ {uuid:1007,num:100}, {uuid:9002,num:1} ],
goods4:[ {uuid:9001,num:100}, {uuid:9002,num:1} ],
}
fight_heros=[9001,9002]
mheros:any = [];
monsters:any = [];

View File

@@ -1,68 +0,0 @@
/*
type
1 远距离攻击,碰撞后 结束
2 远距离攻击,碰撞后 持续,直到技能结束
3 远距离攻击,碰撞后 持续,带击退功能
4 双技能技能1技能结束后触发2技能
5: 特殊技能,触发特殊弹窗选项
6: 近距离攻击,碰撞后
9 buff物品
91: 单体buff加最少血临时
92单体buff随机或自己临时
93: 群体buff物品
94role buff
tg: 对象0 自己1同伴 2 自己和同伴3敌人4自己和对人
dis: 是否移动 1 移动 0 原地
sd 持续时间
cd 卡片技能释放本技能cd
count卡片1次释放本技能数
bsdbuff技能作用持续时间 bsd=0 为永久
bcdbuff技能执行一次间隔
sk_uuid:子技能id
sk_count:子技能个数
sp_name : 预制体名称
path: 图片地址
*/
export const Sitems={
6005:{uuid: 6005,path: "6005",type: 93,level: 3,name: "钢盾",sp_name:"",info:"",
dis:1,count:1,in:0,run:0,atk:0,hp:0,shield:100,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
6006:{uuid: 6006,path: "6006",type: 94,level: 3,name: "魔法盾",sp_name:"",info:"",
dis:1,count:1,in:0,run:0,atk:0,hp:0,shield:300,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
6101:{uuid: 6101,path: "6101",type: 91,level: 1,name: "初级药水",sp_name:"",info:"",
dis:1,count:1,in:0,run:0,atk:0,hp:100,shield:0,sd:30,cd:5,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
6102:{uuid: 6102,path: "6102",type: 93,level: 3,name: "高级药水",sp_name:"",info:"",
dis:1,count:1,in:0,run:0,atk:0,hp:300,shield:0,sd:30,cd:5,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
6210:{uuid: 6210,path: "6210",type: 92,level: 3,name: "普通攻击石",sp_name:"",info:"",
dis:1,count:1,in:0,run:0,atk:20,hp:0,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
6211:{uuid: 6211,path: "6211",type: 93,level: 4,name: "特效攻击石",sp_name:"",info:"",
dis:1,count:1,in:0,run:0,atk:30,hp:0,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
6212:{uuid: 6212,path: "6212",type: 94,level: 4,name: "精炼攻击石",sp_name:"",info:"",
dis:1,count:1,in:0,run:0,atk:5,hp:0,shield:0,sd:0,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
6213:{uuid: 6213,path: "6213",type: 92,level: 3,name: "普通攻速石",sp_name:"",info:"",
dis:1,count:1,in:0,run:0,atk:0,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
6214:{uuid: 6214,path: "6214",type: 93,level: 4,name: "特效攻速石",sp_name:"",info:"",
dis:1,count:1,in:0,run:0,atk:0,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
6215:{uuid: 6215,path: "6215",type: 94,level: 4,name: "精炼攻速石",sp_name:"",info:"",
dis:1,count:1,in:0,run:0,atk:5,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
6216:{uuid: 6216,path: "6216",type: 92,level: 3,name: "普通技能石",sp_name:"",info:"",
dis:1,count:1,in:0,run:0,atk:5,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
6217:{uuid: 6217,path: "6217",type: 93,level: 4,name: "特效技能石",sp_name:"",info:"",
dis:1,count:1,in:0,run:0,atk:5,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
6218:{uuid: 6218,path: "6218",type: 94,level: 4,name: "精炼技能石",sp_name:"",info:"",
dis:1,count:1,in:0,run:0,atk:5,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
}

View File

@@ -6,22 +6,25 @@ type:
*/
export const Items={
1001:{uuid: 1001,path: "1001",type:1,lv:1,r_num:10,name: "经验叶子",info:"提升英雄等级的神奇叶子", },
1002:{uuid: 1002,path: "1002",type:1,lv:2,r_num:10,name: "一星凭证",info:"英雄升级一星需要的凭证", },
1003:{uuid: 1003,path: "1003",type:1,lv:2,r_num:10,name: "二星凭证",info:"英雄升级二星需要的凭证", },
1004:{uuid: 1004,path: "1004",type:1,lv:2,r_num:10,name: "三星凭证",info:"英雄升级三星需要的凭证", },
1005:{uuid: 1005,path: "1005",type:1,lv:2,r_num:10,name: "四星凭证",info:"英雄升级四星需要的凭证", },
1006:{uuid: 1006,path: "1006",type:1,lv:2,r_num:10,name: "五星凭证",info:"英雄升级五星需要的凭证", },
1007:{uuid: 1007,path: "1007",type:1,lv:1,r_num:10,name: "能量石",info:"充满能量的神秘石头,可以提升战场技能等级", },
1008:{uuid: 1008,path: "1008",type:1,lv:1,r_num:10,name: "黄色叶子",info:"未知功能", },
1009:{uuid: 1009,path: "1001",type:1,lv:1,r_num:1,name: "普通攻击石",info:"增加装备攻击力10,成功几率20%", },
1010:{uuid: 1010,path: "1010",type:1,lv:2,r_num:1,name: "高级攻击石",info:"增加装备攻击力10,成功几率30%", },
1011:{uuid: 1011,path: "1011",type:1,lv:3,r_num:1,name: "稀有攻击石",info:"增加装备攻击力10,成功几率40%", },
1012:{uuid: 1012,path: "1012",type:1,lv:4,r_num:1,name: "传说攻击石",info:"增加装备攻击力10,成功几率50%", },
1013:{uuid: 1013,path: "1013",type:1,lv:1,r_num:1,name: "普通生命石",info:"增加装备生命值50,成功几率20%", },
1014:{uuid: 1015,path: "1014",type:1,lv:2,r_num:1,name: "高级生命石",info:"增加装备生命值50,成功几率30%", },
1015:{uuid: 1015,path: "1015",type:1,lv:3,r_num:1,name: "稀有生命石",info:"增加装备生命值50,成功几率40%", },
1016:{uuid: 1016,path: "1016",type:1,lv:4,r_num:1,name: "传说生命石",info:"增加装备生命值50,成功几率50%", },
9001:{uuid: 9001,path: "9001",type:1,lv:0,r_num:1,name: "金币",info:"金币不是万能的,但是没有金币是万万不能的", },
1001:{uuid: 1001,path: "1001",type:1,lv:1,name: "经验叶子",info:"提升英雄等级的神奇叶子", },
1002:{uuid: 1002,path: "1002",type:1,lv:1,name: "一星凭证",info:"英雄升级一星需要的凭证", },
1003:{uuid: 1003,path: "1003",type:1,lv:2,name: "二星凭证",info:"英雄升级二星需要的凭证", },
1004:{uuid: 1004,path: "1004",type:1,lv:3,name: "三星凭证",info:"英雄升级三星需要的凭证", },
1005:{uuid: 1005,path: "1005",type:1,lv:3,name: "四星凭证",info:"英雄升级四星需要的凭证", },
1006:{uuid: 1006,path: "1006",type:1,lv:4,name: "五星凭证",info:"英雄升级五星需要的凭证", },
1007:{uuid: 1007,path: "1007",type:1,lv:1,name: "能量石",info:"充满能量的神秘石头,可以提升战场技能等级", },
1008:{uuid: 1008,path: "1008",type:1,lv:4,name: "黄色叶子",info:"未知功能", },
1009:{uuid: 1009,path: "1001",type:1,lv:1,name: "普通攻击石",info:"增加装备攻击力10,成功几率20%", },
1010:{uuid: 1010,path: "1010",type:1,lv:2,name: "高级攻击石",info:"增加装备攻击力10,成功几率30%", },
1011:{uuid: 1011,path: "1011",type:1,lv:3,name: "稀有攻击石",info:"增加装备攻击力10,成功几率40%", },
1012:{uuid: 1012,path: "1012",type:1,lv:4,name: "传说攻击石",info:"增加装备攻击力10,成功几率50%", },
1013:{uuid: 1013,path: "1013",type:1,lv:1,name: "普通生命石",info:"增加装备生命值50,成功几率20%", },
1014:{uuid: 1015,path: "1014",type:1,lv:2,name: "高级生命石",info:"增加装备生命值50,成功几率30%", },
1015:{uuid: 1015,path: "1015",type:1,lv:3,name: "稀有生命石",info:"增加装备生命值50,成功几率40%", },
1016:{uuid: 1016,path: "1016",type:1,lv:4,name: "传说生命石",info:"增加装备生命值50,成功几率50%", },
9001:{uuid: 9001,path: "9001",type:1,lv:0,name: "金币",info:"金币不是万能的,但是没有金币是万万不能的", },
9002:{uuid: 9002,path: "9002",type:1,lv:2,name: "宝箱",info:"打开宝箱获得随机奖励", },
9003:{uuid: 9003,path: "9003",type:1,lv:3,name: "稀有宝箱",info:"打开宝箱获得随机奖励", },
9004:{uuid: 9004,path: "9004",type:1,lv:4,name: "传说宝箱",info:"打开宝箱获得随机奖励", },
}

View File

@@ -28,40 +28,40 @@ run:number = 0; // 0有目标 带方向1贝塞尔曲线 2 不动 ,3 直线
*/
export const SkillSet={
1001:{uuid: 1001,path: "1001",type: 1,tg:3,angle:true,exp:30,level: 1,name: "火球术",sp_name:"fire",info:"释放一个火球术攻击敌人",
1001:{uuid: 1001,path: "1001",type: 1,tg:3,angle:true,exp:30,upcost:2,level: 1,name: "火球术",sp_name:"fire",info:"释放一个火球术攻击敌人",
dis:1,count:1,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:3,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, },
1002:{uuid: 1002,path: "1002",type: 1,tg:3,angle:true,exp:30,level: 3,name: "寒冰箭",sp_name:"ice",info:"释放一个寒冰箭攻击敌人",
1002:{uuid: 1002,path: "1002",type: 1,tg:3,angle:true,exp:30,upcost:2,level: 3,name: "寒冰箭",sp_name:"ice",info:"释放一个寒冰箭攻击敌人",
dis:1,count:1,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, },
1003:{uuid: 1003,path: "1003",type: 1,tg:3,angle:true,exp:30,level: 3,name: "强效射击",sp_name:"b_arrow",info:"释放一个火球术攻击敌人",
1003:{uuid: 1003,path: "1003",type: 1,tg:3,angle:true,exp:30,upcost:2,level: 3,name: "强效射击",sp_name:"b_arrow",info:"释放一个火球术攻击敌人",
dis:1,count:1,in:0,run:1,ap:10,hp:0,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, },
1004:{uuid: 1004,path: "1004",type: 1,tg:3,angle:true,exp:30,level: 3,name: "奥术冲击",sp_name:"bm_ball",info:"释放一个寒冰箭攻击敌人",
1004:{uuid: 1004,path: "1004",type: 1,tg:3,angle:true,exp:30,upcost:2,level: 3,name: "奥术冲击",sp_name:"bm_ball",info:"释放一个寒冰箭攻击敌人",
dis:1,count:1,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, },
2001:{uuid: 2001,path: "2001",type: 91,tg:1,angle:false,exp:30,level: 1,name: "治愈术",sp_name:"heath",info:"释放一个寒冰箭攻击敌人",
2001:{uuid: 2001,path: "2001",type: 91,tg:1,angle:false,exp:30,upcost:2,level: 1,name: "治愈术",sp_name:"heath",info:"释放一个寒冰箭攻击敌人",
dis:1,count:1,in:0,run:1,ap:0,hp:3,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:450, },
2002:{uuid: 2002,path: "2002",type: 91,tg:0,angle:false,exp:30,level: 1,name: "魔法盾",sp_name:"shield",info:"释放一个寒冰箭攻击敌人",
2002:{uuid: 2002,path: "2002",type: 91,tg:0,angle:false,exp:30,upcost:2,level: 1,name: "魔法盾",sp_name:"shield",info:"释放一个寒冰箭攻击敌人",
dis:1,count:1,in:0.2,run:2,ap:0,hp:0,shield:1,sd:0,cd:0,bsd:8,bcd:0,sk_uuid:1001,sk_count:0,speed:450, },
2003:{uuid: 2003,path: "2003",type: 91,tg:0,angle:false,exp:30,level: 1,name: "狂暴",sp_name:"atkup",info:"释放一个寒冰箭攻击敌人",
2003:{uuid: 2003,path: "2003",type: 91,tg:0,angle:false,exp:30,upcost:2,level: 1,name: "狂暴",sp_name:"atkup",info:"释放一个寒冰箭攻击敌人",
dis:1,count:1,in:0.2,run:2,ap:1,hp:0,shield:0,sd:0,cd:0,bsd:8,bcd:0,sk_uuid:1001,sk_count:0,speed:450, },
3001:{uuid: 3001,path: "3001",type: 1,tg:3,angle:true,exp:30,level: 1,name: "三连击",sp_name:"patk",info:"释放一个魔法球攻击敌人",
3001:{uuid: 3001,path: "3001",type: 1,tg:3,angle:true,exp:30,upcost:2,level: 1,name: "三连击",sp_name:"patk",info:"释放一个魔法球攻击敌人",
dis:1,count:3,in:0.3,run:2,ap:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600,},
4011:{uuid: 4011,path: "1011",type: 11,tg:3,angle:true,exp:30,level: 3,name: "火焰风暴",sp_name:"fire",info:"释放多个个火球术攻击敌人",
4011:{uuid: 4011,path: "1011",type: 11,tg:3,angle:true,exp:30,upcost:2,level: 3,name: "火焰风暴",sp_name:"fire",info:"释放多个个火球术攻击敌人",
dis:1,count:5,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:2,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, },
4012:{uuid: 4012,path: "1012",type: 11,tg:3,angle:true,exp:30,level: 3,name: "冰晶风暴",sp_name:"ice",info:"释放多个个寒冰箭攻击敌人",
4012:{uuid: 4012,path: "1012",type: 11,tg:3,angle:true,exp:30,upcost:2,level: 3,name: "冰晶风暴",sp_name:"ice",info:"释放多个个寒冰箭攻击敌人",
dis:1,count:5,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:2,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, },
9001:{uuid: 9001,path: "1001",type: 1,tg:3,angle:true,exp:30,level: 1,name: "普攻",sp_name:"patk",info:"释放一个魔法球攻击敌人",
9001:{uuid: 9001,path: "1001",type: 1,tg:3,angle:true,exp:30,upcost:2,level: 1,name: "普攻",sp_name:"patk",info:"释放一个魔法球攻击敌人",
dis:1,count:1,in:0,run:0,ap:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:1000,},
9002:{uuid: 9002,path: "1001",type: 1,tg:3,angle:true,exp:30,level: 1,name: "魔法小球",sp_name:"mball",info:"释放一个魔法球攻击敌人",
9002:{uuid: 9002,path: "1001",type: 1,tg:3,angle:true,exp:30,upcost:2,level: 1,name: "魔法小球",sp_name:"mball",info:"释放一个魔法球攻击敌人",
dis:1,count:1,in:0,run:0,ap:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600,},
9003:{uuid: 9003,path: "1001",type: 1,tg:3,angle:true,exp:30,level: 1,name: "射击",sp_name:"arrow",info:"释放一个魔法球攻击敌人",
9003:{uuid: 9003,path: "1001",type: 1,tg:3,angle:true,exp:30,upcost:2,level: 1,name: "射击",sp_name:"arrow",info:"释放一个魔法球攻击敌人",
dis:1,count:1,in:0,run:1,ap:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600,},
8001:{uuid: 8001,path: "8001",type: 1,tg:3,angle:true,exp:30,level: 1,name: "飞刀",sp_name:"sword1",info:"释放一个魔法球攻击敌人",
8001:{uuid: 8001,path: "8001",type: 1,tg:3,angle:true,exp:30,upcost:2,level: 1,name: "飞刀",sp_name:"sword1",info:"释放一个魔法球攻击敌人",
dis:1,count:1,in:0,run:0,ap:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:8001,sk_count:0,speed:600,},
}

View File

@@ -48,103 +48,6 @@ export class HeroBuffComp extends CCComp {
this.mv= this.getComponent(HeroViewComp);
} /** 视图层逻辑代码分离演示 */
start () {
}
add_buff(uuid:number=0,args:any[]){
let new_buff={
skill_uuid:uuid,
skill_name:smc.skills[uuid].name,
atk:smc.skills[uuid].atk,
hp:smc.skills[uuid].hp,
shield:smc.skills[uuid].shield,
time:smc.skills[uuid].bsd,
bcd:smc.skills[uuid].bcd,
sk_uuid:smc.skills[uuid].uuid,
args:args
}
this.buff_add(new_buff);
}
update(dt: number){
if (this.timer.update(dt)) {
this.buff_update()
}
}
reset() {
this.node.destroy();
}
show_buff_atk(){
var path = "game/skills/buff/atk"
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
node.setPosition(this.node.position.x,this.node.position.y+40,this.node.position.z);
}
buff_add(buff:any){
if(!this.node.isValid){ return }
let i = 0
if(this.buffs.length >=0){
this.buffs.forEach((b:any,index:number)=>{
if(b.skill_uuid==buff.skill_uuid){
b.time=buff.time;
if(buff.atk>0){
this.mv.atk+=(buff.atk+buff.args.atk-b.atk);
}
if(buff.hp>0){
this.mv.hp+=(buff.hp+buff.args.hp);
this.mv.add_hp(buff.hp+buff.args.hp);
// this.mv.hp_max+=(buff.hp-b.hp);
}
if(buff.shield>0){
this.mv.shield=(buff.shield+buff.args.shield);
// this.mv.shield_max=(buff.shield+buff.args.shield);
}
i=index
}
})
}
if (i==0||this.buffs.length==0) {
this.buffs.push(buff);
if(buff.atk>0){
this.mv.atk+=(buff.atk+buff.args.atk);
this.show_buff_atk();
}
if(buff.hp>0){
this.mv.hp+=(buff.hp+buff.args.hp);
this.mv.add_hp(buff.hp+buff.args.hp);
// this.mv.hp_max+=buff.hp;
}
if(buff.shield>0){
this.mv.shield=(buff.shield+buff.args.shield);
// this.mv.shield_max=(buff.shield+buff.args.shield);
}
}
}
buff_remove(index:number){
if(this.buffs[index].atk>0){
this.mv.atk-=(this.buffs[index].atk+this.buffs[index].args.atk);
}
if(this.buffs[index].shield>0){
this.mv.shield=0
// this.mv.shield_max-=(this.buffs[index].shield+this.buffs[index].args.shield);
}
// if(this.buffs[index].hp>0){
// this.mv.hp_max-=this.buffs[index].hp;
// }
}
buff_update(){
this.buffs.forEach((buff:any,index:number)=>{
buff.time -= 0.1;
if(buff.time <= 0){
this.buff_remove(index);
}
})
this.buffs = this.buffs.filter((buff:any) => buff.time > 0);
}
}

View File

@@ -483,9 +483,9 @@ export class HeroViewComp extends CCComp {
handle_skill(skill:number){
this.as.max()
this.at = 0;
this.tooltip(3,smc.skills[skill].name,skill);
this.tooltip(3,SkillSet[skill].name,skill);
switch (smc.skills[skill].tg) {
switch (SkillSet[skill].tg) {
case 0: //自己
this.to_add_buff(this.node.getComponent(HeroViewComp),skill)
break;
@@ -521,25 +521,25 @@ export class HeroViewComp extends CCComp {
}
to_add_buff(hero:any,sk:number){
let skill = ecs.getEntity<Skill>(Skill);
let AP = smc.skills[sk].ap+this.ap+smc.vmdata.mission.ap; //攻击力需要加上局内buff
let AP = SkillSet[sk].ap+this.ap+smc.vmdata.mission.ap; //攻击力需要加上局内buff
if(this.box_group == BoxSet.MONSTER){
AP = smc.skills[sk].ap+this.ap+smc.vmdata.mission.map;
AP = SkillSet[sk].ap+this.ap+smc.vmdata.mission.map;
}
let {pos,t_pos}=this.get_hero_pos(hero)
console.log("to_add_buff:"+hero.hero_name+" "+sk);
let is_crit=this.check_crit()
skill.load(pos,this.box_group,this.node,sk,AP,t_pos,is_crit,this.crit_add);
if(smc.skills[sk].hp > 0){ //buff加血
let increase_hp=Math.floor(smc.skills[sk].hp*AP)
if(SkillSet[sk].hp > 0){ //buff加血
let increase_hp=Math.floor(SkillSet[sk].hp*AP)
hero.add_hp(increase_hp)
}
if(smc.skills[sk].ap > 0){ //buff加攻击
let increase_atk=Math.floor(smc.skills[sk].ap*AP)
hero.add_ap(increase_atk,smc.skills[sk].bsd)
if(SkillSet[sk].ap > 0){ //buff加攻击
let increase_atk=Math.floor(SkillSet[sk].ap*AP)
hero.add_ap(increase_atk,SkillSet[sk].bsd)
}
if(smc.skills[sk].shield > 0){ //buff护盾
hero.add_shield(smc.skills[sk].shield)
if(SkillSet[sk].shield > 0){ //buff护盾
hero.add_shield(SkillSet[sk].shield)
}
}
@@ -549,7 +549,7 @@ export class HeroViewComp extends CCComp {
let least_hp:number=0
let t_hero:any= null
if (heros.length > 0) {
if(smc.skills[skill].type==92){ //随机添加buff
if(SkillSet[skill].type==92){ //随机添加buff
let i = RandomManager.instance.getRandomInt(0,heros.length-1,3)
while(!heros[i].HeroView){
@@ -563,7 +563,7 @@ export class HeroViewComp extends CCComp {
for (let i = 0; i < heros.length; i++) {
if(!heros[i].HeroView) continue
let hero = heros[i].HeroView;
if(smc.skills[skill].type==91){ //血量最少单体
if(SkillSet[skill].type==91){ //血量最少单体
if((hero.hp_max-hero.hp) > least_hp){
least_hp = (hero.hp_max-hero.hp)
t_hero = hero

View File

@@ -86,7 +86,6 @@ export class Initialize extends ecs.Entity {
private onComplete(queue: AsyncQueue) {
queue.complete = () => {
// console.log("加载完成!",smc.heros);
smc.skills=SkillSet;
var uic: UICallbacks = {
onAdded: (node: Node, params: any) => {
var comp = node.getComponent(LoadingViewComp) as ecs.Comp;

View File

@@ -1,8 +1,10 @@
import { instantiate, Prefab } from "cc";
import { instantiate, Label, Prefab, resources, Sprite, SpriteAtlas } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { MSCardComp } from "./MSCardComp";
import { smc } from "../common/SingletonModuleComp";
import { HeroInfo } from "../common/config/heroSet";
import { SkillSet } from "../common/config/SkillSet";
/** MSCard 模块 */
@ecs.register(`MSCard`)
@@ -15,17 +17,21 @@ export class MSCard extends ecs.Entity {
}
load(uuid:number=1001,parent:any,zone:number=0) {
var path = "game/gui/MSCard";
// var icon_path = "game/heros/herois"
// resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
// const sprite = node.getChildByName("Mask").getChildByName("icon").getComponent(Sprite);
// sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path);
// });
var icon_path = "game/skills/skill_icon"
var prefab: Prefab = oops.res.get(path, Prefab)!;
console.log("load_hcard",prefab)
var node = instantiate(prefab);
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = node.getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[uuid].path);
});
node.getChildByName("name").getComponent(Label).string = SkillSet[uuid].name
node.parent = parent
var msc = node.getComponent(MSCardComp)!;
msc.s_uuid= uuid
msc.update_data()
if(zone==1) {msc.is_update=true }else{msc.is_update=false}
if(zone==2) {msc.is_select=true}else{msc.is_select=false}
this.add(msc)

View File

@@ -1,10 +1,11 @@
import { _decorator } from "cc";
import { _decorator, Label } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { smc } from "../common/SingletonModuleComp";
import { MissionHomeComp } from "./MissionHomeComp";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { GameEvent } from "../common/config/GameEvent";
import { SkillSet } from "../common/config/SkillSet";
const { ccclass, property } = _decorator;
@@ -34,9 +35,12 @@ export class MSCardComp extends CCComp {
}else{
this.node.getChildByName("set").active=false
}
}
update_data(){
this.node.getChildByName("lv").getComponent(Label).string = smc.skills[this.s_uuid].lv.toString()+"级";
this.node.getChildByName("update").getChildByName("cost").getComponent(Label).string =smc.skills[this.s_uuid].num.toString()+ " / "+(SkillSet[this.s_uuid].upcost*(1+smc.skills[this.s_uuid].lv)).toString()
}
select(){
smc.mission.mskill=this.s_uuid
this.mhc.select_skill()
@@ -50,7 +54,19 @@ export class MSCardComp extends CCComp {
this.node.getChildByName("set").getChildByName("btn").active=true
}
}
update_lv(){
if(smc.skills[this.s_uuid].num <= (SkillSet[this.s_uuid].upcost*(1+smc.skills[this.s_uuid].lv))){
oops.gui.toast("升级需要消耗"+SkillSet[this.s_uuid].upcost+"个能力石")
return
}
smc.skills[this.s_uuid].num -= (SkillSet[this.s_uuid].upcost*(1+smc.skills[this.s_uuid].lv))
smc.skills[this.s_uuid].lv++
let mscards:any= ecs.query(ecs.allOf(MSCardComp));
for(let i=0;i<mscards.length;i++){
mscards[i].MSCardComp.update_data()
}
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();

View File

@@ -149,23 +149,16 @@ export class MissionComp extends CCComp {
this.clear_x1()
}
clear_x1(){
smc.vmdata.items[9001].x1=smc.vmdata.items[9001].x10=0
smc.vmdata.items[1001].x1=smc.vmdata.items[1001].x10=0
smc.vmdata.items[1002].x1=smc.vmdata.items[1002].x10=0
smc.vmdata.items[1003].x1=smc.vmdata.items[1003].x10=0
smc.vmdata.items[1004].x1=smc.vmdata.items[1004].x10=0
smc.vmdata.items[1005].x1=smc.vmdata.items[1005].x10=0
smc.vmdata.items[1006].x1=smc.vmdata.items[1006].x10=0
smc.vmdata.items[1007].x1=smc.vmdata.items[1007].x10=0
smc.vmdata.items[1008].x1=smc.vmdata.items[1008].x10=0
smc.vmdata.items[1009].x1=smc.vmdata.items[1009].x10=0
smc.vmdata.items[1010].x1=smc.vmdata.items[1010].x10=0
smc.vmdata.items[1011].x1=smc.vmdata.items[1011].x10=0
smc.vmdata.items[1012].x1=smc.vmdata.items[1012].x10=0
smc.vmdata.items[1013].x1=smc.vmdata.items[1013].x10=0
smc.vmdata.items[1014].x1=smc.vmdata.items[1014].x10=0
smc.vmdata.items[1015].x1=smc.vmdata.items[1015].x10=0
smc.vmdata.items[1016].x1=smc.vmdata.items[1016].x10=0
for (let i in smc.vmdata.items) {
smc.vmdata.items[i].x1=smc.vmdata.items[i].x10=0
}
for (let i in smc.skills) {
smc.skills[i].x1=smc.skills[i].x10=0
}
for (let i in smc.heros) {
smc.heros[i].x1=smc.heros[i].x10=0
}
console.log("clear_x1",smc.vmdata.items,smc.skills,smc.heros)
}
mskill_init(){
this.MSComp.group=BoxSet.HERO

View File

@@ -4,6 +4,8 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { UIID } from "../common/config/GameUIConfig";
import { Items } from "../common/config/Items";
import { Item } from "./Item";
import { smc } from "../common/SingletonModuleComp";
const { ccclass, property } = _decorator;
@@ -13,26 +15,80 @@ const { ccclass, property } = _decorator;
export class ShopHomeComp extends CCComp {
/** 视图层逻辑代码分离演示 */
start() {
this.get_items();
}
get_items(){
let free = this.node.getChildByName("goods_list").getChildByName("free").getChildByName("items");
let goods1 = this.node.getChildByName("goods_list").getChildByName("goods1").getChildByName("items");
let goods2 = this.node.getChildByName("goods_list").getChildByName("goods2").getChildByName("items");
let goods3 = this.node.getChildByName("goods_list").getChildByName("goods3").getChildByName("items");
for (let x = 0; x < smc.goods.free.length; x++) {
let item=ecs.getEntity<Item>(Item)
item.load(smc.goods.free[x].uuid,smc.goods.free[x].num,free)
}
for (let x = 0; x < smc.goods.goods1.length; x++) {
let item=ecs.getEntity<Item>(Item)
item.load(smc.goods.goods1[x].uuid,smc.goods.goods1[x].num,goods1)
}
for (let x = 0; x < smc.goods.goods2.length; x++) {
let item=ecs.getEntity<Item>(Item)
item.load(smc.goods.goods2[x].uuid,smc.goods.goods2[x].num,goods2)
}
for (let x = 0; x < smc.goods.goods3.length; x++) {
let item=ecs.getEntity<Item>(Item)
item.load(smc.goods.goods3[x].uuid,smc.goods.goods3[x].num,goods3)
}
// for (let x = 0; x < smc.goods.goods4.length; x++) {
// let item=ecs.getEntity<Item>(Item)
// item.load(smc.goods.goods4[x].uuid,smc.goods.goods4[x].num,goods4)
// }
}
item_show(e:any,val:any){
oops.gui.open(UIID.ItemInfo, Items[val]);
}
get_free(){
console.log("免费领取")
if(smc.vmdata.free.buy <= 0){
oops.gui.toast("今日领取次数已用完");
return
}
smc.vmdata.free.buy--
}
get_goods1(){
console.log("购买商品1")
if(smc.vmdata.goods1.buy <= 0){
oops.gui.toast("今日购买次数已用完");
return
}
smc.vmdata.goods1.buy--
}
get_goods2(){
console.log("购买商品2")
if(smc.vmdata.goods2.buy <= 0){
oops.gui.toast("今日购买次数已用完");
return
}
smc.vmdata.goods2.buy--
}
get_goods3(){
console.log("购买商品3")
if(smc.vmdata.goods3.buy <= 0){
oops.gui.toast("今日购买次数已用完");
return
}
smc.vmdata.goods3.buy--
}
get_goods4(){
console.log("购买商品4")
if(smc.vmdata.goods4.buy <= 0){
oops.gui.toast("今日购买次数已用完");
return
}
smc.vmdata.goods4.buy--
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {

View File

@@ -0,0 +1,35 @@
import { _decorator, UITransform } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { MSklist } from "../common/config/SkillSet";
import { MSCard } from "./MSCard";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('SkillHomeComp')
@ecs.register('SkillHome', false)
export class SkillHomeComp extends CCComp {
/** 视图层逻辑代码分离演示 */
start() {
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this);
this.load_skill_card()
}
load_skill_card(){
let ms_num:number =MSklist.length
let parent= this.node.getChildByName("skills").getChildByName("view").getChildByName("content")
let height=ms_num*135
parent.getComponent(UITransform).width=height
for (let i = 0; i < ms_num; i++) {
let msc =ecs.getEntity<MSCard>(MSCard)
msc.load(MSklist[i],parent,1)
}
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();
}
}

View File

@@ -2,7 +2,7 @@
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "5207ea65-7d56-4895-974a-613fa815c084",
"uuid": "cf5847e5-a4d7-4a84-8064-024371ea2125",
"files": [],
"subMetas": {},
"userData": {}

View File

@@ -9,20 +9,12 @@ import { instantiate, Node, Prefab, Vec3 ,tween, v3,animation,Label,resources,Sp
/** Skill 模块 */
@ecs.register(`Skill`)
export class Skill extends ecs.Entity {
/** ---------- 数据层 ---------- */
// SkillModel!: SkillModelComp;
/** ---------- 业务层 ---------- */
// SkillBll!: SkillBllComp;
/** ---------- 视图层 ---------- */
SkillView!: SkillCom;
/** 实始添加的数据层组件 */
protected init() {
}
/** 模块资源释放 */
destroy() {
// 注: 自定义释放逻辑,视图层实现 ecs.IComp 接口的 ecs 组件需要手动释放
@@ -32,7 +24,7 @@ export class Skill extends ecs.Entity {
load(pos: Vec3 = Vec3.ZERO,group:number,parent:Node,uuid:number=1001,
ap:number =10,t_pos:Vec3 = null,is_crit:boolean=false,crit_add:number=0)
{
var path = "game/skills/"+smc.skills[uuid].sp_name;
var path = "game/skills/"+SkillSet[uuid].sp_name;
var prefab: Prefab = oops.res.get(path, Prefab)!;
// console.log("load skill :",path,prefab)
var node = instantiate(prefab);
@@ -42,29 +34,29 @@ export class Skill extends ecs.Entity {
node.setPosition(pos)
var sv = node.getComponent(SkillCom)!;
let angle=0
if(smc.skills[uuid].angle){
if(SkillSet[uuid].angle){
angle = Math.atan2(t_pos.y,t_pos.x) * 180 / Math.PI;
}
sv.angle = angle;
// console.log(smc.skills[uuid].name+"angle:"+angle)
// console.log(SkillSet[uuid].name+"angle:"+angle)
sv.s_uuid = uuid;
sv.ap = ap;
sv.is_crit=is_crit
sv.crit_add=crit_add
// node.setScale(v3(node.scale.x*scale,node.scale.y))
sv.speed=smc.skills[uuid].speed;
sv.dis=smc.skills[uuid].dis;
sv.run_type=smc.skills[uuid].run;
sv.speed=SkillSet[uuid].speed;
sv.dis=SkillSet[uuid].dis;
sv.run_type=SkillSet[uuid].run;
if(sv.dis == 0){
sv.run_type=2
}
sv.in_time=smc.skills[uuid].in;
sv.in_time=SkillSet[uuid].in;
sv.t_pos = t_pos; // 目标增量
sv.type = smc.skills[uuid].type;
sv.type = SkillSet[uuid].type;
sv.box_tag= BoxSet.SKILL_TAG;
sv.box_group=group
// console.log("load skill :",sv)

View File

@@ -51,7 +51,7 @@ export class TooltipCom extends CCComp {
).start()
break
case 3:
this.node.getChildByName("skill").getChildByName("name").getComponent(Label).string = "<"+smc.skills[this.s_uuid].name+">";
this.node.getChildByName("skill").getChildByName("name").getComponent(Label).string = "<"+SkillSet[this.s_uuid].name+">";
this.node.getChildByName("skill").active=true;
this.node.setPosition(v3(this.node.position.x,this.node.position.y+60))
// this.alive_time = 2