card ui调整
This commit is contained in:
File diff suppressed because it is too large
Load Diff
7009
assets/resources/game/heros/cards.plist.meta
Normal file
7009
assets/resources/game/heros/cards.plist.meta
Normal file
File diff suppressed because it is too large
Load Diff
42
assets/resources/game/heros/cards.png.meta
Normal file
42
assets/resources/game/heros/cards.png.meta
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"ver": "1.0.26",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "0474d69a-4ed2-4470-a797-19d9f23c09b0",
|
||||
"files": [
|
||||
".json",
|
||||
".png"
|
||||
],
|
||||
"subMetas": {
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "0474d69a-4ed2-4470-a797-19d9f23c09b0@6c48a",
|
||||
"displayName": "cards",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "repeat",
|
||||
"wrapModeT": "repeat",
|
||||
"minfilter": "linear",
|
||||
"magfilter": "linear",
|
||||
"mipfilter": "none",
|
||||
"anisotropy": 0,
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "0474d69a-4ed2-4470-a797-19d9f23c09b0",
|
||||
"visible": false
|
||||
},
|
||||
"ver": "1.0.22",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"hasAlpha": true,
|
||||
"type": "texture",
|
||||
"fixAlphaTransparencyArtifacts": false,
|
||||
"redirect": "0474d69a-4ed2-4470-a797-19d9f23c09b0@6c48a"
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,8 @@ export enum GameEvent {
|
||||
UseCard = "UseCard",
|
||||
UseHeroCard = "UseHeroCard",
|
||||
UseSkillCard = "UseSkillCard",
|
||||
UseSpecialCard = "UseSpecialCard",
|
||||
UseEquipCard = "UseEquipCard",
|
||||
CallHero = "CallHero",
|
||||
MissionLoss = "MissionLoss",
|
||||
MissionWin = "MissionWin",
|
||||
|
||||
@@ -9,7 +9,7 @@ import { HeroModelComp } from "../hero/HeroModelComp";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { HeroSkillList, SkillSet } from "../common/config/SkillSet";
|
||||
import { cardType, getRandomCardUUID } from "../common/config/CardSet";
|
||||
import { cardType, getRandomCardUUID, SuperCards } from "../common/config/CardSet";
|
||||
import { EquipInfo } from "../common/config/Equips";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
@@ -106,31 +106,18 @@ export class CardComp extends CCComp {
|
||||
show_skill(uuid:number){
|
||||
let show=this.node.getChildByName("show")
|
||||
show.getChildByName("name").getComponent(Label).string=SkillSet[uuid].name
|
||||
show.getChildByName("ap").active=false
|
||||
show.getChildByName("hp").active=false
|
||||
show.getChildByName("mask").getChildByName("skill").active=true
|
||||
show.getChildByName("mask").getChildByName("s_bg").active=true
|
||||
show.getChildByName("mask").getChildByName("equip").active=false
|
||||
show.getChildByName("mask").getChildByName("e_bg").active=false
|
||||
show.getChildByName("mask").getChildByName("hero").active=false
|
||||
show.getChildByName("mask").getChildByName("h_bg").active=false
|
||||
this.do_card_bg_show()
|
||||
var icon_path = "game/skills/skill_icon"
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = show.getChildByName("mask").getChildByName("skill").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[uuid].path);
|
||||
});
|
||||
this.node.getChildByName("Button").getChildByName("Label").getComponent(Label).string=this.check_heros()
|
||||
}
|
||||
show_hero(uuid:number){
|
||||
let show=this.node.getChildByName("show")
|
||||
this.do_card_bg_show()
|
||||
show.getChildByName("ap").active=true
|
||||
show.getChildByName("hp").active=true
|
||||
show.getChildByName("mask").getChildByName("skill").active=false
|
||||
show.getChildByName("mask").getChildByName("s_bg").active=false
|
||||
show.getChildByName("mask").getChildByName("equip").active=false
|
||||
show.getChildByName("mask").getChildByName("e_bg").active=false
|
||||
show.getChildByName("mask").getChildByName("hero").active=true
|
||||
show.getChildByName("mask").getChildByName("h_bg").active=true
|
||||
show.getChildByName("name").getComponent(Label).string=HeroInfo[uuid].name
|
||||
show.getChildByName("ap").getChildByName("num").getComponent(Label).string=HeroInfo[uuid].ap.toString()
|
||||
show.getChildByName("hp").getChildByName("num").getComponent(Label).string=HeroInfo[uuid].hp.toString()
|
||||
@@ -143,27 +130,30 @@ export class CardComp extends CCComp {
|
||||
const sprite = show.getChildByName("mask").getChildByName("hero").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path);
|
||||
});
|
||||
this.node.getChildByName("Button").getChildByName("Label").getComponent(Label).string=this.check_heros()
|
||||
}
|
||||
show_equip(uuid:number){
|
||||
let show=this.node.getChildByName("show")
|
||||
show.getChildByName("ap").active=false
|
||||
show.getChildByName("hp").active=false
|
||||
show.getChildByName("mask").getChildByName("skill").active=false
|
||||
show.getChildByName("mask").getChildByName("s_bg").active=false
|
||||
show.getChildByName("mask").getChildByName("equip").active=true
|
||||
show.getChildByName("mask").getChildByName("e_bg").active=true
|
||||
show.getChildByName("mask").getChildByName("hero").active=false
|
||||
show.getChildByName("mask").getChildByName("h_bg").active=false
|
||||
this.do_card_bg_show()
|
||||
show.getChildByName("name").getComponent(Label).string=EquipInfo[uuid].name
|
||||
var icon_path = "game/heros/equips"
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = show.getChildByName("mask").getChildByName("equip").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(EquipInfo[uuid].uuid.toString());
|
||||
});
|
||||
this.node.getChildByName("Button").getChildByName("Label").getComponent(Label).string=this.check_heros()
|
||||
}
|
||||
show_func(uuid:number){
|
||||
let show=this.node.getChildByName("show")
|
||||
this.do_card_bg_show()
|
||||
show.getChildByName("name").getComponent(Label).string=SuperCards[uuid].name
|
||||
var icon_path = "game/heros/cards"
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = show.getChildByName("mask").getChildByName("func").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(SuperCards[uuid].path);
|
||||
});
|
||||
|
||||
}
|
||||
do_card_bg_show(){
|
||||
this.node.getChildByName("Button").getChildByName("Label").getComponent(Label).string=this.check_heros()
|
||||
let show=this.node.getChildByName("show")
|
||||
show.getChildByName("ap").active=false
|
||||
show.getChildByName("hp").active=false
|
||||
@@ -171,6 +161,32 @@ export class CardComp extends CCComp {
|
||||
show.getChildByName("mask").getChildByName("s_bg").active=false
|
||||
show.getChildByName("mask").getChildByName("equip").active=false
|
||||
show.getChildByName("mask").getChildByName("e_bg").active=false
|
||||
show.getChildByName("mask").getChildByName("hero").active=false
|
||||
show.getChildByName("mask").getChildByName("h_bg").active=false
|
||||
show.getChildByName("mask").getChildByName("func").active=false
|
||||
show.getChildByName("mask").getChildByName("f_bg").active=false
|
||||
switch(this.c_type){
|
||||
case cardType.HERO:
|
||||
show.getChildByName("mask").getChildByName("hero").active=true
|
||||
show.getChildByName("mask").getChildByName("h_bg").active=true
|
||||
show.getChildByName("type").getChildByName("name").getComponent(Label).string="英雄"
|
||||
break
|
||||
case cardType.SKILL:
|
||||
show.getChildByName("mask").getChildByName("skill").active=true
|
||||
show.getChildByName("mask").getChildByName("s_bg").active=true
|
||||
show.getChildByName("type").getChildByName("name").getComponent(Label).string="技能"
|
||||
break
|
||||
case cardType.EQUIP:
|
||||
show.getChildByName("mask").getChildByName("equip").active=true
|
||||
show.getChildByName("mask").getChildByName("e_bg").active=true
|
||||
show.getChildByName("type").getChildByName("name").getComponent(Label).string="装备"
|
||||
break
|
||||
case cardType.SPECIAL:
|
||||
show.getChildByName("mask").getChildByName("func").active=true
|
||||
show.getChildByName("mask").getChildByName("f_bg").active=true
|
||||
show.getChildByName("type").getChildByName("name").getComponent(Label).string="特效"
|
||||
break
|
||||
}
|
||||
}
|
||||
check_heros(){
|
||||
// let heros=ecs.query(ecs.allOf(HeroModelComp))
|
||||
@@ -186,7 +202,7 @@ export class CardComp extends CCComp {
|
||||
}
|
||||
use_card(){
|
||||
switch(this.c_type){
|
||||
case 0:
|
||||
case cardType.HERO:
|
||||
if(smc.vmdata.mission_data.gold< smc.vmdata.mission_data.call_gold){
|
||||
oops.gui.toast("金币不足", false);
|
||||
return
|
||||
@@ -195,16 +211,21 @@ export class CardComp extends CCComp {
|
||||
smc.vmdata.mission_data.gold-=smc.vmdata.mission_data.call_gold
|
||||
oops.message.dispatchEvent(GameEvent.CardsClose)
|
||||
break
|
||||
case 1:
|
||||
case cardType.SKILL:
|
||||
console.log("use_card 技能卡")
|
||||
oops.message.dispatchEvent(GameEvent.UseSkillCard,{uuid:this.c_uuid})
|
||||
oops.message.dispatchEvent(GameEvent.CardsClose)
|
||||
break
|
||||
case 2:
|
||||
case cardType.EQUIP:
|
||||
console.log("use_card 装备卡")
|
||||
oops.message.dispatchEvent(GameEvent.EquipAdd,{uuid:this.c_uuid,type:EquipInfo[this.c_uuid].type})
|
||||
oops.message.dispatchEvent(GameEvent.CardsClose)
|
||||
break
|
||||
case cardType.SPECIAL:
|
||||
console.log("use_card 功能卡")
|
||||
oops.message.dispatchEvent(GameEvent.UseSpecialCard,{uuid:this.c_uuid})
|
||||
oops.message.dispatchEvent(GameEvent.CardsClose)
|
||||
break
|
||||
}
|
||||
}
|
||||
reset() {
|
||||
|
||||
Reference in New Issue
Block a user