dd
This commit is contained in:
@@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"__type__": "cc.Material",
|
||||||
|
"_name": "",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"__editorExtras__": {},
|
||||||
|
"_native": "",
|
||||||
|
"_effectAsset": {
|
||||||
|
"__uuid__": "40c25c17-db22-4ae7-8d3a-f73cbb6d36ba",
|
||||||
|
"__expectedType__": "cc.EffectAsset"
|
||||||
|
},
|
||||||
|
"_techIdx": 0,
|
||||||
|
"_defines": [
|
||||||
|
{
|
||||||
|
"USE_TEXTURE": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_states": [
|
||||||
|
{
|
||||||
|
"rasterizerState": {},
|
||||||
|
"depthStencilState": {},
|
||||||
|
"blendState": {
|
||||||
|
"targets": [
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_props": [
|
||||||
|
{
|
||||||
|
"glowColor": {
|
||||||
|
"__type__": "cc.Color",
|
||||||
|
"r": 255,
|
||||||
|
"g": 235,
|
||||||
|
"b": 0,
|
||||||
|
"a": 255
|
||||||
|
},
|
||||||
|
"glowWidth": 0.002
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"ver":"1.0.21","importer":"material","imported":true,"uuid":"974af3c9-d7ee-449f-a5df-cd8e2dd49188","files":[".json"],"subMetas":{},"userData":{}}
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
|
||||||
|
CCEffect %{
|
||||||
|
techniques:
|
||||||
|
- passes:
|
||||||
|
- vert: sprite-vs:vert
|
||||||
|
frag: sprite-fs:frag
|
||||||
|
depthStencilState:
|
||||||
|
depthTest: false
|
||||||
|
depthWrite: false
|
||||||
|
blendState:
|
||||||
|
targets:
|
||||||
|
- blend: true
|
||||||
|
blendSrc: src_alpha
|
||||||
|
blendDst: one_minus_src_alpha
|
||||||
|
blendDstAlpha: one_minus_src_alpha
|
||||||
|
rasterizerState:
|
||||||
|
cullMode: none
|
||||||
|
properties:
|
||||||
|
alphaThreshold: { value: 0.5 }
|
||||||
|
|
||||||
|
glowColor: { value: [1, 1, 1, 1], editor: { type: color } }
|
||||||
|
glowWidth: { value: 0.05, editor: { slide: true, range: [0, 0.3], step: 0.001 } }
|
||||||
|
glowThreshold: { value: 1, editor: { slide: true, range: [0, 1], step: 0.001 } }
|
||||||
|
}%
|
||||||
|
|
||||||
|
CCProgram sprite-vs %{
|
||||||
|
precision highp float;
|
||||||
|
#include <builtin/uniforms/cc-global>
|
||||||
|
#if USE_LOCAL
|
||||||
|
#include <builtin/uniforms/cc-local>
|
||||||
|
#endif
|
||||||
|
#if SAMPLE_FROM_RT
|
||||||
|
#include <common/common-define>
|
||||||
|
#endif
|
||||||
|
in vec3 a_position;
|
||||||
|
in vec2 a_texCoord;
|
||||||
|
in vec4 a_color;
|
||||||
|
|
||||||
|
out vec4 color;
|
||||||
|
out vec2 uv0;
|
||||||
|
|
||||||
|
vec4 vert () {
|
||||||
|
vec4 pos = vec4(a_position, 1);
|
||||||
|
|
||||||
|
#if USE_LOCAL
|
||||||
|
pos = cc_matWorld * pos;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if USE_PIXEL_ALIGNMENT
|
||||||
|
pos = cc_matView * pos;
|
||||||
|
pos.xyz = floor(pos.xyz);
|
||||||
|
pos = cc_matProj * pos;
|
||||||
|
#else
|
||||||
|
pos = cc_matViewProj * pos;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uv0 = a_texCoord;
|
||||||
|
#if SAMPLE_FROM_RT
|
||||||
|
CC_HANDLE_RT_SAMPLE_FLIP(uv0);
|
||||||
|
#endif
|
||||||
|
color = a_color;
|
||||||
|
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
}%
|
||||||
|
|
||||||
|
CCProgram sprite-fs %{
|
||||||
|
precision highp float;
|
||||||
|
#include <builtin/internal/embedded-alpha>
|
||||||
|
#include <builtin/internal/alpha-test>
|
||||||
|
|
||||||
|
in vec4 color;
|
||||||
|
|
||||||
|
uniform FSConstants {
|
||||||
|
vec4 glowColor;
|
||||||
|
float glowWidth;
|
||||||
|
float glowThreshold;
|
||||||
|
};
|
||||||
|
|
||||||
|
#if USE_TEXTURE
|
||||||
|
in vec2 uv0;
|
||||||
|
#pragma builtin(local)
|
||||||
|
layout(set = 2, binding = 12) uniform sampler2D cc_spriteTexture;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
vec4 getTextureColor (sampler2D mainTexture, vec2 uv) {
|
||||||
|
if (uv.x > 1.0 || uv.x < 0.0 || uv.y > 1.0 || uv.y < 0.0) {
|
||||||
|
return vec4(0.0, 0.0, 0.0, 0.0);
|
||||||
|
}
|
||||||
|
return texture(mainTexture, uv);
|
||||||
|
}
|
||||||
|
|
||||||
|
float getColorAlpha (float angle, float dist) {
|
||||||
|
// 角度转弧度,公式为:弧度 = 角度 * (pi / 180)
|
||||||
|
float radian = angle * 3.14 / 180.0;
|
||||||
|
vec2 newUV = uv0 + vec2(dist * cos(radian), dist * sin(radian));
|
||||||
|
vec4 color = getTextureColor(cc_spriteTexture, newUV);
|
||||||
|
return color.a;
|
||||||
|
}
|
||||||
|
|
||||||
|
float getAverageAlpha (float dist) {
|
||||||
|
float totalAlpha = 0.0;
|
||||||
|
|
||||||
|
totalAlpha += getColorAlpha(0.0, dist);
|
||||||
|
totalAlpha += getColorAlpha(30.0, dist);
|
||||||
|
totalAlpha += getColorAlpha(60.0, dist);
|
||||||
|
totalAlpha += getColorAlpha(90.0, dist);
|
||||||
|
totalAlpha += getColorAlpha(120.0, dist);
|
||||||
|
totalAlpha += getColorAlpha(150.0, dist);
|
||||||
|
totalAlpha += getColorAlpha(180.0, dist);
|
||||||
|
totalAlpha += getColorAlpha(210.0, dist);
|
||||||
|
totalAlpha += getColorAlpha(240.0, dist);
|
||||||
|
totalAlpha += getColorAlpha(270.0, dist);
|
||||||
|
totalAlpha += getColorAlpha(300.0, dist);
|
||||||
|
totalAlpha += getColorAlpha(330.0, dist);
|
||||||
|
|
||||||
|
return totalAlpha * 0.0833;
|
||||||
|
}
|
||||||
|
|
||||||
|
float getGlowAlpha () {
|
||||||
|
if (glowWidth == 0.0 ) {
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
float totalAlpha = 0.0;
|
||||||
|
totalAlpha += getAverageAlpha(glowWidth * 0.1);
|
||||||
|
totalAlpha += getAverageAlpha(glowWidth * 0.2);
|
||||||
|
totalAlpha += getAverageAlpha(glowWidth * 0.3);
|
||||||
|
totalAlpha += getAverageAlpha(glowWidth * 0.4);
|
||||||
|
totalAlpha += getAverageAlpha(glowWidth * 0.5);
|
||||||
|
totalAlpha += getAverageAlpha(glowWidth * 0.6);
|
||||||
|
totalAlpha += getAverageAlpha(glowWidth * 0.7);
|
||||||
|
totalAlpha += getAverageAlpha(glowWidth * 0.8);
|
||||||
|
totalAlpha += getAverageAlpha(glowWidth * 0.9);
|
||||||
|
totalAlpha += getAverageAlpha(glowWidth * 1.0);
|
||||||
|
|
||||||
|
return totalAlpha * 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 frag () {
|
||||||
|
vec4 o = vec4(1, 1, 1, 1);
|
||||||
|
|
||||||
|
#if USE_TEXTURE
|
||||||
|
o *= CCSampleWithAlphaSeparated(cc_spriteTexture, uv0);
|
||||||
|
#if IS_GRAY
|
||||||
|
float gray = 0.2126 * o.r + 0.7152 * o.g + 0.0722 * o.b;
|
||||||
|
o.r = o.g = o.b = gray;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
float alpha = getGlowAlpha();
|
||||||
|
|
||||||
|
if (alpha <= glowThreshold) {
|
||||||
|
alpha /= glowThreshold;
|
||||||
|
alpha = -1.0 * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) + 1.0;
|
||||||
|
} else {
|
||||||
|
alpha = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 dstColor = glowColor * alpha;
|
||||||
|
vec4 scrColor = o;
|
||||||
|
|
||||||
|
o = scrColor * scrColor.a + dstColor * (1.0 - scrColor.a);
|
||||||
|
|
||||||
|
o *= color;
|
||||||
|
ALPHA_TEST(o);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
}%
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"ver":"1.7.1","importer":"effect","imported":true,"uuid":"40c25c17-db22-4ae7-8d3a-f73cbb6d36ba","files":[".json"],"subMetas":{},"userData":{"combinations":[{}]}}
|
||||||
@@ -1271,7 +1271,7 @@
|
|||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": 0,
|
"x": 0,
|
||||||
"y": -314.65,
|
"y": -197.983,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
"_lrot": {
|
"_lrot": {
|
||||||
@@ -1311,8 +1311,8 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 556,
|
"width": 556.1,
|
||||||
"height": 432
|
"height": 332
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
@@ -1379,6 +1379,8 @@
|
|||||||
"__id__": 0
|
"__id__": 0
|
||||||
},
|
},
|
||||||
"fileId": "3fAYpeIJJHJZjCyzC0S8Eq",
|
"fileId": "3fAYpeIJJHJZjCyzC0S8Eq",
|
||||||
|
"instance": null,
|
||||||
|
"targetOverrides": null,
|
||||||
"nestedPrefabInstanceRoots": null
|
"nestedPrefabInstanceRoots": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -31,6 +31,7 @@ export enum GameEvent {
|
|||||||
HeroSkillSelectEnd = "HeroSkillSelectEnd",
|
HeroSkillSelectEnd = "HeroSkillSelectEnd",
|
||||||
HeroSelect = "HeroSelect",
|
HeroSelect = "HeroSelect",
|
||||||
EnhancementSelect = "EnhancementSelect",
|
EnhancementSelect = "EnhancementSelect",
|
||||||
|
CanUpdateLv = "CanUpdateLv",
|
||||||
UseEnhancement = "UseEnhancement",
|
UseEnhancement = "UseEnhancement",
|
||||||
MasterCalled = "MasterCalled",
|
MasterCalled = "MasterCalled",
|
||||||
FightStart = "FightStart",
|
FightStart = "FightStart",
|
||||||
|
|||||||
@@ -54,32 +54,28 @@ export const HQuality = {
|
|||||||
}
|
}
|
||||||
export const MonSet = {
|
export const MonSet = {
|
||||||
0:{pos:v3(390,0,0)},
|
0:{pos:v3(390,0,0)},
|
||||||
1:{pos:v3(390,+80,0)},
|
1:{pos:v3(420,0,0)},
|
||||||
2:{pos:v3(390,-80,0)},
|
2:{pos:v3(450,0,0)},
|
||||||
3:{pos:v3(420,0,0)},
|
3:{pos:v3(480,0,0)},
|
||||||
4:{pos:v3(420,+80,0)},
|
4:{pos:v3(510,0,0)},
|
||||||
5:{pos:v3(420,-80,0)},
|
5:{pos:v3(540,0,0)},
|
||||||
6:{pos:v3(450,0,0)},
|
6:{pos:v3(570,0,0)},
|
||||||
7:{pos:v3(450,+80,0)},
|
7:{pos:v3(600,0,0)},
|
||||||
8:{pos:v3(450,-80,0)},
|
8:{pos:v3(630,0,0)},
|
||||||
9:{pos:v3(480,0,0)},
|
9:{pos:v3(660,0,0)},
|
||||||
10:{pos:v3(480,+80,0)},
|
10:{pos:v3(690,0,0)},
|
||||||
11:{pos:v3(480,-80,0)},
|
11:{pos:v3(720,0,0)},
|
||||||
12:{pos:v3(510,0,0)},
|
12:{pos:v3(750,0,0)},
|
||||||
13:{pos:v3(510,+80,0)},
|
13:{pos:v3(780,0,0)},
|
||||||
14:{pos:v3(510,-80,0)},
|
14:{pos:v3(810,0,0)},
|
||||||
15:{pos:v3(540,0,0)},
|
15:{pos:v3(840,0,0)},
|
||||||
16:{pos:v3(540,+80,0)},
|
16:{pos:v3(870,0,0)},
|
||||||
17:{pos:v3(540,-80,0)},
|
17:{pos:v3(900,0,0)},
|
||||||
18:{pos:v3(570,0,0)},
|
18:{pos:v3(930,0,0)},
|
||||||
19:{pos:v3(570,+80,0)},
|
19:{pos:v3(960,0,0)},
|
||||||
20:{pos:v3(570,-80,0)},
|
20:{pos:v3(990,0,0)},
|
||||||
21:{pos:v3(600,0,0)},
|
21:{pos:v3(1020,0,0)},
|
||||||
22:{pos:v3(600,+80,0)},
|
22:{pos:v3(1050,0,0)},
|
||||||
23:{pos:v3(600,-80,0)},
|
|
||||||
24:{pos:v3(630,0,0)},
|
|
||||||
25:{pos:v3(630,+80,0)},
|
|
||||||
26:{pos:v3(630,-80,0)},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 经验值计算函数 - 复杂递增规律
|
// 经验值计算函数 - 复杂递增规律
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ export class BuffComp extends Component {
|
|||||||
let buff=null
|
let buff=null
|
||||||
let info= null
|
let info= null
|
||||||
if(!this.HeroView) return
|
if(!this.HeroView) return
|
||||||
|
if(!this.HeroView.is_master) return
|
||||||
if(this.HeroView.fac==FacSet.HERO) {info=smc.vmdata.hero;buff=this.FIGHTCON.hero_buff}
|
if(this.HeroView.fac==FacSet.HERO) {info=smc.vmdata.hero;buff=this.FIGHTCON.hero_buff}
|
||||||
if(this.HeroView.is_boss) {info=smc.vmdata.boss;buff=this.FIGHTCON.enemy_buff}
|
if(this.HeroView.is_boss) {info=smc.vmdata.boss;buff=this.FIGHTCON.enemy_buff}
|
||||||
//if(this.HeroView.is_kalami) {target_key="enemy";buff_key="enemy"} 不显示小怪
|
//if(this.HeroView.is_kalami) {target_key="enemy";buff_key="enemy"} 不显示小怪
|
||||||
@@ -104,8 +105,8 @@ export class BuffComp extends Component {
|
|||||||
info.hp=this.HeroView.hp
|
info.hp=this.HeroView.hp
|
||||||
info.hp_buff=buff.HP
|
info.hp_buff=buff.HP
|
||||||
info.hp_max=this.HeroView.hp_max*(100+buff.HP)/100
|
info.hp_max=this.HeroView.hp_max*(100+buff.HP)/100
|
||||||
info.exp=this.HeroView.exp
|
// info.exp=this.HeroView.exp
|
||||||
info.next_exp=this.HeroView.next_exp
|
// info.next_exp=this.HeroView.next_exp
|
||||||
}else{
|
}else{
|
||||||
info.hp=this.HeroView.hp
|
info.hp=this.HeroView.hp
|
||||||
info.hp_buff=buff.HP
|
info.hp_buff=buff.HP
|
||||||
@@ -118,7 +119,7 @@ export class BuffComp extends Component {
|
|||||||
view_deatk += this.HeroView.DEBUFF_DEATKS[i].value
|
view_deatk += this.HeroView.DEBUFF_DEATKS[i].value
|
||||||
}
|
}
|
||||||
info.ap=this.HeroView.ap
|
info.ap=this.HeroView.ap
|
||||||
info.lv=this.HeroView.lv
|
// info.lv=this.HeroView.lv
|
||||||
info.cd=Number((this.HeroView.cd*(100-buff.ATK_CD)/100).toFixed(2))
|
info.cd=Number((this.HeroView.cd*(100-buff.ATK_CD)/100).toFixed(2))
|
||||||
console.log("info.buff.ATK_CD",buff.ATK_CD)
|
console.log("info.buff.ATK_CD",buff.ATK_CD)
|
||||||
info.equip_ap=buff.ATK
|
info.equip_ap=buff.ATK
|
||||||
|
|||||||
@@ -162,26 +162,7 @@ export class HeroViewComp extends CCComp {
|
|||||||
// 处理伤害队列
|
// 处理伤害队列
|
||||||
this.processDamageQueue();
|
this.processDamageQueue();
|
||||||
}
|
}
|
||||||
use_enhancement(e:GameEvent,data:any){
|
|
||||||
//console.log("[HeroViewComp]:use_enhancement",data)
|
|
||||||
if(this.is_master){
|
|
||||||
switch(data.type){
|
|
||||||
case EnhancementType.ATTACK:
|
|
||||||
this.add_ap(data.value)
|
|
||||||
break
|
|
||||||
case EnhancementType.ATTACK_SPEED:
|
|
||||||
this.add_speed(data.value)
|
|
||||||
break
|
|
||||||
case EnhancementType.HEALTH:
|
|
||||||
this.add_hp_max(data.value)
|
|
||||||
break
|
|
||||||
case EnhancementType.DEF:
|
|
||||||
this.add_def(data.value)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
change_atk(e:GameEvent,data:any){
|
change_atk(e:GameEvent,data:any){
|
||||||
if(!this.is_master) return
|
if(!this.is_master) return
|
||||||
|
|
||||||
@@ -225,12 +206,13 @@ export class HeroViewComp extends CCComp {
|
|||||||
*/
|
*/
|
||||||
add_def(def: number){
|
add_def(def: number){
|
||||||
this.def+=def
|
this.def+=def
|
||||||
this.BUFFCOMP.vmdata_update()
|
if(this.is_master) this.BUFFCOMP.vmdata_update()
|
||||||
|
|
||||||
// this.BUFFCOMP.tooltip(TooltipTypes.defup,def.toFixed(0));
|
// this.BUFFCOMP.tooltip(TooltipTypes.defup,def.toFixed(0));
|
||||||
}
|
}
|
||||||
add_speed(cd: number){
|
add_speed(cd: number){
|
||||||
this.cd -=this.cd*cd/100
|
this.cd -=this.cd*cd/100
|
||||||
this.BUFFCOMP.vmdata_update()
|
if(this.is_master) this.BUFFCOMP.vmdata_update()
|
||||||
// this.BUFFCOMP.tooltip(TooltipTypes.speedup,speed.toFixed(0));
|
// this.BUFFCOMP.tooltip(TooltipTypes.speedup,speed.toFixed(0));
|
||||||
}
|
}
|
||||||
add_ap(ap: number,is_num:boolean=true){
|
add_ap(ap: number,is_num:boolean=true){
|
||||||
@@ -240,9 +222,12 @@ export class HeroViewComp extends CCComp {
|
|||||||
}else{
|
}else{
|
||||||
this.ap += Math.floor(ap/100*this.ap);
|
this.ap += Math.floor(ap/100*this.ap);
|
||||||
}
|
}
|
||||||
this.BUFFCOMP.vmdata_update()
|
|
||||||
this.BUFFCOMP.tooltip(TooltipTypes.apup,ap.toFixed(0));
|
this.BUFFCOMP.tooltip(TooltipTypes.apup,ap.toFixed(0));
|
||||||
oops.message.dispatchEvent(GameEvent.APChange,{is_master:this.is_master,fac:this.fac})
|
|
||||||
|
if(this.is_master) {
|
||||||
|
this.BUFFCOMP.vmdata_update();
|
||||||
|
oops.message.dispatchEvent(GameEvent.APChange,{is_master:this.is_master,fac:this.fac})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
de_ap(ap: number,is_num:boolean=true){
|
de_ap(ap: number,is_num:boolean=true){
|
||||||
@@ -252,7 +237,7 @@ export class HeroViewComp extends CCComp {
|
|||||||
}else{
|
}else{
|
||||||
this.ap -= Math.floor(ap/100*this.ap);
|
this.ap -= Math.floor(ap/100*this.ap);
|
||||||
}
|
}
|
||||||
this.BUFFCOMP.vmdata_update()
|
if(this.is_master) this.BUFFCOMP.vmdata_update()
|
||||||
}
|
}
|
||||||
update_hp(e:GameEvent,data:any){
|
update_hp(e:GameEvent,data:any){
|
||||||
//console.log("[HeroViewComp]:update_hp",data)
|
//console.log("[HeroViewComp]:update_hp",data)
|
||||||
@@ -269,7 +254,7 @@ export class HeroViewComp extends CCComp {
|
|||||||
add_hp_max(hp: number=0,is_num:boolean=true){
|
add_hp_max(hp: number=0,is_num:boolean=true){
|
||||||
this.hp_max += Math.floor(hp) ;
|
this.hp_max += Math.floor(hp) ;
|
||||||
this.hp += Math.floor(hp*(100+this.buff_hp)/100) ;
|
this.hp += Math.floor(hp*(100+this.buff_hp)/100) ;
|
||||||
this.BUFFCOMP.vmdata_update(true)
|
if(this.is_master) this.BUFFCOMP.vmdata_update(true)
|
||||||
this.BUFFCOMP.tooltip(TooltipTypes.hpup,hp.toFixed(0));
|
this.BUFFCOMP.tooltip(TooltipTypes.hpup,hp.toFixed(0));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -277,7 +262,7 @@ export class HeroViewComp extends CCComp {
|
|||||||
de_hp_max(hp: number=0,is_num:boolean=true){ //最大值 只存在数值添加, 比例通过buff_hp处理
|
de_hp_max(hp: number=0,is_num:boolean=true){ //最大值 只存在数值添加, 比例通过buff_hp处理
|
||||||
//console.log("[HeroViewComp]:de_hp_max de:",hp,this.hp_max)
|
//console.log("[HeroViewComp]:de_hp_max de:",hp,this.hp_max)
|
||||||
this.hp_max -= Math.floor(hp) ;
|
this.hp_max -= Math.floor(hp) ;
|
||||||
this.BUFFCOMP.vmdata_update(true)
|
if(this.is_master) this.BUFFCOMP.vmdata_update(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
add_hp(hp: number = 0,is_num:boolean=true) {
|
add_hp(hp: number = 0,is_num:boolean=true) {
|
||||||
@@ -302,7 +287,7 @@ export class HeroViewComp extends CCComp {
|
|||||||
this.hp+=real_hp;
|
this.hp+=real_hp;
|
||||||
this.BUFFCOMP.tooltip(TooltipTypes.health,real_hp.toFixed(0));
|
this.BUFFCOMP.tooltip(TooltipTypes.health,real_hp.toFixed(0));
|
||||||
}
|
}
|
||||||
this.BUFFCOMP.vmdata_update(true)
|
if(this.is_master) this.BUFFCOMP.vmdata_update(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -494,7 +479,7 @@ export class HeroViewComp extends CCComp {
|
|||||||
this.ent.destroy();
|
this.ent.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.BUFFCOMP.vmdata_update(true)
|
if(this.is_master) this.BUFFCOMP.vmdata_update(true)
|
||||||
this.showDamage(damage, is_crit);
|
this.showDamage(damage, is_crit);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -646,24 +631,40 @@ export class HeroViewComp extends CCComp {
|
|||||||
exp_up(e:any,data:any){
|
exp_up(e:any,data:any){
|
||||||
if(this.fac==FacSet.MON) return
|
if(this.fac==FacSet.MON) return
|
||||||
//console.log("[HeroViewComp]:经验提高",data.exp)
|
//console.log("[HeroViewComp]:经验提高",data.exp)
|
||||||
this.exp+=data.exp
|
smc.vmdata.hero.exp+=data.exp
|
||||||
this.next_exp=getUpExp(this.lv)
|
// smc.vmdata.hero.next_exp=getUpExp(this.lv)
|
||||||
let diff=this.exp-this.next_exp
|
if(smc.vmdata.hero.exp >= smc.vmdata.hero.next_exp){
|
||||||
if(diff >= 0){
|
oops.message.dispatchEvent(GameEvent.CanUpdateLv)
|
||||||
this.exp=diff
|
|
||||||
//console.log("[HeroViewComp]:exp_up",this.exp,this.next_exp)
|
|
||||||
oops.message.dispatchEvent(GameEvent.EnhancementSelect)
|
|
||||||
this.to_update()
|
|
||||||
}
|
}
|
||||||
this.BUFFCOMP.vmdata_update(true) //简易更新vmdata
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
use_enhancement(e:GameEvent,data:any){
|
||||||
|
//console.log("[HeroViewComp]:use_enhancement",data)
|
||||||
|
if(!this.is_master) return
|
||||||
|
switch(data.type){
|
||||||
|
case EnhancementType.ATTACK:
|
||||||
|
this.add_ap(data.value)
|
||||||
|
break
|
||||||
|
case EnhancementType.ATTACK_SPEED:
|
||||||
|
this.add_speed(data.value)
|
||||||
|
break
|
||||||
|
case EnhancementType.HEALTH:
|
||||||
|
this.add_hp_max(data.value)
|
||||||
|
break
|
||||||
|
case EnhancementType.DEF:
|
||||||
|
this.add_def(data.value)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
this.to_update()
|
||||||
|
}
|
||||||
to_update(){
|
to_update(){
|
||||||
if(!this.is_master) return
|
if(!this.is_master) return
|
||||||
oops.message.dispatchEvent(GameEvent.HeroLvUp,{lv:this.lv})
|
// oops.message.dispatchEvent(GameEvent.HeroLvUp,{lv:this.lv})
|
||||||
this.lv+=1
|
|
||||||
this.next_exp=getUpExp(this.lv)
|
smc.vmdata.hero.exp = smc.vmdata.hero.exp-smc.vmdata.hero.next_exp
|
||||||
this.BUFFCOMP.vmdata_update()
|
smc.vmdata.hero.lv = smc.vmdata.hero.lv+1
|
||||||
|
smc.vmdata.hero.next_exp=getUpExp(smc.vmdata.hero.lv)
|
||||||
|
|
||||||
this.BUFFCOMP.lv_up()
|
this.BUFFCOMP.lv_up()
|
||||||
this.BUFFCOMP.tooltip(TooltipTypes.lvup)
|
this.BUFFCOMP.tooltip(TooltipTypes.lvup)
|
||||||
//@todo 需要添加 升级动画
|
//@todo 需要添加 升级动画
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ export class BarCompComp extends CCComp {
|
|||||||
this.on(GameEvent.FightReady,this.readay,this)
|
this.on(GameEvent.FightReady,this.readay,this)
|
||||||
this.on(GameEvent.MasterCalled,this.master_called,this)
|
this.on(GameEvent.MasterCalled,this.master_called,this)
|
||||||
this.on(GameEvent.APChange,this.ap_change,this)
|
this.on(GameEvent.APChange,this.ap_change,this)
|
||||||
|
this.on(GameEvent.CanUpdateLv,this.show_uplv_button,this)
|
||||||
|
this.on(GameEvent.UseEnhancement,this.hide_uplv_button,this)
|
||||||
|
|
||||||
}
|
}
|
||||||
start() {
|
start() {
|
||||||
@@ -35,6 +37,7 @@ export class BarCompComp extends CCComp {
|
|||||||
private readay(){
|
private readay(){
|
||||||
this.node.getChildByName("bar").active = true
|
this.node.getChildByName("bar").active = true
|
||||||
this.node.getChildByName("bar").getChildByName("more").active=false
|
this.node.getChildByName("bar").getChildByName("more").active=false
|
||||||
|
this.node.getChildByName("bar").getChildByName("uplv").active=false
|
||||||
}
|
}
|
||||||
private master_called(e:any,data:any){
|
private master_called(e:any,data:any){
|
||||||
this.node.getChildByName("bar").active = true
|
this.node.getChildByName("bar").active = true
|
||||||
@@ -58,6 +61,12 @@ export class BarCompComp extends CCComp {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
show_uplv_button(){
|
||||||
|
this.node.getChildByName("bar").getChildByName("uplv").active=true
|
||||||
|
}
|
||||||
|
hide_uplv_button(){
|
||||||
|
this.node.getChildByName("bar").getChildByName("uplv").active=false
|
||||||
|
}
|
||||||
show_master_more(){
|
show_master_more(){
|
||||||
let barNode = this.node.getChildByName("bar");
|
let barNode = this.node.getChildByName("bar");
|
||||||
let node = barNode.getChildByName("more");
|
let node = barNode.getChildByName("more");
|
||||||
|
|||||||
@@ -69,7 +69,9 @@ export class MissionComp extends CCComp {
|
|||||||
to_ready(){
|
to_ready(){
|
||||||
oops.message.dispatchEvent(GameEvent.HeroSelect,{is_master:true})
|
oops.message.dispatchEvent(GameEvent.HeroSelect,{is_master:true})
|
||||||
}
|
}
|
||||||
|
to_uplv(){
|
||||||
|
oops.message.dispatchEvent(GameEvent.EnhancementSelect)
|
||||||
|
}
|
||||||
to_call_friend(){
|
to_call_friend(){
|
||||||
oops.message.dispatchEvent(GameEvent.HeroSelect,{is_master:false})
|
oops.message.dispatchEvent(GameEvent.HeroSelect,{is_master:false})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user