| 123456789101112131415161718192021222324252627282930 |
- import { _decorator, Component, sp, Label, Sprite, SpriteFrame } from "cc";
- import { ResourceLoader } from "../../core/resourceManager/ResourceLoader";
- import { Window } from "../../core/ui/window/Window";
- import { UserHero } from "../UserHeroData";
- const { ccclass, property } = _decorator;
- /**
- * 合成成功提示
- * @author 袁浩
- */
- @ccclass("Compose")
- export class Compose extends Component {
- @property({ tooltip: "武将骨骼动画组件", type: sp.Skeleton })
- public body: sp.Skeleton;
- @property({ tooltip: "武将名称", type: Label })
- public nameLabel: Label;
- @property({ tooltip: "阵营图标", type: Sprite })
- public campIcon: Sprite;
- @property({ tooltip: "所有阵营图标", type: [SpriteFrame] })
- public campIconList: SpriteFrame[] = [];
- start() {
- let data: UserHero = this.getComponent(Window).params[0];
- this.initUI(data);
- }
- private async initUI(data: UserHero) {
- this.nameLabel.string = data.client.name;
- this.campIcon.spriteFrame = this.campIconList[data.client.camp - 1];
- this.body.skeletonData = await this.getComponent(ResourceLoader).load(`spine/hero/${data.client.hero_res}`, sp.SkeletonData);
- this.body.setAnimation(0, "idle", true);
- }
- }
|