Skip to content

Commit

Permalink
Merge pull request #141 from Saphs/further_fixes
Browse files Browse the repository at this point in the history
fix wake player is undefined bug
  • Loading branch information
DanielLiebler authored Sep 13, 2021
2 parents d595398 + 1bf1fe0 commit 226b675
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class IngameRuleBookComponent {
},
{ text: 'Jede Aktion muss versucht werden.', icon: 'far fa-dizzy' },
{ text: 'Fehlgeschlagene Aufgaben werden mit 2 Strafschlücken bestraft.', icon: 'fas fa-beer' },
{ text: 'Wer mit spielt akzeptiert automatisch alle Regeln.', icon: 'fas fa-balance-scale' },
{ text: 'Wer mitspielt akzeptiert automatisch alle Regeln.', icon: 'fas fa-balance-scale' },
];

constructor(private gameState: GameStateService) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,13 @@ export class StateDisplayComponent implements OnDestroy {
this.activeTimer.start();

this.gameState.activePlayerLogin$.pipe(take(1)).subscribe((name: string) => {
this.gameState.sendMessage(MessageType.GAME_MESSAGE, {
type: MessageType.GAME_MESSAGE,
action: GameActionType.wakePlayer,
targetLoginName: name,
});
if (name !== undefined && name !== '' && name !== null) {
this.gameState.sendMessage(MessageType.GAME_MESSAGE, {
type: MessageType.GAME_MESSAGE,
action: GameActionType.wakePlayer,
targetLoginName: name,
});
}
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/services/game-state.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class GameStateService {
/** Access values for the game state */
me$: AsyncSubject<Player> = new AsyncSubject<Player>();
currentHostLogin$: Subject<string> = new Subject<string>();
activePlayerLogin$: BehaviorSubject<string> = new BehaviorSubject<string>(undefined);
activePlayerLogin$: ReplaySubject<string> = new ReplaySubject<string>(1);
activeAction$: ReplaySubject<string> = new ReplaySubject<string>(1);
playerMap$: BehaviorSubject<Map<string, Player>> = new BehaviorSubject<Map<string, Player>>(new Map());
// TODO: This is a one to one replacement for the old PlayerListUpdateCallback. This might be suboptimal. Please check actual calls to it.
Expand Down

0 comments on commit 226b675

Please sign in to comment.