dd
This commit is contained in:
@@ -12,7 +12,7 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import{HeroCardViewComp} from "./HeroCardViewComp";
|
||||
import { CardSet } from "../common/config/CardSet";
|
||||
import { CardSet ,SkillSet} from "../common/config/CardSet";
|
||||
/** 角色实体 */
|
||||
@ecs.register(`HeroCard`)
|
||||
export class HeroCard extends ecs.Entity {
|
||||
@@ -32,20 +32,28 @@ export class HeroCard extends ecs.Entity {
|
||||
|
||||
/** 加载角色 */
|
||||
load(pos: Vec3 = Vec3.ZERO,uuid:number=1001,parent:Node,type:number=1) {
|
||||
// console.log("load hero",uuid);
|
||||
// var path = "game/monster/"+prefab_path;
|
||||
switch(type){
|
||||
let path: string;
|
||||
let url: string;
|
||||
let pathName: string;
|
||||
let name: string;
|
||||
let level: number;
|
||||
|
||||
switch (type) {
|
||||
case 1:
|
||||
var path = "game/heros/hero_card";
|
||||
path = "game/heros/hero_card";
|
||||
url = "game/heros/heros";
|
||||
({ path: pathName, name, level } = smc.heros[uuid]);
|
||||
break;
|
||||
case 2:
|
||||
var path = "game/heros/skill_card";
|
||||
path = "game/heros/skill_card";
|
||||
url = "game/heros/skill";
|
||||
({ path: pathName, name, level } = SkillSet[uuid]);
|
||||
break;
|
||||
case 3:
|
||||
var path = "game/heros/item_card";
|
||||
break;
|
||||
default:
|
||||
var path = "game/heros/hero_card";
|
||||
path = "game/heros/hero_card";
|
||||
url = "game/heros/heros";
|
||||
({ path: pathName, name, level } = smc.heros[uuid]);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,20 +63,19 @@ export class HeroCard extends ecs.Entity {
|
||||
// node.getChildByName("avatar").setScale(node.getChildByName("avatar").scale.x*camp, node.getChildByName("avatar").scale.y, node.getChildByName("avatar").scale.z);
|
||||
node.setPosition(pos)
|
||||
|
||||
const url = 'game/heros/heros';
|
||||
|
||||
resources.load(url, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = node.getChildByName("hero").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(CardSet[uuid].path);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(pathName);
|
||||
});
|
||||
|
||||
var hcv = node.getComponent(HeroCardViewComp)!;
|
||||
hcv.card_name=CardSet[uuid].name
|
||||
hcv.card_name=name
|
||||
hcv.card_uid=uuid
|
||||
hcv.card_type=type
|
||||
hcv.card_level=level
|
||||
this.add(hcv);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user