From f03f04caa131bf251e81ca62d97036ebded64c4a Mon Sep 17 00:00:00 2001 From: tobspr Date: Sat, 23 May 2020 15:04:55 +0200 Subject: [PATCH] Allow to disable hints, add changelog --- src/css/main.scss | 1 + src/css/states/changelog.scss | 24 +++++++++++++ src/css/states/main_menu.scss | 3 +- src/css/states/preload.scss | 23 ++++++++++++ src/js/application.js | 2 ++ src/js/changelog.js | 23 ++++++++++++ src/js/core/config.js | 4 +-- src/js/game/hud/hud.js | 5 +-- src/js/game/hud/parts/tutorial_hints.js | 9 +++++ src/js/profile/application_settings.js | 10 +++++- src/js/states/changelog.js | 45 +++++++++++++++++++++++ src/js/states/main_menu.js | 11 ++++-- src/js/states/preload.js | 47 +++++++++++++++++++++++++ src/js/states/settings.js | 4 --- translations/base-en.yaml | 21 ++++++++++- 15 files changed, 218 insertions(+), 14 deletions(-) create mode 100644 src/css/states/changelog.scss create mode 100644 src/js/changelog.js create mode 100644 src/js/states/changelog.js diff --git a/src/css/main.scss b/src/css/main.scss index 35b885be..3f06853f 100644 --- a/src/css/main.scss +++ b/src/css/main.scss @@ -27,6 +27,7 @@ @import "states/settings"; @import "states/about"; @import "states/mobile_warning"; +@import "states/changelog"; @import "ingame_hud/buildings_toolbar"; @import "ingame_hud/building_placer"; diff --git a/src/css/states/changelog.scss b/src/css/states/changelog.scss new file mode 100644 index 00000000..d4a948bf --- /dev/null +++ b/src/css/states/changelog.scss @@ -0,0 +1,24 @@ +#state_ChangelogState { + .content { + display: flex; + flex-direction: column; + } + .entry { + padding: 20px; + .version { + @include Heading; + } + .date { + @include PlainText; + &::before { + content: " | "; + } + color: #aaabaf; + } + + .changes { + @include SuperSmallText; + @include S(padding-left, 20px); + } + } +} diff --git a/src/css/states/main_menu.scss b/src/css/states/main_menu.scss index 91157f1c..cb8b0b06 100644 --- a/src/css/states/main_menu.scss +++ b/src/css/states/main_menu.scss @@ -322,8 +322,7 @@ transform: scale(1.01); } - &.iogLink { - // background: transparenT; + &:not(.boxLink) { align-self: flex-end; justify-self: flex-end; height: unset; diff --git a/src/css/states/preload.scss b/src/css/states/preload.scss index 4a16d387..2c8a302e 100644 --- a/src/css/states/preload.scss +++ b/src/css/states/preload.scss @@ -6,6 +6,29 @@ } } + .changelogDialogEntry { + width: 100%; + flex-direction: column; + text-align: left; + padding: 10px; + box-sizing: border-box; + .version { + @include Heading; + } + .date { + @include PlainText; + &::before { + content: " | "; + } + color: #aaabaf; + } + + .changes { + @include SuperSmallText; + @include S(padding-left, 20px); + } + } + .failureBox { .logo { img { diff --git a/src/js/application.js b/src/js/application.js index bb87b768..58804ee5 100644 --- a/src/js/application.js +++ b/src/js/application.js @@ -37,6 +37,7 @@ import { AboutState } from "./states/about"; import { PlatformWrapperImplElectron } from "./platform/electron/wrapper"; import { StorageImplElectron } from "./platform/electron/storage"; import { MobileWarningState } from "./states/mobile_warning"; +import { ChangelogState } from "./states/changelog"; const logger = createLogger("application"); @@ -165,6 +166,7 @@ export class Application { SettingsState, KeybindingsState, AboutState, + ChangelogState, ]; for (let i = 0; i < states.length; ++i) { diff --git a/src/js/changelog.js b/src/js/changelog.js new file mode 100644 index 00000000..3b3bb229 --- /dev/null +++ b/src/js/changelog.js @@ -0,0 +1,23 @@ +export const CHANGELOG = [ + { + version: "1.0.2", + date: "23.05.2020", + entries: [ + "Introduced changelog", + "Removed 'early access' label because the game isn't actually early access - its in a pretty good state already! (No worries, a lot more updates will follow!)", + "Added a 'Show hint' button which shows a small video for almost all levels to help out", + "Now showing proper descriptions when completing levels, with instructions on what the gained reward does.", + "Show a landing page on mobile devices about the game not being ready to be played on mobile yet", + "Fix painters and mixers being affected by the shape processors upgrade and not the painter one", + "Added 'multiplace' setting which is equivalent to holding SHIFT all the time", + "Added keybindings to zoom in / zoom out", + "Tunnels now also show connection lines to tunnel exits, instead of just tunnel entries", + "Lots of minor fixes and improvements", + ], + }, + { + version: "1.0.1", + date: "21.05.2020", + entries: ["Initial release!"], + }, +]; diff --git a/src/js/core/config.js b/src/js/core/config.js index 69106be0..70f9ee3b 100644 --- a/src/js/core/config.js +++ b/src/js/core/config.js @@ -83,8 +83,8 @@ export const globalConfig = { debug: { /* dev:start */ - fastGameEnter: true, - noArtificialDelays: true, + // fastGameEnter: true, + // noArtificialDelays: true, // disableSavegameWrite: true, // showEntityBounds: true, // showAcceptorEjectors: true, diff --git a/src/js/game/hud/hud.js b/src/js/game/hud/hud.js index bec6c69e..2d317b7f 100644 --- a/src/js/game/hud/hud.js +++ b/src/js/game/hud/hud.js @@ -62,8 +62,6 @@ export class GameHUD { notifications: new HUDNotifications(this.root), settingsMenu: new HUDSettingsMenu(this.root), - tutorialHints: new HUDPartTutorialHints(this.root), - // betaOverlay: new HUDBetaOverlay(this.root), debugInfo: new HUDDebugInfo(this.root), @@ -87,6 +85,9 @@ export class GameHUD { if (IS_DEMO) { this.parts.watermark = new HUDWatermark(this.root); } + if (this.root.app.settings.getAllSettings().offerHints) { + this.parts.tutorialHints = new HUDPartTutorialHints(this.root); + } const frag = document.createDocumentFragment(); for (const key in this.parts) { diff --git a/src/js/game/hud/parts/tutorial_hints.js b/src/js/game/hud/parts/tutorial_hints.js index 3a304479..853d054f 100644 --- a/src/js/game/hud/parts/tutorial_hints.js +++ b/src/js/game/hud/parts/tutorial_hints.js @@ -54,6 +54,15 @@ export class HUDPartTutorialHints extends BaseHUDPart { this.domAttach = new DynamicDomAttach(this.root, this.element); this.currentShownLevel = new TrackedState(this.updateVideoUrl, this); + + this.root.signals.postLoadHook.add(() => { + if (this.root.hubGoals.level === 1) { + this.root.hud.parts.dialogs.showInfo( + T.dialogs.hintDescription.title, + T.dialogs.hintDescription.desc + ); + } + }); } updateVideoUrl(level) { diff --git a/src/js/profile/application_settings.js b/src/js/profile/application_settings.js index 55ce861f..96cbed2f 100644 --- a/src/js/profile/application_settings.js +++ b/src/js/profile/application_settings.js @@ -116,6 +116,7 @@ export const allApplicationSettings = [ }), new BoolSetting("alwaysMultiplace", categoryGame, (app, value) => {}), + new BoolSetting("offerHints", categoryGame, (app, value) => {}), ]; export function getApplicationSettingById(id) { @@ -133,6 +134,7 @@ class SettingsStorage { this.refreshRate = "60"; this.alwaysMultiplace = false; + this.offerHints = true; /** * @type {Object.} @@ -291,9 +293,10 @@ export class ApplicationSettings extends ReadWriteProxy { } getCurrentVersion() { - return 6; + return 7; } + /** @param {{settings: SettingsStorage, version: number}} data */ migrate(data) { // Simply reset before if (data.version < 5) { @@ -307,6 +310,11 @@ export class ApplicationSettings extends ReadWriteProxy { data.version = 6; } + if (data.version < 7) { + data.settings.offerHints = true; + data.version = 7; + } + return ExplainedResult.good(); } } diff --git a/src/js/states/changelog.js b/src/js/states/changelog.js new file mode 100644 index 00000000..498162d3 --- /dev/null +++ b/src/js/states/changelog.js @@ -0,0 +1,45 @@ +import { TextualGameState } from "../core/textual_game_state"; +import { T } from "../translations"; +import { CHANGELOG } from "../changelog"; + +export class ChangelogState extends TextualGameState { + constructor() { + super("ChangelogState"); + } + + getStateHeaderTitle() { + return T.changelog.title; + } + + getMainContentHTML() { + const entries = CHANGELOG; + + let html = ""; + + for (let i = 0; i < entries.length; ++i) { + const entry = entries[i]; + html += ` +
+ ${entry.version} + ${entry.date} +
    + ${entry.entries.map(text => `
  • ${text}
  • `).join("")} +
+
+ `; + } + + return html; + } + + onEnter() { + const links = this.htmlElement.querySelectorAll("a[href]"); + links.forEach(link => { + this.trackClicks( + link, + () => this.app.platformWrapper.openExternalLink(link.getAttribute("href")), + { preventClick: true } + ); + }); + } +} diff --git a/src/js/states/main_menu.js b/src/js/states/main_menu.js index 814afde6..1c9d5010 100644 --- a/src/js/states/main_menu.js +++ b/src/js/states/main_menu.js @@ -77,16 +77,18 @@ export class MainMenuState extends GameState {