ArtistResidentItemPlaceholder.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. const Api = require('../net/Api');
  2. const { GameNotificationKey } = require("../utils/GameEnum");
  3. const HomeApi = require("../net/HomeApi");
  4. const AlertManager = require("../utils/AlertManager");
  5. cc.Class({
  6. extends: cc.Component,
  7. properties: {
  8. headSprite: cc.Sprite,
  9. nickRichText: cc.RichText,
  10. jobLevelLabel: cc.Label,
  11. jobTitleLabel: cc.Label,
  12. effectLabel: cc.Label,
  13. },
  14. init(artistData) {
  15. this.artistData = artistData;
  16. this.jobLevelLabel.string = this.artistData.jobLevel;
  17. //有职业的时候才赋值
  18. if (this.artistData.jobName) {
  19. this.jobTitleLabel.string = this.artistData.jobName;
  20. } else {
  21. this.jobTitleLabel.string = "";
  22. }
  23. this.nickRichText.string = `<color=#584a47>${this.artistData.nick}</c> <img src='50002'/>`;
  24. this.effectLabel.string = `加成效果: 收益增加${this.artistData.addition}%`;
  25. Api.createImageFromUrl(this.artistData.head, (spriteFrame) => {
  26. this.headSprite.spriteFrame = spriteFrame;
  27. }, null);
  28. },
  29. onLoad () {
  30. },
  31. start () {
  32. },
  33. // update (dt) {},
  34. });