From 7c6dbd14f27583b2817629d68d50e7ce38625fa5 Mon Sep 17 00:00:00 2001 From: Maroxy Date: Sat, 11 Dec 2021 12:39:19 +0100 Subject: [PATCH] Add setting fields and configure them when opening window --- public/html/settings.html | 21 +++++++++++++++++++++ src/sass/components.sass | 16 ++++++++++++++++ src/ts/lib/LauncherLib.ts | 8 ++++++++ src/ts/settings.ts | 9 ++++++++- 4 files changed, 53 insertions(+), 1 deletion(-) diff --git a/public/html/settings.html b/public/html/settings.html index 2494de4..89a49a7 100644 --- a/public/html/settings.html +++ b/public/html/settings.html @@ -313,6 +313,27 @@ diff --git a/src/sass/components.sass b/src/sass/components.sass index c2aebc9..aceb185 100644 --- a/src/sass/components.sass +++ b/src/sass/components.sass @@ -12,6 +12,22 @@ p, span, div color: map.get($theme-map, "text") + /* Text Field + + .text-field + width: calc(100% - 28px) + border-radius: 16px + padding: 8px + background-color: map.get($theme-map, "background2") + color: map.get($theme-map, "text") + border: unset + outline: none + font-size: 15px + + &:placeholder + color: map.get($theme-map, "text") + + /* Directory selector .directory-selector diff --git a/src/ts/lib/LauncherLib.ts b/src/ts/lib/LauncherLib.ts index 0488a69..dfef4ba 100644 --- a/src/ts/lib/LauncherLib.ts +++ b/src/ts/lib/LauncherLib.ts @@ -34,6 +34,14 @@ const config = new store ({ patch: null, // Installed patch info ({ version, state } - related game's version and patch's state) runner: null, // Selected runner ({ folder, executable }) rpc: false, // Discord RPC + rpcsettings: { + launcher: 'Preparing to launch', + ingame: { + details: 'In-Game', + state: null, + elapsed: true + } + }, playtime: 0, // Number of seconds user spent in game hud: 'none', // none / dxvk / mangohud shaders: 'none', // none / shader's folder diff --git a/src/ts/settings.ts b/src/ts/settings.ts index 45219aa..105b955 100644 --- a/src/ts/settings.ts +++ b/src/ts/settings.ts @@ -212,9 +212,16 @@ $(() => { $('#discord-rpc-conf').toggle(); $('#discord-rpc-conf-btn').toggle(); + if (LauncherLib.getConfig('rpcsettings.ingame.elapsed')) + $('#rpc-game-elapsed').addClass('checkbox-active'); + + $('#rpc-game-state').attr('placeholder', LauncherLib.getConfig('rpcsettings.ingame.state')); + $('#rpc-game-details').attr('placeholder', LauncherLib.getConfig('rpcsettings.ingame.details')); + $('#rpc-launch-details').attr('placeholder', LauncherLib.getConfig('rpcsettings.launcher')); + $('#discord-rpc').on('classChange', () => { LauncherLib.updateConfig('rpc', $('#discord-rpc').hasClass('checkbox-active')); - + // Toggles the RPC Settings (hide/show) $('#discord-rpc-conf').toggle(); $('#discord-rpc-conf-btn').toggle();