77d42084-be76-47c2-8338-e2cdfbbee723.js 5.75 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 GameModelManager_1 = require("../../../../model/GameModelManager");
const { ccclass, property } = cc._decorator;
let DatingEventSubviewImpl = /** @class */ (() => {
    let DatingEventSubviewImpl = class DatingEventSubviewImpl extends ListSubviewImpl_1.ListSubviewImpl {
        constructor() {
            super(...arguments);
            this.listItemPrefab = CCDummyObjects_1.DummyPrefab;
            this.leftButton = CCDummyObjects_1.DummyButton;
            this.nameButton = CCDummyObjects_1.DummyButton;
            this.rightButton = CCDummyObjects_1.DummyButton;
            this.scrollViewRoot = CCDummyObjects_1.DummyNode;
            this.scrollViewContent = CCDummyObjects_1.DummyNode;
            this.sectionBtn = CCDummyObjects_1.DummyPrefab;
            this.extraPlotButton = CCDummyObjects_1.DummyNode;
            this.getItemNode = (k) => {
                let ret = undefined;
                let v = this._itemViews[k];
                if (v) {
                    ret = v.node;
                }
                return ret;
            };
        }
        // private _scrollViewOffsetY: number;
        onLoad() {
            super.onLoad();
        }
        createListItemView(index) {
            let node = cc.instantiate(this.listItemPrefab);
            return Promise.resolve(node.getComponent(DatingEventItemViewImpl_1.DatingEventItemViewImpl));
        }
        onRefreshListEnd() {
            this.scheduleOnce(() => {
                this.scheduleOnce(() => {
                    this.contentLayout.updateLayout();
                    // if (this._scrollViewOffsetY) {
                    //     this.scrollView.scrollToOffset(new cc.Vec2(0, this._scrollViewOffsetY));
                    //     this._scrollViewOffsetY = 0;
                    // } else {
                    this.scrollToTop();
                    // }
                    GameModelManager_1.GameModelManager.CheckDateGuide.emit();
                });
            });
        }
        onScrollEvent(scrollview, eventType, customEventData) {
            if (cc.ScrollView.EventType.SCROLL_BEGAN === eventType) {
                this._props.onScrollBegin();
            }
            else if (cc.ScrollView.EventType.SCROLL_ENDED === eventType) {
                this._props.onScrollEnd();
            }
        }
        // setCurrEventId(id: number) {
        //     this._scrollViewOffsetY = this.scrollView.content.height - (250 * id) - (250 / 2);
        // }
        getLeftButton() {
            return this.leftButton;
        }
        getNameButton() {
            return this.nameButton;
        }
        getRightButton() {
            return this.rightButton;
        }
        getScrollViewRoot() {
            return this.scrollViewRoot;
        }
        getScrollViewContent() {
            return this.scrollViewContent;
        }
        getSectionBtn() {
            return this.sectionBtn;
        }
        getExtraPlotButton() {
            return this.extraPlotButton;
        }
        onLeftButtonClick() {
            this._props.onLeftButtonClickCallback();
        }
        onRightButtonClick() {
            this._props.onRightButtonClickCallback();
        }
        onNameButtonClick() {
            this._props.onNameButtonClickCallback();
        }
        onExtraPlotButtonClick() {
            this._props.onExtraPlotButtonClickCallback();
        }
        onCloseSectionView() {
            this._props.onCloseSectionViewCallBack();
        }
    };
    __decorate([
        property(cc.Prefab)
    ], DatingEventSubviewImpl.prototype, "listItemPrefab", void 0);
    __decorate([
        property(cc.Button)
    ], DatingEventSubviewImpl.prototype, "leftButton", void 0);
    __decorate([
        property(cc.Button)
    ], DatingEventSubviewImpl.prototype, "nameButton", void 0);
    __decorate([
        property(cc.Button)
    ], DatingEventSubviewImpl.prototype, "rightButton", void 0);
    __decorate([
        property(cc.Node)
    ], DatingEventSubviewImpl.prototype, "scrollViewRoot", void 0);
    __decorate([
        property(cc.Node)
    ], DatingEventSubviewImpl.prototype, "scrollViewContent", void 0);
    __decorate([
        property(cc.Prefab)
    ], DatingEventSubviewImpl.prototype, "sectionBtn", void 0);
    __decorate([
        property(cc.Node)
    ], DatingEventSubviewImpl.prototype, "extraPlotButton", void 0);
    DatingEventSubviewImpl = __decorate([
        ccclass,
        PresenterCCViewFactory_1.RegSubview(DatingEventSubview_1.DatingEventSubviewType)
    ], DatingEventSubviewImpl);
    return DatingEventSubviewImpl;
})();
exports.DatingEventSubviewImpl = DatingEventSubviewImpl;

cc._RF.pop();