| @@ -53,8 +53,19 @@ | ||
| 53 | 53 | 'title' => __( 'Alphabet Soup', 'desktop-mode' ), |
| 54 | 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 | 55 | 'icon_svg' => openstation_alphabet_soup_icon_svg(), |
| 56 | 56 | 'script' => 'os-game-alphabet-soup', |
| 57 | + // Mirrors the `window` block in | |
| 58 | + // `src/games/alphabet-soup/index.ts`. Declared here as well | |
| 59 | + // so the window opens at the right size on the very first | |
| 60 | + // play, before the bundle that carries the def has been | |
| 61 | + // fetched. Keep the two in step. | |
| 62 | + 'window' => array( | |
| 63 | + 'width' => 860, | |
| 64 | + 'height' => 660, | |
| 65 | + 'minWidth' => 600, | |
| 66 | + 'minHeight' => 500, | |
| 67 | + ), | |
| 57 | 68 | 'score_columns' => array( |
| 58 | 69 | array( |
| 59 | 70 | 'key' => 'score', |
| 60 | 71 | 'label' => __( 'Score', 'desktop-mode' ), |
| @@ -108,15 +119,20 @@ | ||
| 108 | 119 | } |
| 109 | 120 | add_action( 'init', 'openstation_alphabet_soup_register', 20 ); |
| 110 | 121 | |
| 111 | 122 | /** |
| 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. | |
| 123 | + * Ride the Alphabet Soup window styles on the Games window as a | |
| 124 | + * companion — same shape as Inkfall; see | |
| 125 | + * `openstation_inkfall_window_styles()` for the reasoning. | |
| 126 | + * | |
| 127 | + * @param array $window_args Args passed to `openstation_register_window()`. | |
| 128 | + * @return array | |
| 115 | 129 | */ |
| 116 | -function openstation_alphabet_soup_enqueue_styles() { | |
| 117 | - if ( ! function_exists( 'openstation_games_user_can_use' ) || ! openstation_games_user_can_use() ) { | |
| 118 | - return; | |
| 130 | +function openstation_alphabet_soup_window_styles( $window_args ) { | |
| 131 | + if ( ! is_array( $window_args ) ) { | |
| 132 | + return $window_args; | |
| 119 | 133 | } |
| 120 | - wp_enqueue_style( 'os-game-alphabet-soup' ); | |
| 134 | + $window_args['styles'] = isset( $window_args['styles'] ) ? (array) $window_args['styles'] : array(); | |
| 135 | + $window_args['styles'][] = 'os-game-alphabet-soup'; | |
| 136 | + return $window_args; | |
| 121 | 137 | } |
| 122 | -add_action( 'admin_enqueue_scripts', 'openstation_alphabet_soup_enqueue_styles', 30 ); | |
| 138 | +add_filter( 'openstation_games_window_args', 'openstation_alphabet_soup_window_styles' ); | |