MCPcopy Create free account
hub / github.com/Monogatari/Monogatari / reset

Method reset

src/actions/Dialog.ts:128–163  ·  view source on GitHub ↗
({ keepNVL = false, saveNVL = false }: { keepNVL?: boolean; saveNVL?: boolean } = {})

Source from the content-addressed store, hash-verified

126 }
127
128 static override async reset({ keepNVL = false, saveNVL = false }: { keepNVL?: boolean; saveNVL?: boolean } = {}): Promise<void> {
129 const textBox = this.engine.element().find('[data-component="text-box"]').get(0) as any;
130
131 if (!textBox) {
132 return;
133 }
134
135 if (saveNVL === true && textBox.props.mode === 'nvl') {
136 this.engine.history('nvl').push(textBox.content('dialog').html());
137 }
138
139 if (keepNVL !== true) {
140 textBox.setProps({ mode: 'adv' });
141 }
142
143
144 this.engine.element().find('[data-component="text-box"]').data('speaking', '');
145
146 this.engine.element().find('[data-ui="who"]').style('color', '');
147
148 this.engine.element().find('[data-ui="who"]').html('');
149 this.engine.element().find('[data-ui="say"]').html('');
150
151 this.engine.element().find('[data-ui="face"]').attribute('src', '');
152 this.engine.element().find('[data-ui="face"]').hide();
153
154 // Remove all classes from the text-box
155 Array.from(textBox.classList).forEach((c: any) => textBox.classList.remove(c));
156
157 // Remove all classes from the centered-dialog
158 const centeredDialog = this.engine.element().find('[data-component="centered-dialog"]').get(0);
159
160 if (centeredDialog) {
161 Array.from(centeredDialog.classList).forEach((c: any) => centeredDialog.classList.remove(c));
162 }
163 }
164
165 static override matchString(): boolean {
166 return true;

Callers 1

displayNvlDialogMethod · 0.45

Calls 5

historyMethod · 0.80
getMethod · 0.65
removeMethod · 0.65
elementMethod · 0.45
contentMethod · 0.45

Tested by

no test coverage detected