Skip to content

Commit

Permalink
text format order fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jjppof committed Jan 21, 2024
1 parent ac6cb4d commit c59513f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions base/utils/DialogManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,16 +374,16 @@ export class DialogManager {
* @returns Returns the text formetted.
*/
private format_text(text: string) {
text = text.replace(/\${HERO}/g, this.data.info.main_char_list[this.data.hero.key_name].name);
text = text.replace(/( )?\${BREAK}( )?/g, " ${BREAK} ");
text = text.replace(/( )?\${BREAK_LINE}( )?/g, " ${BREAK_LINE} ");
let storage_match = /(?: )?\${STORAGE:(\w+)}(?: )?/g.exec(text);
while (storage_match !== null) {
const storage_key = storage_match[1];
const re = new RegExp(`( )?\\\${STORAGE:${_.escapeRegExp(storage_key)}}( )?`, "g");
text = text.replace(re, `$1${this.data.storage.get(storage_key)}$2`);
storage_match = /(?: )?\${STORAGE:(\w+)}(?: )?/g.exec(text);
}
text = text.replace(/\${HERO}/g, this.data.info.main_char_list[this.data.hero.key_name].name);
text = text.replace(/( )?\${BREAK}( )?/g, " ${BREAK} ");
text = text.replace(/( )?\${BREAK_LINE}( )?/g, " ${BREAK_LINE} ");
return text;
}

Expand Down

0 comments on commit c59513f

Please sign in to comment.