d02a4db18b44c0a5a905a8da4cd0296fd426a944.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2"], function (_export, _context) {
  2. "use strict";
  3. var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Component, Size, Sprite, SpriteFrame, UITransform, ch, Hall, _dec, _dec2, _dec3, _class, _class2, _descriptor, _descriptor2, _crd, ccclass, property, UI_Head_Icon;
  4. function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
  5. function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
  6. function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
  7. function _reportPossibleCrUseOfch(extras) {
  8. _reporterNs.report("ch", "../../../ch/ch", _context.meta, extras);
  9. }
  10. function _reportPossibleCrUseOfHall(extras) {
  11. _reporterNs.report("Hall", "../../hall/Hall", _context.meta, extras);
  12. }
  13. return {
  14. setters: [function (_unresolved_) {
  15. _reporterNs = _unresolved_;
  16. }, function (_cc) {
  17. _cclegacy = _cc.cclegacy;
  18. __checkObsolete__ = _cc.__checkObsolete__;
  19. __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
  20. _decorator = _cc._decorator;
  21. Component = _cc.Component;
  22. Size = _cc.Size;
  23. Sprite = _cc.Sprite;
  24. SpriteFrame = _cc.SpriteFrame;
  25. UITransform = _cc.UITransform;
  26. }, function (_unresolved_2) {
  27. ch = _unresolved_2.ch;
  28. }, function (_unresolved_3) {
  29. Hall = _unresolved_3.Hall;
  30. }],
  31. execute: function () {
  32. _crd = true;
  33. _cclegacy._RF.push({}, "32da00Ug65PLLJF/VDL1/LR", "UI_Head_Icon", undefined);
  34. __checkObsolete__(['_decorator', 'Component', 'Node', 'Size', 'Sprite', 'SpriteFrame', 'UITransform', 'Vec2']);
  35. ({
  36. ccclass,
  37. property
  38. } = _decorator);
  39. _export("UI_Head_Icon", UI_Head_Icon = (_dec = ccclass('UI_Head_Icon'), _dec2 = property(Sprite), _dec3 = property([SpriteFrame]), _dec(_class = (_class2 = class UI_Head_Icon extends Component {
  40. constructor() {
  41. super(...arguments);
  42. _initializerDefineProperty(this, "head", _descriptor, this);
  43. _initializerDefineProperty(this, "default_head", _descriptor2, this);
  44. }
  45. start() {}
  46. update(deltaTime) {}
  47. show(uid, head) {
  48. var rc = this.default_head[(_crd && ch === void 0 ? (_reportPossibleCrUseOfch({
  49. error: Error()
  50. }), ch) : ch).util.getRandomInt(0, this.default_head.length - 1)];
  51. (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
  52. error: Error()
  53. }), Hall) : Hall).getInstance().head_icon.showIcon(uid, head, this.head, rc).then(spf => {
  54. if (spf != null) this.adaptationIcon(this.head, spf, new Size(55, 55));
  55. });
  56. }
  57. adaptationIcon(icon, spriteFrameIcon, tSize) {
  58. if (spriteFrameIcon) {
  59. var size = spriteFrameIcon.originalSize; //适配图片
  60. var iconSize = new Size();
  61. var raito = size.width / size.height;
  62. if (raito < 1) {
  63. iconSize.height = tSize.height;
  64. iconSize.width = tSize.height * raito;
  65. } else {
  66. iconSize.width = tSize.width;
  67. iconSize.height = tSize.width / raito;
  68. }
  69. icon.spriteFrame = spriteFrameIcon;
  70. icon.getComponent(UITransform).setContentSize(iconSize);
  71. }
  72. }
  73. }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "head", [_dec2], {
  74. configurable: true,
  75. enumerable: true,
  76. writable: true,
  77. initializer: null
  78. }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "default_head", [_dec3], {
  79. configurable: true,
  80. enumerable: true,
  81. writable: true,
  82. initializer: function initializer() {
  83. return [];
  84. }
  85. })), _class2)) || _class));
  86. _cclegacy._RF.pop();
  87. _crd = false;
  88. }
  89. };
  90. });
  91. //# sourceMappingURL=d02a4db18b44c0a5a905a8da4cd0296fd426a944.js.map