af19548b-fcd7-44fd-9640-8c3fa40cb0ae.js 2.96 KB
"use strict";
cc._RF.push(module, 'af195SL/NdE/ZZAjD+kDLCu', 'ActivitiesNoticeItem');
// script/game/ui/ActivitiesNoticeItem.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 CCDummyObjects_1 = require("../../common/CCDummyObjects");
const ResUtils_1 = require("../../common/utils/ResUtils");
const ActivitiesItemModelManager_1 = require("../model/ActivitiesItemModelManager");
const { ccclass, property } = cc._decorator;
let ActivitiesNoticeItem = /** @class */ (() => {
    let ActivitiesNoticeItem = class ActivitiesNoticeItem extends cc.Component {
        constructor() {
            super(...arguments);
            this.backgroundSprite = CCDummyObjects_1.DummySprite;
            this.clickNode = CCDummyObjects_1.DummyNode;
            this.redDotNode = CCDummyObjects_1.DummyNode;
            this.describeRichText = CCDummyObjects_1.DummyRichText;
        }
        async setData(activityId, canClick, describe, callback) {
            this._activityId = activityId;
            this._callFunc = callback;
            this.backgroundSprite.spriteFrame = await ResUtils_1.ResUtils.loadRes(`textures/notice/activitiesItem/${activityId}`, cc.SpriteFrame);
            this.clickNode.active = canClick;
            this.describeRichText.string = describe;
            this.refreshRedDot();
        }
        refreshRedDot() {
            let isReaded = ActivitiesItemModelManager_1.ActivitiesItemModelManager.getActivitiesReaded(this._activityId);
            this.redDotNode.active = !isReaded;
        }
        onItemButtonClick() {
            if (this._callFunc) {
                this._callFunc();
            }
        }
    };
    __decorate([
        property({ type: cc.Sprite, displayName: "Background sprite" })
    ], ActivitiesNoticeItem.prototype, "backgroundSprite", void 0);
    __decorate([
        property({ type: cc.Node, displayName: "Click node" })
    ], ActivitiesNoticeItem.prototype, "clickNode", void 0);
    __decorate([
        property({ type: cc.Node, displayName: "RedDot node" })
    ], ActivitiesNoticeItem.prototype, "redDotNode", void 0);
    __decorate([
        property({ type: cc.RichText, displayName: "Background richText" })
    ], ActivitiesNoticeItem.prototype, "describeRichText", void 0);
    ActivitiesNoticeItem = __decorate([
        ccclass
    ], ActivitiesNoticeItem);
    return ActivitiesNoticeItem;
})();
exports.default = ActivitiesNoticeItem;

cc._RF.pop();