diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.ts
index db858c6..1b303b8 100644
--- a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.ts
+++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.ts
@@ -1,5 +1,6 @@
-import { Component } from '@angular/core';
+import {Component, OnInit} from '@angular/core';
import {animateText, onSideNavChange} from '../../shared/animations/sidenav-animations';
+import {GMSignalRService} from '../../shared/signalR-service/gm-signalR.service';
@Component({
selector: 'app-game-master-dashboard',
@@ -7,15 +8,19 @@ import {animateText, onSideNavChange} from '../../shared/animations/sidenav-anim
styleUrls: ['./game-master-dashboard.component.css'],
animations: [onSideNavChange, animateText]
})
-export class GameMasterDashboardComponent {
+export class GameMasterDashboardComponent implements OnInit {
leftSidenavExpanded = false;
leftSidenavTextExpanded = false;
rightSidenavExpanded = false;
rightSidenavTextExpanded = false;
- constructor() {}
+ constructor(private signalRService: GMSignalRService) {}
- UpdateSidenavStatus(sidenav: string, newValue: boolean){
+ ngOnInit() {
+ this.signalRService.Login();
+ }
+
+ UpdateSidenavStatus(sidenav: string, newValue: boolean) {
switch (sidenav) {
case 'left':
this.leftSidenavExpanded = newValue;
diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/signalR-service/base/signalR.service.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/signalR-service/base/signalR.service.ts
index e597d57..a402767 100644
--- a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/signalR-service/base/signalR.service.ts
+++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/signalR-service/base/signalR.service.ts
@@ -27,15 +27,19 @@ export class SignalRService {
public startConnection() {
if (this.hubConnection.state === HubConnectionState.Connected) {
- return;
+ return true;
}
this.hubConnection.start().then(
() => {
console.log('Hub connection started!');
this.connectionEstablished$.next(true);
+ return true;
},
- error => console.error(error)
+ error => {
+ console.error(error);
+ return false;
+ }
);
}
-}
\ No newline at end of file
+}
diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/signalR-service/gm-signalR.service.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/signalR-service/gm-signalR.service.ts
index 367d54f..4ca94db 100644
--- a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/signalR-service/gm-signalR.service.ts
+++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/signalR-service/gm-signalR.service.ts
@@ -8,10 +8,19 @@ export class GMSignalRService {
constructor(@Inject('BASE_URL') baseUrl: string) {
this.signalR = new SignalRService(baseUrl);
this.registerOnServerEvents();
+ }
+
+ public Login() {
this.signalR.startConnection();
+
+ this.signalR.connectionEstablished$.subscribe(() => {
+ if (this.signalR.connectionEstablished$.getValue() === true) {
+ this.signalR.hubConnection.send('GameMasterLogin');
+ }
+ });
}
private registerOnServerEvents(): void {
-
+
}
-}
\ No newline at end of file
+}
diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/signalR-service/player-signalR.service.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/signalR-service/player-signalR.service.ts
index b716f53..31db81f 100644
--- a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/signalR-service/player-signalR.service.ts
+++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/signalR-service/player-signalR.service.ts
@@ -11,7 +11,16 @@ export class PlayerSignalRService {
this.signalR.startConnection();
}
- private registerOnServerEvents(): void {
-
+ public Login() {
+ this.signalR.startConnection();
+
+ this.signalR.connectionEstablished$.subscribe(() => {
+ if (this.signalR.connectionEstablished$.getValue() === true) {
+ this.signalR.hubConnection.send('GameMasterLogin');
+ }
+ });
}
-}
\ No newline at end of file
+
+ private registerOnServerEvents(): void {
+ }
+}
diff --git a/SessionCompanion/SessionCompanion/SessionCompanion.xml b/SessionCompanion/SessionCompanion/SessionCompanion.xml
index 13641ce..507803a 100644
--- a/SessionCompanion/SessionCompanion/SessionCompanion.xml
+++ b/SessionCompanion/SessionCompanion/SessionCompanion.xml
@@ -11,6 +11,13 @@
Identyfikator postaci
ViewModel Postaci/ErrorResponse
+
+
+ Metoda zwraca listę postaci przypisanych do danego użytkownika
+
+ Identyfikator użytkownika
+ Lista postać lub wiadomość błędu
+
Metoda przyjmuje login oraz hasło i sprawdza czy istnieje użytkownik o podanych parametrach
@@ -32,14 +39,9 @@
true jesli ktoś jest już zalogowany i false jeśli nie
-
+
- Lista zalogowanych graczy i identyfikator wybranej postaci
-
-
-
-
- Status, czy GM został już zalogowany
+ Klasa zawierająca wszystkie dane potrzebne w SignalR odnośnie aktualnej sesji