装备ui 等级和品质 表现
This commit is contained in:
9
assets/resources/game/05-outline-glow.meta
Normal file
9
assets/resources/game/05-outline-glow.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "af691440-7aca-4cb5-9a78-9bfed9cb70de",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
BIN
assets/resources/game/05-outline-glow/.DS_Store
vendored
Normal file
BIN
assets/resources/game/05-outline-glow/.DS_Store
vendored
Normal file
Binary file not shown.
1
assets/resources/game/05-outline-glow/materials.meta
Normal file
1
assets/resources/game/05-outline-glow/materials.meta
Normal file
@@ -0,0 +1 @@
|
||||
{"ver":"1.2.0","importer":"directory","imported":true,"uuid":"551a2611-69c0-45ae-bfc6-37f056a34b33","files":[],"subMetas":{},"userData":{}}
|
||||
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"__type__": "cc.Material",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"_native": "",
|
||||
"_effectAsset": {
|
||||
"__uuid__": "cfeeea4f-db9c-42cd-a0f7-fc5cb37bd3d7",
|
||||
"__expectedType__": "cc.EffectAsset"
|
||||
},
|
||||
"_techIdx": 0,
|
||||
"_defines": [
|
||||
{
|
||||
"USE_TEXTURE": true
|
||||
}
|
||||
],
|
||||
"_states": [
|
||||
{
|
||||
"rasterizerState": {},
|
||||
"depthStencilState": {},
|
||||
"blendState": {
|
||||
"targets": [
|
||||
{}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"_props": [
|
||||
{
|
||||
"glowColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 0,
|
||||
"g": 0,
|
||||
"b": 0,
|
||||
"a": 255
|
||||
},
|
||||
"glowWidth": 0.003,
|
||||
"glowThreshold": 0.645
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"ver":"1.0.21","importer":"material","imported":true,"uuid":"2fcd55a9-38ca-45aa-9164-68e48aaf51ce","files":[".json"],"subMetas":{},"userData":{}}
|
||||
1
assets/resources/game/05-outline-glow/shaders.meta
Normal file
1
assets/resources/game/05-outline-glow/shaders.meta
Normal file
@@ -0,0 +1 @@
|
||||
{"ver":"1.2.0","importer":"directory","imported":true,"uuid":"7d369c63-9191-4323-abcc-edda5799a410","files":[],"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,15 @@
|
||||
{
|
||||
"ver": "1.7.1",
|
||||
"importer": "effect",
|
||||
"imported": true,
|
||||
"uuid": "cfeeea4f-db9c-42cd-a0f7-fc5cb37bd3d7",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"combinations": [
|
||||
{}
|
||||
]
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,7 @@ import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { HeroSkillList, SkillSet } from "../common/config/SkillSet";
|
||||
import { cardType, getRandomCardUUID, Quality, SuperCards } from "../common/config/CardSet";
|
||||
import { EquipInfo } from "../common/config/Equips";
|
||||
import { EquipInfo, EquipType } from "../common/config/Equips";
|
||||
import { FightSet } from "../common/config/Mission";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
@@ -169,6 +169,13 @@ export class CardComp extends CCComp {
|
||||
show.getChildByName("mask").getChildByName("equip").active=false
|
||||
show.getChildByName("mask").getChildByName("hero").active=false
|
||||
show.getChildByName("mask").getChildByName("func").active=false
|
||||
show.getChildByName("mask").getChildByName("abg").active=false
|
||||
show.getChildByName("mask").getChildByName("wbg").active=false
|
||||
show.getChildByName("mask").getChildByName("lv1").active=false
|
||||
show.getChildByName("mask").getChildByName("lv2").active=false
|
||||
show.getChildByName("mask").getChildByName("lv3").active=false
|
||||
show.getChildByName("mask").getChildByName("lv4").active=false
|
||||
show.getChildByName("mask").getChildByName("lv5").active=false
|
||||
switch(this.c_type){
|
||||
case cardType.HERO:
|
||||
show.getChildByName("mask").getChildByName("hero").active=true
|
||||
@@ -180,6 +187,34 @@ export class CardComp extends CCComp {
|
||||
break
|
||||
case cardType.EQUIP:
|
||||
show.getChildByName("mask").getChildByName("equip").active=true
|
||||
switch(EquipInfo[this.c_uuid].type){
|
||||
case EquipType.ARMOR:
|
||||
show.getChildByName("mask").getChildByName("abg").active=true
|
||||
break
|
||||
case EquipType.WEAPON:
|
||||
show.getChildByName("mask").getChildByName("wbg").active=true
|
||||
break
|
||||
case EquipType.ACCESSORY:
|
||||
console.log("[cardcomp]:装备卡 饰品")
|
||||
break
|
||||
}
|
||||
switch(EquipInfo[this.c_uuid].lv){
|
||||
case 1:
|
||||
show.getChildByName("mask").getChildByName("lv1").active=true
|
||||
break
|
||||
case 2:
|
||||
show.getChildByName("mask").getChildByName("lv2").active=true
|
||||
break
|
||||
case 3:
|
||||
show.getChildByName("mask").getChildByName("lv3").active=true
|
||||
break
|
||||
case 4:
|
||||
show.getChildByName("mask").getChildByName("lv4").active=true
|
||||
break
|
||||
case 5:
|
||||
show.getChildByName("mask").getChildByName("lv5").active=true
|
||||
break
|
||||
}
|
||||
show.getChildByName("type").getChildByName("name").getComponent(Label).string="装备"
|
||||
break
|
||||
case cardType.SPECIAL:
|
||||
@@ -197,8 +232,8 @@ export class CardComp extends CCComp {
|
||||
show.getChildByName("mask").getChildByName("q3").active=q==Quality.BLUE
|
||||
show.getChildByName("mask").getChildByName("q4").active=q==Quality.PURPLE
|
||||
show.getChildByName("mask").getChildByName("q5").active=q==Quality.ORANGE
|
||||
this.node.getChildByName("show").getChildByName("coins").active=true
|
||||
this.node.getChildByName("show").getChildByName("coins").getChildByName("num").getComponent(Label).string=this.get_cost_gold(q).toString()
|
||||
// this.node.getChildByName("show").getChildByName("coins").active=false
|
||||
// this.node.getChildByName("show").getChildByName("coins").getChildByName("num").getComponent(Label).string=this.get_cost_gold(q).toString()
|
||||
}
|
||||
|
||||
get_cost_gold(quality:number){
|
||||
@@ -250,13 +285,13 @@ export class CardComp extends CCComp {
|
||||
break
|
||||
case cardType.EQUIP:
|
||||
console.log("[cardcomp]:use_card 装备卡")
|
||||
if(!this.cost_gold_check()) return
|
||||
// if(!this.cost_gold_check()) return
|
||||
oops.message.dispatchEvent(GameEvent.EquipAdd,{uuid:this.c_uuid,type:EquipInfo[this.c_uuid].type,slot:this.equip_slot})
|
||||
oops.message.dispatchEvent(GameEvent.CardsClose)
|
||||
break
|
||||
case cardType.SPECIAL:
|
||||
console.log("[cardcomp]:use_card 功能卡")
|
||||
if(!this.cost_gold_check()) return
|
||||
// if(!this.cost_gold_check()) return
|
||||
oops.message.dispatchEvent(GameEvent.UseSpecialCard,{uuid:this.c_uuid})
|
||||
oops.message.dispatchEvent(GameEvent.CardsClose)
|
||||
break
|
||||
|
||||
@@ -5,6 +5,7 @@ import { smc } from '../common/SingletonModuleComp';
|
||||
import { EquipInfo, EquipType, EquipAttrTarget, EquipSpecialAttr} from '../common/config/Equips';
|
||||
import { BuffAttr, DebuffAttr, geDebuffNum, getBuffNum } from '../common/config/SkillSet';
|
||||
import { FightSet } from '../common/config/Mission';
|
||||
import { Quality } from '../common/config/CardSet';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('EquipsComp')
|
||||
@@ -109,31 +110,65 @@ export class EquipsComp extends Component {
|
||||
}
|
||||
show_weapon(uuid:number){
|
||||
let icon = this.boxs.getChildByName("weapon").getChildByName("icon")
|
||||
icon.active=true
|
||||
var icon_path = "game/heros/equips2"
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = icon.getChildByName("icon").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(EquipInfo[uuid].path);
|
||||
});
|
||||
icon.active=true
|
||||
var icon_path = "game/heros/equips2"
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = icon.getChildByName("icon").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(EquipInfo[uuid].path);
|
||||
});
|
||||
icon.getChildByName("lv1").active=EquipInfo[uuid].lv==1
|
||||
icon.getChildByName("lv2").active=EquipInfo[uuid].lv==2
|
||||
icon.getChildByName("lv3").active=EquipInfo[uuid].lv==3
|
||||
icon.getChildByName("lv4").active=EquipInfo[uuid].lv==4
|
||||
icon.getChildByName("lv5").active=EquipInfo[uuid].lv==5
|
||||
icon.getChildByName("q1").active=EquipInfo[uuid].quality==Quality.WHITE
|
||||
icon.getChildByName("q2").active=EquipInfo[uuid].quality==Quality.GREEN
|
||||
icon.getChildByName("q3").active=EquipInfo[uuid].quality==Quality.BLUE
|
||||
icon.getChildByName("q4").active=EquipInfo[uuid].quality==Quality.PURPLE
|
||||
icon.getChildByName("q5").active=EquipInfo[uuid].quality==Quality.ORANGE
|
||||
|
||||
}
|
||||
show_armor(uuid:number){
|
||||
let icon = this.boxs.getChildByName("armor").getChildByName("icon")
|
||||
icon.active=true
|
||||
var icon_path = "game/heros/equips2"
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = icon.getChildByName("icon").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(EquipInfo[uuid].path);
|
||||
});
|
||||
icon.active=true
|
||||
var icon_path = "game/heros/equips2"
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = icon.getChildByName("icon").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(EquipInfo[uuid].path);
|
||||
});
|
||||
icon.getChildByName("lv1").active=EquipInfo[uuid].lv==1
|
||||
icon.getChildByName("lv2").active=EquipInfo[uuid].lv==2
|
||||
icon.getChildByName("lv3").active=EquipInfo[uuid].lv==3
|
||||
icon.getChildByName("lv4").active=EquipInfo[uuid].lv==4
|
||||
icon.getChildByName("lv5").active=EquipInfo[uuid].lv==5
|
||||
|
||||
icon.getChildByName("q1").active=EquipInfo[uuid].quality==Quality.WHITE
|
||||
icon.getChildByName("q2").active=EquipInfo[uuid].quality==Quality.GREEN
|
||||
icon.getChildByName("q3").active=EquipInfo[uuid].quality==Quality.BLUE
|
||||
icon.getChildByName("q4").active=EquipInfo[uuid].quality==Quality.PURPLE
|
||||
icon.getChildByName("q5").active=EquipInfo[uuid].quality==Quality.ORANGE
|
||||
}
|
||||
show_accessory(uuid:number){
|
||||
let icon = this.boxs.getChildByName("accessory").getChildByName("icon")
|
||||
icon.active=true
|
||||
var icon_path = "game/heros/equips2"
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = icon.getChildByName("icon").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(EquipInfo[uuid].path);
|
||||
});
|
||||
icon.active=true
|
||||
var icon_path = "game/heros/equips2"
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = icon.getChildByName("icon").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(EquipInfo[uuid].path);
|
||||
});
|
||||
icon.getChildByName("lv1").active=EquipInfo[uuid].lv==1
|
||||
icon.getChildByName("lv2").active=EquipInfo[uuid].lv==2
|
||||
icon.getChildByName("lv3").active=EquipInfo[uuid].lv==3
|
||||
icon.getChildByName("lv4").active=EquipInfo[uuid].lv==4
|
||||
icon.getChildByName("lv5").active=EquipInfo[uuid].lv==5
|
||||
|
||||
icon.getChildByName("q1").active=EquipInfo[uuid].quality==Quality.WHITE
|
||||
icon.getChildByName("q2").active=EquipInfo[uuid].quality==Quality.GREEN
|
||||
icon.getChildByName("q3").active=EquipInfo[uuid].quality==Quality.BLUE
|
||||
icon.getChildByName("q4").active=EquipInfo[uuid].quality==Quality.PURPLE
|
||||
icon.getChildByName("q5").active=EquipInfo[uuid].quality==Quality.ORANGE
|
||||
|
||||
|
||||
}
|
||||
count_attrs(){
|
||||
// 重置所有属性
|
||||
@@ -295,12 +330,15 @@ export class EquipsComp extends Component {
|
||||
this.boxs.getChildByName("weapon").getChildByName("get").active =false
|
||||
this.boxs.getChildByName("weapon").getChildByName("light").active=false
|
||||
this.boxs.getChildByName("weapon").getChildByName("tip").active=false
|
||||
this.boxs.getChildByName("weapon").getChildByName("icon").active =false
|
||||
this.boxs.getChildByName("armor").getChildByName("get").active =false
|
||||
this.boxs.getChildByName("armor").getChildByName("light").active=false
|
||||
this.boxs.getChildByName("armor").getChildByName("tip").active=false
|
||||
this.boxs.getChildByName("armor").getChildByName("icon").active =false
|
||||
this.boxs.getChildByName("accessory").getChildByName("get").active =false
|
||||
this.boxs.getChildByName("accessory").getChildByName("light").active=false
|
||||
this.boxs.getChildByName("accessory").getChildByName("tip").active=false
|
||||
this.boxs.getChildByName("accessory").getChildByName("icon").active =false
|
||||
}
|
||||
|
||||
private show_equip_change(e:string){
|
||||
|
||||
Reference in New Issue
Block a user