Power names are now shown as the model name

This commit is contained in:
Tyler Marques 2025-05-29 14:05:14 -07:00
parent b90df44aee
commit d20eaa5217
No known key found for this signature in database
GPG key ID: CB99EDCF41D3016F
9 changed files with 167 additions and 40 deletions

View file

@ -2,6 +2,8 @@ import * as THREE from "three";
import { gameState } from "../gameState";
import { config } from "../config";
import { advanceToNextPhase } from "../phase";
import { getPowerDisplayName, getAllPowerDisplayNames } from '../utils/powerNames';
import { PowerENUM } from '../types/map';
let faceIconCache = {}; // Cache for generated face icons
@ -19,17 +21,17 @@ export function createChatWindows() {
chatWindows = {};
// Create a chat window for each power (except the current power)
const powers = ['AUSTRIA', 'ENGLAND', 'FRANCE', 'GERMANY', 'ITALY', 'RUSSIA', 'TURKEY'];
const powers = [PowerENUM.AUSTRIA, PowerENUM.ENGLAND, PowerENUM.FRANCE, PowerENUM.GERMANY, PowerENUM.ITALY, PowerENUM.RUSSIA, PowerENUM.TURKEY];
// Filter out the current power for chat windows
const otherPowers = powers.filter(power => power !== gameState.currentPower);
// Add a GLOBAL chat window first
createChatWindow('GLOBAL', true);
createChatWindow(PowerENUM.GLOBAL, true);
// Create chat windows for each power except the current one
otherPowers.forEach(power => {
createChatWindow(power);
createChatWindow(getPowerDisplayName(power));
});
}
// Modified to use 3D face icons properly
@ -56,10 +58,10 @@ function createChatWindow(power, isGlobal = false) {
const titleElement = document.createElement('span');
if (isGlobal) {
titleElement.style.color = '#ffffff';
titleElement.textContent = 'GLOBAL';
titleElement.textContent = getPowerDisplayName(PowerENUM.GLOBAL);
} else {
titleElement.className = `power-${power.toLowerCase()}`;
titleElement.textContent = power;
titleElement.textContent = getPowerDisplayName(power as PowerENUM);
}
titleElement.style.fontWeight = 'bold'; // Make text more prominent
titleElement.style.textShadow = '1px 1px 2px rgba(0,0,0,0.7)'; // Add text shadow for better readability
@ -325,7 +327,7 @@ function addMessageToChat(msg, phaseName, animateWords = false, onComplete = nul
const headerSpan = document.createElement('span');
headerSpan.style.fontWeight = 'bold';
headerSpan.className = `power-${senderColor}`;
headerSpan.textContent = `${msg.sender}: `;
headerSpan.textContent = `${getPowerDisplayName(msg.sender as PowerENUM)}: `;
messageElement.appendChild(headerSpan);
// Create a span for the message content that will be filled word by word
@ -550,17 +552,18 @@ async function generateFaceIcon(power) {
offCamera.position.set(0, 0, 50);
// Power-specific colors with higher contrast/saturation
const colorMap = {
'GLOBAL': 0xf5f5f5, // Brighter white
'AUSTRIA': 0xff0000, // Brighter red
'ENGLAND': 0x0000ff, // Brighter blue
'FRANCE': 0x00bfff, // Brighter cyan
'GERMANY': 0x1a1a1a, // Darker gray for better contrast
'ITALY': 0x00cc00, // Brighter green
'RUSSIA': 0xe0e0e0, // Brighter gray
'TURKEY': 0xffcc00 // Brighter yellow
const colorMap: Record<PowerENUM, number> = {
[PowerENUM.GLOBAL]: 0xf5f5f5, // Brighter white
[PowerENUM.AUSTRIA]: 0xff0000, // Brighter red
[PowerENUM.ENGLAND]: 0x0000ff, // Brighter blue
[PowerENUM.FRANCE]: 0x00bfff, // Brighter cyan
[PowerENUM.GERMANY]: 0x1a1a1a, // Darker gray for better contrast
[PowerENUM.ITALY]: 0x00cc00, // Brighter green
[PowerENUM.RUSSIA]: 0xe0e0e0, // Brighter gray
[PowerENUM.TURKEY]: 0xffcc00, // Brighter yellow
[PowerENUM.EUROPE]: 0xf5f5f5, // Same as global
};
const headColor = colorMap[power] || 0x808080;
const headColor = colorMap[power as PowerENUM] || 0x808080;
// Larger head geometry
const headGeom = new THREE.BoxGeometry(20, 20, 20); // Increased from 16x16x16