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,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;qDACY;IAnBvB,cAAc;QADlC,OAAO;OACa,cAAc,CA8OlC;IAAD,qBAAC;KAAA;kBA9OoB,cAAc","file":"","sourceRoot":"/","sourcesContent":["import { SentenceType, SentenceMediaContent, SentenceContent, SentenceTextContent } from \"../../../../../avg/model/PlotModel\";\nimport { richNodesToCocosString, richNodeTextCount } from \"../../../../../avg/utils/RichTextUtils\";\nimport { DeepReadonly } from \"simba-utils\";\nimport { DummyNode, DummyRichText, DummyLabel, DummySprite } from \"../../../../../common/CCDummyObjects\";\nimport { AudioManager } from \"../../../../../common/gameplay/managers/AudioManager\";\nimport { ResUtils } from \"../../../../../common/utils/ResUtils\";\nimport { UIManager } from \"../../../../../common/gameplay/managers/UIManager\";\nimport { ImagePreviewPresenter } from \"../../../presenter/message/ImagePreviewPresenter\";\n\nconst { ccclass, property } = cc._decorator;\n\nconst BASE_DELAY = 1;\nconst PER_CHAR_DELAY = 0.1;\n\n@ccclass\nexport default class ChatBubbleView extends cc.Component {\n    //#region editor bindings\n    @property({ type: cc.Sprite })\n    private iconSprite: cc.Sprite = DummySprite;\n    @property({ type: cc.Label })\n    private nameLabel: cc.Label = DummyLabel;\n    @property({ type: cc.RichText })\n    private textContentLabel: cc.RichText = DummyRichText;\n    @property({ type: cc.Node })\n    private inputtingNode?: cc.Node = undefined;\n    @property({ type: cc.Node })\n    private contentNode: cc.Node = DummyNode;\n    @property({ type: cc.Node })\n    private bgNode: cc.Node = DummyNode;\n    @property({ type: cc.Sprite })\n    private itemIconSprite?: cc.Sprite = undefined;\n    @property({ type: cc.Sprite })\n    private imageSprite?: cc.Sprite = undefined;\n    @property({ type: cc.Node })\n    private container?: cc.Node = undefined;\n\n    playVoice() {\n        if (this._voicePath) {\n            this.contentNode.children[1].getComponent(cc.Animation)?.play(\"voice_play\");\n            AudioManager.playVoice(this._voicePath).then(() => {\n                this.contentNode.children[1].getComponent(cc.Animation)?.play(\"voice_stop\");\n            });\n        }\n    }\n\n    previewImage() {\n        UIManager.pushPresenter(ImagePreviewPresenter, this._previewImage);\n    }\n    //#endregion\n\n    private _previewImage: string;\n\n    private _extraNode?: cc.Node;\n\n    private _nodeHeight: number;\n    private _bgWidth: number;\n    private _bgHeight: number;\n    private _textHeight: number;\n    private _icon: string;\n    private _itemIcon: string;\n    private _timer?: number;\n    private _voicePath?: string;\n\n    private delay(time: number) {\n        return new Promise((resolve) => {\n            this._timer = setTimeout(() => {\n                this._timer = undefined;\n                resolve();\n            }, time * 1000);\n        });\n    }\n\n    init() {\n        this._nodeHeight = this.node.height;\n        this._bgWidth = this.bgNode.width;\n        this._bgHeight = this.bgNode.height;\n        this._textHeight = this.textContentLabel.node.height;\n    }\n\n    reuse() {\n        if (this._timer) { clearTimeout(this._timer); this._timer = undefined; }\n        if (this._nodeHeight === undefined) return;\n        if (this._extraNode) this._extraNode.destroy();\n        this.node.height = this._nodeHeight;\n        this.bgNode.width = this._bgWidth;\n        this.bgNode.height = this._bgHeight;\n        this.textContentLabel.string = \"\";\n        this._previewImage = \"\";\n        this.bgNode.active = true;\n        if (this.imageSprite) this.imageSprite.node.parent.active = false;\n    }\n\n    private async resizeContent() {\n        if (this._previewImage) { // 图片类型\n            let sf = this.imageSprite!.spriteFrame;\n            let width = this.imageSprite!.node.width = Math.max(sf.getOriginalSize().width, 200);\n            this.imageSprite!.node.height = width / sf.getOriginalSize().width * sf.getOriginalSize().height;\n            this.node.height = -this.imageSprite!.node.y + this.imageSprite!.node.height + 40;\n        } else {\n            this.textContentLabel.node.active = true;\n            this.textContentLabel.maxWidth = 0;\n            while (!this.enabledInHierarchy) {\n                if (!this.enabled) return;\n                await this.delay(0.5);\n            }\n            (this.textContentLabel as any)._updateRichText();\n            if (400 < this.textContentLabel.node.width) {\n                this.textContentLabel.maxWidth = 400;\n                let diff = this.textContentLabel.node.height - this._textHeight;\n                this.node.height = this._nodeHeight + diff;\n                this.bgNode.height = this._bgHeight + diff;\n            }\n            if (this.bgNode.anchorX == 0) {\n                this.bgNode.width = Math.max(this._bgWidth, this.textContentLabel.node.x + this.textContentLabel.node.width + 40);\n            } else {\n                this.bgNode.width = Math.max(this._bgWidth, -this.textContentLabel.node.x + this.textContentLabel.node.width + 40);\n            }\n        }\n    }\n\n    setName(name: string) {\n        this.nameLabel.string = name;\n    }\n\n    setIcon(icon: string) {\n        if (icon && this._icon !== icon) {\n            this._icon = icon;\n            ResUtils.loadRes(icon, cc.SpriteFrame).then((sf) => {\n                if (this._icon === icon) this.iconSprite.spriteFrame = sf;\n            });\n        }\n    }\n\n    setText(txt: string) {\n        this.textContentLabel.string = txt;\n    }\n\n    setItemIcon(icon: string) {\n        if (icon && this._itemIcon !== icon && this.itemIconSprite) {\n            this._itemIcon = icon;\n            ResUtils.loadRes(icon, cc.SpriteFrame).then((sf) => {\n                if (this._itemIcon === icon) this.itemIconSprite!.spriteFrame = sf;\n            });\n        }\n    }\n\n    setExtraContent(node: cc.Node) {\n        if (this.container) {\n            this._extraNode = node;\n            node.parent = this.container;\n        }\n    }\n\n    async setContent(content: DeepReadonly<SentenceContent>, select?: number, shouldDelay = false): Promise<void> {\n        if (this._nodeHeight === undefined) this.init();\n        let textCount = 0;\n        let setContent1 = async (content: DeepReadonly<SentenceTextContent | SentenceMediaContent>) => {\n            if (content.type === SentenceType.TEXT) {\n                textCount = richNodeTextCount(content.value);\n                this.textContentLabel.string = richNodesToCocosString(content.value);\n                this.contentNode.children[0].active = true;\n                this.contentNode.children[1].active = false;\n                this.contentNode.children[2].active = false;\n            } else if (content.type === SentenceType.AUDIO) {\n                this._voicePath = \"voice/\" + content.value;\n                this.contentNode.children[0].active = false;\n                this.contentNode.children[1].active = true;\n                this.contentNode.children[2].active = false;\n            } else if (content.type === SentenceType.IMAGE && this.imageSprite) {\n                this.contentNode.children[0].active = false;\n                this.contentNode.children[1].active = false;\n                this.contentNode.children[2].active = true;\n                if (content.value) {\n                    this._previewImage = \"textures/stickers/\" + content.value;\n                    let thumb = \"textures/stickers/thumb/\" + content.value;\n                    let info = cc.resources.getInfoWithPath(thumb);\n                    console.log(\"getInfoWithPath\", info);\n                    if (!info) {\n                        thumb = this._previewImage;\n                    }\n                    try {\n                        await ResUtils.loadRes(thumb, cc.SpriteFrame).then((sf) => {\n                            // if (this.imageSprite!.node.activeInHierarchy) {\n                                this.imageSprite!.spriteFrame = sf;\n                            // }\n                        });\n                    } catch (e) {\n\n                    }\n                }\n            } else {\n                console.error(\"content type not supported yet.\")\n            }\n        }\n        let inputtingForever = false;\n        let promise: Promise<any> | undefined = undefined;\n        if (content.type === SentenceType.SELECT) {\n            if (select === undefined) {\n                inputtingForever = true;\n            } else {\n                let option = content.value[select];\n                if (option.content) {\n                    promise = setContent1(option.content as DeepReadonly<SentenceTextContent | SentenceMediaContent>);\n                } else {\n                    this.contentNode.children[0].active = true;\n                    this.contentNode.children[1].active = false;\n                    this.textContentLabel.string = option.summary;\n                }\n            }\n        } else {\n            promise = setContent1(content as DeepReadonly<SentenceTextContent | SentenceMediaContent>);\n        }\n        if (this.inputtingNode) {\n            if (shouldDelay || inputtingForever) {\n                this.inputtingNode.active = true;\n                this.contentNode.active = false;\n                this.inputtingNode.children[0].runAction(cc.repeatForever(cc.rotateBy(1, 360)));\n                if (inputtingForever) return;\n                if (promise) await promise;\n                await this.delay(BASE_DELAY + PER_CHAR_DELAY * textCount);\n                // return new Promise<void>((resolve) => {\n                //     this.scheduleOnce(() => {\n                this.inputtingNode.children[0].stopAllActions();\n                this.inputtingNode.active = false;\n                this.contentNode.active = true;\n                if (this._previewImage) this.bgNode.active = false;\n                this.resizeContent();\n                //     resolve();\n                // }, BASE_DELAY + PER_CHAR_DELAY * textCount);\n                // })\n            } else {\n                if (promise) await promise;\n                this.inputtingNode.children[0].stopAllActions();\n                this.inputtingNode.active = false;\n                this.contentNode.active = true;\n                if (this._previewImage) this.bgNode.active = false;\n                this.resizeContent();\n            }\n        }\n    }\n\n    clearInputting() {\n        if (this._timer) {\n            clearTimeout(this._timer);\n            this._timer = undefined;\n            if (this.inputtingNode) {\n                this.inputtingNode.children[0].stopAllActions();\n                this.inputtingNode.active = false;\n            }\n            this.contentNode.active = true;\n            this.resizeContent();\n        }\n    }\n}"]}