7473711f-e670-4903-b945-fc7d830fdb74.js 2.9 KB
"use strict";
cc._RF.push(module, '74737Ef5nBJA7lF/H2DD9t0', 'SuitItem');
// script/game/ui/SuitItem.ts

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
const simba_cc_resutils_1 = require("simba-cc-resutils");
const CCDummyObjects_1 = require("../../common/CCDummyObjects");
const GameConstData_1 = require("../../common/gameplay/gamedata/GameConstData");
const UIManager_1 = require("../../common/gameplay/managers/UIManager");
const { ccclass, property } = cc._decorator;
let SuitItem = /** @class */ (() => {
    let SuitItem = class SuitItem extends cc.Component {
        constructor() {
            super(...arguments);
            this.iconSprite = CCDummyObjects_1.DummySprite;
            this.nameLabel = CCDummyObjects_1.DummyLabel;
            this.lockRootNode = CCDummyObjects_1.DummyNode;
            this.unlockConditionLabel = CCDummyObjects_1.DummyLabel;
            this._showLockRootNode = true;
        }
        async setData(suitConfig, showLockRootNode) {
            this.iconSprite.spriteFrame = await simba_cc_resutils_1.ResUtils.loadRes(GameConstData_1.GameConstData.GAME_CONST_BEDROOMCAT_SUIT_SPR_DIR + suitConfig.clothingId, cc.SpriteFrame);
            this.nameLabel.string = suitConfig.clothingName;
            this._showLockRootNode = showLockRootNode;
            if (showLockRootNode) {
                this.lockRootNode.active = true;
                this.unlockConditionLabel.string = suitConfig.unlockCondition;
            }
        }
        onBtnClick() {
            if (this._showLockRootNode) {
                UIManager_1.UIManager.showToast("快去完成任务,领取服装吧!");
                return;
            }
        }
    };
    __decorate([
        property({ type: cc.Sprite, displayName: "Icon sprite" })
    ], SuitItem.prototype, "iconSprite", void 0);
    __decorate([
        property({ type: cc.Label, displayName: "Name label" })
    ], SuitItem.prototype, "nameLabel", void 0);
    __decorate([
        property({ type: cc.Node, displayName: "Lock root node" })
    ], SuitItem.prototype, "lockRootNode", void 0);
    __decorate([
        property({ type: cc.Label, displayName: "Unlock condition label" })
    ], SuitItem.prototype, "unlockConditionLabel", void 0);
    SuitItem = __decorate([
        ccclass
    ], SuitItem);
    return SuitItem;
})();
exports.default = SuitItem;

cc._RF.pop();