英雄碎片完成
This commit is contained in:
32
assets/script/game/hero/HChipComp.ts
Normal file
32
assets/script/game/hero/HChipComp.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { _decorator, Component, Label, Node, resources, Sprite, SpriteAtlas } from 'cc';
|
||||
import { HeroInfo } from '../common/config/heroSet';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('HChipComp')
|
||||
export class HChipComp extends Component {
|
||||
h_uuid:number=0
|
||||
num:number=0
|
||||
lv:number=0
|
||||
start() {
|
||||
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
|
||||
}
|
||||
|
||||
update_data(h_uuid:number,num:number=0){
|
||||
var icon_path = "game/heros/herois"
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = this.node.getChildByName("hero").getChildByName("icon").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[h_uuid].path);
|
||||
});
|
||||
if(num > 0){
|
||||
this.node.getChildByName("num").getComponent(Label).string = num.toString();
|
||||
}else{
|
||||
this.node.getChildByName("num").getComponent(Label).string = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
9
assets/script/game/hero/HChipComp.ts.meta
Normal file
9
assets/script/game/hero/HChipComp.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "dc8e3ce8-1ced-41ab-bbf6-72310977465a",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
Reference in New Issue
Block a user