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MAAM,mBAAQ,CAAC,OAAO,CAAM,aAAa,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC;aAClE;YACD,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC;YACvB,YAAY,GAAG,GAAG,CAAC,QAAQ,CAAC;YAC5B,MAAM;SACT;QAAC,OAAO,CAAC,EAAE;YACR,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACjB,MAAM,mBAAK,CAAC,CAAC,CAAC,CAAC;SAClB;KACJ;AACL,CAAC;AAlBD,sCAkBC;AAED,SAAgB,WAAW;IACvB,OAAO,YAAY,CAAC;AACxB,CAAC;AAFD,kCAEC;AAED,SAAgB,eAAe,CAAC,SAAiB;IAC7C,OAAO,YAAY,CAAC,SAAS,CAAC,CAAC;AACnC,CAAC;AAFD,0CAEC","file":"","sourceRoot":"/","sourcesContent":["import { Chapter, Plot, ReadonlyPlot, SpecialPlotId } from \"../model/PlotModel\";\nimport { GameConfig } from \"../../GameConfig\";\nimport { delay } from \"simba-utils\";\nimport { ResUtils } from \"../../common/utils/ResUtils\";\n\nlet plotsIndex: { firstPlot: number, entries: { [key: number]: number } } = {\n firstPlot: -1,\n entries: {}\n};\n\nlet chaptersData: { [key: number]: Chapter } = {};\n\nconst curPlotsData: { [key: number]: { [key: number]: ReadonlyPlot } } = {};\n\n// Managed by PlotManager, do not call directly\nexport function initCustomPlots(plots: { [key: number]: ReadonlyPlot }) {\n if (curPlotsData[-100]) {\n console.error(\"initCustomPlots already called!\");\n return;\n }\n curPlotsData[-100] = plots;\n}\n\n// Managed by PlotManager, do not call directly\nexport function addCustomPlotData(plot: ReadonlyPlot) {\n curPlotsData[-100][plot.id] = plot;\n}\n\nexport function getPlotsIndex() {\n return plotsIndex;\n}\n\nconst USE_CDN_PLOTS = false;\n\n\nexport async function getPlot(plotId: number) {\n if (plotId === undefined) return undefined;\n if (plotId <= SpecialPlotId.CustomPlotStart) {\n return curPlotsData[-100][plotId];\n }\n if (plotId < 0) {\n return { id: plotId } as Plot;\n }\n let chapterId = plotsIndex.entries[plotId];\n if (!curPlotsData[chapterId]) {\n curPlotsData[plotsIndex.entries[plotId]] = await retrievePlotsForChapter(chapterId);\n }\n return curPlotsData[chapterId][plotId];\n}\n\nasync function retrievePlotsForChapter(chapterId: number) {\n while (1) {\n try {\n let res: any;\n if (USE_CDN_PLOTS) {\n let resStr = await GameConfig.cdnServer.get(`/plots/${chapterId}.json`, 5000, { \"Cache-Control\": \"no-cache, no-store\" }) as string;\n res = JSON.parse(resStr);\n } else {\n res = await ResUtils.loadRes<any>(`/plots/${chapterId}`, cc.JsonAsset);\n }\n return res;\n } catch (e) {\n console.error(e);\n }\n }\n}\n\nexport function getChapter(chapterId: number) {\n return chaptersData[chapterId];\n}\n\nexport async function initPlotsData() {\n while (true) {\n try {\n let res: any;\n if (USE_CDN_PLOTS) {\n let resStr = await GameConfig.cdnServer.get(\"/plots/index.json\", 5000, { \"Cache-Control\": \"no-cache, no-store\" }) as string;\n res = JSON.parse(resStr);\n } else {\n res = await ResUtils.loadRes<any>(\"plots/index\", cc.JsonAsset);\n }\n plotsIndex = res.plots;\n chaptersData = res.chapters;\n break;\n } catch (e) {\n console.error(e);\n await delay(1);\n }\n }\n}\n\nexport function getChapters(): { [key: number]: Chapter } {\n return chaptersData;\n}\n\nexport function getChapterPlots(chapterId: number) {\n return curPlotsData[chapterId];\n}"]}