From 93870bbd78ac012efe33d7f008314c9c0e855bd7 Mon Sep 17 00:00:00 2001 From: Nicklas Ronge Date: Wed, 8 Jul 2020 20:40:32 +0200 Subject: [PATCH] - added a new hotkey (default on F10) to manually capture replays --- CHANGELOG.md | 1 + manifest.json | 7 ++- overlay.babel | 53 +++++++++++++++++++ src/app/core/config/hotkey.ts | 3 +- .../settings-support.component.html | 28 +++++----- .../settings-support.component.scss | 3 +- .../settings-window.component.scss | 2 +- .../replay-settings.component.html | 48 +++++++++++++++++ .../modules/replay/replay-feature-settings.ts | 3 ++ src/app/modules/replay/replay.module.ts | 32 +++++++++-- .../component/header/header.component.scss | 13 ++--- src/assets/i18n/english.json | 1 + src/assets/i18n/french.json | 1 + src/assets/i18n/german.json | 1 + src/assets/i18n/korean.json | 1 + src/assets/i18n/polish.json | 1 + src/assets/i18n/portuguese.json | 1 + src/assets/i18n/russian.json | 1 + src/assets/i18n/simplified-chinese.json | 1 + src/assets/i18n/spanish.json | 1 + src/assets/i18n/thai.json | 1 + src/assets/i18n/traditional-chinese.json | 1 + 22 files changed, 171 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd0181b2..d60034ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## 1.0.8 (2020-07-05) +- added a new hotkey (default on F10) to manually capture replays - fixed an issue at the market type filter resulting in a unknown category error ## 1.0.7 (2020-07-01) diff --git a/manifest.json b/manifest.json index 0f7f6164..63165a28 100644 --- a/manifest.json +++ b/manifest.json @@ -270,9 +270,14 @@ "action-type": "custom" }, "misc-stash-highlight": { - "title": "Highlight Item in Stash", + "title": "Highlight a item in stash", "action-type": "custom", "default": "Alt+F" + }, + "replay-manually": { + "title": "Capture a replay manually", + "action-type": "custom", + "default": "F10" } }, "externally_connectable": { diff --git a/overlay.babel b/overlay.babel index 8cbe763b..cdc0fffb 100644 --- a/overlay.babel +++ b/overlay.babel @@ -11904,6 +11904,59 @@ + + manually + false + + + + + + de-DE + false + + + en-US + false + + + es-ES + false + + + fr-FR + false + + + ko-KR + false + + + pl-PL + false + + + pt-BR + false + + + ru-RU + false + + + th-TH + false + + + zh-CHS + false + + + zh-CHT + false + + + name false diff --git a/src/app/core/config/hotkey.ts b/src/app/core/config/hotkey.ts index bf741f3e..97dd1855 100644 --- a/src/app/core/config/hotkey.ts +++ b/src/app/core/config/hotkey.ts @@ -16,5 +16,6 @@ export enum Hotkey { Bookmark4 = 'bookmark4', Bookmark5 = 'bookmark5', Bookmark6 = 'bookmark6', - MiscStashHighlight = 'misc-stash-highlight' + MiscStashHighlight = 'misc-stash-highlight', + ReplayManually = 'replay-manually' } diff --git a/src/app/layout/component/settings-support/settings-support.component.html b/src/app/layout/component/settings-support/settings-support.component.html index 9692564e..afcb0866 100644 --- a/src/app/layout/component/settings-support/settings-support.component.html +++ b/src/app/layout/component/settings-support/settings-support.component.html @@ -1,26 +1,28 @@
-
+
+ +

{{'support.developer.text' | translate}}

+
+ +
+
+
+
+
+

{{'support.question.text' | translate}}

- -
-
- -

{{'support.developer.text' | translate}}

-
- -
-
-
\ No newline at end of file diff --git a/src/app/layout/component/settings-support/settings-support.component.scss b/src/app/layout/component/settings-support/settings-support.component.scss index 43880831..fd216ab0 100644 --- a/src/app/layout/component/settings-support/settings-support.component.scss +++ b/src/app/layout/component/settings-support/settings-support.component.scss @@ -3,8 +3,7 @@ p { color: $label-color; font-size: 13px; - margin: 0 0 $gutter 0; - height: 40px; + margin: 0 0 $gutter * 2 0; } button { diff --git a/src/app/layout/window/settings-window/settings-window.component.scss b/src/app/layout/window/settings-window/settings-window.component.scss index 8dcc324f..cc605cff 100644 --- a/src/app/layout/window/settings-window/settings-window.component.scss +++ b/src/app/layout/window/settings-window/settings-window.component.scss @@ -1,7 +1,7 @@ @import "../../../../styles/variables"; .tab-content { - padding: 12px 12px 0px 12px; + padding: 12px; } ::ng-deep { diff --git a/src/app/modules/replay/component/replay-settings/replay-settings.component.html b/src/app/modules/replay/component/replay-settings/replay-settings.component.html index fc3d6c12..3a467921 100644 --- a/src/app/modules/replay/component/replay-settings/replay-settings.component.html +++ b/src/app/modules/replay/component/replay-settings/replay-settings.component.html @@ -1,3 +1,51 @@ + +
+
+ + {{'replay.capture' | translate}} + +
+
+
+
+ + {{'app.hotkey' | translate}} + + + keyboard + + +
+
+
+
+
+ +
+ + +
+
+
+
+
+ +
+ + +
+
+
+
+
+
diff --git a/src/app/modules/replay/replay-feature-settings.ts b/src/app/modules/replay/replay-feature-settings.ts index 0e68ea88..56acbe4e 100644 --- a/src/app/modules/replay/replay-feature-settings.ts +++ b/src/app/modules/replay/replay-feature-settings.ts @@ -1,6 +1,9 @@ import { FeatureSettings } from '@app/feature'; export interface ReplayFeatureSettings extends FeatureSettings { + replayCaptureManually?: boolean; + replayCaptureManuallyPastDuration?: number; + replayCaptureManuallyFutureDuration?: number; replayCaptureDeath?: boolean; replayCaptureDeathPastDuration?: number; replayCaptureDeathFutureDuration?: number; diff --git a/src/app/modules/replay/replay.module.ts b/src/app/modules/replay/replay.module.ts index ece922d1..523d06f4 100644 --- a/src/app/modules/replay/replay.module.ts +++ b/src/app/modules/replay/replay.module.ts @@ -1,4 +1,5 @@ import { NgModule } from '@angular/core'; +import { Hotkey } from '@app/config'; import { Feature, FeatureConfig, FeatureModule, FEATURE_MODULES } from '@app/feature'; import { NotificationService } from '@app/notification'; import { GameEvent, RunningGameInfo } from '@app/odk'; @@ -35,25 +36,46 @@ export class ReplayModule implements FeatureModule { replayCaptureDeathPastDuration: 8, replayCaptureKill: false, replayCaptureKillFutureDuration: 3, - replayCaptureKillPastDuration: 5 + replayCaptureKillPastDuration: 5, + replayCaptureManually: false, + replayCaptureManuallyFutureDuration: 0, + replayCaptureManuallyPastDuration: 10, } }; return config; } public getFeatures(): Feature[] { - const features: Feature[] = []; + const features: Feature[] = [ + { hotkey: Hotkey.ReplayManually } + ]; return features; } public onSettingsChange(settings: ReplayFeatureSettings): void { - const shouldCapture = settings.replayCaptureDeath || settings.replayCaptureKill; + const shouldCapture = settings.replayCaptureManually || settings.replayCaptureDeath || settings.replayCaptureKill; if (shouldCapture !== this.shouldCapture) { this.shouldCapture = shouldCapture; this.updateCapturing(); } } + public onKeyPressed(hotkey: Hotkey, settings: ReplayFeatureSettings): void { + switch (hotkey) { + case Hotkey.ReplayManually: + if (settings.replayCaptureManually) { + this.replay.capture( + settings.replayCaptureManuallyPastDuration, + settings.replayCaptureManuallyFutureDuration + ).subscribe(() => { }, error => { + console.warn('Could not capture a manually triggered event.', error); + this.notification.show('replay.capture-error'); + }); + } + break; + } + } + public onGameEvent(event: GameEvent, settings: ReplayFeatureSettings): void { switch (event?.name) { case 'death': @@ -82,12 +104,12 @@ export class ReplayModule implements FeatureModule { } public onInfo(info: RunningGameInfo, settings: ReplayFeatureSettings): void { - const shouldCapture = settings.replayCaptureDeath || settings.replayCaptureKill; + const shouldCapture = settings.replayCaptureManually || settings.replayCaptureDeath || settings.replayCaptureKill; const { isRunning } = info; if (shouldCapture !== this.shouldCapture || isRunning !== this.isRunning) { this.isRunning = info.isRunning; - this.shouldCapture = settings.replayCaptureDeath || settings.replayCaptureKill; + this.shouldCapture = shouldCapture; this.updateCapturing(); } } diff --git a/src/app/shared/module/odk/component/header/header.component.scss b/src/app/shared/module/odk/component/header/header.component.scss index a1ebca4b..157c09d5 100644 --- a/src/app/shared/module/odk/component/header/header.component.scss +++ b/src/app/shared/module/odk/component/header/header.component.scss @@ -119,27 +119,20 @@ $border-color: #1a1a1a; .content { width: 100%; - - &:not(.inline) { - &.has-footer { - height: calc(100% - #{$footer-size} - #{$header-size}); - } - - height: calc(100% - #{$header-size}); - } + height: 100%; &.fixed { padding: $header-size 0 0 0; &.has-footer { - padding: $header-size 0 $footer-size - 1px 0; + padding: $header-size 0 $footer-size 0; } &.reverse { padding: 0 0 $header-size 0; &.has-footer { - padding: $footer-size 0 $header-size - 1px 0; + padding: $footer-size 0 $header-size 0; } } } diff --git a/src/assets/i18n/english.json b/src/assets/i18n/english.json index 04ee0e68..b1a7746f 100644 --- a/src/assets/i18n/english.json +++ b/src/assets/i18n/english.json @@ -371,6 +371,7 @@ "death": "Death event", "future-duration": "Future duration", "kill": "Kill event", + "manually": "Manually", "name": "Replay", "past-duration": "Past duration", "start-error": "The events capturing could not be started.", diff --git a/src/assets/i18n/french.json b/src/assets/i18n/french.json index 8a1e790b..d9831e66 100644 --- a/src/assets/i18n/french.json +++ b/src/assets/i18n/french.json @@ -367,6 +367,7 @@ "death": "Événement de décès", "future-duration": "Durée future", "kill": "Tuer l'événement", + "manually": "Manuellement", "name": "Rejouer", "past-duration": "Durée passée", "start-error": "La capture des événements n'a pas pu démarrer.", diff --git a/src/assets/i18n/german.json b/src/assets/i18n/german.json index 7127bd89..72393878 100644 --- a/src/assets/i18n/german.json +++ b/src/assets/i18n/german.json @@ -367,6 +367,7 @@ "death": "Todesereignis", "future-duration": "Zukünftige Dauer", "kill": "Tötungsereignis", + "manually": "Manuell", "name": "Wiederholung", "past-duration": "Vergangene Dauer", "start-error": "Die Ereigniserfassung konnte nicht gestartet werden.", diff --git a/src/assets/i18n/korean.json b/src/assets/i18n/korean.json index d262c3b8..9f78fa3f 100644 --- a/src/assets/i18n/korean.json +++ b/src/assets/i18n/korean.json @@ -367,6 +367,7 @@ "death": "죽음의 사건", "future-duration": "향후 기간", "kill": "킬 이벤트", + "manually": "수동으로", "name": "다시 하다", "past-duration": "지난 기간", "start-error": "이벤트 캡처를 시작할 수 없습니다.", diff --git a/src/assets/i18n/polish.json b/src/assets/i18n/polish.json index 2906141c..23dfa2d4 100644 --- a/src/assets/i18n/polish.json +++ b/src/assets/i18n/polish.json @@ -367,6 +367,7 @@ "death": "Zdarzenie śmierci", "future-duration": "Przyszły czas trwania", "kill": "Zabij zdarzenie", + "manually": "ręcznie", "name": "Powtórna rozgrywka", "past-duration": "Czas przeszły", "start-error": "Nie można rozpocząć przechwytywania zdarzeń.", diff --git a/src/assets/i18n/portuguese.json b/src/assets/i18n/portuguese.json index d85aaf9e..da3bb759 100644 --- a/src/assets/i18n/portuguese.json +++ b/src/assets/i18n/portuguese.json @@ -367,6 +367,7 @@ "death": "Evento de morte", "future-duration": "Duração futura", "kill": "Matar evento", + "manually": "Manualmente", "name": "Repetir", "past-duration": "Duração passada", "start-error": "A captura de eventos não pôde ser iniciada.", diff --git a/src/assets/i18n/russian.json b/src/assets/i18n/russian.json index b759f319..6df49e0d 100644 --- a/src/assets/i18n/russian.json +++ b/src/assets/i18n/russian.json @@ -367,6 +367,7 @@ "death": "Событие смерти", "future-duration": "Будущая продолжительность", "kill": "Убить событие", + "manually": "вручную", "name": "переигровка", "past-duration": "Прошлая продолжительность", "start-error": "Захват событий не может быть начат.", diff --git a/src/assets/i18n/simplified-chinese.json b/src/assets/i18n/simplified-chinese.json index 032352b1..92451a4e 100644 --- a/src/assets/i18n/simplified-chinese.json +++ b/src/assets/i18n/simplified-chinese.json @@ -367,6 +367,7 @@ "death": "死亡事件", "future-duration": "未来持续时间", "kill": "杀死事件", + "manually": "手动地", "name": "重播", "past-duration": "过去的持续时间", "start-error": "无法开始事件捕获。", diff --git a/src/assets/i18n/spanish.json b/src/assets/i18n/spanish.json index 97743271..1aa72dc3 100644 --- a/src/assets/i18n/spanish.json +++ b/src/assets/i18n/spanish.json @@ -367,6 +367,7 @@ "death": "Evento de muerte", "future-duration": "Duración futura", "kill": "Evento de muerte", + "manually": "a mano", "name": "Repetición", "past-duration": "Duración pasada", "start-error": "No se pudo iniciar la captura de eventos.", diff --git a/src/assets/i18n/thai.json b/src/assets/i18n/thai.json index 7257b59f..5b4f678b 100644 --- a/src/assets/i18n/thai.json +++ b/src/assets/i18n/thai.json @@ -367,6 +367,7 @@ "death": "เหตุการณ์ความตาย", "future-duration": "อนาคตระยะเวลา", "kill": "ฆ่าเหตุการณ์", + "manually": "ด้วยมือ", "name": "เล่นใหม่", "past-duration": "ระยะเวลาที่ผ่านมา", "start-error": "ไม่สามารถเริ่มต้นการจับภาพเหตุการณ์", diff --git a/src/assets/i18n/traditional-chinese.json b/src/assets/i18n/traditional-chinese.json index 8e59840a..e36a57e4 100644 --- a/src/assets/i18n/traditional-chinese.json +++ b/src/assets/i18n/traditional-chinese.json @@ -367,6 +367,7 @@ "death": "死亡事件", "future-duration": "未來幾秒內", "kill": "擊殺事件", + "manually": "手動地", "name": "重播", "past-duration": "過去幾秒內", "start-error": "無法開始事件獲取。",