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ACH,eAAe;QACX,IAAI,GAAG,GAAyC,EAAE,CAAC;QACnD,IAAI,GAAG,GAAG,oCAAa,CAAC,YAAY,CAAC,iBAAO,CAAC,CAAC;QAC9C,KAAK,IAAI,EAAE,IAAI,GAAG,EAAE;YAChB,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;SAC1D;QACD,IAAI,CAAC,cAAc,GAAG,GAAG,CAAC;IAC9B,CAAC;CACJ;AAEU,QAAA,sBAAsB,GAAG,IAAI,uBAAuB,EAAE,CAAC","file":"","sourceRoot":"/","sourcesContent":["import { ConfigManager } from \"simba-config-manager\";\nimport { GameRecord } from \"../../avg/AVG\";\nimport { itemTbl } from \"../../config/ItemTbl\";\n\nclass UnlockItemModelManager1 {\n /**存档Key */\n private UnlockItems = 'UnlockItems';\n /**存档Key */\n private ClickedItems = 'ClickedItems';\n /**存档Key */\n private UnlockedIntroductionItems = 'UnlockedIntroductionItems';\n /**解锁的物品ids */\n private items: Array<number> = [];\n /**点击过的物品ids */\n private clickedItem: Array<number> = [];\n /**已经解锁简介的物品ids */\n private unlockedIntroductionItem: Array<number> = [];\n /**配置掉落物品的剧情id和午评id的映射表 */\n private _unlockPlotIds: Array<{ itemId: number, plotId: number }> = [];\n\n /**获取配置掉落物品的剧情id和午评id的映射表 */\n public get unlockPlotIds(): Array<{ itemId: number, plotId: number }> {\n if (this._unlockPlotIds.length == 0) this.analysisItemCfg();\n return this._unlockPlotIds\n }\n\n public get unlockItems(): Array<number> {\n let items: Array<number> = [];\n let itemsStr = GameRecord.globalVariables[this.UnlockItems];\n if (itemsStr) {\n let itemsIdStr: Array<string> = itemsStr.split(',');\n itemsIdStr.forEach(id => {\n try {\n items.push(Number(id));\n } catch (error) {\n console.error(error);\n }\n });\n }\n return items;\n }\n\n public get clickedItems(): Array<number> {\n this.clickedItem = [];\n let itemsStr = GameRecord.globalVariables[this.ClickedItems];\n if (itemsStr) {\n let itemsIdStr: Array<string> = itemsStr.split(',');\n itemsIdStr.forEach(id => {\n try {\n this.clickedItem.push(Number(id));\n } catch (error) {\n console.error(error);\n }\n });\n }\n return this.clickedItem;\n }\n\n public get unlockedIntroductionItems(): Array<number> {\n this.unlockedIntroductionItem = [];\n let itemsStr = GameRecord.globalVariables[this.UnlockedIntroductionItems];\n if (itemsStr) {\n let itemsIdStr: Array<string> = itemsStr.split(',');\n itemsIdStr.forEach(id => {\n try {\n this.unlockedIntroductionItem.push(Number(id));\n } catch (error) {\n console.error(error);\n }\n });\n }\n return this.unlockedIntroductionItem;\n }\n\n /**\n * 保存解锁了简介的物品id到存档\n * @param id 点击过的物品id\n */\n saveUnlockedIntroductionItemIdToGameRecord(id: number): boolean {\n this.unlockedIntroductionItem = [];\n let itemsStr = GameRecord.globalVariables[this.UnlockedIntroductionItems];\n if (itemsStr) {\n let itemsIdStr: Array<string> = itemsStr.split(',');\n itemsIdStr.forEach(id => {\n try {\n this.unlockedIntroductionItem.push(Number(id));\n } catch (error) {\n console.error(error);\n }\n });\n }\n if (this.unlockedIntroductionItem.indexOf(id) == -1) {\n this.unlockedIntroductionItem.push(id);\n GameRecord.globalVariables[this.UnlockedIntroductionItems] = this.unlockedIntroductionItem.toString();\n GameRecord.saveRecord();\n return true;\n }\n return false;\n }\n\n /**\n * 保存点击过的物品id到存档\n * @param id 点击过的物品id\n */\n saveClickedItemIdToGameRecord(id: number): boolean {\n this.clickedItem = [];\n let itemsStr = GameRecord.globalVariables[this.ClickedItems];\n if (itemsStr) {\n let itemsIdStr: Array<string> = itemsStr.split(',');\n itemsIdStr.forEach(id => {\n try {\n this.clickedItem.push(Number(id));\n } catch (error) {\n console.error(error);\n }\n });\n }\n if (this.clickedItem.indexOf(id) == -1) {\n this.clickedItem.push(id);\n GameRecord.globalVariables[this.ClickedItems] = this.clickedItem.toString();\n GameRecord.saveRecord();\n return true;\n }\n return false;\n }\n\n\n /**\n * 保存解锁的物品id到存档\n * @param id 解锁的物品id\n */\n saveItemIdToGameRecord(id: number): boolean {\n this.items = [];\n let itemsStr = GameRecord.globalVariables[this.UnlockItems];\n if (itemsStr) {\n let itemsIdStr: Array<string> = itemsStr.split(',');\n itemsIdStr.forEach(id => {\n try {\n this.items.push(Number(id));\n } catch (error) {\n console.error(error);\n }\n });\n }\n if (this.items.indexOf(id) == -1) {\n this.items.push(id);\n GameRecord.globalVariables[this.UnlockItems] = this.items.toString();\n // GameRecord.autoSave();\n return true;\n }\n return false;\n }\n\n /**\n * 登录初始化已经解锁的items\n */\n loginInitUnlockItems() {\n //获取已经存在的items\n this.items = [];\n let itemsStr = GameRecord.globalVariables[this.UnlockItems];\n if (itemsStr) {\n let itemsIdStr: Array<string> = itemsStr.split(',');\n itemsIdStr.forEach(id => {\n try {\n this.items.push(Number(id));\n } catch (error) {\n console.error(error);\n }\n });\n }\n //当前剧情应该解锁的所有物品\n let itemcfg: { itemId: number, plotId: number }[] = this.unlockPlotIds;\n //获取当前的剧情id\n let record = GameRecord.getPlotsInfo();\n for (let i = 0; i < itemcfg.length; i++) {\n let ele = itemcfg[i];\n if (ele) {\n if (record[`${ele.plotId}`] && record[`${ele.plotId}`].cnt >= 1) {\n if (this.items.indexOf(ele.itemId) == -1) {\n this.items.push(ele.itemId);\n }\n }\n }\n }\n GameRecord.globalVariables[this.UnlockItems] = this.items.toString();\n // GameRecord.autoSave();\n }\n\n /**\n * 解析item表结果\n */\n analysisItemCfg() {\n let ret: { itemId: number, plotId: number }[] = [];\n let cfg = ConfigManager.getAllConfig(itemTbl);\n for (let id in cfg) {\n ret.push({ itemId: Number(id), plotId: cfg[id].plot });\n }\n this._unlockPlotIds = ret;\n }\n}\n\nexport let UnlockItemModelManager = new UnlockItemModelManager1();"]}