mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-25 06:26:16 -04:00
Build 29087244
This commit is contained in:
parent
5ba93500b4
commit
49f3769b54
21 changed files with 2505 additions and 2517 deletions
|
@ -36,54 +36,54 @@ export function creativeMode(gameState: GameState) {
|
|||
|
||||
export async function openCreativeModePerksPicker() {
|
||||
let creativeModePerks: Partial<{ [id in PerkId]: number }> = getSettingValue(
|
||||
"creativeModePerks",
|
||||
{},
|
||||
);
|
||||
"creativeModePerks",
|
||||
{},
|
||||
);
|
||||
const customLevels = (getSettingValue("custom_levels", []) as RawLevel[]).map(
|
||||
transformRawLevel,
|
||||
);
|
||||
|
||||
while (true ) {
|
||||
while (true) {
|
||||
const levelOptions = [
|
||||
...allLevels.map((l, li) => {
|
||||
const problem = reasonLevelIsLocked(li, getHistory(), true)?.text || "";
|
||||
return {
|
||||
icon: icons[l.name],
|
||||
text: l.name,
|
||||
value: l,
|
||||
disabled: !!problem,
|
||||
tooltip: problem || describeLevel(l),
|
||||
className: "",
|
||||
};
|
||||
}),
|
||||
...customLevels.map((l) => ({
|
||||
icon: levelIconHTML(l.bricks, l.size, l.color),
|
||||
text: l.name,
|
||||
value: l,
|
||||
disabled: !l.bricks.filter((b) => b !== "_").length,
|
||||
tooltip: describeLevel(l),
|
||||
className: "",
|
||||
})),
|
||||
];
|
||||
|
||||
const levelOptions= [
|
||||
...allLevels.map((l, li) => {
|
||||
const problem =
|
||||
reasonLevelIsLocked(li, getHistory(), true)?.text || "";
|
||||
return {
|
||||
icon: icons[l.name],
|
||||
text: l.name,
|
||||
value: l,
|
||||
disabled: !!problem,
|
||||
tooltip: problem || describeLevel(l),
|
||||
className:''
|
||||
};
|
||||
}),
|
||||
...customLevels.map((l) => ({
|
||||
icon: levelIconHTML(l.bricks, l.size, l.color),
|
||||
text: l.name,
|
||||
value: l,
|
||||
disabled: !l.bricks.filter((b) => b !== "_").length,
|
||||
tooltip: describeLevel(l),
|
||||
className:''
|
||||
}))
|
||||
]
|
||||
const selectedLeveOption =
|
||||
levelOptions.find(
|
||||
(l) => l.text === getSettingValue("creativeModeLevel", ""),
|
||||
) || levelOptions[0];
|
||||
selectedLeveOption.className = "highlight";
|
||||
|
||||
const selectedLeveOption= levelOptions.find(l=>l.text===getSettingValue("creativeModeLevel", '')) || levelOptions[0]
|
||||
selectedLeveOption.className= 'highlight'
|
||||
|
||||
|
||||
const choice=await asyncAlert<Upgrade | Level | "reset" | "play">({
|
||||
const choice = await asyncAlert<Upgrade | Level | "reset" | "play">({
|
||||
title: t("lab.menu_entry"),
|
||||
className: "actionsAsGrid",
|
||||
content: [
|
||||
{
|
||||
icon: icons['icon:reset'],
|
||||
icon: icons["icon:reset"],
|
||||
value: "reset",
|
||||
text: t("lab.reset"),
|
||||
disabled: !sumOfValues(creativeModePerks),
|
||||
},
|
||||
{
|
||||
icon: icons['icon:new_run'],
|
||||
{
|
||||
icon: icons["icon:new_run"],
|
||||
value: "play",
|
||||
text: t("lab.play"),
|
||||
disabled: !sumOfValues(creativeModePerks),
|
||||
|
@ -106,24 +106,28 @@ export async function openCreativeModePerksPicker() {
|
|||
tooltip: u.help(creativeModePerks[u.id] || 1),
|
||||
})),
|
||||
t("lab.select_level"),
|
||||
...levelOptions
|
||||
...levelOptions,
|
||||
],
|
||||
})
|
||||
if(!choice)return
|
||||
});
|
||||
if (!choice) return;
|
||||
if (choice === "reset") {
|
||||
upgrades.forEach((u) => {
|
||||
creativeModePerks[u.id] = 0;
|
||||
});
|
||||
setSettingValue("creativeModePerks", creativeModePerks);
|
||||
setSettingValue("creativeModeLevel", '')
|
||||
} else if (choice === "play" || ("bricks" in choice && choice.name==getSettingValue("creativeModeLevel", ''))) {
|
||||
setSettingValue("creativeModeLevel", "");
|
||||
} else if (
|
||||
choice === "play" ||
|
||||
("bricks" in choice &&
|
||||
choice.name == getSettingValue("creativeModeLevel", ""))
|
||||
) {
|
||||
if (await confirmRestart(gameState)) {
|
||||
restart({
|
||||
perks: creativeModePerks,
|
||||
level: selectedLeveOption.value,
|
||||
isCreativeRun: true,
|
||||
});
|
||||
return
|
||||
return;
|
||||
}
|
||||
} else if ("bricks" in choice) {
|
||||
setSettingValue("creativeModeLevel", choice.name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue