PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.5
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.5
1.1.10 1.1.9 1.1.8 1.1.7 1.1.6 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.1 1.0.0 0.9.8 0.9.7 0.9.6 0.9.4 0.9.5 0.9.3 0.9.2 0.9.1 0.9.0 0.8.9 0.8.8 0.8.7 All 34 releases
desktop-mode / includes / games / alphabet-soup.php

alphabet-soup.php in OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin 1.1.5, at includes/games/alphabet-soup.php

139 lines 5.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 // 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 ),
68 'score_columns' => array(
69 array(
70 'key' => 'score',
71 'label' => __( 'Score', 'desktop-mode' ),
72 'type' => 'number',
73 ),
74 array(
75 'key' => 'mode',
76 'label' => __( 'Mode', 'desktop-mode' ),
77 'type' => 'text',
78 ),
79 array(
80 'key' => 'size',
81 'label' => __( 'Size', 'desktop-mode' ),
82 'type' => 'text',
83 ),
84 array(
85 'key' => 'words',
86 'label' => __( 'Words', 'desktop-mode' ),
87 'type' => 'number',
88 ),
89 array(
90 'key' => 'wpm',
91 'label' => __( 'WPM', 'desktop-mode' ),
92 'type' => 'number',
93 ),
94 array(
95 'key' => 'accuracy',
96 'label' => __( 'Accuracy', 'desktop-mode' ),
97 'type' => 'number',
98 ),
99 array(
100 'key' => 'streak',
101 'label' => __( 'Streak', 'desktop-mode' ),
102 'type' => 'number',
103 ),
104 array(
105 'key' => 'wave',
106 'label' => __( 'Wave', 'desktop-mode' ),
107 'type' => 'number',
108 ),
109 array(
110 'key' => 'time',
111 'label' => __( 'Time', 'desktop-mode' ),
112 'type' => 'time',
113 ),
114 ),
115 // The dictionary URL arrives via the framework-injected
116 // `wordsUrl` config key (see includes/games/config.php).
117 )
118 );
119 }
120 add_action( 'init', 'openstation_alphabet_soup_register', 20 );
121
122 /**
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
129 */
130 function openstation_alphabet_soup_window_styles( $window_args ) {
131 if ( ! is_array( $window_args ) ) {
132 return $window_args;
133 }
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;
137 }
138 add_filter( 'openstation_games_window_args', 'openstation_alphabet_soup_window_styles' );
139