()
| 400 | |
| 401 | |
| 402 | characterDialog(): Promise<void> { |
| 403 | // Check if the character has a name to show |
| 404 | if (typeof this.character.name !== 'undefined' && !this.nvl) { |
| 405 | this.engine.element().find('[data-ui="who"]').html(this.engine.replaceVariables(this.character.name)); |
| 406 | } |
| 407 | |
| 408 | let directory = this.character.directory; |
| 409 | |
| 410 | if (typeof directory == 'undefined') { |
| 411 | directory = ''; |
| 412 | } else { |
| 413 | directory += '/'; |
| 414 | } |
| 415 | |
| 416 | // Focus the character's sprite and colorize it's name with the defined |
| 417 | // color on its declaration |
| 418 | this.engine.element().find(`[data-character="${this.id}"]`).addClass('focus'); |
| 419 | |
| 420 | if (typeof this.character.color === 'string' && this.character.color !== '') { |
| 421 | this.engine.element().find('[data-ui="who"]').style('color', this.character.color); |
| 422 | } else { |
| 423 | this.engine.element().find('[data-ui="who"]').style('color', 'var(--character-name-color)'); |
| 424 | } |
| 425 | // Check if an expression or face image was used and if it exists and |
| 426 | // display it |
| 427 | if (typeof this.image !== 'undefined' && !this.nvl) { |
| 428 | const path = `${this.engine.setting('AssetsPath').root}/${this.engine.setting('AssetsPath').characters}/${directory}${this.image}`; |
| 429 | this.engine.element().find('[data-ui="face"]').attribute('src', path); |
| 430 | this.engine.element().find('[data-ui="face"]').show(); |
| 431 | this.engine.element().find('[data-component="text-box"]').data('expression', this.expression as string); |
| 432 | } |
| 433 | |
| 434 | // Check if the character object defines if the type animation should be used. |
| 435 | if (typeof this.character.type_animation !== 'undefined') { |
| 436 | return this.displayDialog(this.dialog, this.clearDialog, this.id, this.character.type_animation); |
| 437 | } else { |
| 438 | return this.displayDialog(this.dialog, this.clearDialog, this.id, true); |
| 439 | } |
| 440 | } |
| 441 | |
| 442 | override async apply({ updateLog = true } = {}): Promise<void> { |
| 443 | try { |
no test coverage detected