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AC;iBACzB;aACJ;QACL,CAAC;KAqBJ,CAAA;IA9IU,yBAAI,GAAG,sBAAsB,CAAC;IAD5B,oBAAoB;QADhC,qCAAY,CAAC,qCAAmB,CAAC;OACrB,oBAAoB,CA+IhC;IAAD,2BAAC;KAAA;AA/IY,oDAAoB","file":"","sourceRoot":"/","sourcesContent":["import { Presenter } from \"../../../common/classbase/PresenterBase\";\nimport { DatingEventSceneModel, DatingEventStatus } from \"../../model/DatingEventSceneModel\";\nimport { DatingSceneView, DatingSceneViewType } from \"../view/type/DatingSceneView\";\nimport { RegPresenter } from \"../PresenterCCViewFactory\";\nimport { DeepReadonly, delay } from \"simba-utils\";\nimport { SentenceType, Plot } from \"../../../avg/model/PlotModel\";\nimport { PlotManager } from \"../../../avg/PlotManager\";\nimport { Action, ActionType } from \"../../../avg/model/ActionModel\";\nimport { getPlot } from \"../../../avg/game-data/PlotsData\";\nimport { PlotSceneType } from \"../../Enums\";\nimport { ActionManager } from \"../../../avg/ActionManager\";\nimport { GameConstData } from \"../../../common/gameplay/gamedata/GameConstData\";\nimport { richNodesToCocosString } from \"../../../avg/utils/RichTextUtils\";\nimport { UIManager } from \"../../../common/gameplay/managers/UIManager\";\nimport SentenceSelectorViewPresenter from \"./SentenceSelectorViewPresenter\";\nimport { SentenceSelectorViewProps } from \"../view/type/SentenceSelectorView\";\nimport { FaceType } from \"../../../avg/EditorEnums\";\nimport { GameModelManager } from \"../../model/GameModelManager\";\nimport { GameRecord } from \"../../../avg/game-data/GameRecord\";\nimport { EditorEvents } from \"../../../avg/EditorEvents\";\nimport { AudioManager } from \"../../../common/gameplay/managers/AudioManager\";\nimport GameRoleDataModel from \"../../model/GameRoleDataModel\";\n\ntype DatingPlot = DeepReadonly<Plot & { face: FaceType, portrait?: number, portraitFace?: FaceType }>\n@RegPresenter(DatingSceneViewType)\nexport class DatingScenePresenter extends Presenter<DatingEventSceneModel, DatingSceneView> {\n static uuid = \"DatingScenePresenter\";\n private _currPlot?: DatingPlot;\n private _executingPlot = false;\n private _completingPlot = false;\n private _isReview = false;\n private _model: DatingEventSceneModel;\n // private _actionFilter?: (action: DeepReadonly<Action>) => boolean;\n private _plotBranch = 0;\n private _currSelect?: number = undefined;\n private _finished = false;\n\n onOpen(param: DatingEventSceneModel) {\n super.onOpen(param);\n this._finished = false;\n this.view.completePlotCallback = this.completePlot;\n this._model = param;\n delay(0.1).then(async () => {\n if (param.status === DatingEventStatus.Completed) {\n this._isReview = true;\n // this._actionFilter = (action) => {\n // return action.type !== ActionType.ModifyVariable;\n // }\n this._model.background = \"\";\n this._currPlot = await getPlot(param.config.start_plot_id)! as DatingPlot;\n\n } else {\n let plots = PlotManager.getCurrentPlots();\n this._plotBranch = plots.findIndex(v => v.plotSceneType === PlotSceneType.DatingEvent && v.plotSceneTypeId === param.id);\n this._currPlot = plots[this._plotBranch] as DatingPlot;\n if (this._currPlot.id === this._model.firstPlot.id) {\n GameRecord.recordVariables.bgm = \"\"; // 新约会,不继承之前剧情的背景音乐存档\n this._model.background = \"\";\n }\n this._currSelect = PlotManager.getPlotSelection(this._currPlot.id);\n if (GameRecord.recordVariables.bgm) {\n AudioManager.playMusic(GameRecord.recordVariables.bgm);\n }\n }\n if (this._model.background) {\n await this.view.setBackground(\"textures/background/dating_event/\" + this._model.background);\n }\n this.execPlot();\n });\n\n this._disposable.add(EditorEvents.SET_DATING_BG.on((bgPath) => {\n this._model.background = bgPath;\n if (bgPath) bgPath = \"textures/background/dating_event/\" + bgPath;\n return this.view.setBackground(bgPath);\n }));\n }\n\n onClose() {\n UIManager.popToPresenter(this);\n }\n\n async execPlot() {\n if (this._currPlot) {\n if (this._currPlot.plotSceneType === PlotSceneType.DatingEvent && this._currPlot.plotSceneTypeId === this._model.id) {\n this._executingPlot = true;\n const sentence = this._currPlot.sentences[0];\n const content = sentence.content;\n const roleData = GameModelManager.getRoleData(sentence.roleId)!;\n let otherPortrait: string | undefined = undefined;\n if (this._currPlot.portrait !== undefined) {\n let otherRole = GameModelManager.getRoleData(this._currPlot.portrait);\n if (otherRole) {\n otherPortrait = otherRole.getPortrait(this._currPlot.portraitFace);\n }\n }\n if (content) { // TODO 图片设置\n if (content.type === SentenceType.TEXT) {\n await this.view.setContent(sentence.roleId === GameConstData.GAME_CONST_PLAYER_ROLE_VALUE,\n richNodesToCocosString(content.value),\n sentence.roleId === 1 ? undefined : roleData.getConfig().name,\n sentence.roleId === 1 ? otherPortrait : roleData.getPortrait(this._currPlot.face,),\n otherPortrait);\n } else if (content.type === SentenceType.SELECT) {\n let setSelection = async () => {\n let value = content.value[this._currSelect!];\n let str = value.summary;\n if (value.content && value.content.type === SentenceType.EMPTY) { // 空类型,不做展示\n this.completePlot();\n return;\n } else if (value.content && value.content.type === SentenceType.TEXT) {\n str = richNodesToCocosString(value.content.value);\n }\n await this.view.setContent(true, str, roleData.getConfig().name, roleData.getPortrait(this._currPlot!.face), otherPortrait);\n }\n if (this._currSelect === undefined) {\n let props: SentenceSelectorViewProps =\n {\n sentence: content,\n backgroundpath: \"\",\n clickcausehide: false,\n optionStyle1: true,\n y: -250,\n onSelectIndexCallback: (index: number) => { this._currSelect = index; setSelection(); }\n };\n UIManager.pushPresenter(SentenceSelectorViewPresenter, props);\n await this.view.setContent(true, \"\", roleData.getConfig().name, roleData.getPortrait(this._currPlot!.face), otherPortrait);\n } else {\n await setSelection();\n }\n } else {\n console.error(\"不支持的约会剧情\", content);\n }\n } else { // 没有句子,只设置其立绘、背景等\n await this.view.setContent(false, \"\", \"\", roleData.getPortrait(this._currPlot!.face), otherPortrait);\n }\n if (this._currPlot.sentences[0].actions.actions.length) {\n await ActionManager.executeActions(this._currPlot.sentences[0].actions, undefined, !this._isReview);\n }\n this._executingPlot = false;\n } else {\n // 本次约会剧情结束\n this._model.status = DatingEventStatus.Completed;\n this._finished = true;\n UIManager.showToast(\"本次剧情结束\");\n this.view.guideBack();\n }\n }\n }\n\n completePlot = async () => {\n if (this._executingPlot || this._completingPlot || !this._currPlot || this._finished) return;\n let content = this._currPlot.sentences[0].content;\n if (content && content.type === SentenceType.SELECT && this._currSelect === undefined) return;\n this._completingPlot = true;\n if (this._isReview) {\n let nextPlot = await PlotManager.getNextPlot(this._currPlot, this._currSelect);\n if (nextPlot) {\n this._currPlot = nextPlot as DatingPlot;\n }\n } else {\n this._model.status = DatingEventStatus.InProgress;\n let nextPlots = await PlotManager.completePlot(this._currPlot, this._currSelect);\n this._currPlot = nextPlots[this._plotBranch] as DatingPlot;\n }\n this._currSelect = undefined;\n this._completingPlot = false;\n this.execPlot();\n }\n}"]}