619b0e59-7430-408f-90ce-f73215067f3d.js 4 KB
"use strict";
cc._RF.push(module, '619b05ZdDBAj5DO9zIVBn89', 'DatingEventItemViewImpl');
// script/game/ui/view/impl/dating/DatingEventItemViewImpl.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 });
exports.DatingEventItemViewImpl = void 0;
const CCDummyObjects_1 = require("../../../../../common/CCDummyObjects");
const ListItemImpl_1 = require("../../../baseview/impl/ListItemImpl");
const simba_cc_resutils_1 = require("simba-cc-resutils");
const DatingEventSceneModel_1 = require("../../../../model/DatingEventSceneModel");
const { ccclass, property } = cc._decorator;
let DatingEventItemViewImpl = /** @class */ (() => {
    let DatingEventItemViewImpl = class DatingEventItemViewImpl extends ListItemImpl_1.ListItemImpl {
        constructor() {
            super(...arguments);
            this.titleRichText = CCDummyObjects_1.DummyRichText;
            this.newNode = CCDummyObjects_1.DummyNode;
            this.contentSprite = CCDummyObjects_1.DummySprite;
            this.statusIcons = [];
            this.statusSprite = CCDummyObjects_1.DummySprite;
        }
        onLoad() {
            super.onLoad();
            this.bindProp("title", this.titleRichText, "string");
            this.bindProp("coverImage", (value) => {
                if (value) {
                    simba_cc_resutils_1.ResUtils.loadRes(value, cc.SpriteFrame).then((sf) => {
                        this.contentSprite.spriteFrame = sf;
                    });
                }
            });
            this.bindProp("status", (status) => {
                if (status === DatingEventSceneModel_1.DatingEventStatus.Locked) {
                    this.contentSprite.node.active = false;
                }
                else {
                    this.contentSprite.node.active = true;
                    if (status === DatingEventSceneModel_1.DatingEventStatus.New || status === DatingEventSceneModel_1.DatingEventStatus.InProgress) {
                        this.newNode.active = true;
                    }
                    else {
                        this.newNode.active = false;
                    }
                    if (status === DatingEventSceneModel_1.DatingEventStatus.New) {
                        this.statusSprite.spriteFrame = this.statusIcons[0];
                    }
                    else if (status === DatingEventSceneModel_1.DatingEventStatus.InProgress) {
                        this.statusSprite.spriteFrame = this.statusIcons[1];
                    }
                    else if (status === DatingEventSceneModel_1.DatingEventStatus.Completed) {
                        this.statusSprite.spriteFrame = this.statusIcons[2];
                    }
                }
            });
        }
    };
    __decorate([
        property(cc.RichText)
    ], DatingEventItemViewImpl.prototype, "titleRichText", void 0);
    __decorate([
        property(cc.Node)
    ], DatingEventItemViewImpl.prototype, "newNode", void 0);
    __decorate([
        property(cc.Sprite)
    ], DatingEventItemViewImpl.prototype, "contentSprite", void 0);
    __decorate([
        property([cc.SpriteFrame])
    ], DatingEventItemViewImpl.prototype, "statusIcons", void 0);
    __decorate([
        property(cc.Sprite)
    ], DatingEventItemViewImpl.prototype, "statusSprite", void 0);
    DatingEventItemViewImpl = __decorate([
        ccclass
    ], DatingEventItemViewImpl);
    return DatingEventItemViewImpl;
})();
exports.DatingEventItemViewImpl = DatingEventItemViewImpl;

cc._RF.pop();