英雄icon 直接使用json动画,不需要icon图片了
This commit is contained in:
@@ -52,7 +52,7 @@ export const getHeroListByCalled = (count:number,called:any[])=>{
|
||||
|
||||
export const HeroList = [5021,5022,5023,5024,5025,5026,5027,5028]
|
||||
export const MonList = [5201,5202,5203,5204,5205,5206,5219,5220,5221,5222,5223,5224,5225,5226,5227]
|
||||
export const Masters = [5001,5002,5003,5004,5005,5006,5007,5008,5009,5010,5011,5012]
|
||||
export const Masters = [5001,5002,5005,5009,5010,5011]
|
||||
|
||||
export const HeroPos={
|
||||
0:{pos:v3(-290,0,0)},
|
||||
@@ -255,28 +255,26 @@ export const getGrowthModeDescription = (heroType: HType): string => {
|
||||
export const HeroInfo = {
|
||||
|
||||
//主将
|
||||
5001:{uuid:5001,name:"刺心.艾吉斯",path:"k1", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
5001:{uuid:5001,name:"刺心.艾吉斯",path:"k2", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:100,ap:15,dis:400,cd:1.5,speed:50,skills:[6010,6004,6004],
|
||||
buff:[],info:"剑类专精,穿刺伤害额外+10%"},
|
||||
|
||||
5002:{uuid:5002,name:"飓风.格罗姆",path:"k2", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
5002:{uuid:5002,name:"飓风.格罗姆",path:"k3", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:100,ap:15,dis:400,cd:1.5,speed:50,skills:[6010,6005,6005],
|
||||
buff:[],info:"斧类专精,风怒概率增加10%"},
|
||||
|
||||
5003:{uuid:5003,name:"碎颅.赫克托",path:"k4", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:100,ap:15,dis:400,cd:1.5,speed:50,skills:[6010,6021,6001],
|
||||
buff:[],info:"锤类专精,暴击概率增加10%"},
|
||||
// 5003:{uuid:5003,name:"碎颅.赫克托",path:"k4", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
// type:HType.warrior,hp:100,ap:15,dis:400,cd:1.5,speed:50,skills:[6010,6021,6001],
|
||||
// buff:[],info:"锤类专精,暴击概率增加10%"},
|
||||
|
||||
5004:{uuid:5004,name:"裂伤.塔米拉",path:"k3", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:100,ap:15,dis:400,cd:1.5,speed:50,skills:[6010,6021,6001],
|
||||
buff:[],info:"刀类专精,易伤效果额外持续1次"},
|
||||
// 5004:{uuid:5004,name:"裂伤.塔米拉",path:"k3", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
// type:HType.warrior,hp:100,ap:15,dis:400,cd:1.5,speed:50,skills:[6010,6021,6001],
|
||||
// buff:[],info:"刀类专精,易伤效果额外持续1次"},
|
||||
|
||||
5005:{uuid:5005,name:"幽灵射手",path:"a4", quality:HQuality.BLUE,lv:1,kind:2,
|
||||
type:HType.remote,hp:100,ap:15,dis:400,cd:1.5,speed:50,skills:[6003,6003,6003],
|
||||
buff:[],info:"说明"},
|
||||
5006:{uuid:5006,name:"战争领主",path:"k5", quality:HQuality.BLUE,lv:1,kind:2,
|
||||
type:HType.warrior,hp:100,ap:15,dis:400,cd:1.5,speed:50,skills:[6002,6002,6002],
|
||||
buff:[],info:"说明"},
|
||||
|
||||
|
||||
5007:{uuid:5007,name:"混沌法师",path:"zh1", quality:HQuality.BLUE,lv:1,kind:2,
|
||||
type:HType.mage,hp:100,ap:15,dis:400,cd:1.5,speed:50,skills:[6002,6002,6002],
|
||||
@@ -286,7 +284,7 @@ export const HeroInfo = {
|
||||
type:HType.mage,hp:100,ap:15,dis:400,cd:1.5,speed:50,skills:[6002,6002,6002],
|
||||
buff:[],info:"说明"},
|
||||
|
||||
5009:{uuid:5009,name:"风暴精灵",path:"m4", quality:HQuality.BLUE,lv:1,kind:2,
|
||||
5009:{uuid:5009,name:"风暴精灵",path:"d1", quality:HQuality.BLUE,lv:1,kind:2,
|
||||
type:HType.mage,hp:100,ap:15,dis:400,cd:1.5,speed:50,skills:[6002,6002,6002],
|
||||
buff:[],info:"说明"},
|
||||
|
||||
@@ -297,10 +295,7 @@ export const HeroInfo = {
|
||||
5011:{uuid:5011,name:"暴风射手",path:"a5", quality:HQuality.BLUE,lv:1,kind:2,
|
||||
type:HType.remote,hp:100,ap:15,dis:400,cd:1.5,speed:50,skills:[6003,6003,6003],
|
||||
buff:[],info:"说明"},
|
||||
|
||||
5012:{uuid:5012,name:"苍穹射手",path:"a3", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
type:HType.remote,hp:100,ap:15,dis:400,cd:1.5,speed:50,skills:[6003,6003,6003],
|
||||
buff:[],info:"说明"},
|
||||
|
||||
|
||||
|
||||
//怪物
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { _decorator, Animation, Label, resources, SpriteAtlas,Sprite } from "cc";
|
||||
import { _decorator, Animation, Label, resources, SpriteAtlas,Sprite, Skeleton, SkinnedMeshRenderer, sp } from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
@@ -150,22 +150,47 @@ export class CardComp extends CCComp {
|
||||
});
|
||||
show.getChildByName("info").getComponent(Label).string=SkillSet[uuid].info
|
||||
}
|
||||
|
||||
/* 英雄 直接加载骨骼动画 */ //注意 动画名称为Idle
|
||||
show_hero(uuid:number){
|
||||
let show=this.node.getChildByName("show")
|
||||
show.getChildByName("name").getChildByName("name").getComponent(Label).string=HeroInfo[uuid].name
|
||||
this.do_card_bg_show(HeroInfo[uuid].quality)
|
||||
this.node.getChildByName("show").getChildByName("coins").active=false
|
||||
// show.getChildByName("ap").active=true
|
||||
// show.getChildByName("hp").active=true
|
||||
// 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("lv").getChildByName("num").getComponent(Label).string=HeroInfo[uuid].lv.toString()
|
||||
var icon_path = "game/heros/herois"
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = show.getChildByName("mask").getChildByName("hero").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path);
|
||||
show.getChildByName("coins").active=false
|
||||
var icon_path = "game/heros/heros/"+HeroInfo[uuid].path
|
||||
resources.load(icon_path, sp.SkeletonData, (err, skeleton) => {
|
||||
if (err) {
|
||||
console.error("[CardComp]: 加载骨骼数据失败:", err);
|
||||
return;
|
||||
}
|
||||
console.log("[CardComp]: 加载骨骼数据成功:", skeleton)
|
||||
// 检查节点是否仍然存在
|
||||
const maskNode = show.getChildByName("mask");
|
||||
if (!maskNode) {
|
||||
console.error("[CardComp]: mask节点不存在");
|
||||
return;
|
||||
}
|
||||
|
||||
const heroNode = maskNode.getChildByName("hero");
|
||||
if (!heroNode) {
|
||||
console.error("[CardComp]: hero节点不存在");
|
||||
return;
|
||||
}
|
||||
|
||||
const spine = heroNode.getComponent(sp.Skeleton);
|
||||
if (!spine) {
|
||||
console.error("[CardComp]: hero节点上没有找到SkinnedMeshRenderer组件");
|
||||
return;
|
||||
}
|
||||
|
||||
if (spine) {
|
||||
spine.skeletonData = skeleton;
|
||||
spine.setAnimation(0, "Idle", true);
|
||||
}
|
||||
});
|
||||
// resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
// const sprite = show.getChildByName("mask").getChildByName("hero").getComponent(Sprite);
|
||||
// sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path);
|
||||
// });
|
||||
show.getChildByName("info").getComponent(Label).string=HeroInfo[uuid].info
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { _decorator, resources, Sprite, SpriteAtlas ,Node, ProgressBar, tween, v3, Label, Animation, CCString, CCInteger} from "cc";
|
||||
import { _decorator, resources, Sprite, SpriteAtlas ,Node, ProgressBar, tween, v3, Label, Animation, CCString, CCInteger, sp} from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
@@ -174,17 +174,16 @@ export class HeroUiComp extends CCComp {
|
||||
* @param heroPath 英雄路径
|
||||
*/
|
||||
private loadHeroIcon(iconNode: Node, heroPath: string) {
|
||||
const iconPath = "game/heros/herois"
|
||||
resources.load(iconPath, SpriteAtlas, (err: any, atlas) => {
|
||||
if (err) {
|
||||
console.error("[HeroUiComp]: Failed to load hero icon atlas:", err)
|
||||
return
|
||||
iconNode.parent.getChildByName("iconbg").active=false
|
||||
const icon_path = "game/heros/heros/"+heroPath
|
||||
resources.load(icon_path, sp.SkeletonData, (err, skeleton) => {
|
||||
const spine = iconNode.getComponent(sp.Skeleton);
|
||||
if (spine) {
|
||||
spine.skeletonData = skeleton;
|
||||
spine.setAnimation(0, "Idle", true);
|
||||
}
|
||||
const sprite = iconNode.getComponent(Sprite)
|
||||
if (sprite && atlas) {
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(heroPath)
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -219,6 +218,8 @@ export class HeroUiComp extends CCComp {
|
||||
if (iconNode) {
|
||||
iconNode.active = false
|
||||
}
|
||||
heroNode.getChildByName("iconbg").active=true
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user