355 lines
12 KiB
JavaScript
355 lines
12 KiB
JavaScript
(function() {
|
|
'use strict';
|
|
|
|
// =========================================================================
|
|
// GAME STYLES (from GamerComp)
|
|
// =========================================================================
|
|
|
|
var GAME_STYLES = [
|
|
{
|
|
id: 'action-arcade',
|
|
name: 'Action/Arcade',
|
|
description: 'Space shooters, platformers, fast-paced action',
|
|
icon: '🎮',
|
|
keywords: ['space', 'shooter', 'platformer', 'action', 'arcade', 'fast'],
|
|
recommendedMoods: ['Epic', 'Intense', 'Heroic'],
|
|
recommendedThemes: ['space', 'retro', 'urban'],
|
|
recommendedContexts: ['spaceship-cockpit', 'platformer-standard', 'jetpack']
|
|
},
|
|
{
|
|
id: 'puzzle',
|
|
name: 'Puzzle',
|
|
description: 'Match-3, sliding puzzles, brain teasers',
|
|
icon: '🧩',
|
|
keywords: ['puzzle', 'match', 'brain', 'logic', 'thinking'],
|
|
recommendedMoods: ['Chill', 'Ambient', 'Playful'],
|
|
recommendedThemes: ['abstract', 'colorful', 'indoor'],
|
|
recommendedContexts: ['platformer-standard', 'scientist-labcoat']
|
|
},
|
|
{
|
|
id: 'story-adventure',
|
|
name: 'Story Adventure',
|
|
description: 'Visual novels, choose-your-adventure',
|
|
icon: '📖',
|
|
keywords: ['story', 'adventure', 'narrative', 'choice', 'visual'],
|
|
recommendedMoods: ['Mysterious', 'Ambient', 'Epic'],
|
|
recommendedThemes: ['fantasy', 'nature', 'urban'],
|
|
recommendedContexts: ['adventure-hero', 'wizard-robes', 'knight-armor']
|
|
},
|
|
{
|
|
id: 'racing',
|
|
name: 'Racing',
|
|
description: 'Car racing, running games, speed challenges',
|
|
icon: '🏎️',
|
|
keywords: ['race', 'racing', 'car', 'speed', 'run', 'fast'],
|
|
recommendedMoods: ['Intense', 'Epic', 'Heroic'],
|
|
recommendedThemes: ['urban', 'nature', 'sky'],
|
|
recommendedContexts: ['race-car', 'motorcycle', 'hoverboard', 'runner']
|
|
},
|
|
{
|
|
id: 'pet-simulator',
|
|
name: 'Pet/Simulator',
|
|
description: 'Virtual pets, farm games, life simulation',
|
|
icon: '🐕',
|
|
keywords: ['pet', 'animal', 'farm', 'care', 'virtual', 'simulation'],
|
|
recommendedMoods: ['Playful', 'Chill', 'Ambient'],
|
|
recommendedThemes: ['nature', 'indoor', 'colorful'],
|
|
recommendedContexts: ['platformer-standard', 'chef-outfit']
|
|
},
|
|
{
|
|
id: 'trivia-quiz',
|
|
name: 'Trivia/Quiz',
|
|
description: 'Quiz shows, fact games, knowledge tests',
|
|
icon: '❓',
|
|
keywords: ['trivia', 'quiz', 'question', 'knowledge', 'fact'],
|
|
recommendedMoods: ['Playful', 'Quirky', 'Ambient'],
|
|
recommendedThemes: ['abstract', 'indoor', 'colorful'],
|
|
recommendedContexts: ['scientist-labcoat', 'platformer-standard']
|
|
},
|
|
{
|
|
id: 'music-rhythm',
|
|
name: 'Music/Rhythm',
|
|
description: 'Rhythm games, dance games, music creation',
|
|
icon: '🎵',
|
|
keywords: ['music', 'rhythm', 'dance', 'beat', 'song'],
|
|
recommendedMoods: ['Playful', 'Intense', 'Epic'],
|
|
recommendedThemes: ['colorful', 'retro', 'abstract'],
|
|
recommendedContexts: ['athlete-uniform', 'superhero-cape']
|
|
},
|
|
{
|
|
id: 'creative-drawing',
|
|
name: 'Creative/Drawing',
|
|
description: 'Drawing games, design tools, art creation',
|
|
icon: '🎨',
|
|
keywords: ['draw', 'create', 'art', 'design', 'color', 'paint'],
|
|
recommendedMoods: ['Chill', 'Playful', 'Ambient'],
|
|
recommendedThemes: ['colorful', 'abstract', 'nature'],
|
|
recommendedContexts: ['platformer-standard', 'chef-outfit']
|
|
},
|
|
{
|
|
id: 'rpg-battle',
|
|
name: 'RPG/Battle',
|
|
description: 'Turn-based battles, dungeon crawlers, adventures',
|
|
icon: '⚔️',
|
|
keywords: ['rpg', 'battle', 'dungeon', 'quest', 'hero', 'monster'],
|
|
recommendedMoods: ['Epic', 'Heroic', 'Mysterious'],
|
|
recommendedThemes: ['fantasy', 'spooky', 'nature'],
|
|
recommendedContexts: ['knight-armor', 'wizard-robes', 'ninja-outfit', 'dragon-rider']
|
|
},
|
|
{
|
|
id: 'sports',
|
|
name: 'Sports',
|
|
description: 'Ball games, olympic events, athletic challenges',
|
|
icon: '⚽',
|
|
keywords: ['sports', 'ball', 'soccer', 'basketball', 'athletic'],
|
|
recommendedMoods: ['Intense', 'Epic', 'Heroic'],
|
|
recommendedThemes: ['sports', 'nature', 'urban'],
|
|
recommendedContexts: ['athlete-uniform', 'sports-player']
|
|
},
|
|
{
|
|
id: 'physics-pinball',
|
|
name: 'Physics/Pinball',
|
|
description: 'Pinball, angry birds style, physics puzzles',
|
|
icon: '🎱',
|
|
keywords: ['physics', 'pinball', 'bounce', 'launch', 'gravity'],
|
|
recommendedMoods: ['Playful', 'Quirky', 'Intense'],
|
|
recommendedThemes: ['mechanical', 'colorful', 'retro'],
|
|
recommendedContexts: ['platformer-standard', 'mech-suit']
|
|
}
|
|
];
|
|
|
|
// =========================================================================
|
|
// MOOD TO THEME MAPPINGS
|
|
// =========================================================================
|
|
|
|
var MOOD_THEME_AFFINITIES = {
|
|
Epic: ['space', 'fantasy', 'sports', 'sky'],
|
|
Chill: ['nature', 'underwater', 'indoor', 'seasonal'],
|
|
Intense: ['urban', 'mechanical', 'sports', 'weather'],
|
|
Playful: ['colorful', 'retro', 'nature', 'indoor'],
|
|
Mysterious: ['spooky', 'fantasy', 'underwater', 'weather'],
|
|
Heroic: ['space', 'fantasy', 'urban', 'sky'],
|
|
Quirky: ['retro', 'colorful', 'abstract', 'indoor'],
|
|
Ambient: ['nature', 'underwater', 'sky', 'seasonal']
|
|
};
|
|
|
|
// =========================================================================
|
|
// THEME TO CONTEXT MAPPINGS
|
|
// =========================================================================
|
|
|
|
var THEME_CONTEXT_AFFINITIES = {
|
|
space: ['spaceship-cockpit', 'space-suit', 'mech-suit', 'jetpack'],
|
|
nature: ['platformer-standard', 'adventure-hero', 'cowboy-gear'],
|
|
urban: ['race-car', 'motorcycle', 'runner', 'superhero-cape'],
|
|
fantasy: ['knight-armor', 'wizard-robes', 'dragon-rider'],
|
|
spooky: ['ninja-outfit', 'wizard-robes', 'platformer-standard'],
|
|
underwater: ['submarine', 'space-suit', 'adventure-hero'],
|
|
retro: ['pacman-style', 'platformer-standard', 'athlete-uniform'],
|
|
sports: ['athlete-uniform', 'sports-player', 'runner'],
|
|
sky: ['airplane', 'flappy-style', 'jetpack', 'dragon-rider'],
|
|
colorful: ['superhero-cape', 'athlete-uniform', 'platformer-standard'],
|
|
mechanical: ['mech-suit', 'tank', 'scientist-labcoat'],
|
|
indoor: ['chef-outfit', 'scientist-labcoat', 'platformer-standard'],
|
|
weather: ['adventure-hero', 'cowboy-gear', 'pirate-outfit'],
|
|
seasonal: ['platformer-standard', 'athlete-uniform', 'chef-outfit'],
|
|
abstract: ['platformer-standard', 'scientist-labcoat']
|
|
};
|
|
|
|
// =========================================================================
|
|
// COLOR PALETTES
|
|
// =========================================================================
|
|
|
|
var COLOR_PALETTES = {
|
|
'space-blue': ['#0a0a2e', '#1a1a4e', '#2a2a6e', '#4a4a9e', '#6a6abe'],
|
|
'forest-green': ['#1a3a1a', '#2a4a2a', '#3a5a3a', '#4a7a4a', '#5a9a5a'],
|
|
'sunset-orange': ['#2a1a0a', '#4a2a1a', '#6a3a2a', '#9a5a3a', '#ca7a4a'],
|
|
'ocean-teal': ['#0a2a2a', '#1a3a4a', '#2a4a5a', '#3a6a7a', '#4a8a9a'],
|
|
'neon-pink': ['#2a0a2a', '#4a1a4a', '#6a2a6a', '#9a3a9a', '#ca4aca'],
|
|
'retro-arcade': ['#0a0a0a', '#1a1a3a', '#3a3a6a', '#6a6a9a', '#9a9aca'],
|
|
'fantasy-purple': ['#1a0a2a', '#2a1a4a', '#4a2a6a', '#6a3a9a', '#8a4aca'],
|
|
'spooky-grey': ['#0a0a0a', '#1a1a1a', '#2a2a2a', '#3a3a3a', '#4a4a4a'],
|
|
'sports-red': ['#2a0a0a', '#4a1a1a', '#6a2a2a', '#9a3a3a', '#ca4a4a'],
|
|
'nature-brown': ['#2a1a0a', '#3a2a1a', '#4a3a2a', '#5a4a3a', '#6a5a4a'],
|
|
'candy-rainbow': ['#ff6b6b', '#ffd93d', '#6bcf7f', '#4ecdc4', '#a06cd5']
|
|
};
|
|
|
|
// =========================================================================
|
|
// CATALOG QUERIES
|
|
// =========================================================================
|
|
|
|
function getGameStyles() {
|
|
return GAME_STYLES.slice();
|
|
}
|
|
|
|
function getGameStyleById(id) {
|
|
return GAME_STYLES.find(function(s) { return s.id === id; }) || null;
|
|
}
|
|
|
|
function getGameStyleByKeyword(keyword) {
|
|
keyword = keyword.toLowerCase();
|
|
return GAME_STYLES.filter(function(s) {
|
|
return s.keywords.some(function(k) {
|
|
return k.includes(keyword) || keyword.includes(k);
|
|
});
|
|
});
|
|
}
|
|
|
|
function getMoodsForTheme(theme) {
|
|
var moods = [];
|
|
for (var mood in MOOD_THEME_AFFINITIES) {
|
|
if (MOOD_THEME_AFFINITIES[mood].includes(theme)) {
|
|
moods.push(mood);
|
|
}
|
|
}
|
|
return moods;
|
|
}
|
|
|
|
function getThemesForMood(mood) {
|
|
return MOOD_THEME_AFFINITIES[mood] || [];
|
|
}
|
|
|
|
function getContextsForTheme(theme) {
|
|
return THEME_CONTEXT_AFFINITIES[theme] || [];
|
|
}
|
|
|
|
function getColorPalette(id) {
|
|
return COLOR_PALETTES[id] || COLOR_PALETTES['space-blue'];
|
|
}
|
|
|
|
function getAllColorPalettes() {
|
|
return Object.keys(COLOR_PALETTES).map(function(id) {
|
|
return { id: id, colors: COLOR_PALETTES[id] };
|
|
});
|
|
}
|
|
|
|
function suggestPalette(theme, mood) {
|
|
// Theme-based suggestions
|
|
var themeMap = {
|
|
space: 'space-blue',
|
|
nature: 'forest-green',
|
|
urban: 'neon-pink',
|
|
fantasy: 'fantasy-purple',
|
|
spooky: 'spooky-grey',
|
|
underwater: 'ocean-teal',
|
|
retro: 'retro-arcade',
|
|
sports: 'sports-red',
|
|
sky: 'space-blue',
|
|
colorful: 'candy-rainbow',
|
|
mechanical: 'retro-arcade',
|
|
indoor: 'nature-brown',
|
|
weather: 'sunset-orange',
|
|
seasonal: 'forest-green'
|
|
};
|
|
|
|
return themeMap[theme] || 'space-blue';
|
|
}
|
|
|
|
// =========================================================================
|
|
// UNIFIED SEARCH
|
|
// =========================================================================
|
|
|
|
function search(query) {
|
|
query = query.toLowerCase();
|
|
var results = {
|
|
gameStyles: [],
|
|
moods: [],
|
|
themes: [],
|
|
contexts: [],
|
|
palettes: []
|
|
};
|
|
|
|
// Search game styles
|
|
GAME_STYLES.forEach(function(style) {
|
|
if (style.name.toLowerCase().includes(query) ||
|
|
style.description.toLowerCase().includes(query)) {
|
|
results.gameStyles.push(style);
|
|
}
|
|
});
|
|
|
|
// Search moods
|
|
Object.keys(MOOD_THEME_AFFINITIES).forEach(function(mood) {
|
|
if (mood.toLowerCase().includes(query)) {
|
|
results.moods.push(mood);
|
|
}
|
|
});
|
|
|
|
// Search themes
|
|
Object.keys(THEME_CONTEXT_AFFINITIES).forEach(function(theme) {
|
|
if (theme.includes(query)) {
|
|
results.themes.push(theme);
|
|
}
|
|
});
|
|
|
|
// Search palettes
|
|
Object.keys(COLOR_PALETTES).forEach(function(palette) {
|
|
if (palette.includes(query)) {
|
|
results.palettes.push(palette);
|
|
}
|
|
});
|
|
|
|
return results;
|
|
}
|
|
|
|
// =========================================================================
|
|
// STATISTICS
|
|
// =========================================================================
|
|
|
|
function getStats() {
|
|
var musicCount = 0, bgCount = 0, contextCount = 0;
|
|
|
|
if (window.MusicEngine) {
|
|
musicCount = MusicEngine.getCatalog ? MusicEngine.getCatalog().length : 160;
|
|
}
|
|
if (window.BackgroundEngine) {
|
|
bgCount = BackgroundEngine.getTotalCount ? BackgroundEngine.getTotalCount() : 120;
|
|
}
|
|
if (window.ContextCatalog) {
|
|
contextCount = ContextCatalog.getAll ? ContextCatalog.getAll().length : 26;
|
|
}
|
|
|
|
return {
|
|
gameStyles: GAME_STYLES.length,
|
|
musicSongs: musicCount,
|
|
backgrounds: bgCount,
|
|
avatarContexts: contextCount,
|
|
colorPalettes: Object.keys(COLOR_PALETTES).length,
|
|
moods: Object.keys(MOOD_THEME_AFFINITIES).length,
|
|
themes: Object.keys(THEME_CONTEXT_AFFINITIES).length
|
|
};
|
|
}
|
|
|
|
// =========================================================================
|
|
// PUBLIC API
|
|
// =========================================================================
|
|
|
|
window.AssetCatalog = {
|
|
// Game styles
|
|
GAME_STYLES: GAME_STYLES,
|
|
getGameStyles: getGameStyles,
|
|
getGameStyleById: getGameStyleById,
|
|
getGameStyleByKeyword: getGameStyleByKeyword,
|
|
|
|
// Mood/Theme mappings
|
|
getMoodsForTheme: getMoodsForTheme,
|
|
getThemesForMood: getThemesForMood,
|
|
getContextsForTheme: getContextsForTheme,
|
|
|
|
// Color palettes
|
|
getColorPalette: getColorPalette,
|
|
getAllColorPalettes: getAllColorPalettes,
|
|
suggestPalette: suggestPalette,
|
|
|
|
// Search
|
|
search: search,
|
|
|
|
// Stats
|
|
getStats: getStats,
|
|
|
|
// Direct data access
|
|
MOOD_THEME_AFFINITIES: MOOD_THEME_AFFINITIES,
|
|
THEME_CONTEXT_AFFINITIES: THEME_CONTEXT_AFFINITIES,
|
|
COLOR_PALETTES: COLOR_PALETTES
|
|
};
|
|
|
|
})();
|