hero 界面调整 局内英雄不再升级,改为升级局内技能

This commit is contained in:
2024-11-19 15:15:05 +08:00
parent e89f590979
commit e6f4a8085b
10 changed files with 188 additions and 151 deletions

View File

@@ -37,35 +37,35 @@
"__id__": 45 "__id__": 45
}, },
{ {
"__id__": 55 "__id__": 56
}, },
{ {
"__id__": 64 "__id__": 65
}, },
{ {
"__id__": 74 "__id__": 75
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 82 "__id__": 83
}, },
{ {
"__id__": 84 "__id__": 85
}, },
{ {
"__id__": 86 "__id__": 87
}, },
{ {
"__id__": 88 "__id__": 89
}, },
{ {
"__id__": 90 "__id__": 91
} }
], ],
"_prefab": { "_prefab": {
"__id__": 92 "__id__": 93
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -857,6 +857,9 @@
}, },
{ {
"__id__": 53 "__id__": 53
},
{
"__id__": 55
} }
], ],
"removedComponents": [] "removedComponents": []
@@ -887,8 +890,8 @@
], ],
"value": { "value": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 4.465, "x": 0,
"y": 99.253, "y": 107.768,
"z": 0 "z": 0
} }
}, },
@@ -944,6 +947,21 @@
"16MuhUBUpB2ZdBTYflEf1n" "16MuhUBUpB2ZdBTYflEf1n"
] ]
}, },
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 49
},
"propertyPath": [
"_lscale"
],
"value": {
"__type__": "cc.Vec3",
"x": 1.2,
"y": 1,
"z": 1
}
},
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_objFlags": 0, "_objFlags": 0,
@@ -951,14 +969,14 @@
"__id__": 1 "__id__": 1
}, },
"_prefab": { "_prefab": {
"__id__": 56 "__id__": 57
}, },
"__editorExtras__": {} "__editorExtras__": {}
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
"__id__": 55 "__id__": 56
}, },
"asset": { "asset": {
"__uuid__": "5b4ca49e-0f12-4478-b56d-bf8198b36b90", "__uuid__": "5b4ca49e-0f12-4478-b56d-bf8198b36b90",
@@ -966,7 +984,7 @@
}, },
"fileId": "0d6ZXmA5dHkZxoGONDL2sE", "fileId": "0d6ZXmA5dHkZxoGONDL2sE",
"instance": { "instance": {
"__id__": 57 "__id__": 58
}, },
"targetOverrides": null "targetOverrides": null
}, },
@@ -980,10 +998,7 @@
"mountedComponents": [], "mountedComponents": [],
"propertyOverrides": [ "propertyOverrides": [
{ {
"__id__": 58 "__id__": 59
},
{
"__id__": 60
}, },
{ {
"__id__": 61 "__id__": 61
@@ -993,6 +1008,9 @@
}, },
{ {
"__id__": 63 "__id__": 63
},
{
"__id__": 64
} }
], ],
"removedComponents": [] "removedComponents": []
@@ -1000,7 +1018,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 59 "__id__": 60
}, },
"propertyPath": [ "propertyPath": [
"_name" "_name"
@@ -1016,7 +1034,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 59 "__id__": 60
}, },
"propertyPath": [ "propertyPath": [
"_lpos" "_lpos"
@@ -1031,7 +1049,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 59 "__id__": 60
}, },
"propertyPath": [ "propertyPath": [
"_lrot" "_lrot"
@@ -1047,7 +1065,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 59 "__id__": 60
}, },
"propertyPath": [ "propertyPath": [
"_euler" "_euler"
@@ -1062,7 +1080,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 59 "__id__": 60
}, },
"propertyPath": [ "propertyPath": [
"_active" "_active"
@@ -1076,14 +1094,14 @@
"__id__": 1 "__id__": 1
}, },
"_prefab": { "_prefab": {
"__id__": 65 "__id__": 66
}, },
"__editorExtras__": {} "__editorExtras__": {}
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
"__id__": 64 "__id__": 65
}, },
"asset": { "asset": {
"__uuid__": "ec11e9f5-3347-4d5e-8ed8-f98a6ac7963a", "__uuid__": "ec11e9f5-3347-4d5e-8ed8-f98a6ac7963a",
@@ -1091,7 +1109,7 @@
}, },
"fileId": "c46/YsCPVOJYA4mWEpNYRx", "fileId": "c46/YsCPVOJYA4mWEpNYRx",
"instance": { "instance": {
"__id__": 66 "__id__": 67
}, },
"targetOverrides": null "targetOverrides": null
}, },
@@ -1105,10 +1123,7 @@
"mountedComponents": [], "mountedComponents": [],
"propertyOverrides": [ "propertyOverrides": [
{ {
"__id__": 67 "__id__": 68
},
{
"__id__": 69
}, },
{ {
"__id__": 70 "__id__": 70
@@ -1121,6 +1136,9 @@
}, },
{ {
"__id__": 73 "__id__": 73
},
{
"__id__": 74
} }
], ],
"removedComponents": [] "removedComponents": []
@@ -1128,7 +1146,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 68 "__id__": 69
}, },
"propertyPath": [ "propertyPath": [
"_name" "_name"
@@ -1144,7 +1162,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 68 "__id__": 69
}, },
"propertyPath": [ "propertyPath": [
"_lpos" "_lpos"
@@ -1159,7 +1177,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 68 "__id__": 69
}, },
"propertyPath": [ "propertyPath": [
"_lrot" "_lrot"
@@ -1175,7 +1193,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 68 "__id__": 69
}, },
"propertyPath": [ "propertyPath": [
"_euler" "_euler"
@@ -1190,7 +1208,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 68 "__id__": 69
}, },
"propertyPath": [ "propertyPath": [
"_lscale" "_lscale"
@@ -1205,7 +1223,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 68 "__id__": 69
}, },
"propertyPath": [ "propertyPath": [
"_active" "_active"
@@ -1219,14 +1237,14 @@
"__id__": 1 "__id__": 1
}, },
"_prefab": { "_prefab": {
"__id__": 75 "__id__": 76
}, },
"__editorExtras__": {} "__editorExtras__": {}
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
"__id__": 74 "__id__": 75
}, },
"asset": { "asset": {
"__uuid__": "ae4493bd-cbcc-4392-921c-3e2b0fcd5338", "__uuid__": "ae4493bd-cbcc-4392-921c-3e2b0fcd5338",
@@ -1234,7 +1252,7 @@
}, },
"fileId": "91yoyAQGNDm5ziI7NUChZ+", "fileId": "91yoyAQGNDm5ziI7NUChZ+",
"instance": { "instance": {
"__id__": 76 "__id__": 77
}, },
"targetOverrides": null "targetOverrides": null
}, },
@@ -1248,16 +1266,16 @@
"mountedComponents": [], "mountedComponents": [],
"propertyOverrides": [ "propertyOverrides": [
{ {
"__id__": 77 "__id__": 78
},
{
"__id__": 79
}, },
{ {
"__id__": 80 "__id__": 80
}, },
{ {
"__id__": 81 "__id__": 81
},
{
"__id__": 82
} }
], ],
"removedComponents": [] "removedComponents": []
@@ -1265,7 +1283,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 78 "__id__": 79
}, },
"propertyPath": [ "propertyPath": [
"_name" "_name"
@@ -1281,7 +1299,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 78 "__id__": 79
}, },
"propertyPath": [ "propertyPath": [
"_lpos" "_lpos"
@@ -1296,7 +1314,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 78 "__id__": 79
}, },
"propertyPath": [ "propertyPath": [
"_lrot" "_lrot"
@@ -1312,7 +1330,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 78 "__id__": 79
}, },
"propertyPath": [ "propertyPath": [
"_euler" "_euler"
@@ -1334,7 +1352,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 83 "__id__": 84
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -1362,7 +1380,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 85 "__id__": 86
}, },
"enabledContactListener": true, "enabledContactListener": true,
"bullet": true, "bullet": true,
@@ -1396,7 +1414,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 87 "__id__": 88
}, },
"tag": 0, "tag": 0,
"_group": 4, "_group": 4,
@@ -1430,7 +1448,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 89 "__id__": 90
}, },
"animator": { "animator": {
"__id__": 33 "__id__": 33
@@ -1451,7 +1469,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 91 "__id__": 92
}, },
"_id": "" "_id": ""
}, },
@@ -1472,13 +1490,13 @@
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": [ "nestedPrefabInstanceRoots": [
{ {
"__id__": 74 "__id__": 75
}, },
{ {
"__id__": 64 "__id__": 65
}, },
{ {
"__id__": 55 "__id__": 56
}, },
{ {
"__id__": 45 "__id__": 45

View File

@@ -96,7 +96,7 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 5.223, "x": 0,
"y": 4.463, "y": 4.463,
"z": 0 "z": 0
}, },
@@ -224,7 +224,7 @@
"a": 255 "a": 255
}, },
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@39df8", "__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@ff93c",
"__expectedType__": "cc.SpriteFrame" "__expectedType__": "cc.SpriteFrame"
}, },
"_type": 1, "_type": 1,
@@ -310,7 +310,7 @@
"a": 255 "a": 255
}, },
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@75769", "__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@9c879",
"__expectedType__": "cc.SpriteFrame" "__expectedType__": "cc.SpriteFrame"
}, },
"_type": 1, "_type": 1,
@@ -753,7 +753,7 @@
"__id__": 39 "__id__": 39
} }
], ],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 45 "__id__": 45
@@ -892,7 +892,7 @@
"a": 255 "a": 255
}, },
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@45eb2", "__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@228f2",
"__expectedType__": "cc.SpriteFrame" "__expectedType__": "cc.SpriteFrame"
}, },
"_type": 0, "_type": 0,

View File

@@ -1140,7 +1140,7 @@
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
"r": 231, "r": 231,
"g": 22, "g": 139,
"b": 22, "b": 22,
"a": 255 "a": 255
}, },
@@ -1164,9 +1164,9 @@
"_enableOutline": true, "_enableOutline": true,
"_outlineColor": { "_outlineColor": {
"__type__": "cc.Color", "__type__": "cc.Color",
"r": 255, "r": 244,
"g": 255, "g": 255,
"b": 255, "b": 122,
"a": 255 "a": 255
}, },
"_outlineWidth": 7, "_outlineWidth": 7,

View File

@@ -1087,7 +1087,7 @@
"__id__": 45 "__id__": 45
} }
], ],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 51 "__id__": 51
@@ -2396,7 +2396,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 130, "width": 0,
"height": 10 "height": 10
}, },
"_anchorPoint": { "_anchorPoint": {
@@ -2483,7 +2483,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 130, "width": 130,
"height": 1 "height": 10
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -2518,10 +2518,7 @@
"b": 255, "b": 255,
"a": 255 "a": 255
}, },
"_spriteFrame": { "_spriteFrame": null,
"__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@0e130",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 1, "_type": 1,
"_fillType": 0, "_fillType": 0,
"_sizeMode": 0, "_sizeMode": 0,
@@ -2558,7 +2555,7 @@
}, },
"_mode": 0, "_mode": 0,
"_totalLength": 130, "_totalLength": 130,
"_progress": 1, "_progress": 0,
"_reverse": false, "_reverse": false,
"_id": "" "_id": ""
}, },

View File

@@ -11987,8 +11987,8 @@
"rawHeight": 26, "rawHeight": 26,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 7,
"borderRight": 0, "borderRight": 8,
"packable": true, "packable": true,
"pixelsToUnit": 100, "pixelsToUnit": 100,
"pivotX": 0.5, "pivotX": 0.5,
@@ -12033,8 +12033,8 @@
"rawHeight": 20, "rawHeight": 20,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 5,
"borderRight": 0, "borderRight": 5,
"packable": true, "packable": true,
"pixelsToUnit": 100, "pixelsToUnit": 100,
"pivotX": 0.5, "pivotX": 0.5,

View File

@@ -2,9 +2,9 @@
export const HeroInfo = { export const HeroInfo = {
9001: { 9001: {
uuid: 9001, path: "k1", type: 1, lv: 1,name: "白骑士", wp:1001,arm:2001,ring:3001,shoes:4001, uuid: 9001, path: "k1", type: 1, lv: 1,name: "白骑士", wp:1001,arm:2001,ring:3001,shoes:4001,
exp_type:0,lv2:5,lv3:10,lv4:20,lv5:30,a_exp:1,ua_exp:1,d_exp:10,ed_exp:1,a_buff:8101,ua_buff:8201,d_buff:8301,ed_buff:8401, aep:1,uaep:1,dep:10,edep:1,
ap: 20, ap_rate:0.1, hp: 100, hp_rate:0.1, def:10,def_rate:0.1,dis: 100, a_cd: 1, power: 0, power_max: 15, speed: 100,vun:0,crit:20,crit_add:0,dodge:0, ap: 20, ap_rate:0.1, hp: 100, hp_rate:0.1, def:10,def_rate:0.1,dis: 100, a_cd: 1, pw: 0, pwm: 15,pws: 1, speed: 100,vun:0,crit:20,crit_add:0,dodge:0,
sk1: 9001, sk2: 2002, sk3: 9003, sk4: 9004, sk5: 9005, sk6: 9006, atktype: 1,skr:[0,10,20,30,40,50],uar:[0,10,20,30,40,50],dr:[0,10,20,30,40,50], sk1: 9001, sk2: 2002, sk3: 9003, sk4: 9004, sk5: 9005, sk6: 9006, atktype: 1,akr:10,uar:10,dgr:10,crr:10,akc:1,uac:1,dgc:1,crc:1,
}, },

View File

@@ -80,7 +80,9 @@ export class Hero extends ecs.Entity {
hv.hero_type= HInf.type; hv.hero_type= HInf.type;
hv.speed =hv.ospeed = HInf.speed; hv.speed =hv.ospeed = HInf.speed;
hv.dis = HInf.dis; hv.dis = HInf.dis;
hv.power = HInf.power; hv.pw = HInf.pw;
hv.pwm= HInf.pwm;
hv.pws= HInf.pws
hv.lv = HInf.lv; hv.lv = HInf.lv;
hv.type = HInf.type; hv.type = HInf.type;
hv.sk1 = HInf.sk1; hv.sk1 = HInf.sk1;
@@ -88,8 +90,14 @@ export class Hero extends ecs.Entity {
hv.sk3 = HInf.sk3; hv.sk3 = HInf.sk3;
hv.sk4 = HInf.sk4; hv.sk4 = HInf.sk4;
hv.sk5 = HInf.sk5; hv.sk5 = HInf.sk5;
hv.skr = HInf.skr; hv.akc = HInf.akc;
hv.uac = HInf.uac;
hv.crc = HInf.crc;
hv.dgc = HInf.dgc;
hv.akr = HInf.akr;
hv.uar = HInf.uar; hv.uar = HInf.uar;
hv.crr = HInf.crr;
hv.dgr = HInf.dgr;
hv.type = HInf.type; hv.type = HInf.type;
hv.hp= hv.hp_max =HInf.hp; hv.hp= hv.hp_max =HInf.hp;
hv.ap = HInf.ap; hv.ap = HInf.ap;
@@ -99,7 +107,6 @@ export class Hero extends ecs.Entity {
hv.crit = HInf.crit; //暴击率 hv.crit = HInf.crit; //暴击率
hv.crit_add = HInf.crit_add;//暴击伤害加成 hv.crit_add = HInf.crit_add;//暴击伤害加成
hv.dodge = HInf.dodge; //闪避率 hv.dodge = HInf.dodge; //闪避率
hv.power_max= HInf.power_max
this.add(hv); this.add(hv);
} }
set_ratio(uuid:number){ set_ratio(uuid:number){

View File

@@ -46,7 +46,6 @@ export class HeroViewComp extends CCComp {
box_group:number = BoxSet.HERO; box_group:number = BoxSet.HERO;
atk_range:number = 150; atk_range:number = 150;
private timer:Timer = new Timer(1); //计时器
is_dead:boolean = false; //是否摧毁 is_dead:boolean = false; //是否摧毁
@@ -57,17 +56,24 @@ export class HeroViewComp extends CCComp {
hp_max: number = 100; /** 最大血量 */ hp_max: number = 100; /** 最大血量 */
hp_speed: number = 0; //每秒回复量 hp_speed: number = 0; //每秒回复量
power: number = 0; /**能量**/ pw: number = 0; /**能量**/
power_max: number = 1200; /** 能量最大值 */ pwm: number = 15; /** 能量最大值 */
power_speed: number = 1; //能量回复速度每0.1秒回复量 pws: number = 1; //能量回复速度每0.1秒回复量
pwt:Timer = new Timer(1); //计时器
sk1:number = 9001; sk1:number = 9001;
sk2:number = 1001; sk2:number = 1001;
sk3:number = 1001; sk3:number = 1001;
sk4:number = 1001; sk4:number = 1001;
sk5:number = 1001; sk5:number = 1001;
skr:any=[0,0,0,0,0,0]; akr:number=0;
uar:any=[0,0,0,0,0,0]; uar:number=0;
dgr:number=0;
crr:number=0;
akc:number=0;
uac:number=0;
dgc:number=0;
crc:number=0;
ap: number = 10; /**攻击力 */ ap: number = 10; /**攻击力 */
ap_buff: number = 0; ap_buff: number = 0;
ap_buffs:any = []; ap_buffs:any = [];
@@ -89,6 +95,10 @@ export class HeroViewComp extends CCComp {
atk_count: number = 0; atk_count: number = 0;
atked_count: number = 0; atked_count: number = 0;
dodge_count: number = 0;
crit_count: number = 0;
stop_cd: number = 0.5; /*停止倒计时*/ stop_cd: number = 0.5; /*停止倒计时*/
dir_y:number = 0; dir_y:number = 0;
@@ -125,7 +135,7 @@ export class HeroViewComp extends CCComp {
let collider = this.getComponent(Collider2D); let collider = this.getComponent(Collider2D);
collider.group = this.box_group; collider.group = this.box_group;
console.log("hero collider ",this.scale,collider); // console.log("hero collider ",this.scale,collider);
if (collider) { if (collider) {
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this); collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
// collider.on(Contact2DType.END_CONTACT, this.onEndContact, this); // collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
@@ -204,12 +214,10 @@ export class HeroViewComp extends CCComp {
return return
} }
// if (this.timer.update(dt)) { if (this.pwt.update(dt)) {
// this.power_change(this.power_speed) this.pw+=this.pws
// } }
// if(this.anm_timer.update(dt)) { this.check_power()
// this.handle_skill(this.sk2)
// }
this.check_atk_buffs(dt) this.check_atk_buffs(dt)
this.check_atk_counts() this.check_atk_counts()
this.in_stop(dt); this.in_stop(dt);
@@ -220,23 +228,6 @@ export class HeroViewComp extends CCComp {
this.move(dt); this.move(dt);
} }
change_anm(){
if (this.anm_name == "atk") {
this.as.atk()
this.anm_name = "move"
}
if (this.anm_name == "move") {
this.as.move()
this.anm_name = "atk"
}
if (this.anm_name == "idle") {
this.as.idle()
this.anm_name = "move"
}
}
check_enemy_alive(){ check_enemy_alive(){
let dir = 320 let dir = 320
this.enemy = v3(720,this.node.position.y) this.enemy = v3(720,this.node.position.y)
@@ -329,11 +320,26 @@ export class HeroViewComp extends CCComp {
return {pos,t_pos} return {pos,t_pos}
} }
//能量判断
check_power(){
if(this.pw >= this.pwm){
this.pw = 0
this.node.getChildByName("max").active=true
this.scheduleOnce(()=>{
this.node.getChildByName("max").active=false
},0.8)
this.handle_skill(this.sk2)
return true
}else{
return false
}
}
//暴击判断 //暴击判断
check_crit(){ check_crit(){
let i = RandomManager.instance.getRandomInt(0,100,3) let i = RandomManager.instance.getRandomInt(0,100,3)
if(i < this.crit){ if(i < this.crit){
console.log("攻击会暴击",i,this.crit); this.tooltip(5,"*会心一击*");
this.crit_count += 1
return true return true
}else{ }else{
return false return false
@@ -343,21 +349,21 @@ export class HeroViewComp extends CCComp {
check_dodge(){ check_dodge(){
let i = RandomManager.instance.getRandomInt(0,100,3) let i = RandomManager.instance.getRandomInt(0,100,3)
if(i < this.dodge){ if(i < this.dodge){
this.tooltip(5,"闪避"); this.tooltip(5,"/闪避/");
console.log("闪避了",i,this.dodge); this.dodge_count += 1
return true return true
}else{ }else{
return false return false
} }
} }
check_atk_counts(){ check_atk_counts(){
if(this.atk_count >= 1){ if(this.atk_count >= this.akc){
this.atk_count = 0 this.atk_count = 0
console.log("atk_count 清零:"+this.atk_count); // console.log("atk_count 清零:"+this.atk_count);
let i = RandomManager.instance.getRandomInt(0,100,3) let i = RandomManager.instance.getRandomInt(0,100,3)
console.log("大招判断: i="+i+":skr="+this.skr[this.lv]); // console.log("攻击判断: i="+i+":akr="+this.akr);
if(i < this.skr[this.lv]){ if(i < this.akr){
console.log("大招触发: i="+i+":skr="+this.skr[this.lv]); // console.log("攻击触发: i="+i+":akr="+this.akr);
this.node.getChildByName("max").active=true this.node.getChildByName("max").active=true
this.scheduleOnce(()=>{ this.scheduleOnce(()=>{
this.node.getChildByName("max").active=false this.node.getChildByName("max").active=false
@@ -365,12 +371,40 @@ export class HeroViewComp extends CCComp {
this.handle_skill(this.sk2) this.handle_skill(this.sk2)
} }
} }
if(this.atked_count >= 1){ if(this.dodge_count >= this.dgc){
this.dodge_count = 0
// console.log("dodge_count 清零:"+this.dodge_count);
let i = RandomManager.instance.getRandomInt(0,100,3)
// console.log("闪避判断: i="+i+":dgr="+this.dgr);
if(i < this.dgr){
// console.log("闪避触发: i="+i+":dgr="+this.dgr);
this.node.getChildByName("max").active=true
this.scheduleOnce(()=>{
this.node.getChildByName("max").active=false
},0.8)
this.handle_skill(this.sk2)
}
}
if(this.crit_count >= this.crc){
this.crit_count = 0
// console.log("crit_count 清零:"+this.crit_count);
let i = RandomManager.instance.getRandomInt(0,100,3)
// console.log("暴击判断: i="+i+":crr="+this.crr);
if(i < this.crr){
// console.log("闪避触发: i="+i+":crr="+this.crr);
this.node.getChildByName("max").active=true
this.scheduleOnce(()=>{
this.node.getChildByName("max").active=false
},0.8)
this.handle_skill(this.sk2)
}
}
if(this.atked_count >= this.uac){
this.atked_count = 0 this.atked_count = 0
let i = RandomManager.instance.getRandomInt(0,100,3) let i = RandomManager.instance.getRandomInt(0,100,3)
console.log("受伤判断i="+i+":skr="+this.skr[this.lv]); // console.log("受伤判断i="+i+":akr="+this.uar);
if(i < this.skr[this.lv]){ if(i < this.uar){
console.log("受伤触发: i="+i+":skr="+this.skr[this.lv]); // console.log("受伤触发: i="+i+":uar="+this.uar);
this.node.getChildByName("max").active=true this.node.getChildByName("max").active=true
this.scheduleOnce(()=>{ this.scheduleOnce(()=>{
this.node.getChildByName("max").active=false this.node.getChildByName("max").active=false

View File

@@ -19,6 +19,7 @@ export class HCardComp extends CCComp {
ap:any=[] ap:any=[]
hp:any=[] hp:any=[]
life:any=[] life:any=[]
pw:any=[]
protected onLoad(): void { protected onLoad(): void {
@@ -26,10 +27,11 @@ export class HCardComp extends CCComp {
start() { start() {
this.heros= ecs.query(ecs.allOf(HeroModelComp)); this.heros= ecs.query(ecs.allOf(HeroModelComp));
this.hc_name=this.node.getChildByName("name").getComponent(Label)! this.hc_name=this.node.getChildByName("name").getComponent(Label)!
this.icon=this.node.getChildByName("icon").getComponent(Sprite)! // this.icon=this.node.getChildByName("icon").getComponent(Sprite)!
this.hp=this.node.getChildByName("hp").getChildByName("num").getComponent(Label)! this.hp=this.node.getChildByName("hp").getChildByName("num").getComponent(Label)!
this.ap=this.node.getChildByName("ap").getChildByName("num").getComponent(Label)! this.ap=this.node.getChildByName("ap").getChildByName("num").getComponent(Label)!
this.life=this.node.getChildByName("life").getComponent(ProgressBar)! this.life=this.node.getChildByName("life").getComponent(ProgressBar)!
this.pw=this.node.getChildByName("pow").getComponent(ProgressBar)!
this.hc_name.string= this.heros[this.hi].HeroView.hero_name this.hc_name.string= this.heros[this.hi].HeroView.hero_name
console.log("hcard start") console.log("hcard start")
} }
@@ -37,6 +39,7 @@ export class HCardComp extends CCComp {
this.hp.string=this.heros[this.hi].HeroView.hp_max this.hp.string=this.heros[this.hi].HeroView.hp_max
this.ap.string=this.heros[this.hi].HeroView.ap this.ap.string=this.heros[this.hi].HeroView.ap
this.life.progress=this.heros[this.hi].HeroView.hp/this.heros[this.hi].HeroView.hp_max this.life.progress=this.heros[this.hi].HeroView.hp/this.heros[this.hi].HeroView.hp_max
this.pw.progress=this.heros[this.hi].HeroView.pw/this.heros[this.hi].HeroView.pwm
} }
/** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */ /** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */

View File

@@ -58,18 +58,10 @@ export class MissionComp extends CCComp {
mon_index:number = 0 mon_index:number = 0
onLoad(){ onLoad(){
// 监听全局事件
oops.message.on("other_add_monster", this.on_other_add_monster, this);
oops.message.on("do_add_hero", this.on_do_add_hero, this);
oops.message.on("mission_start", this.mission_start, this);
oops.message.on("mission_end", this.mission_end, this);
oops.message.on("mon_dead", this.on_mon_dead, this);
} }
start() { start() {
this.hcard_call()
} }
protected update(dt: number): void { protected update(dt: number): void {
@@ -174,18 +166,6 @@ export class MissionComp extends CCComp {
oops.message.dispatchEvent("do_reward"); oops.message.dispatchEvent("do_reward");
} }
private on_other_add_monster(event: string, args: any) {
var scene = smc.map.MapView.scene;
let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE)
let monster_layer = scene.entityLayer!.node!
this.addMonster(args.uuid)
}
check_mon_count(){
let count = 0;
let list = ecs.query(ecs.allOf(MonModelComp));
count = list.length
return count;
}
count_mon_pos(){ count_mon_pos(){
let monsters:any= ecs.query(ecs.allOf(MonModelComp)); let monsters:any= ecs.query(ecs.allOf(MonModelComp));
for(let i=0;i<monsters.length;i++){ for(let i=0;i<monsters.length;i++){
@@ -203,9 +183,7 @@ export class MissionComp extends CCComp {
} }
} }
private on_do_add_hero(event: string, args: any) {
this.addHero(args.uuid)
}
heros_call(){ heros_call(){
let hero:any =RandomManager.instance.getRandomByObjectList(smc.cards, 1); let hero:any =RandomManager.instance.getRandomByObjectList(smc.cards, 1);
this.addHero(hero[0].uuid) this.addHero(hero[0].uuid)