1411de84-62aa-4c48-bf98-4cd4b23f63d7.js 3.56 KB
"use strict";
cc._RF.push(module, '1411d6EYqpMSL+YTNSyP2PX', 'CCGameCenterListView');
// script/cooperation/script/CCGameCenterListView.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 EventCenter_1 = require("../event/EventCenter");
const EventKit_1 = require("../event/EventKit");
const CCCooperationItem_1 = require("./CCCooperationItem");
const CooperationDataCenter_1 = require("./CooperationDataCenter");
const GameCenter_1 = require("./GameCenter");
const CCGameCenterNodeFactory_1 = require("./CCGameCenterNodeFactory");
const CCDummyObjects_1 = require("../../common/CCDummyObjects");
const simba_sdk_1 = require("simba-sdk");
const MainViewPresenter_1 = require("../../game/ui/presenter/MainViewPresenter");
const { ccclass, property } = cc._decorator;
let CCGameCenterListView = /** @class */ (() => {
    let CCGameCenterListView = class CCGameCenterListView extends cc.Component {
        constructor() {
            super(...arguments);
            this.contentNode = CCDummyObjects_1.DummyNode;
            this._disposable = new EventKit_1.CompositeDisposable;
            this.onRefreshContent = () => {
                if (!this.contentNode) {
                    return;
                }
                this.contentNode.removeAllChildren(true);
                let isRelease = GameCenter_1.default.getInstance().getIsRelease();
                let list = CooperationDataCenter_1.default.getInstance().getCooperationItemDataModelList();
                for (let i = 0; i < list.length; i++) {
                    let node = CCGameCenterNodeFactory_1.default.getInstance().getSubGameNode();
                    if (!node) {
                        break;
                    }
                    let script = node.getComponent(CCCooperationItem_1.CCCooperationItem);
                    if (script) {
                        script.setRelease(isRelease);
                        script.bindData(list[i]);
                        script.setLocation(CooperationDataCenter_1.SubGameLocation.GameCenter);
                    }
                    this.contentNode.addChild(node);
                }
            };
        }
        onLoad() {
            this.registerEventListener();
        }
        registerEventListener() {
            this._disposable.add(EventCenter_1.EventCenter.REFRESH_SUB_GAME_LIST.on(this.onRefreshContent));
        }
        start() {
        }
        update(dt) { }
        onViewClick() {
            EventCenter_1.EventCenter.SHOW_GAME_CENTER_LIST_VIEW.emit(false);
            if (MainViewPresenter_1.default.tabIndex == 3) {
                simba_sdk_1.SDK.showGameClubButton();
            }
        }
    };
    __decorate([
        property({ type: cc.Node, visible: true, displayName: "scrollview内容节点", tooltip: "contentNode" })
    ], CCGameCenterListView.prototype, "contentNode", void 0);
    CCGameCenterListView = __decorate([
        ccclass
    ], CCGameCenterListView);
    return CCGameCenterListView;
})();
exports.default = CCGameCenterListView;

cc._RF.pop();