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BAAmB;QAF/B,OAAO;QACP,gCAAO,CAAC,qCAAmB,EAAE,2BAA2B,CAAC;OAC7C,mBAAmB,CA0G/B;IAAD,0BAAC;KAAA;AA1GY,kDAAmB","file":"","sourceRoot":"/","sourcesContent":["import { CCView } from \"../../../../../common/classbase/CCViewBase\";\nimport { DatingSceneView, DatingSceneViewType } from \"../../type/DatingSceneView\";\nimport { RegView } from \"../../../PresenterCCViewFactory\";\nimport { UIManager } from \"../../../../../common/gameplay/managers/UIManager\";\nimport { DummySprite, DummyNode } from \"../../../../../common/CCDummyObjects\";\nimport { ResUtils } from \"../../../../../common/utils/ResUtils\";\n\nconst { ccclass, property } = cc._decorator;\n\n@ccclass\n@RegView(DatingSceneViewType, \"prefab/ui/DatingSceneView\")\nexport class DatingSceneViewImpl extends CCView implements DatingSceneView {\n    //#region editor bindings\n    @property(cc.Sprite)\n    private backgroundSprite = DummySprite;\n    @property(cc.Sprite)\n    private portraitSprite = DummySprite;\n    @property(cc.Sprite)\n    private selfSmallPortrait = DummySprite;\n    @property(cc.Node)\n    private otherDialogNode = DummyNode;\n    @property(cc.Node)\n    private selfDialogNode = DummyNode;\n    @property(cc.Node)\n    private narratorDialogNode = DummyNode;\n    @property(cc.Node)\n    private backRedDot = DummyNode;\n\n    closeAction() {\n        this.backgroundSprite.spriteFrame = undefined as any;\n        this.portraitSprite.spriteFrame = undefined as any;\n        this.selfSmallPortrait.spriteFrame = undefined as any;\n        this.otherDialogNode.active = false;\n        this.selfDialogNode.active = false;\n        this.narratorDialogNode.active = false;\n        this.backRedDot.active = false;\n        this.close();\n    }\n    //#endregion\n\n    completePlotCallback: () => void;\n\n    onEnable() {\n        this.node.on(cc.Node.EventType.TOUCH_END, this.touchEndHandler, this);\n    }\n\n    onDisable() {\n        this.node.off(cc.Node.EventType.TOUCH_END, this.touchEndHandler, this);\n    }\n\n    touchEndHandler = () => {\n        if (this.completePlotCallback) this.completePlotCallback();\n    }\n\n    guideBack() {\n        this.backRedDot.active = true;\n    }\n\n    async setContent(isSelf: boolean, text: string, name?: string, portraitImg?: string, otherPortraitImg?: string): Promise<void> {\n        let promises: Promise<any>[] = [];\n        if (!((isSelf && otherPortraitImg) || portraitImg)) { // 防止切换过程中闪\n            this.portraitSprite.spriteFrame = undefined as any;\n        }\n        if (portraitImg) {\n            promises.push(ResUtils.loadRes(portraitImg, cc.SpriteFrame).then((sf) => {\n                if (this.node.active) {\n                    if (isSelf) {\n                        this.selfSmallPortrait.spriteFrame = sf;\n                    } else {\n                        this.portraitSprite.spriteFrame = sf;\n                    }\n                }\n            }));\n        }\n        if (isSelf && otherPortraitImg) {\n            promises.push(ResUtils.loadRes(otherPortraitImg, cc.SpriteFrame).then((sf) => {\n                this.portraitSprite.spriteFrame = sf;\n            }));\n        }\n        this.otherDialogNode.active = false;\n        this.selfDialogNode.active = false;\n        this.narratorDialogNode.active = false;\n        if (text) {\n            if (isSelf) { // 自己\n                this.selfDialogNode.active = true;\n                this.selfDialogNode.children[0].getComponent(cc.Label).string = name!;\n                this.selfDialogNode.children[1].getComponent(cc.RichText).string = text;\n            } else if (name) { // 别人\n                this.otherDialogNode.active = true;\n                this.otherDialogNode.children[0].getComponent(cc.Label).string = name!;\n                this.otherDialogNode.children[1].getComponent(cc.RichText).string = text;\n            } else { // 旁白\n                this.narratorDialogNode.active = true;\n                this.narratorDialogNode.children[0].getComponent(cc.RichText).string = text;\n            }\n        }\n        try {\n            await Promise.all(promises);\n        } catch (e) {\n            console.error(e);\n        }\n    }\n\n    async setBackground(bgImage: string) {\n        if (!bgImage) {\n            this.backgroundSprite.spriteFrame = undefined as any;\n        } else {\n            try {\n                let sf = await ResUtils.loadRes(bgImage, cc.SpriteFrame);\n                this.backgroundSprite.spriteFrame = sf;\n                this.backgroundSprite.node.height = this.node.height;\n                this.backgroundSprite.node.width = sf.getOriginalSize().width / sf.getOriginalSize().height * this.node.height\n            } catch (e) {\n                console.error(e);\n            }\n        }\n    }\n}\n"]}