card ui调整

This commit is contained in:
2025-06-19 10:28:31 +08:00
parent 2c9f176912
commit 3accaa1850
5 changed files with 7912 additions and 632 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View 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"
}
}

View File

@@ -18,6 +18,8 @@ export enum GameEvent {
UseCard = "UseCard", UseCard = "UseCard",
UseHeroCard = "UseHeroCard", UseHeroCard = "UseHeroCard",
UseSkillCard = "UseSkillCard", UseSkillCard = "UseSkillCard",
UseSpecialCard = "UseSpecialCard",
UseEquipCard = "UseEquipCard",
CallHero = "CallHero", CallHero = "CallHero",
MissionLoss = "MissionLoss", MissionLoss = "MissionLoss",
MissionWin = "MissionWin", MissionWin = "MissionWin",

View File

@@ -9,7 +9,7 @@ import { HeroModelComp } from "../hero/HeroModelComp";
import { HeroViewComp } from "../hero/HeroViewComp"; import { HeroViewComp } from "../hero/HeroViewComp";
import { smc } from "../common/SingletonModuleComp"; import { smc } from "../common/SingletonModuleComp";
import { HeroSkillList, SkillSet } from "../common/config/SkillSet"; 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"; import { EquipInfo } from "../common/config/Equips";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@@ -106,31 +106,18 @@ export class CardComp extends CCComp {
show_skill(uuid:number){ show_skill(uuid:number){
let show=this.node.getChildByName("show") let show=this.node.getChildByName("show")
show.getChildByName("name").getComponent(Label).string=SkillSet[uuid].name show.getChildByName("name").getComponent(Label).string=SkillSet[uuid].name
show.getChildByName("ap").active=false this.do_card_bg_show()
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
var icon_path = "game/skills/skill_icon" var icon_path = "game/skills/skill_icon"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => { resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = show.getChildByName("mask").getChildByName("skill").getComponent(Sprite); const sprite = show.getChildByName("mask").getChildByName("skill").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[uuid].path); sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[uuid].path);
}); });
this.node.getChildByName("Button").getChildByName("Label").getComponent(Label).string=this.check_heros()
} }
show_hero(uuid:number){ show_hero(uuid:number){
let show=this.node.getChildByName("show") let show=this.node.getChildByName("show")
this.do_card_bg_show()
show.getChildByName("ap").active=true show.getChildByName("ap").active=true
show.getChildByName("hp").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("name").getComponent(Label).string=HeroInfo[uuid].name
show.getChildByName("ap").getChildByName("num").getComponent(Label).string=HeroInfo[uuid].ap.toString() show.getChildByName("ap").getChildByName("num").getComponent(Label).string=HeroInfo[uuid].ap.toString()
show.getChildByName("hp").getChildByName("num").getComponent(Label).string=HeroInfo[uuid].hp.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); const sprite = show.getChildByName("mask").getChildByName("hero").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path); sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path);
}); });
this.node.getChildByName("Button").getChildByName("Label").getComponent(Label).string=this.check_heros()
} }
show_equip(uuid:number){ show_equip(uuid:number){
let show=this.node.getChildByName("show") let show=this.node.getChildByName("show")
show.getChildByName("ap").active=false this.do_card_bg_show()
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
show.getChildByName("name").getComponent(Label).string=EquipInfo[uuid].name show.getChildByName("name").getComponent(Label).string=EquipInfo[uuid].name
var icon_path = "game/heros/equips" var icon_path = "game/heros/equips"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => { resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = show.getChildByName("mask").getChildByName("equip").getComponent(Sprite); const sprite = show.getChildByName("mask").getChildByName("equip").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(EquipInfo[uuid].uuid.toString()); sprite.spriteFrame = atlas.getSpriteFrame(EquipInfo[uuid].uuid.toString());
}); });
this.node.getChildByName("Button").getChildByName("Label").getComponent(Label).string=this.check_heros()
} }
show_func(uuid:number){ 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") let show=this.node.getChildByName("show")
show.getChildByName("ap").active=false show.getChildByName("ap").active=false
show.getChildByName("hp").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("s_bg").active=false
show.getChildByName("mask").getChildByName("equip").active=false show.getChildByName("mask").getChildByName("equip").active=false
show.getChildByName("mask").getChildByName("e_bg").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(){ check_heros(){
// let heros=ecs.query(ecs.allOf(HeroModelComp)) // let heros=ecs.query(ecs.allOf(HeroModelComp))
@@ -186,7 +202,7 @@ export class CardComp extends CCComp {
} }
use_card(){ use_card(){
switch(this.c_type){ switch(this.c_type){
case 0: case cardType.HERO:
if(smc.vmdata.mission_data.gold< smc.vmdata.mission_data.call_gold){ if(smc.vmdata.mission_data.gold< smc.vmdata.mission_data.call_gold){
oops.gui.toast("金币不足", false); oops.gui.toast("金币不足", false);
return return
@@ -195,16 +211,21 @@ export class CardComp extends CCComp {
smc.vmdata.mission_data.gold-=smc.vmdata.mission_data.call_gold smc.vmdata.mission_data.gold-=smc.vmdata.mission_data.call_gold
oops.message.dispatchEvent(GameEvent.CardsClose) oops.message.dispatchEvent(GameEvent.CardsClose)
break break
case 1: case cardType.SKILL:
console.log("use_card 技能卡") console.log("use_card 技能卡")
oops.message.dispatchEvent(GameEvent.UseSkillCard,{uuid:this.c_uuid}) oops.message.dispatchEvent(GameEvent.UseSkillCard,{uuid:this.c_uuid})
oops.message.dispatchEvent(GameEvent.CardsClose) oops.message.dispatchEvent(GameEvent.CardsClose)
break break
case 2: case cardType.EQUIP:
console.log("use_card 装备卡") console.log("use_card 装备卡")
oops.message.dispatchEvent(GameEvent.EquipAdd,{uuid:this.c_uuid,type:EquipInfo[this.c_uuid].type}) oops.message.dispatchEvent(GameEvent.EquipAdd,{uuid:this.c_uuid,type:EquipInfo[this.c_uuid].type})
oops.message.dispatchEvent(GameEvent.CardsClose) oops.message.dispatchEvent(GameEvent.CardsClose)
break break
case cardType.SPECIAL:
console.log("use_card 功能卡")
oops.message.dispatchEvent(GameEvent.UseSpecialCard,{uuid:this.c_uuid})
oops.message.dispatchEvent(GameEvent.CardsClose)
break
} }
} }
reset() { reset() {