Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ThorConzales
committed
Sep 5, 2017
1 parent
31a7b42
commit c933822
Showing
13 changed files
with
109 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 3 additions & 6 deletions
9
Client/Client/src/app/settings/general-page/general-page.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
export * from './overlay-page.component'; |
28 changes: 28 additions & 0 deletions
28
Client/Client/src/app/settings/overlay-page/overlay-page.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,28 @@ | |||
<center-spinner *ngIf="loading"></center-spinner> | |||
<div *ngIf="!loading" style="padding: 10px;"> | |||
<md-slide-toggle style="display: block;" color="primary" [checked]="conf.showOverlay" [(ngModel)]="conf.showOverlay">Show overlay</md-slide-toggle> | |||
<md-slide-toggle style="display: block; margin-top: 10px;" color="primary" [checked]="conf.showOverlayWhenFocused" [(ngModel)]="conf.showOverlayWhenFocused">Show overlay only when the game is focused</md-slide-toggle> | |||
<md-slide-toggle style="display: block; margin-top: 10px;" color="primary" [checked]="conf.showOverlayWhenInLobby" [(ngModel)]="conf.showOverlayWhenInLobby">Show overlay only when you are in lobby (<strong>you must start the session before joining or hosting a lobby, otherwhise overlay won't be shown</strong>)</md-slide-toggle> | |||
<div style="font-size: 20px; margin-top: 10px; margin-bottom: 5px;">Overlay Position</div> | |||
<div style="display: inline-block; width: 200px;"> | |||
<div style="font-size: 16px; margin-bottom: 5px;">When game is active</div> | |||
<md-input-container style="display: inline-block; width: 50px;"> | |||
<input mdInput="number" placeholder="Top" [value]="overlayActiveTopPosition" [(ngModel)]="overlayActiveTopPosition"> | |||
</md-input-container> | |||
<md-input-container style="display: inline-block; width: 50px;"> | |||
<input mdInput="number" placeholder="Left" [value]="overlayActiveLeftPosition" [(ngModel)]="overlayActiveLeftPosition"> | |||
</md-input-container> | |||
</div> | |||
<div style="display: inline-block; width: 200px;"> | |||
<div style="font-size: 16px; margin-bottom: 5px;">When game is inactive</div> | |||
<md-input-container style="display: inline-block; width: 50px;"> | |||
<input mdInput="number" placeholder="Top" [value]="overlayInactiveTopPosition" [(ngModel)]="overlayInactiveTopPosition"> | |||
</md-input-container> | |||
<md-input-container style="display: inline-block; width: 50px;"> | |||
<input mdInput="number" placeholder="Left" [value]="overlayInactiveLeftPosition" [(ngModel)]="overlayInactiveLeftPosition"> | |||
</md-input-container> | |||
</div> | |||
<div style="text-align: center;"> | |||
<button md-raised-button class="primaryButton" (click)="save()">Save</button> | |||
</div> | |||
</div> |
46 changes: 46 additions & 0 deletions
46
Client/Client/src/app/settings/overlay-page/overlay-page.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,46 @@ | |||
import { Component, OnInit } from '@angular/core'; | |||
|
|||
import { Configuration } from '../../app.models'; | |||
import { ConfigurationService, AppService, TrackingService } from '../../shared'; | |||
|
|||
@Component({ | |||
selector: 'overlay-page', | |||
templateUrl: 'overlay-page.component.html' | |||
}) | |||
export class OverlayPageComponent implements OnInit { | |||
public loading = false; | |||
public conf: Configuration; | |||
public overlayActiveTopPosition: number; | |||
public overlayActiveLeftPosition: number; | |||
public overlayInactiveTopPosition: number; | |||
public overlayInactiveLeftPosition: number; | |||
|
|||
constructor(private configurationService: ConfigurationService, private appService: AppService, private trackingService: TrackingService) { | |||
} | |||
|
|||
public ngOnInit() { | |||
this.readConfiguration(); | |||
} | |||
|
|||
private readConfiguration() { | |||
this.loading = true; | |||
this.configurationService.getConfiguration(() => { | |||
this.conf = this.configurationService.configuration; | |||
this.loading = false; | |||
}); | |||
} | |||
|
|||
public save() { | |||
this.loading = true; | |||
this.configurationService.configuration = this.conf; | |||
this.configurationService.saveConfiguration().subscribe(() => { | |||
this.appService.toastSuccess("Settings saved."); | |||
this.readConfiguration(); | |||
this.trackingService.sendEvent("Settings", "OverlaySettingsSaved"); | |||
}, error => { | |||
this.loading = false; | |||
console.error("Failed to save settings", error); | |||
this.appService.toastError("Failed to save settings, check the logs."); | |||
}); | |||
} | |||
} |
5 changes: 4 additions & 1 deletion
5
Client/Client/src/app/settings/settings-page/settings-page.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1 +1,4 @@ | |||
<general-page></general-page> | <md-tab-group> | ||
<md-tab label="Overlay"><overlay-page></overlay-page></md-tab> | |||
<md-tab label="General"><general-page></general-page></md-tab> | |||
</md-tab-group> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,16 +1,17 @@ | |||
import { NgModule } from '@angular/core'; | import { NgModule } from '@angular/core'; | ||
import { BrowserModule } from '@angular/platform-browser'; | import { BrowserModule } from '@angular/platform-browser'; | ||
import { FormsModule } from '@angular/forms'; | import { FormsModule } from '@angular/forms'; | ||
import { MdButtonModule, MdInputModule, MdSlideToggleModule } from '@angular/material'; | import { MdButtonModule, MdInputModule, MdSlideToggleModule, MdTabsModule } from '@angular/material'; | ||
|
|
||
import { CenterSpinnerModule } from '../shared' | import { CenterSpinnerModule } from '../shared' | ||
import { SettingsPageComponent } from './settings-page'; | import { SettingsPageComponent } from './settings-page'; | ||
import { GeneralPageComponent } from './general-page'; | import { GeneralPageComponent } from './general-page'; | ||
import { OverlayPageComponent } from './overlay-page'; | |||
|
|
||
@NgModule({ | @NgModule({ | ||
imports: [BrowserModule, FormsModule, MdButtonModule, MdInputModule, MdSlideToggleModule, CenterSpinnerModule], | imports: [BrowserModule, FormsModule, MdButtonModule, MdInputModule, MdSlideToggleModule, MdTabsModule, CenterSpinnerModule], | ||
exports: [SettingsPageComponent], | exports: [SettingsPageComponent], | ||
declarations: [SettingsPageComponent, GeneralPageComponent], | declarations: [SettingsPageComponent, GeneralPageComponent, OverlayPageComponent], | ||
entryComponents: [] | entryComponents: [] | ||
}) | }) | ||
export class SettingsModule { } | export class SettingsModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters