var t = require; var e = module; var i = exports; Object.defineProperty(i, "__esModule", {value: !0}); const a = t("App"), s = t("BaseController"), n = t("ControllerConst"), o = t("NotificationConst"), r = t("MachineService"), l = t("MapService"), h = t("StageUpgradeService"), c = t("GuideModel"), d = t("SystemOpenConfig"), u = t("SystemOpenConst"); let p = null; i.default = class extends s.default { constructor() { super(), (this._waitOpenList = []), (p = this), a.default.NotificationCenter.addListener(o.NotificationConst.INIT_GAME, this.init, this); } static get ins() { return p; } init() { if ( (a.default.NotificationCenter.removeListener(o.NotificationConst.INIT_GAME, this.init, this), !this._configMap) ) { for (var t in (this.initConfig(), this._configMap)) { var e = this._configMap[t], t = this.checkSystemOpen(e.index, !0); t ? a.default.NotificationCenter.dispatch(o.NotificationConst.SYS_OPEN, e.index, t) : this._waitOpenList.push(e); } this.initSelfEvent(), a.default.NotificationCenter.addListener(o.NotificationConst.CHECK_SYS_OPEN, this.checkSys, this), a.default.NotificationCenter.addListener(o.NotificationConst.GUIDE_STEP_FINISH, this.checkAllSys, this), a.default.NotificationCenter.addListener( o.NotificationConst.STAGE_UPGRADE_UPDATE, this.checkAllSys, this ), a.default.NotificationCenter.addListener(o.NotificationConst.ENTER_MAP, this.checkAllSys, this), a.default.NotificationCenter.addListener(o.NotificationConst.MACHINE_UPDATE, this.checkAllSys, this); } } initSelfEvent() { this.registerFunc(u.OpenConst.CHCEK_OPEN, this.checkSystemOpen, this); } initConfig() { var t, e = a.default.ConfigManager.getConfig("SystemDataManager"); for (t in ((this._configMap = {}), e)) { var i = e[t], i = new d.default().parse(i); this._configMap[i.id] = i; } } getConfigByIndex(t) { if (this._configMap) { t = u.OpenTypeConst[t]; return this._configMap[t]; } } getConfigByType(t) { if (this._configMap) return this._configMap[t]; } checkSystemGuide() {} checkSystemOpen(t, e) { t = this.getConfigByIndex(t); if (!t) return !1; for (const o of t.openConList) switch (o.type) { case "i": if (!a.default.Platform.getIsShowPay()) return !1; break; case "m": if (!l.default.ins.curCfg) return !1; var i = l.default.ins.curId; if (o.value > i) return !1; if (o.value < i) return !0; break; case "l": if (o.value > r.default.ins.getCurMachineMaxLv()) return !1; break; case "u": if (!h.default.ins.isUnlock(o.value)) return !1; break; case "d": var s = a.default.GameDataMsr.playerInfo.registerTime / 1e3 / 3600 / 24, i = a.default.DateUtils.Now() / 1e3 / 3600 / 24; if (o.value > i - s) return !1; break; case "g": let t = a.default.ControllerManager.applyFunc( n.ControllerConst.Guide, c.GuideConst.CHECK_IS_GUIDE, o.value ); if ( !t && (902 == o.value && (t = a.default.ControllerManager.applyFunc( n.ControllerConst.Guide, c.GuideConst.CHECK_IS_GUIDE, 400 )), (t = t || a.default.ControllerManager.applyFunc( n.ControllerConst.Guide, c.GuideConst.CHECK_IS_GUIDE, 1 )), !t) ) return !1; } return !0; } checkAllSys(e = !1) { for (let t = this._waitOpenList.length - 1; 0 <= t; t--) { var i = this._waitOpenList[t], s = this.checkSystemOpen(i.index, e); s && (this._waitOpenList.splice(t, 1), i.isPlayAni && e ? a.default.NotificationCenter.dispatch(o.NotificationConst.SYS_OPEN, i.index, s, !0) : a.default.NotificationCenter.dispatch(o.NotificationConst.SYS_OPEN, i.index, s)); } } checkSys(t, e = !1) { e = this.checkSystemOpen(t, e); null != e && a.default.NotificationCenter.dispatch(o.NotificationConst.SYS_OPEN, t, e); } };