diff --git a/src/css/ingame_hud/dialogs.scss b/src/css/ingame_hud/dialogs.scss index d72265e7..b7743bb1 100644 --- a/src/css/ingame_hud/dialogs.scss +++ b/src/css/ingame_hud/dialogs.scss @@ -199,7 +199,8 @@ color: #fff; } - &.timedButton { + &.timedButton, + &.timedButtonSlow { pointer-events: none; cursor: default; position: relative; @@ -214,13 +215,27 @@ content: " "; display: inline-block; background: rgba(#fff, 0.6); - @include InlineAnimation(5s linear) { - 0% { - width: 100%; - } - 100% { - width: 0%; - } + } + } + + &.timedButton::after { + @include InlineAnimation(5s linear) { + 0% { + width: 100%; + } + 100% { + width: 0%; + } + } + } + + &.timedButtonSlow::after { + @include InlineAnimation(10s linear) { + 0% { + width: 100%; + } + 100% { + width: 0%; } } } diff --git a/src/js/changelog.js b/src/js/changelog.js index f079cafa..00c4ec5f 100644 --- a/src/js/changelog.js +++ b/src/js/changelog.js @@ -1,4 +1,12 @@ export const CHANGELOG = [ + { + version: "1.1.9", + date: "02.07.2020", + entries: [ + "There are now notifications every 15 minutes in the demo version to buy the full version (For further details and the reason, check the #surveys channel in the discord)", + "I'm still working on the wires update, I hope to release it mid july!", + ], + }, { version: "1.1.18", date: "27.06.2020", diff --git a/src/js/core/modal_dialog_elements.js b/src/js/core/modal_dialog_elements.js index 0902a193..47c03616 100644 --- a/src/js/core/modal_dialog_elements.js +++ b/src/js/core/modal_dialog_elements.js @@ -151,6 +151,7 @@ export class Dialog { const params = (rawParams || "").split("/"); const useTimeout = params.indexOf("timeout") >= 0; + const useTimeoutSlow = params.indexOf("timeoutSlow") >= 0; const isEnter = params.indexOf("enter") >= 0; const isEscape = params.indexOf("escape") >= 0; @@ -167,6 +168,16 @@ export class Dialog { }, 5000); this.timeouts.push(timeout); } + + if (useTimeoutSlow) { + button.classList.add("timedButtonSlow"); + const timeout = setTimeout(() => { + button.classList.remove("timedButtonSlow"); + arrayDeleteValue(this.timeouts, timeout); + }, 10000); + this.timeouts.push(timeout); + } + if (isEnter || isEscape) { // if (this.app.settings.getShowKeyboardShortcuts()) { // Show keybinding diff --git a/src/js/game/hud/hud.js b/src/js/game/hud/hud.js index 1bbc2041..3de09aff 100644 --- a/src/js/game/hud/hud.js +++ b/src/js/game/hud/hud.js @@ -38,6 +38,7 @@ import { HUDColorBlindHelper } from "./parts/color_blind_helper"; import { HUDShapeViewer } from "./parts/shape_viewer"; import { HUDWiresOverlay } from "./parts/wires_overlay"; import { HUDChangesDebugger } from "./parts/debug_changes"; +import { HUDStandaloneReminder } from "./parts/standalone_reminder"; export class GameHUD { /** @@ -103,6 +104,7 @@ export class GameHUD { if (IS_DEMO) { this.parts.watermark = new HUDWatermark(this.root); + this.parts.standaloneReminder = new HUDStandaloneReminder(this.root); } if (G_IS_DEV && globalConfig.debug.renderChanges) { diff --git a/src/js/game/hud/parts/standalone_reminder.js b/src/js/game/hud/parts/standalone_reminder.js new file mode 100644 index 00000000..238fe20c --- /dev/null +++ b/src/js/game/hud/parts/standalone_reminder.js @@ -0,0 +1,40 @@ +import { BaseHUDPart } from "../base_hud_part"; +import { T } from "../../../translations"; +import { THIRDPARTY_URLS } from "../../../core/config"; + +// How often to show the dialog +const DIALOG_INTERVAL = 15; + +// When to start showing the dialogs +const DIALOG_START_INTERVAL = 15; + +export class HUDStandaloneReminder extends BaseHUDPart { + initialize() { + this.lastMinutesHintShown = DIALOG_START_INTERVAL - DIALOG_INTERVAL; + } + + getMinutesPlayed() { + return Math.floor(this.root.time.now() / 60.0); + } + + showHint() { + this.root.app.analytics.trackUiClick("demonotice_show"); + const { getStandalone } = this.root.hud.parts.dialogs.showWarning( + T.dialogs.buyFullVersion.title, + T.dialogs.buyFullVersion.desc.replace("", "" + this.getMinutesPlayed()), + ["later:bad:timeoutSlow", "getStandalone:good"] + ); + getStandalone.add(() => { + this.root.app.analytics.trackUiClick("demonotice_click"); + this.root.app.platformWrapper.openExternalLink(THIRDPARTY_URLS.standaloneStorePage); + }); + } + + update() { + const minutesPlayed = this.getMinutesPlayed(); + if (this.lastMinutesHintShown + DIALOG_INTERVAL < minutesPlayed) { + this.lastMinutesHintShown = minutesPlayed; + this.showHint(); + } + } +} diff --git a/translations/base-en.yaml b/translations/base-en.yaml index 930e5f29..60c2c198 100644 --- a/translations/base-en.yaml +++ b/translations/base-en.yaml @@ -268,6 +268,11 @@ dialogs: title: Export screenshot desc: You requested to export your base as a screenshot. Please note that this can be quite slow for a big base and even crash your game! + buyFullVersion: + title: Enjoy the game? + desc: >- + You are already playing the demo for minutes! Please get the standalone on steam for all features and to support me!

PS: It has a dark mode, and you can import your savegame to continue where you left! :P + ingame: # This is shown in the top left corner and displays useful keybindings in # every situation diff --git a/version b/version index b0c8928e..3a21f22a 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.1.18 \ No newline at end of file +1.1.19 \ No newline at end of file