// Debug alert for mobile debugging
if (typeof debugAlert === 'function') {
debugAlert('overlay.js loaded');
}
/**
* Open overlay with specified content type - delegates to appropriate modules
* @param {string} type - Type of overlay content ('tiles', 'map', 'game')
*/
function openOverlay(type) {
const overlay = document.getElementById('overlay');
const overlayContent = document.getElementById('overlayContent');
overlayContent.innerHTML = '';
overlay.style.display = 'block';
if (type === 'tiles') {
// Delegate to tile picker module
if (typeof openTilePickerOverlay === 'function') {
openTilePickerOverlay();
} else {
overlayContent.innerHTML = '<p>Tile picker module not loaded</p>';
}
} else if (type === 'map') {
// Delegate to tilemap module
if (typeof openTilemapOverlay === 'function') {
openTilemapOverlay();
} else {
overlayContent.innerHTML = '<p>Tilemap module not loaded</p>';
}
} else if (type === 'game') {
// Delegate to game controller module
if (typeof openGameController === 'function') {
openGameController();
} else {
overlayContent.innerHTML = `
<div style="padding: 20px; text-align: center;">
<h2>Game Controller</h2>
<p>Game controller module not loaded</p>
<p>Check that object.js is loaded properly</p>
<p>Available functions: ${Object.getOwnPropertyNames(window).filter(name => name.includes('Game') || name.includes('game')).join(', ')}</p>
</div>
`;
}
}
}
// Initialize overlay close button
document.getElementById('overlayClose').onclick = () => {
document.getElementById('overlay').style.display = 'none';
};