Skip to content

Commit d18c7b9

Browse files
committed
Add timeout amount functionality
1 parent 8bba740 commit d18c7b9

10 files changed

Lines changed: 94 additions & 7 deletions

File tree

angular/src/app/observer/observer.component.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,16 @@
227227
loadingIcon="pi pi-sync"
228228
(onClick)="onConnectClick()"
229229
/>
230+
<p-button
231+
fluid
232+
class="self-center"
233+
severity="contrast"
234+
icon="pi pi-save"
235+
(onClick)="saveAllValues()"
236+
pTooltip="Save Without Connecting"
237+
tooltipPosition="top"
238+
showDelay="500"
239+
/>
230240
<p-button
231241
fluid
232242
label="Extras"
@@ -277,6 +287,7 @@
277287
<app-tournamentinfo
278288
id="tournamentinfoPanelId"
279289
[data]="tournamentInfo"
290+
[timeoutInfo]="timeoutInfo"
280291
(validationChanged)="onPanelValidationChanged($event, 'tournamentinfoPanelId')"
281292
></app-tournamentinfo>
282293
</blockable-div>

angular/src/app/observer/observer.component.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,12 @@ export class ObserverComponent implements OnInit {
267267
secret: "",
268268
endTime: 0,
269269
};
270+
271+
protected timeoutInfo: TimeoutInfo = {
272+
max: 2,
273+
left: 2,
274+
right: 2,
275+
};
270276
//#endregion
271277

272278
constructor(
@@ -338,6 +344,13 @@ export class ObserverComponent implements OnInit {
338344
console.log("Playercam session expired, clearing info.");
339345
}
340346
}
347+
348+
const loadedTimeoutInfo = this.localStorageService.getItem<TimeoutInfo>("timeouts");
349+
if (loadedTimeoutInfo) {
350+
this.timeoutInfo = loadedTimeoutInfo;
351+
} else {
352+
this.timeoutInfo = { max: 2, left: 2, right: 2 };
353+
}
341354
}
342355

343356
ngOnInit() {
@@ -417,6 +430,12 @@ export class ObserverComponent implements OnInit {
417430
mapPool.push(this.translateMapInfo(this.rightMap));
418431
}
419432

433+
this.timeoutInfo = {
434+
max: this.timeoutInfo.max,
435+
left: this.timeoutInfo.max,
436+
right: this.timeoutInfo.max,
437+
};
438+
420439
this.electron.processInputs(
421440
this.basicInfo.ingestIp,
422441
this.basicInfo.groupCode,
@@ -447,6 +466,7 @@ export class ObserverComponent implements OnInit {
447466
this.sponsorInfo,
448467
this.watermarkInfo,
449468
this.playercamsInfo,
469+
this.timeoutInfo,
450470
);
451471

452472
this.saveAllValues();
@@ -465,6 +485,7 @@ export class ObserverComponent implements OnInit {
465485
this.localStorageService.setItem("sponsors", this.sponsorInfo);
466486
this.localStorageService.setItem("watermark", this.watermarkInfo);
467487
this.localStorageService.setItem("playercams", this.playercamsInfo);
488+
this.localStorageService.setItem("timeouts", this.timeoutInfo);
468489
}
469490

470491
protected onExtrasClick() {
@@ -712,6 +733,9 @@ export class ObserverComponent implements OnInit {
712733
const temp = this.leftTeamInfo;
713734
this.leftTeamInfo = this.rightTeamInfo;
714735
this.rightTeamInfo = temp;
736+
const tempSeeding = this.seriesInfo.seedingLeft;
737+
this.seriesInfo.seedingLeft = this.seriesInfo.seedingRight;
738+
this.seriesInfo.seedingRight = tempSeeding;
715739
}
716740

717741
copyToClipboardClick() {
@@ -804,6 +828,12 @@ export type PlayercamsInfo = {
804828
endTime: number;
805829
};
806830

831+
export type TimeoutInfo = {
832+
max: number;
833+
left: number;
834+
right: number;
835+
};
836+
807837
export type SponsorInfo = {
808838
enabled: boolean;
809839
duration: number;

angular/src/app/services/electron.service.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export class ElectronService {
4040
sponsorInfo: any,
4141
watermarkInfo: any,
4242
playercamsInfo: any,
43+
timeoutInfo: any,
4344
) {
4445
this.api.processInputs(
4546
ingestIp,
@@ -55,6 +56,7 @@ export class ElectronService {
5556
sponsorInfo,
5657
watermarkInfo,
5758
playercamsInfo,
59+
timeoutInfo,
5860
);
5961
}
6062

angular/src/app/tournamentinfo/tournamentinfo.component.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,31 @@ <h1 class="text-color text-xl font-bold">Tournament Info</h1>
7171
</p-inputnumber>
7272
<label for="timeoutDurationInput">Timeout Duration (seconds)</label>
7373
</p-floatlabel>
74+
75+
<p-floatlabel variant="on" class="mb-2">
76+
<p-inputnumber
77+
fluid
78+
id="timeoutCountInput"
79+
[showButtons]="true"
80+
buttonLayout="horizontal"
81+
inputId="horizontal"
82+
spinnerMode="horizontal"
83+
[(ngModel)]="timeoutInfo.max"
84+
(ngModelChange)="runValidation()"
85+
[step]="1"
86+
value="2"
87+
min="0"
88+
max="10"
89+
>
90+
<ng-template #incrementbuttonicon>
91+
<span class="pi pi-plus"></span>
92+
</ng-template>
93+
<ng-template #decrementbuttonicon>
94+
<span class="pi pi-minus"></span>
95+
</ng-template>
96+
</p-inputnumber>
97+
<label for="timeoutCountInput">Timeout Count</label>
98+
</p-floatlabel>
7499
</div>
75100

76101
<!-- These are supposed to be visible, with the logo taking up 2/6 and the backdrop taking up 4/6 but I can't manage to make it work properly right now -->

angular/src/app/tournamentinfo/tournamentinfo.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { FloatLabelModule } from "primeng/floatlabel";
55
import { InputNumberModule } from "primeng/inputnumber";
66
import { InputTextModule } from "primeng/inputtext";
77
import { ToggleSwitchModule } from "primeng/toggleswitch";
8-
import { TournamentInfo } from "../observer/observer.component";
8+
import { TimeoutInfo, TournamentInfo } from "../observer/observer.component";
99
import { Validatable, ValidationState } from "../services/validation.service";
1010
import { PopoverModule } from "primeng/popover";
1111

@@ -27,6 +27,9 @@ export class TournamentinfoComponent implements Validatable, AfterContentInit {
2727
@Input({ required: true })
2828
data!: TournamentInfo;
2929

30+
@Input({ required: true })
31+
timeoutInfo!: TimeoutInfo;
32+
3033
ngAfterContentInit(): void {
3134
this.runValidation();
3235
}
@@ -38,6 +41,7 @@ export class TournamentinfoComponent implements Validatable, AfterContentInit {
3841
valid = this.logoImageError == false && valid;
3942
valid = this.backdropImageError == false && valid;
4043
valid = this.data.timeoutDuration != null && valid;
44+
valid = this.timeoutInfo.max != null && valid;
4145

4246
this.validationChanged.emit(valid ? ValidationState.VALID : ValidationState.INVALID);
4347
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"name": "Purple Shark UG (haftungsbeschränkt)",
55
"url": "https://www.valospectra.com"
66
},
7-
"version": "0.2.46",
7+
"version": "0.3.1",
88
"description": "https://www.valospectra.com",
99
"private": true,
1010
"main": "./app/main.js",

src/main.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
GEPStatus,
1212
ISeedingInfo,
1313
ISeriesInfo,
14+
ITimeoutInfo,
1415
ITournamentInfo,
1516
PlayercamsInfo,
1617
SponsorInfo,
@@ -56,10 +57,10 @@ let win!: Electron.Main.BrowserWindow;
5657
let tray: Tray | null = null;
5758
let traySetting: boolean = getTraySetting();
5859
let iconPathGlobal = "";
59-
let runAtStartupSetting: { enabled: boolean; startMinimized: boolean, aux: boolean } = {
60+
let runAtStartupSetting: { enabled: boolean; startMinimized: boolean; aux: boolean } = {
6061
enabled: false,
6162
startMinimized: false,
62-
aux: false
63+
aux: false,
6364
};
6465

6566
const VALORANT_ID = 21640;
@@ -279,7 +280,7 @@ app.whenReady().then(async () => {
279280
openAtLogin: !isDev() && startup.enabled,
280281
enabled: !isDev() && startup.enabled,
281282
openAsHidden: !isDev() && startup.enabled && startup.startMinimized,
282-
args: (!isDev() && startup.aux) ? ["--auxiliary"] : []
283+
args: !isDev() && startup.aux ? ["--auxiliary"] : [],
283284
});
284285

285286
createWindow();
@@ -395,6 +396,7 @@ function processInputs(
395396
sponsorInfo: SponsorInfo,
396397
watermarkInfo: WatermarkInfo,
397398
playercamsInfo: PlayercamsInfo,
399+
timeoutInfo: ITimeoutInfo,
398400
) {
399401
const webContents = event.sender;
400402
const win = BrowserWindow.fromWebContents(webContents)!;
@@ -516,6 +518,7 @@ function processInputs(
516518
sponsorInfo,
517519
watermarkInfo,
518520
playercamsInfo,
521+
timeoutInfo,
519522
win,
520523
);
521524
}
@@ -877,11 +880,11 @@ function setStartupSettings(_event: any, enabled: boolean, startMinimized: boole
877880
openAtLogin: !isDev() && enabled,
878881
enabled: !isDev() && enabled,
879882
openAsHidden: !isDev() && enabled && startMinimized,
880-
args: (!isDev() && enabled && aux) ? ["--auxiliary"] : []
883+
args: !isDev() && enabled && aux ? ["--auxiliary"] : [],
881884
});
882885
}
883886

884-
function getStartupSettings(): { enabled: boolean; startMinimized: boolean, aux: boolean } {
887+
function getStartupSettings(): { enabled: boolean; startMinimized: boolean; aux: boolean } {
885888
const retrieved = storage.getSync("startupSettings");
886889
if (retrieved == null || Object.keys(retrieved).length == 0) {
887890
return { enabled: false, startMinimized: false, aux: false };

src/preload.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ contextBridge.exposeInMainWorld("electronAPI", {
1515
sponsorInfo: any,
1616
watermarkInfo: any,
1717
playercamsInfo: any,
18+
timeoutInfo: any,
1819
) =>
1920
ipcRenderer.send(
2021
"process-inputs",
@@ -31,6 +32,7 @@ contextBridge.exposeInMainWorld("electronAPI", {
3132
sponsorInfo,
3233
watermarkInfo,
3334
playercamsInfo,
35+
timeoutInfo,
3436
),
3537
processAuxInputs: (ingestIp: any, name: any) =>
3638
ipcRenderer.send("process-aux-inputs", ingestIp, name),

src/services/connectorService.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
IFormattedData,
1818
ISeedingInfo,
1919
ISeriesInfo,
20+
ITimeoutInfo,
2021
ITournamentInfo,
2122
PlayercamsInfo,
2223
SocketChannels,
@@ -85,6 +86,7 @@ export class ConnectorService {
8586
sponsorInfo: SponsorInfo,
8687
watermarkInfo: WatermarkInfo,
8788
playercamsInfo: PlayercamsInfo,
89+
timeoutInfo: ITimeoutInfo,
8890
win: Electron.Main.BrowserWindow,
8991
) {
9092
if (RegExp("(http|https)://[^/]+:[0-9]+").test(ingestIp)) {
@@ -191,6 +193,7 @@ export class ConnectorService {
191193
seedingInfo: seedingInfo,
192194
tournamentInfo: tournamentInfo,
193195
timeoutDuration: tournamentInfo.timeoutDuration,
196+
timeoutCounter: timeoutInfo,
194197
sponsorInfo: sponsorInfo,
195198
watermarkInfo: watermarkInfo,
196199
playercamsInfo: playercamsInfo,

src/services/formattingService.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ export interface IToolsData {
289289
seedingInfo: ISeedingInfo;
290290
tournamentInfo: ITournamentInfo;
291291
timeoutDuration: number;
292+
timeoutCounter: ITimeoutInfo;
292293
sponsorInfo: SponsorInfo;
293294
watermarkInfo: WatermarkInfo;
294295
playercamsInfo: PlayercamsInfo;
@@ -313,6 +314,12 @@ export type ITournamentInfo = {
313314
timeoutDuration: number;
314315
};
315316

317+
export type ITimeoutInfo = {
318+
max: number;
319+
left: number;
320+
right: number;
321+
};
322+
316323
export type SponsorInfo = {
317324
enabled: boolean;
318325
duration: number;

0 commit comments

Comments
 (0)