619b0e59-7430-408f-90ce-f73215067f3d.js 5.37 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 ResUtils_1 = require("../../../../../common/utils/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);
            //#region editor bindings
            this.jointLines = [];
            this.titleLabel = CCDummyObjects_1.DummyLabel;
            this.dateLabel = CCDummyObjects_1.DummyLabel;
            this.timeLabel = CCDummyObjects_1.DummyLabel;
            this.newNode = CCDummyObjects_1.DummyNode;
            this.coverSprite = CCDummyObjects_1.DummySprite;
            this.lockText = CCDummyObjects_1.DummyLabel;
            this.statusIcons = [];
            this.statusSprite = CCDummyObjects_1.DummySprite;
        }
        //#endregion
        onLoad() {
            super.onLoad();
            this.bindProp("title", this.titleLabel, "string");
            this.bindProp("date", this.dateLabel, "string");
            this.bindProp("time", this.timeLabel, "string");
            this.bindProp("coverImage", (value) => {
                if (value) {
                    ResUtils_1.ResUtils.loadRes(value, cc.SpriteFrame).then((sf) => {
                        this.coverSprite.spriteFrame = sf;
                    });
                }
            });
            this.bindProp("lockText", this.lockText, "string");
            this.bindProp("status", (status) => {
                if (status === DatingEventSceneModel_1.DatingEventStatus.Locked) {
                    this.coverSprite.node.active = false;
                    this.lockText.node.parent.active = true;
                }
                else {
                    this.coverSprite.node.active = true;
                    this.lockText.node.parent.active = false;
                    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];
                    }
                }
            });
            this.bindProp("lineStyle", (value) => {
                if (value === "none") {
                    this.jointLines[0].parent.active = false;
                }
                else {
                    this.jointLines[0].parent.active = true;
                    this.jointLines[value].active = true;
                    this.jointLines[(value + 1) % 2].active = false;
                }
            });
        }
    };
    __decorate([
        property([cc.Node])
    ], DatingEventItemViewImpl.prototype, "jointLines", void 0);
    __decorate([
        property(cc.Label)
    ], DatingEventItemViewImpl.prototype, "titleLabel", void 0);
    __decorate([
        property(cc.Label)
    ], DatingEventItemViewImpl.prototype, "dateLabel", void 0);
    __decorate([
        property(cc.Label)
    ], DatingEventItemViewImpl.prototype, "timeLabel", void 0);
    __decorate([
        property(cc.Node)
    ], DatingEventItemViewImpl.prototype, "newNode", void 0);
    __decorate([
        property(cc.Sprite)
    ], DatingEventItemViewImpl.prototype, "coverSprite", void 0);
    __decorate([
        property(cc.Label)
    ], DatingEventItemViewImpl.prototype, "lockText", 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();