| 1 |
<?php |
| 2 |
/** |
| 3 |
* OpenStation — Alphabet Soup registration. |
| 4 |
* |
| 5 |
* Alphabet Soup is the built-in daily word search: a seeded letter |
| 6 |
* grid with hidden words to drag out of the soup. The seed is the |
| 7 |
* current date (`dd-mm-yyyy`), so every player worldwide gets the |
| 8 |
* SAME puzzle each day — Daily mode plays three relaxed waves, |
| 9 |
* Time Attack races a countdown on a differently-seeded pot. The |
| 10 |
* game code lives in its own lazily-loaded bundle |
| 11 |
* (`assets/js/game-alphabet-soup[.min].js`, source |
| 12 |
* `src/games/alphabet-soup/`); this file only declares the |
| 13 |
* discovery metadata + score columns. The shared dictionary asset |
| 14 |
* arrives via the framework-injected `wordsUrl` config key. |
| 15 |
* |
| 16 |
* @package OpenStation |
| 17 |
*/ |
| 18 |
|
| 19 |
defined( 'ABSPATH' ) || exit; |
| 20 |
|
| 21 |
/** |
| 22 |
* The Alphabet Soup icon: a steaming bowl with letter tiles afloat. |
| 23 |
* |
| 24 |
* @return string Raw `<svg>` markup. |
| 25 |
*/ |
| 26 |
function openstation_alphabet_soup_icon_svg() { |
| 27 |
return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">' |
| 28 |
. '<path fill="#2b1d4d" d="M8 30h48a2 2 0 0 1 2 2c0 10-6 18-14 21l-1 3H21l-1-3C12 50 6 42 6 32a2 2 0 0 1 2-2z"/>' |
| 29 |
. '<ellipse cx="32" cy="30" rx="24" ry="5" fill="#4c3585"/>' |
| 30 |
. '<rect x="16" y="22" width="11" height="11" rx="2.5" fill="#ffd166" transform="rotate(-8 21.5 27.5)"/>' |
| 31 |
. '<rect x="30" y="24" width="10" height="10" rx="2.5" fill="#06d6a0" transform="rotate(6 35 29)"/>' |
| 32 |
. '<rect x="42" y="22" width="9" height="9" rx="2.5" fill="#ff6b6b" transform="rotate(-12 46.5 26.5)"/>' |
| 33 |
. '<path fill="#2b1d4d" d="M20 25.5l2.2-5h1.6l2.2 5h-1.7l-.3-.8h-2l-.3.8zm2.4-2h1.2l-.6-1.5z"/>' |
| 34 |
. '<path fill="#0b3d33" d="M33 26h2.4a1.8 1.8 0 0 1 0 3.6H33zm1.4 1.2v1.2h.9a.6.6 0 0 0 0-1.2z"/>' |
| 35 |
. '<path fill="#5c1a1a" d="M44.5 24.2h2.6v1.1h-1.9v.7h1.6v1h-1.6v1.2h-1.3z"/>' |
| 36 |
. '<path fill="none" stroke="#c77dff" stroke-width="2" stroke-linecap="round" d="M24 16c0-3 3-3 3-6M35 15c0-3 3-3 3-6"/>' |
| 37 |
. '</svg>'; |
| 38 |
} |
| 39 |
|
| 40 |
/** |
| 41 |
* Register Alphabet Soup with the games registry on `init`. |
| 42 |
* |
| 43 |
* Priority 20 — alongside the Games window registration. |
| 44 |
*/ |
| 45 |
function openstation_alphabet_soup_register() { |
| 46 |
if ( ! function_exists( 'openstation_games_user_can_use' ) || ! openstation_games_user_can_use() ) { |
| 47 |
return; |
| 48 |
} |
| 49 |
|
| 50 |
openstation_register_game( |
| 51 |
'alphabet-soup', |
| 52 |
array( |
| 53 |
'title' => __( 'Alphabet Soup', 'desktop-mode' ), |
| 54 |
'description' => __( 'The daily word search: a seeded letter soup that is the same for every player worldwide — the seed is today’s date. Pick a pot (8×8, 12×12, or 16×16 with more words), drag across the letters to fish them out, chain streaks, and clear waves; Time Attack stirs a different pot against the clock. Your first run of each puzzle earns the shareable score card.', 'desktop-mode' ), |
| 55 |
'icon_svg' => openstation_alphabet_soup_icon_svg(), |
| 56 |
'script' => 'os-game-alphabet-soup', |
| 57 |
'score_columns' => array( |
| 58 |
array( |
| 59 |
'key' => 'score', |
| 60 |
'label' => __( 'Score', 'desktop-mode' ), |
| 61 |
'type' => 'number', |
| 62 |
), |
| 63 |
array( |
| 64 |
'key' => 'mode', |
| 65 |
'label' => __( 'Mode', 'desktop-mode' ), |
| 66 |
'type' => 'text', |
| 67 |
), |
| 68 |
array( |
| 69 |
'key' => 'size', |
| 70 |
'label' => __( 'Size', 'desktop-mode' ), |
| 71 |
'type' => 'text', |
| 72 |
), |
| 73 |
array( |
| 74 |
'key' => 'words', |
| 75 |
'label' => __( 'Words', 'desktop-mode' ), |
| 76 |
'type' => 'number', |
| 77 |
), |
| 78 |
array( |
| 79 |
'key' => 'wpm', |
| 80 |
'label' => __( 'WPM', 'desktop-mode' ), |
| 81 |
'type' => 'number', |
| 82 |
), |
| 83 |
array( |
| 84 |
'key' => 'accuracy', |
| 85 |
'label' => __( 'Accuracy', 'desktop-mode' ), |
| 86 |
'type' => 'number', |
| 87 |
), |
| 88 |
array( |
| 89 |
'key' => 'streak', |
| 90 |
'label' => __( 'Streak', 'desktop-mode' ), |
| 91 |
'type' => 'number', |
| 92 |
), |
| 93 |
array( |
| 94 |
'key' => 'wave', |
| 95 |
'label' => __( 'Wave', 'desktop-mode' ), |
| 96 |
'type' => 'number', |
| 97 |
), |
| 98 |
array( |
| 99 |
'key' => 'time', |
| 100 |
'label' => __( 'Time', 'desktop-mode' ), |
| 101 |
'type' => 'time', |
| 102 |
), |
| 103 |
), |
| 104 |
// The dictionary URL arrives via the framework-injected |
| 105 |
// `wordsUrl` config key (see includes/games/config.php). |
| 106 |
) |
| 107 |
); |
| 108 |
} |
| 109 |
add_action( 'init', 'openstation_alphabet_soup_register', 20 ); |
| 110 |
|
| 111 |
/** |
| 112 |
* Enqueue the Alphabet Soup window styles. The game's script is |
| 113 |
* lazily loaded by the framework on first launch, but its CSS is |
| 114 |
* tiny and must already be present when the window opens. |
| 115 |
*/ |
| 116 |
function openstation_alphabet_soup_enqueue_styles() { |
| 117 |
if ( ! function_exists( 'openstation_games_user_can_use' ) || ! openstation_games_user_can_use() ) { |
| 118 |
return; |
| 119 |
} |
| 120 |
wp_enqueue_style( 'os-game-alphabet-soup' ); |
| 121 |
} |
| 122 |
add_action( 'admin_enqueue_scripts', 'openstation_alphabet_soup_enqueue_styles', 30 ); |
| 123 |
|