Zixuan19 commited on
Commit
6defe5a
·
verified ·
1 Parent(s): 62cb7ad

step 1 is information only: no hours gate, every game open

Browse files
Files changed (4) hide show
  1. app.js +12 -15
  2. data.json +8 -36
  3. index.html +1 -1
  4. style.css +1 -2
app.js CHANGED
@@ -61,9 +61,8 @@ function screen(genres, modding) { // genres: {kind: hours band}
61
  if (!kinds.length) return {ok: false, message: msg("need_genre")};
62
  if (kinds.some(g => !genres[g])) return {ok: false, message: msg("need_hours_answer")};
63
  if (!modding) return {ok: false, message: msg("need_modding_answer")};
64
- const ok = kinds.filter(g => genres[g] !== "lt10" || D.makers.includes(modding));
65
- if (!ok.length) return {ok: false, message: msg("too_new")};
66
- return {ok: true, games: knownGames(ok), skipped: kinds.filter(g => !ok.includes(g))};
67
  }
68
  const videoSeconds = f => new Promise(res => { const v = document.createElement("video"); v.preload = "metadata";
69
  v.onloadedmetadata = () => { URL.revokeObjectURL(v.src); res(v.duration); }; v.onerror = () => res(NaN); v.src = URL.createObjectURL(f); });
@@ -77,7 +76,7 @@ async function check(v) {
77
  if (!/^https?:\/\/\S+$/.test(g.link)) errors.push(msg("new_link"));
78
  if (n < na || n > nb) errors.push(msg("new_modding_len", {a: na, b: nb, n})); else if (lowEffort(g.modding)) errors.push(msg("low_effort", {x: g.modding.slice(0, 44)}));
79
  if (!g.help) errors.push(msg("new_help")); }
80
- else if (!D.game_track[v.game]) errors.push(msg("game")); else if (!screenState.games.includes(v.game)) errors.push(msg("game_not_known"));
81
  if (v.mod_link && !/^https?:\/\/\S+$/.test(v.mod_link)) errors.push(msg("mod_link"));
82
  if (modFiles.length > L.mod_files) errors.push(msg("mod_files_max", {m: L.mod_files, n: modFiles.length}));
83
  for (const f of modFiles) { const k = kind(f.name);
@@ -191,17 +190,17 @@ function setPoints(points) {
191
  ps.forEach(p => box.appendChild(pointRow(d, p))); }
192
  labelRows();
193
  }
194
- function fillGames(preferred) { // every game as a tile; the ones whose kind is not ticked with enough hours are locked
195
- const cur = preferred || radio("game"), open = screenState ? screenState.games : [];
196
- $("#game").innerHTML = [...D.game_ids].sort((a, b) => open.includes(b) - open.includes(a)).map(id => {
197
- const label = D.choices.games[lang].find(([, g]) => g === id)[0], m = label.match(/[((](.*)[))]/), ok = open.includes(id);
198
  const note = (m ? m[1] : "").replace(/^(open source|开源)[,,]\s*/, "");
199
- return `<label class="tile${ok ? "" : " locked"}"><input type="radio" name="game" value="${id}"${ok ? "" : " disabled"}${ok && cur === id ? " checked" : ""}>` +
200
  `<img src="data/games/${id}.jpg" alt="" loading="lazy"><div><b>${esc(D.game_short[lang][id])}</b><span>${esc(note)}</span>` +
201
- `<i>${ok ? (D.game_track[id] === "core" ? t("open_source") : "") : t("game_locked")}</i></div></label>`;
202
  }).join("") + `<label class="tile new"><input type="radio" name="game" value="${D.new_game}"${cur === D.new_game ? " checked" : ""}>` +
203
  `<span class="plus" aria-hidden="true">+</span><div><b>${t("game_new")}</b><span>${t("game_new_sub")}</span><i>${t("game_new_tag")}</i></div></label>`;
204
- $("#game_locked_info").hidden = open.length === D.game_ids.length; showNew();
205
  }
206
  const showNew = () => { $("#newgame").hidden = radio("game") !== D.new_game; };
207
  const showMod = () => { $("#modbox").hidden = !isMaker(); };
@@ -210,10 +209,8 @@ function renderModFiles() {
210
  $$("#mod_filelist button").forEach(b => b.onclick = () => { modFiles.splice(+b.dataset.i, 1); renderModFiles(); stale(); });
211
  }
212
  function showVerdict() {
213
- const g = genreHours(), s = screen(g, radio("modding")), label = Object.fromEntries(D.choices.genres[lang].map(([l, id]) => [id, l.split(" → ")[0]]));
214
- $("#verdict").innerHTML = !s.ok ? `${rich(t("v_no"))}${esc(s.message)}`
215
- : rich(("other" in g && !s.skipped.includes("other") ? t("v_ok_other") : t("v_ok", {games: s.games.map(x => D.game_short[lang][x]).join(", ")})) +
216
- (s.skipped.length ? t("v_skipped", {kinds: s.skipped.map(k => label[k]).join(", ")}) : ""));
217
  $("#verdict").className = "verdict " + (s.ok ? "ok" : "wait"); return s;
218
  }
219
  function renderFiles() {
 
61
  if (!kinds.length) return {ok: false, message: msg("need_genre")};
62
  if (kinds.some(g => !genres[g])) return {ok: false, message: msg("need_hours_answer")};
63
  if (!modding) return {ok: false, message: msg("need_modding_answer")};
64
+ const first = knownGames(kinds); // nobody is turned away: every game is open, those of the ticked kinds first
65
+ return {ok: true, games: [...first, ...D.game_ids.filter(id => !first.includes(id))]};
 
66
  }
67
  const videoSeconds = f => new Promise(res => { const v = document.createElement("video"); v.preload = "metadata";
68
  v.onloadedmetadata = () => { URL.revokeObjectURL(v.src); res(v.duration); }; v.onerror = () => res(NaN); v.src = URL.createObjectURL(f); });
 
76
  if (!/^https?:\/\/\S+$/.test(g.link)) errors.push(msg("new_link"));
77
  if (n < na || n > nb) errors.push(msg("new_modding_len", {a: na, b: nb, n})); else if (lowEffort(g.modding)) errors.push(msg("low_effort", {x: g.modding.slice(0, 44)}));
78
  if (!g.help) errors.push(msg("new_help")); }
79
+ else if (!D.game_track[v.game]) errors.push(msg("game"));;
80
  if (v.mod_link && !/^https?:\/\/\S+$/.test(v.mod_link)) errors.push(msg("mod_link"));
81
  if (modFiles.length > L.mod_files) errors.push(msg("mod_files_max", {m: L.mod_files, n: modFiles.length}));
82
  for (const f of modFiles) { const k = kind(f.name);
 
190
  ps.forEach(p => box.appendChild(pointRow(d, p))); }
191
  labelRows();
192
  }
193
+ function fillGames(preferred) { // every game as a tile, the games of the ticked kinds first
194
+ const cur = preferred || radio("game"), order = screenState ? screenState.games : D.game_ids;
195
+ $("#game").innerHTML = order.map(id => {
196
+ const label = D.choices.games[lang].find(([, g]) => g === id)[0], m = label.match(/[((](.*)[))]/);
197
  const note = (m ? m[1] : "").replace(/^(open source|开源)[,,]\s*/, "");
198
+ return `<label class="tile"><input type="radio" name="game" value="${id}"${cur === id ? " checked" : ""}>` +
199
  `<img src="data/games/${id}.jpg" alt="" loading="lazy"><div><b>${esc(D.game_short[lang][id])}</b><span>${esc(note)}</span>` +
200
+ `<i>${D.game_track[id] === "core" ? t("open_source") : ""}</i></div></label>`;
201
  }).join("") + `<label class="tile new"><input type="radio" name="game" value="${D.new_game}"${cur === D.new_game ? " checked" : ""}>` +
202
  `<span class="plus" aria-hidden="true">+</span><div><b>${t("game_new")}</b><span>${t("game_new_sub")}</span><i>${t("game_new_tag")}</i></div></label>`;
203
+ showNew();
204
  }
205
  const showNew = () => { $("#newgame").hidden = radio("game") !== D.new_game; };
206
  const showMod = () => { $("#modbox").hidden = !isMaker(); };
 
209
  $$("#mod_filelist button").forEach(b => b.onclick = () => { modFiles.splice(+b.dataset.i, 1); renderModFiles(); stale(); });
210
  }
211
  function showVerdict() {
212
+ const s = screen(genreHours(), radio("modding"));
213
+ $("#verdict").innerHTML = s.ok ? rich(t("v_ok")) : esc(s.message);
 
 
214
  $("#verdict").className = "verdict " + (s.ok ? "ok" : "wait"); return s;
215
  }
216
  function renderFiles() {
data.json CHANGED
@@ -121,8 +121,8 @@
121
  "关于你"
122
  ],
123
  "s1_sub": [
124
- "A few quick questions, so we can offer you the right games.",
125
- "几个小问题,方便我们给你列出合适的游戏。"
126
  ],
127
  "q_genres": [
128
  "Which of these kinds of games do you know well? (select all that apply)",
@@ -153,8 +153,8 @@
153
  "勾选的每一类,你大约各玩了多少小时?"
154
  ],
155
  "q_hours_info": [
156
- "A rough figure is fine; Steam shows your hours on each game's library page. You can set a challenge for a kind you have played for 10 hours or more.",
157
- "大概的数字就行,Steam 库里每款游戏都显示游玩时间。玩过 10 小时以上的类型才能出题。"
158
  ],
159
  "q_hours_none": [
160
  "Tick a kind above first.",
@@ -176,21 +176,9 @@
176
  "Continue",
177
  "继续"
178
  ],
179
- "v_skipped": [
180
- " Left out for now (under 10 hours): {kinds}.",
181
- "暂时没有列入(不到 10 小时):{kinds}。"
182
- ],
183
  "v_ok": [
184
- "**Great, thank you!** Next, pick your game below. Open to you: {games}.",
185
- "**太好了,谢谢你!** 接下来请在下面选游戏。你可以选:{games}。"
186
- ],
187
- "v_ok_other": [
188
- "**Great, thank you!** Next, pick your game below. You chose “Other”, so every game is open: pick the one closest to what you know.",
189
- "**太好了,谢谢你!** 接下来请在下面选游戏。你选了“其他”,所以全部游戏都可以选,挑一款和你熟悉的最接近的。"
190
- ],
191
- "v_no": [
192
- "**Thank you for your interest.** ",
193
- "**谢谢你的关注。** "
194
  ],
195
  "s2": [
196
  "Your challenge",
@@ -208,14 +196,6 @@
208
  "Pick this first: everything else you write is about this game.",
209
  "请先选这一项:后面填的内容都围绕这款游戏。"
210
  ],
211
- "game_locked": [
212
- "Locked",
213
- "未解锁"
214
- ],
215
- "game_locked_info": [
216
- "Greyed-out games need their kind ticked in step 1 with 10 hours or more. Change it there and they unlock at once.",
217
- "灰色的游戏需要在第 1 步勾选对应类型,并且玩过 10 小时以上。回到第 1 步改一下,这里会立刻解锁。"
218
- ],
219
  "game_none": [
220
  "Please pick a game first.",
221
  "请先选一款游戏。"
@@ -598,13 +578,9 @@
598
  "One more thing: the question about mods.",
599
  "还差一题:关于 mod 的那一题。"
600
  ],
601
- "too_new": [
602
- "We are really glad you want to help. Writing a task leans on knowing a game's main systems well, which usually takes around 10 hours of play, so this may be a little early. Please come back after some more time with the game: we would love to see your idea then.",
603
- "很高兴你愿意参与。出题需要比较熟悉一款游戏的主要系统,通常要玩上 10 小时左右,所以现在可能稍早了一点。欢迎多玩一阵再回来,我们很期待到时看到你的想法。"
604
- ],
605
  "screen_first": [
606
- "Please answer the questions in step 1 first (at least one kind of game with 10 hours or more).",
607
- "请先回答第 1 步的问题(至少有一类游戏玩过 10 小时以上)。"
608
  ],
609
  "nickname": [
610
  "Enter the name to credit (1–40 characters).",
@@ -618,10 +594,6 @@
618
  "Pick the game the AI should build in.",
619
  "请选想让 AI 在哪款游戏里做。"
620
  ],
621
- "game_not_known": [
622
- "This game is locked: its kind is not ticked in step 1 with 10 hours or more. Change it there, or pick another game.",
623
- "这款游戏还没解锁:第 1 步里没有勾选它的类型,或不到 10 小时。回到第 1 步改一下,或者换一款游戏。"
624
- ],
625
  "category": [
626
  "Choose what the AI should mainly recreate (a place, rules or a story).",
627
  "请选主要想让 AI 还原什么(地方、规则或故事)。"
 
121
  "关于你"
122
  ],
123
  "s1_sub": [
124
+ "A few quick questions, so we know who is taking part. Whatever you answer, you can go on.",
125
+ "几个小问题,只是想了解一下参与的朋友。怎么答都可以继续。"
126
  ],
127
  "q_genres": [
128
  "Which of these kinds of games do you know well? (select all that apply)",
 
153
  "勾选的每一类,你大约各玩了多少小时?"
154
  ],
155
  "q_hours_info": [
156
+ "A rough figure is fine; Steam shows your hours on each game's library page.",
157
+ "大概的数字就行,Steam 库里每款游戏都显示游玩时间。"
158
  ],
159
  "q_hours_none": [
160
  "Tick a kind above first.",
 
176
  "Continue",
177
  "继续"
178
  ],
 
 
 
 
179
  "v_ok": [
180
+ "**Great, thank you!** Next, pick your game below. The games of the kinds you ticked come first; every game is open.",
181
+ "**太好了,谢谢你!** 接下来请在下面选游戏。你勾选的类型对应的游戏排在前面,所有游戏都可以选。"
 
 
 
 
 
 
 
 
182
  ],
183
  "s2": [
184
  "Your challenge",
 
196
  "Pick this first: everything else you write is about this game.",
197
  "请先选这一项:后面填的内容都围绕这款游戏。"
198
  ],
 
 
 
 
 
 
 
 
199
  "game_none": [
200
  "Please pick a game first.",
201
  "请先选一款游戏。"
 
578
  "One more thing: the question about mods.",
579
  "还差一题:关于 mod 的那一题。"
580
  ],
 
 
 
 
581
  "screen_first": [
582
+ "Please answer the questions in step 1 first.",
583
+ "请先回答第 1 步的问题。"
584
  ],
585
  "nickname": [
586
  "Enter the name to credit (1–40 characters).",
 
594
  "Pick the game the AI should build in.",
595
  "请选想让 AI 在哪款游戏里做。"
596
  ],
 
 
 
 
597
  "category": [
598
  "Choose what the AI should mainly recreate (a place, rules or a story).",
599
  "请选主要想让 AI 还原什么(地方、规则或故事)。"
index.html CHANGED
@@ -93,7 +93,7 @@
93
  <section class="panel" id="sec_game">
94
  <h3 class="sec"><span data-t="nav2"></span></h3>
95
  <fieldset><legend data-t="game"></legend><p class="info" data-t="game_info"></p>
96
- <div id="game" class="tiles"></div><p class="info lockinfo" id="game_locked_info" data-t="game_locked_info"></p></fieldset>
97
  <fieldset id="newgame" class="sub" hidden><legend data-t="new_title"></legend><p class="info" data-t="new_info"></p>
98
  <div class="row">
99
  <div class="grow"><label class="q" for="new_name" data-t="new_name"></label><input id="new_name" type="text" maxlength="60" data-ph="new_name_ph"></div>
 
93
  <section class="panel" id="sec_game">
94
  <h3 class="sec"><span data-t="nav2"></span></h3>
95
  <fieldset><legend data-t="game"></legend><p class="info" data-t="game_info"></p>
96
+ <div id="game" class="tiles"></div></fieldset>
97
  <fieldset id="newgame" class="sub" hidden><legend data-t="new_title"></legend><p class="info" data-t="new_info"></p>
98
  <div class="row">
99
  <div class="grow"><label class="q" for="new_name" data-t="new_name"></label><input id="new_name" type="text" maxlength="60" data-ph="new_name_ph"></div>
style.css CHANGED
@@ -170,14 +170,13 @@ textarea { resize: vertical; line-height: 1.5; }
170
  .tile img, .tile .plus { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface); }
171
  .tile .plus { display: grid; place-items: center; font: 400 44px/1 var(--pixel); color: var(--accent); background: var(--accent-soft); }
172
  .tile div { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; flex: 1; }
173
- .tile:hover:not(.locked) { border-color: var(--accent-mid); }
174
  .tile input { position: absolute; opacity: 0; } .tile:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
175
  .tile:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
176
  .tile:has(input:checked)::after { content: "✓"; position: absolute; right: 6px; top: 6px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%;
177
  background: var(--accent); color: var(--on-accent); font-size: 13px; font-weight: 700; }
178
  .tile b { font-size: 15px; line-height: 1.25; } .tile span { font-size: 13px; color: var(--muted); line-height: 1.35; }
179
  .tile i { margin-top: auto; padding-top: 4px; font: 600 11px/1 var(--sans); font-style: normal; letter-spacing: .08em; text-transform: uppercase; color: var(--good); min-height: 15px; }
180
- .tile.locked { cursor: not-allowed; border-style: dashed; } .tile.locked img { filter: grayscale(1); opacity: .45; } .tile.locked div { opacity: .6; } .tile.locked i { color: var(--dim); }
181
  .tile.new i { color: var(--accent); }
182
  .lockinfo { margin: 10px 0 0; }
183
  .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
 
170
  .tile img, .tile .plus { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface); }
171
  .tile .plus { display: grid; place-items: center; font: 400 44px/1 var(--pixel); color: var(--accent); background: var(--accent-soft); }
172
  .tile div { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; flex: 1; }
173
+ .tile:hover { border-color: var(--accent-mid); }
174
  .tile input { position: absolute; opacity: 0; } .tile:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
175
  .tile:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
176
  .tile:has(input:checked)::after { content: "✓"; position: absolute; right: 6px; top: 6px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%;
177
  background: var(--accent); color: var(--on-accent); font-size: 13px; font-weight: 700; }
178
  .tile b { font-size: 15px; line-height: 1.25; } .tile span { font-size: 13px; color: var(--muted); line-height: 1.35; }
179
  .tile i { margin-top: auto; padding-top: 4px; font: 600 11px/1 var(--sans); font-style: normal; letter-spacing: .08em; text-transform: uppercase; color: var(--good); min-height: 15px; }
 
180
  .tile.new i { color: var(--accent); }
181
  .lockinfo { margin: 10px 0 0; }
182
  .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }