({ updateLog = true } = {})
| 440 | } |
| 441 | |
| 442 | override async apply({ updateLog = true } = {}): Promise<void> { |
| 443 | try { |
| 444 | const dialogLog = this.engine.component('dialog-log') as { instances?: () => { each: (cb: (instance: { write: (data: { id: string; character: string; dialog: string }) => void }) => void) => void } } | undefined; |
| 445 | if (typeof dialogLog !== 'undefined' && dialogLog.instances) { |
| 446 | if (this._cycle === 'Application' && updateLog === true) { |
| 447 | dialogLog.instances().each((instance) => instance.write({ |
| 448 | id: this.id, |
| 449 | character: this.character, |
| 450 | dialog: this.clearDialog |
| 451 | })); |
| 452 | } |
| 453 | } |
| 454 | } catch (e) { |
| 455 | this.engine.debug.error(e); |
| 456 | } |
| 457 | |
| 458 | const textBoxElement = this.engine.element().find('[data-component="text-box"]').get(0) as TextBoxComponent | undefined; |
| 459 | if (textBoxElement?.state?.hidden === true) { |
| 460 | FancyError.show('action:dialog:textbox_hidden', { |
| 461 | statement: `<code class='language=javascript'>"${this._statement}"</code>`, |
| 462 | label: this.engine.state('label'), |
| 463 | step: this.engine.state('step') |
| 464 | }); |
| 465 | } |
| 466 | |
| 467 | if (typeof this.character !== 'undefined') { |
| 468 | this._handleCustomClasses(textBoxElement); |
| 469 | (textBoxElement as any)?.show(); |
| 470 | return this.characterDialog(); |
| 471 | } else if (this.id === 'centered') { |
| 472 | return this.displayCenteredDialog(this.dialog, this.clearDialog, this.id, this.engine.setting('CenteredTypeAnimation')); |
| 473 | } else { |
| 474 | this._handleCustomClasses(textBoxElement); |
| 475 | (textBoxElement as any)?.show(); |
| 476 | return this.displayDialog(this.dialog, this.clearDialog, '_narrator', this.engine.setting('NarratorTypeAnimation')); |
| 477 | } |
| 478 | } |
| 479 | |
| 480 | override async didApply(): Promise<ActionApplyResult> { |
| 481 | this.engine.global('_dialog_pending_revert', true); |
no test coverage detected