| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- import { _decorator, Component, Node, Sprite, Label, SpriteFrame } from "cc";
- import { ResourceLoader } from "../../core/resourceManager/ResourceLoader";
- import { BitmapFont } from "../../core/ui/BitmapFont";
- import { Window } from "../../core/ui/window/Window";
- import { MarshalSkillSystem } from "../../marshal/MarshalSkillSystem";
- import { UserHero } from "../UserHeroData";
- const { ccclass, property, requireComponent } = _decorator;
- /**
- * 升星成功提示
- * @author 袁浩
- */
- @ccclass('UpStar')
- @requireComponent(ResourceLoader)
- export class UpStar extends Component {
- @property({ tooltip: "图标-前", type: Sprite })
- public avatorSpritePre: Sprite;
- @property({ tooltip: "图标-后", type: Sprite })
- public avatorSpriteNow: Sprite;
- @property({ tooltip: "星级-前", type: BitmapFont })
- public starBitmapLabelPre: BitmapFont;
- @property({ tooltip: "星级-后", type: BitmapFont })
- public starBitmapLabelNow: BitmapFont;
- @property({ tooltip: "攻击加成文本-前", type: Label })
- public attackLabelPre: Label;
- @property({ tooltip: "攻击加成文本-后", type: Label })
- public attackLabelNow: Label;
- @property({ tooltip: "品质框-前", type: Sprite })
- public qualityBorderPre: Sprite;
- @property({ tooltip: "品质框-后", type: Sprite })
- public qualityBorderNow: Sprite;
- @property({ tooltip: "所有品质框", type: [SpriteFrame] })
- public qualityBorderList: SpriteFrame[] = [];
- private data: UserHero;
- private oldStar: number;
- private isCanClose: boolean;
- start() {
- this.initUI();
- }
- public async initUI() {
- let params = this.getComponent(Window).params;
- this.data = params[0] as UserHero;
- this.oldStar = params[1] as number;
- this.qualityBorderPre.spriteFrame = this.qualityBorderNow.spriteFrame = this.qualityBorderList[this.data.client.color - 1];
- let starStringPre = "";
- for (let i = 0; i < this.oldStar; i++) {
- starStringPre += "0";
- }
- let starStringNow = "";
- for (let i = 0; i < this.data.server.star; i++) {
- starStringNow += "0";
- }
- this.starBitmapLabelPre.string = starStringPre;
- this.starBitmapLabelNow.string = starStringNow;
- this.attackLabelPre.string = `${this.data.client.attack + (this.data.server.lv - 1) * parseInt(this.data.client.upRatio.split(",")[this.oldStar - 1])}`;
- this.attackLabelNow.string = `${this.data.client.attack + (this.data.server.lv - 1) * parseInt(this.data.client.upRatio.split(",")[this.data.server.star - 1])}`;
- let avatorSpriteFrame = await this.getComponent(ResourceLoader).load<SpriteFrame>(`images/general/texture/head_img/${this.data.client.hero_res}/spriteFrame`, SpriteFrame);
- this.avatorSpritePre.spriteFrame = this.avatorSpriteNow.spriteFrame = avatorSpriteFrame;
- }
- private onClose(forceClose: () => void) {
- if (this.isCanClose) {
- forceClose();
- MarshalSkillSystem.updateMarshalSkillInfo(this.data.client.id);
- }
- }
- private aniCallback() {
- this.isCanClose = true;
- }
- }
|