Rudimentary moments working, instant chat debug tool

The moments are now triggered correctly and have the phases happen as
expected.
Also added an instant chat tool that skips the playing out of all the
messages and instead lets us quickly move through a game
This commit is contained in:
Tyler Marques 2025-05-29 15:46:36 -07:00
parent 8a3b6273cc
commit e1309c4012
No known key found for this signature in database
GPG key ID: CB99EDCF41D3016F
5 changed files with 130 additions and 7 deletions

View file

@ -5,6 +5,7 @@
import { updateNextMomentDisplay, initNextMomentTool } from "./nextMoment";
import { initDebugProvinceHighlighting } from "./provinceHighlight";
import { initInstantChatTool } from "./instantChat";
export class DebugMenu {
private toggleBtn: HTMLButtonElement;
@ -171,6 +172,7 @@ export class DebugMenu {
}
private initTools(): void {
initInstantChatTool(this);
initNextMomentTool(this);
initDebugProvinceHighlighting()
}

View file

@ -0,0 +1,54 @@
/**
* Debug tool for making all chat messages appear instantly
* Provides a toggle to skip word-by-word animation during message playback
*/
import { config } from '../config';
import { DebugMenu } from './debugMenu';
// Flag to control instant chat behavior
let instantChatEnabled = false;
/**
* Gets whether instant chat is currently enabled
*/
export function isInstantChatEnabled(): boolean {
return instantChatEnabled;
}
/**
* Initializes the instant chat debug tool
* @param debugMenu - The debug menu instance to add this tool to
*/
export function initInstantChatTool(debugMenu: DebugMenu): void {
const content = `
<div style="margin-bottom: 10px;">
<label style="display: flex; align-items: center; gap: 8px; cursor: pointer;">
<input type="checkbox" id="instant-chat-toggle" style="margin: 0;">
<span>Instant Chat Display</span>
</label>
<div style="font-size: 12px; color: #666; margin-top: 4px;">
Skip word-by-word animation and show all chat messages instantly
</div>
</div>
`;
debugMenu.addDebugTool('Chat Controls', content);
// Set up event listener for the toggle
const toggleElement = document.getElementById('instant-chat-toggle') as HTMLInputElement;
if (toggleElement) {
// Set initial state
toggleElement.checked = instantChatEnabled;
// Handle toggle changes
toggleElement.addEventListener('change', (e) => {
const target = e.target as HTMLInputElement;
instantChatEnabled = target.checked;
if (config.isDebugMode) {
console.log(`Instant chat ${instantChatEnabled ? 'enabled' : 'disabled'}`);
}
});
}
}