From e1adc7d5237fb33d9ed2129bb21a270a3abbee49 Mon Sep 17 00:00:00 2001 From: tobspr <> Date: Sat, 16 May 2020 12:43:11 +0200 Subject: [PATCH] Add notifications when saving and new upgrades are available, minor improvements --- LICENSE | 17 ++++++++ gulp/package.json | 3 +- gulp/webpack.config.js | 5 +++ gulp/webpack.production.config.js | 5 +++ gulp/yarn.lock | 13 +++++++ res/ui/icons/notification_saved.png | Bin 0 -> 1744 bytes res/ui/icons/notification_success.png | Bin 0 -> 1684 bytes res/ui/icons/notification_upgrade.png | Bin 0 -> 2319 bytes res/ui/vignette.lossless.png | Bin 6059 -> 6016 bytes src/css/common.scss | 5 --- src/css/icons.scss | 7 ++++ src/css/ingame_hud/notifications.scss | 44 +++++++++++++++++++++ src/css/main.scss | 6 ++- src/css/mixins.scss | 29 -------------- src/js/game/hud/hud.js | 4 ++ src/js/game/hud/parts/game_menu.js | 25 ++++++++++-- src/js/game/hud/parts/mass_selector.js | 9 ++++- src/js/game/hud/parts/notifications.js | 52 +++++++++++++++++++++++++ src/js/game/key_action_mapper.js | 2 +- src/js/translations/en.yaml | 0 20 files changed, 183 insertions(+), 43 deletions(-) create mode 100644 LICENSE create mode 100644 res/ui/icons/notification_saved.png create mode 100644 res/ui/icons/notification_success.png create mode 100644 res/ui/icons/notification_upgrade.png create mode 100644 src/css/ingame_hud/notifications.scss create mode 100644 src/js/game/hud/parts/notifications.js create mode 100644 src/js/translations/en.yaml diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..40ad553c --- /dev/null +++ b/LICENSE @@ -0,0 +1,17 @@ +“Commons Clause” License Condition v1.0 + +The Software is provided to you by the Licensor under the License, as defined below, subject to the following condition. + +Without limiting other conditions in the License, the grant of rights under the License will not include, and the License does not grant to you, the right to Sell the Software. + +For purposes of the foregoing, “Sell” means practicing any or all of the rights granted to you under the License to provide to third parties, for a fee or other consideration (including without limitation fees for hosting or consulting/ support services related to the Software), a product or service whose value derives, entirely or substantially, from the functionality of the Software. Any license notice or attribution required by the License must also include this Commons Clause License Condition notice. + + + +Copyright 2020 Tobias Springer + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, BUT NOT sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/gulp/package.json b/gulp/package.json index 3cb8ae15..9e39962a 100644 --- a/gulp/package.json +++ b/gulp/package.json @@ -110,6 +110,7 @@ "speed-measure-webpack-plugin": "^1.3.1", "strip-json-comments": "^3.0.1", "trim": "^0.0.1", - "webpack-stream": "^5.1.0" + "webpack-stream": "^5.1.0", + "yaml-loader": "^0.6.0" } } diff --git a/gulp/webpack.config.js b/gulp/webpack.config.js index f3bdb601..026ec55e 100644 --- a/gulp/webpack.config.js +++ b/gulp/webpack.config.js @@ -108,6 +108,11 @@ module.exports = ({ watch = false, standalone = false }) => { }, }, }, + { + test: /\.ya?ml$/, + type: "json", // Required by Webpack v4 + use: "yaml-loader", + }, ], }, output: { diff --git a/gulp/webpack.production.config.js b/gulp/webpack.production.config.js index fab5dbeb..27a8370b 100644 --- a/gulp/webpack.production.config.js +++ b/gulp/webpack.production.config.js @@ -269,6 +269,11 @@ module.exports = ({ test: /\.md$/, use: ["html-loader", "markdown-loader"], }, + { + test: /\.ya?ml$/, + type: "json", // Required by Webpack v4 + use: "yaml-loader", + }, ], }, }; diff --git a/gulp/yarn.lock b/gulp/yarn.lock index 702d54b9..093c8d54 100644 --- a/gulp/yarn.lock +++ b/gulp/yarn.lock @@ -14068,6 +14068,19 @@ yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3: resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.3.tgz#b4b049e314be545e3ce802236d6cd22cd91c3de9" integrity sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A== +yaml-loader@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/yaml-loader/-/yaml-loader-0.6.0.tgz#fe1c48b9f4803dace55a59a1474e790ba6ab1b48" + integrity sha512-1bNiLelumURyj+zvVHOv8Y3dpCri0F2S+DCcmps0pA1zWRLjS+FhZQg4o3aUUDYESh73+pKZNI18bj7stpReow== + dependencies: + loader-utils "^1.4.0" + yaml "^1.8.3" + +yaml@^1.8.3: + version "1.10.0" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.0.tgz#3b593add944876077d4d683fee01081bd9fff31e" + integrity sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg== + yargs-parser@^13.0.0, yargs-parser@^13.1.0: version "13.1.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.1.tgz#d26058532aa06d365fe091f6a1fc06b2f7e5eca0" diff --git a/res/ui/icons/notification_saved.png b/res/ui/icons/notification_saved.png new file mode 100644 index 0000000000000000000000000000000000000000..de7096a4ab69dd274c25eb106667a03dc5eb8440 GIT binary patch literal 1744 zcmbVNeM}o=7=I5C8G*XQWnmkd+s(vHyw85nyR3Y*g*IEUfjSt8!u9TLIcR&w-9ZmD zOG8Y|B1X*g56%A3WR7ha+aDTDNCuf^#HfUSWM;&PanbmP5sglrne)BUHq7AHnq2RF zpZE9to{#r=o;x1x?5M5YT@3)J4Tl0<=-pyJRh8)ftTJ*Py|!tgqXqzu59|kfwZX9m zfcxr|Sg+X|IV?zOni6F-4k;_GAv6F7n=MV0hM|eaVN%KXi0|j-30#qVM2|bdL^MAf zR6-Lv?4Ib1NfW~oFB8p8_(4lR1ZilBxRp+248igdd0qjnZ81&Yd5AgeBU){PcyA<% z`&Av{ZpuSStjmoz@)YZFx_JI^oMTuo&3I|nNwOZn#RwdS7k&h?rppPTE6`rBg?2t- z&@?rHrnA{Bm3308o}^ix=V^wcIgUgK(iqQ}qD5wmeMN=wYB^Vq-ZtkU_dmXkKh=NAsIKiwHV6^?nc4oZeTcpVK$%< zRaO$?TSC1877muu3U-zG4JXvOB>?NOlQ8nJ9>rd(OZHZFUeM(toIn4Va-O%&e%x)+EZ-eb3kOH;F%khXC2c^ z4y$su4fJ83ELN^LvDuffnr(-s08oQfj$dc^mc5hZH_>Q+>uA;KllU0OW!J873)o~3 zz8nWr9iVJ`4piU(t7-w* zYuM+Zp~ScS___AHSfg@}9p>z#viIs*e!qN*-ERZw))!mz!sWUhwsP)Au=B&?(oAp{ zcxTGquLZkDKfeC*d~Budh{IxQma_}wdivsTwae@Moex~u?pg4i`Shzl!gb)I-Hn$j eZneDs%kA=~qEAZCxxWnA-<)u;GcemWF!?7=P&keN literal 0 HcmV?d00001 diff --git a/res/ui/icons/notification_success.png b/res/ui/icons/notification_success.png new file mode 100644 index 0000000000000000000000000000000000000000..123619d5fc09d5e28c0adb96b4bb594126542c03 GIT binary patch literal 1684 zcmV;F25b3=P)004R>004l5008;`004mK004C`008P>0026e000+ooVrmw00002 zVoOIv0063uBQgL0010qNS#tmY4#WTe4#WYKD-Ig~000McNliruGEGrto+O3vHVHFDmxmsD@zOY% zsM$CTql`W@W4FmdVVb6wvc~Ks3!NUa!V6HKGom%6$wf#BP~q!=&OU4Z=f9qF*iZl7 z>+-FCuf6tKdv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&O*V_UsCD(<+cuwZHpu;ps(>&4T=fs@&?cY3ows{5&GJgRH$+d%P1^v#?er&mR1 zp89U+Pc&et=_&a5ZEaChA@I`l7v<9Nv=S{9inA&Dl2`PeI{abFYhmI~2YuW%aH2=L@In0IZ=rnp&wul;zR_IRcbeDg+>#nt zy&iaUy6X=U_1~#Ky4Ld2R>$^5wI12mW#Ly_t|gV4S|_i7#=99c$3~1QXVpF#e5n7E ziKu}dgQxf67deTCeFFux@d;et6J>eLUBTa$y4p}@Tw~>+uXjiURf z%E8L(lT_ZlvJ++33T__W!6l|EddKX}SL%=QpWoAPS+M2o!-58<=vaJa&eD;8T+UpX zH3c*heqDo#555VH+x=dKJ1pX81xJQVQa5gW{>6ag#+@g;&m%Q^Hgq%zCvc_C=W)T% zfu@*y{5z{Mdk{b5{QZ=>`IdBi zNPRJ~h+36<@KNRV(ZYsU*Yb`!+fHBCu%+qF{-))tP96|t162=QrSNdprk;&J2@CtsXKy9j=z4s m^bO&7QIctE^21Q~)S{a$w>MO#xBrg)Wl_c^DbB>awfCQ%f_B~j literal 0 HcmV?d00001 diff --git a/res/ui/vignette.lossless.png b/res/ui/vignette.lossless.png index 26f0529627adcba53e99fd74fd90861a079e3cce..b7bb65ac16453fc4ecd25e58254b3248c95d71af 100644 GIT binary patch delta 4555 zcmb7|X*k>4zQ_NWkeKJvmWWVADib2AVhnBBXeruiA_H0#HE&8{Y$!_UJV?=2Ybed> zv=!;V#x{092c&aUO4@Cz635;9?t9OR^W3}7i#0v#S)cVAzH2?}S+zDi8kE%*%h$KzYgVKqq4maLo|~SPPb#T zu^0!2JsU$}5N$Ce94;J#b->ecOq`u9&X!qr4q|0Wu(J;*;pi9~!ZYy!g}oX)f@n}DD<6S3j8bQYe3u_LhY7&eaRfT6STSPY%cB01PGnQW2+4uy=3 zGs&WFQfIiUz;IB1Z^-vh)acqAo|lOtI%PAEKfm5;T>;Qqz?9_Y{R zL;{;(Z%4Ps*pWy?3>&{{iUXca!r(}B9GhrQVi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JWazE)1k~&Pd#YOkZ24F$@OBV|(&_ zLd+;$`oLgXNJ2l6@1f`BrM)0IKbGhg4 z{0QzZlaP&HlE^;x)8InoaMph8F&~e2$J>YA(A>z3_jNqN>n*5GPAhnhkSRvvR`s56 zBlJQY;R++TU=R76Y@61s`M72)u&iAb|MVuM7jFqu);+WG=Vi9f#K;0$f^ok0e=JCA AI{*Lx diff --git a/src/css/common.scss b/src/css/common.scss index c0a305aa..ee646730 100644 --- a/src/css/common.scss +++ b/src/css/common.scss @@ -87,11 +87,6 @@ body { // } } -// Dirty hack -* { - @include TextShadow3DImpl; -} - img { -webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */ } diff --git a/src/css/icons.scss b/src/css/icons.scss index fa124f67..4e6e779b 100644 --- a/src/css/icons.scss +++ b/src/css/icons.scss @@ -20,3 +20,10 @@ $upgrades: belt, miner, painting, processors; background-image: uiResource("res/ui/upgrades/#{$upgrade}.png") !important; } } + +$icons: notification_saved, notification_success, notification_upgrade; +@each $icon in $icons { + [data-icon="icons/#{$icon}.png"] { + background-image: uiResource("res/ui/icons/#{$icon}.png") !important; + } +} diff --git a/src/css/ingame_hud/notifications.scss b/src/css/ingame_hud/notifications.scss new file mode 100644 index 00000000..36e56e28 --- /dev/null +++ b/src/css/ingame_hud/notifications.scss @@ -0,0 +1,44 @@ +#ingame_HUD_Notifications { + position: absolute; + @include S(bottom, 60px); + @include S(right, 10px); + + .notification { + background: rgba(#333438, 0.8); + @include S(border-radius, 2px); + @include S(margin-top, 3px); + color: #fff; + @include PlainText; + @include S(padding, 7px, 10px); + @include S(width, 200px); + + &[data-icon] { + @include S(background-position-x, 8px); + background-position-y: center; + @include S(padding-left, 35px); + background-repeat: no-repeat; + @include S(background-size, 15px); + } + + transform-origin: 100% 50%; + + @include InlineAnimation(5s ease-in-out) { + 0% { + opacity: 1; + } + + 87% { + opacity: 1; + transform: scale(1); + } + 95% { + transform: scale(1.05); + } + + 100% { + opacity: 0; + transform: scale(0.5); + } + } + } +} diff --git a/src/css/main.scss b/src/css/main.scss index 9b2bbe54..c2668158 100644 --- a/src/css/main.scss +++ b/src/css/main.scss @@ -36,11 +36,13 @@ @import "ingame_hud/vignette_overlay"; @import "ingame_hud/statistics"; @import "ingame_hud/pinned_shapes"; +@import "ingame_hud/notifications"; // Z-Index $elements: ingame_Canvas, ingame_VignetteOverlay, ingame_HUD_building_placer, ingame_HUD_PinnedShapes, - ingame_HUD_buildings_toolbar, ingame_HUD_GameMenu, ingame_HUD_KeybindingOverlay, ingame_HUD_Shop, - ingame_HUD_Statistics, ingame_HUD_BetaOverlay, ingame_HUD_MassSelector, ingame_HUD_UnlockNotification; + ingame_HUD_buildings_toolbar, ingame_HUD_GameMenu, ingame_HUD_KeybindingOverlay, ingame_HUD_Notifications, + ingame_HUD_Shop, ingame_HUD_Statistics, ingame_HUD_BetaOverlay, ingame_HUD_MassSelector, + ingame_HUD_UnlockNotification; $zindex: 100; diff --git a/src/css/mixins.scss b/src/css/mixins.scss index 9881ffea..311c176d 100644 --- a/src/css/mixins.scss +++ b/src/css/mixins.scss @@ -253,38 +253,9 @@ button, } @mixin TextShadow3D($color: rgb(222, 234, 238), $borderColor: #000) { - // @if $borderColor != #000 { - // @include TextShadow3DImpl($color: $color, $borderColor: $borderColor); - // } color: $color; } -@mixin TextShadow3DImpl( - $color: rgb(222, 234, 238), - $scale: 1, - $additionalShadowAlpha: 1, - $borderColor: #222428 -) { - // color: $text3dColor; - - $borderColor: rgba(15, 18, 23, 0.9); - - // $shadowColor: darken($color, 40%); - - $border: 0.07em; - $borderMid: $border * 1.14; - - $drop1: $borderMid + 0.02; - $drop2: $borderMid + 0.06em; - - // text-shadow: #{$border} #{$border} 0 $borderColor, #{-$border} #{$border} 0 $borderColor, #{$border} #{-$border} 0 $borderColor, - // #{-$border} #{-$border} 0 $borderColor, 0 #{$borderMid} 0 $borderColor, 0 #{-$borderMid} 0 $borderColor, - // #{$borderMid} 0 0 $borderColor, #{-$borderMid} 0 0 $borderColor, 0 #{$drop1} 0 $borderColor, #{$borderMid} #{$drop1} 0 $borderColor, - // #{-$borderMid} #{$drop1} 0 $borderColor, 0 #{$drop2} 0 $borderColor, #{$borderMid} #{$drop2} 0 $borderColor, - // #{-$borderMid} #{$drop2} 0 $borderColor, -0.2em 0.13em 0 rgba(#111, 0.25); // 0px 0.07em 0px $shadowColor, - // 0px 0.15em 0.09em rgba(#333539, $additionalShadowAlpha);; -} - // ---------------------------------------- /* Shine animation prefab, useful for buttons etc. Adds a bright shine which moves over the button like a reflection. Performance heavy. */ diff --git a/src/js/game/hud/hud.js b/src/js/game/hud/hud.js index 7f71872a..2dacb3cb 100644 --- a/src/js/game/hud/hud.js +++ b/src/js/game/hud/hud.js @@ -19,6 +19,7 @@ import { HUDStatistics } from "./parts/statistics"; import { MetaBuilding } from "../meta_building"; import { HUDPinnedShapes } from "./parts/pinned_shapes"; import { ShapeDefinition } from "../shape_definition"; +import { HUDNotifications, enumNotificationType } from "./parts/notifications"; export class GameHUD { /** @@ -51,12 +52,15 @@ export class GameHUD { pinnedShapes: new HUDPinnedShapes(this.root), + notifications: new HUDNotifications(this.root), + // betaOverlay: new HUDBetaOverlay(this.root), }; this.signals = { selectedPlacementBuildingChanged: /** @type {TypedSignal<[MetaBuilding|null]>} */ (new Signal()), shapePinRequested: /** @type {TypedSignal<[ShapeDefinition, number]>} */ (new Signal()), + notification: /** @type {TypedSignal<[string, enumNotificationType]>} */ (new Signal()), }; if (!IS_MOBILE) { diff --git a/src/js/game/hud/parts/game_menu.js b/src/js/game/hud/parts/game_menu.js index d00a22e4..0a80af16 100644 --- a/src/js/game/hud/parts/game_menu.js +++ b/src/js/game/hud/parts/game_menu.js @@ -1,6 +1,7 @@ import { BaseHUDPart } from "../base_hud_part"; import { makeDiv, randomInt } from "../../../core/utils"; import { SOUNDS } from "../../../platform/sound"; +import { enumNotificationType } from "./notifications"; export class HUDGameMenu extends BaseHUDPart { initialize() {} @@ -14,6 +15,10 @@ export class HUDGameMenu extends BaseHUDPart { handler: () => this.root.hud.parts.shop.show(), keybinding: "menu_open_shop", badge: () => this.root.hubGoals.getAvailableUpgradeCount(), + notification: /** @type {[string, enumNotificationType]} */ ([ + "A new upgrade is available!", + enumNotificationType.upgrade, + ]), }, { id: "stats", @@ -23,10 +28,16 @@ export class HUDGameMenu extends BaseHUDPart { }, ]; - /** @type {Array<{ badge: function, button: HTMLElement, badgeElement: HTMLElement, lastRenderAmount: number }>} */ + /** @type {Array<{ + * badge: function, + * button: HTMLElement, + * badgeElement: HTMLElement, + * lastRenderAmount: number, + * notification: [string, enumNotificationType] + * }>} */ this.badgesToUpdate = []; - buttons.forEach(({ id, label, handler, keybinding, badge }) => { + buttons.forEach(({ id, label, handler, keybinding, badge, notification }) => { const button = document.createElement("button"); button.setAttribute("data-button-id", id); this.element.appendChild(button); @@ -45,6 +56,7 @@ export class HUDGameMenu extends BaseHUDPart { lastRenderAmount: 0, button, badgeElement, + notification, }); } }); @@ -68,8 +80,9 @@ export class HUDGameMenu extends BaseHUDPart { update() { let playSound = false; + let notifications = new Set(); for (let i = 0; i < this.badgesToUpdate.length; ++i) { - const { badge, button, badgeElement, lastRenderAmount } = this.badgesToUpdate[i]; + const { badge, button, badgeElement, lastRenderAmount, notification } = this.badgesToUpdate[i]; const amount = badge(); if (lastRenderAmount !== amount) { if (amount > 0) { @@ -78,6 +91,9 @@ export class HUDGameMenu extends BaseHUDPart { // Check if the badge increased if (amount > lastRenderAmount) { playSound = true; + if (notification) { + notifications.add(notification); + } } this.badgesToUpdate[i].lastRenderAmount = amount; button.classList.toggle("hasBadge", amount > 0); @@ -87,6 +103,9 @@ export class HUDGameMenu extends BaseHUDPart { if (playSound) { this.root.soundProxy.playUi(SOUNDS.badgeNotification); } + notifications.forEach(([notification, type]) => { + this.root.hud.signals.notification.dispatch(notification, type); + }); } onGameSaved() { diff --git a/src/js/game/hud/parts/mass_selector.js b/src/js/game/hud/parts/mass_selector.js index ed9a8aa7..f54d1e3c 100644 --- a/src/js/game/hud/parts/mass_selector.js +++ b/src/js/game/hud/parts/mass_selector.js @@ -13,13 +13,18 @@ const logger = createLogger("hud/mass_selector"); export class HUDMassSelector extends BaseHUDPart { createElements(parent) { + const removalKeybinding = this.root.gameState.keyActionMapper + .getBinding("confirm_mass_delete") + .getKeyCodeString(); + const abortKeybinding = this.root.gameState.keyActionMapper.getBinding("back").getKeyCodeString(); + this.element = makeDiv( parent, "ingame_HUD_MassSelector", [], ` - Press DEL to remove selected buildings - and ESC to cancel. + Press ${removalKeybinding} to remove selected buildings + and ${abortKeybinding} to cancel. ` ); } diff --git a/src/js/game/hud/parts/notifications.js b/src/js/game/hud/parts/notifications.js new file mode 100644 index 00000000..eee61b8e --- /dev/null +++ b/src/js/game/hud/parts/notifications.js @@ -0,0 +1,52 @@ +import { BaseHUDPart } from "../base_hud_part"; +import { makeDiv } from "../../../core/utils"; + +/** @enum {string} */ +export const enumNotificationType = { + saved: "saved", + upgrade: "upgrade", + success: "success", +}; + +export class HUDNotifications extends BaseHUDPart { + createElements(parent) { + this.element = makeDiv(parent, "ingame_HUD_Notifications", [], ``); + } + + initialize() { + this.root.hud.signals.notification.add(this.onNotification, this); + + /** @type {Array<{ element: HTMLElement, expireAt: number}>} */ + this.notificationElements = []; + + // Automatic notifications + this.root.signals.gameSaved.add(() => + this.onNotification("Your game has been saved.", enumNotificationType.saved) + ); + } + + /** + * @param {string} message + * @param {enumNotificationType} type + */ + onNotification(message, type) { + const element = makeDiv(this.element, null, ["notification", "type-" + type], message); + element.setAttribute("data-icon", "icons/notification_" + type + ".png"); + + this.notificationElements.push({ + element, + expireAt: this.root.time.realtimeNow() + 5, + }); + } + + update() { + const now = this.root.time.realtimeNow(); + for (let i = 0; i < this.notificationElements.length; ++i) { + const handle = this.notificationElements[i]; + if (handle.expireAt <= now) { + handle.element.remove(); + this.notificationElements.splice(i, 1); + } + } + } +} diff --git a/src/js/game/key_action_mapper.js b/src/js/game/key_action_mapper.js index e557f0d8..fdadfb99 100644 --- a/src/js/game/key_action_mapper.js +++ b/src/js/game/key_action_mapper.js @@ -29,7 +29,7 @@ export const defaultKeybindings = { menu_open_shop: { keyCode: key("F") }, menu_open_stats: { keyCode: key("G") }, - confirm_mass_delete: { keyCode: 46 }, // DEL + confirm_mass_delete: { keyCode: key("X") }, // DEL toggle_hud: { keyCode: 113 }, // F2 }, diff --git a/src/js/translations/en.yaml b/src/js/translations/en.yaml new file mode 100644 index 00000000..e69de29b