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AiB,CAAC,GAAW;QAClC,IAAI,GAAG,GAAY,KAAK,CAAC;QACzB,IAAI,CAAC,GAAG,gBAAU,CAAC,eAAe,CAAC,eAAe,CAAW,CAAC;QAC9D,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE;YACtB,IAAI,IAAI,GAAuB,IAAI,CAAC,KAAK,CAAC,CAAC,CAAuB,CAAC;YACnE,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SAC1D;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IAED,UAAU;IACV,SAAS,cAAc,CAAC,WAA6B;QACjD,IAAI,IAAI,GAAuB,EAAE,CAAC;QAClC,IAAI,CAAC,OAAO,EAAE;YACV,IAAI,CAAC,GAAG,gBAAU,CAAC,eAAe,CAAC,eAAe,CAAW,CAAC;YAC9D,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE;gBACtB,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAuB,CAAC;aAC9C;SACJ;QACD,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACvB,gBAAU,CAAC,eAAe,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACnE,gBAAU,CAAC,UAAU,EAAE,CAAC;IAC5B,CAAC;AACL,CAAC,EA3DgB,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QA2DjC","file":"","sourceRoot":"/","sourcesContent":["import { GameRecord, SpecialPlotId } from \"../../avg/AVG\";\nimport { UIManager } from \"../../common/gameplay/managers/UIManager\";\nimport AlertDialogViewPresenter from \"../ui/presenter/AlertDialogViewPresenter\";\nimport { AlertDialogViewProps } from \"../ui/view/type/AlertDialogView\";\n\nexport namespace PlotBranchManager {\n /**存档Key */\n const KEY_PLOT_RECORD = 'r_save_p';\n const ONLYONE = true;\n\n export function savePlotIdToGlobal(recordModel: IPlotRecordModel) {\n //如果保存的结构体不存在或者存档剧情中的id是剧情结束或者未完待续这两种特殊剧情,弹出提示并直接返回不做存档处理\n if (!recordModel || recordModel.plotId === SpecialPlotId.End || recordModel.plotId === SpecialPlotId.ToBeContinued) {\n UIManager.showSceneToast(\"存档数据错误!\");\n return;\n }\n let temp: AlertDialogViewProps =\n {\n dataptr: {},\n titlecontent: \"提示\",\n content: \"确定将当前剧情覆盖到存档位吗?\",\n ishasad: true,\n istwobtn: true,\n adconfig: \"inject_fruit\",\n hasBanner: false,\n callback: (type, ret) => {\n if (ret) {\n let saveAlredy: boolean = checkRecordAlredy(recordModel.plotId);\n if (saveAlredy) {\n UIManager.showSceneToast(\"你已经在此处存储过存档\");\n } else {\n savePlotRecord(recordModel);\n UIManager.showSceneToast(\"保存成功\");\n }\n }\n }\n };\n UIManager.pushPresenter(AlertDialogViewPresenter, temp);\n }\n\n /**检测是否已经存档过当前剧情 */\n function checkRecordAlredy(pid: number): boolean {\n let ret: boolean = false;\n let s = GameRecord.globalVariables[KEY_PLOT_RECORD] as string;\n if (s && \"\" !== s.trim()) {\n let mArr: IPlotRecordModel[] = JSON.parse(s) as IPlotRecordModel[];\n ret = mArr.findIndex((v) => v.plotId === pid) !== (-1);\n }\n return ret;\n }\n\n /**实际存储 */\n function savePlotRecord(recordModel: IPlotRecordModel) {\n let mArr: IPlotRecordModel[] = [];\n if (!ONLYONE) {\n let s = GameRecord.globalVariables[KEY_PLOT_RECORD] as string;\n if (s && \"\" !== s.trim()) {\n mArr = JSON.parse(s) as IPlotRecordModel[];\n }\n }\n mArr.push(recordModel);\n GameRecord.globalVariables[KEY_PLOT_RECORD] = JSON.stringify(mArr);\n GameRecord.saveRecord();\n }\n}\n\n/**存档结构体 */\nexport interface IPlotRecordModel {\n plotId: number;\n desc: string;\n}\n\n"]}