77d42084-be76-47c2-8338-e2cdfbbee723.js 3.29 KB
"use strict";
cc._RF.push(module, '77d42CEvnZHwoM44s37vucj', 'DatingEventSubviewImpl');
// script/game/ui/view/impl/dating/DatingEventSubviewImpl.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.DatingEventSubviewImpl = void 0;
const ListSubviewImpl_1 = require("../../../baseview/impl/ListSubviewImpl");
const DatingEventSubview_1 = require("../../type/DatingEventSubview");
const DatingEventItemViewImpl_1 = require("./DatingEventItemViewImpl");
const PresenterCCViewFactory_1 = require("../../../PresenterCCViewFactory");
const CCDummyObjects_1 = require("../../../../../common/CCDummyObjects");
const { ccclass, property } = cc._decorator;
let DatingEventSubviewImpl = /** @class */ (() => {
    let DatingEventSubviewImpl = class DatingEventSubviewImpl extends ListSubviewImpl_1.ListSubviewImpl {
        constructor() {
            super(...arguments);
            //#region editor bindings
            this.listItemPrefabs = [];
            this.listSuffix = undefined;
            this.noDataNode = CCDummyObjects_1.DummyNode;
        }
        //#endregion
        onLoad() {
            super.onLoad();
            this.bindProp("items", (value) => {
                this.noDataNode.active = !value.length;
                if (this.listSuffix) {
                    this.listSuffix.active = !!value.length;
                }
            });
        }
        createListItemView(index) {
            let prefab = this.listItemPrefabs[index % this.listItemPrefabs.length];
            let node = cc.instantiate(prefab);
            return Promise.resolve(node.getComponent(DatingEventItemViewImpl_1.DatingEventItemViewImpl));
        }
        onRefreshListEnd() {
            if (this.listSuffix) {
                this.listSuffix.setSiblingIndex(this.contentLayout.node.childrenCount);
            }
            if (this.name.indexOf("MainEvent") === 0) {
                this.scheduleOnce(() => {
                    this.scheduleOnce(() => {
                        this.contentLayout.updateLayout();
                        this.scrollToBottom(false);
                    });
                });
            }
        }
    };
    __decorate([
        property([cc.Prefab])
    ], DatingEventSubviewImpl.prototype, "listItemPrefabs", void 0);
    __decorate([
        property(cc.Node)
    ], DatingEventSubviewImpl.prototype, "listSuffix", void 0);
    __decorate([
        property(cc.Node)
    ], DatingEventSubviewImpl.prototype, "noDataNode", void 0);
    DatingEventSubviewImpl = __decorate([
        ccclass,
        PresenterCCViewFactory_1.RegSubview(DatingEventSubview_1.DatingEventSubviewType)
    ], DatingEventSubviewImpl);
    return DatingEventSubviewImpl;
})();
exports.DatingEventSubviewImpl = DatingEventSubviewImpl;

cc._RF.pop();