-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from halomademeapc/feature/game
First usable version
- Loading branch information
Showing
36 changed files
with
764 additions
and
84 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
import { Room } from './room'; | ||
import { Emblem } from './emblem'; | ||
import { Card } from './card'; | ||
|
||
export class User { | ||
public id: string; | ||
public roomId: string; | ||
public displayName: string; | ||
public isHost: boolean; | ||
public emblemId: number; | ||
public currentCardId: number; | ||
public room: Room; | ||
public emblem: Emblem; | ||
public currentCard: Card; | ||
} |
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 | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
<div class="full-height d-flex flex-column justify-content-center"> | ||
<div class="container"> | ||
<div class="card my-5 p-3"> | ||
<h2 class="mb-3 display-4">Planning Poker</h2> | ||
<h2 class="display-4">Planning Poker</h2> | ||
<small class="mb-3 text-muted">Made by <a href="https://www.halomademeapc.com">Alex Griffith</a></small> | ||
<app-create-room></app-create-room> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
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 | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Injectable, EventEmitter } from '@angular/core'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class NotificationService { | ||
public messages: EventEmitter<string>; | ||
|
||
constructor() { } | ||
constructor() { | ||
this.messages = new EventEmitter<string>(); | ||
} | ||
|
||
public notify = (msg: string) => this.messages.emit(msg); | ||
} |
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
27 changes: 22 additions & 5 deletions
27
ClientApp/src/app/shared-components/card-list/card-list.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 | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,44 @@ | ||
import { Component, Input, SimpleChanges, Output, EventEmitter, OnChanges } from '@angular/core'; | ||
import { Component, Input, SimpleChanges, Output, EventEmitter, OnChanges, OnInit } from '@angular/core'; | ||
import { Card } from 'src/app/models/entities/card'; | ||
import { PokerService } from 'src/app/services/poker.service'; | ||
import { Observable } from 'rxjs'; | ||
import { map } from 'rxjs/operators'; | ||
|
||
@Component({ | ||
selector: 'app-card-list', | ||
templateUrl: './card-list.component.html', | ||
styleUrls: ['./card-list.component.scss'] | ||
}) | ||
export class CardListComponent implements OnChanges { | ||
export class CardListComponent implements OnChanges, OnInit { | ||
@Input() cards: Array<Card>; | ||
@Input() isEnabled: boolean; | ||
@Output() cardSelected: EventEmitter<number> = new EventEmitter<number>(); | ||
isEnabled = true; | ||
selectedCardId: number = null; | ||
|
||
constructor() { } | ||
constructor(private service: PokerService) { } | ||
|
||
ngOnChanges(changes: SimpleChanges): void { | ||
if (changes.isEnabled && changes.isEnabled.currentValue !== changes.isEnabled.previousValue) { | ||
this.selectedCardId = null; | ||
} | ||
} | ||
|
||
ngOnInit(): void { | ||
this.watchRoundEnd().subscribe(); | ||
this.watchRoundStart().subscribe(); | ||
} | ||
|
||
onCardSelected = (cardId: number): void => { | ||
this.cardSelected.emit(cardId); | ||
this.service.playCard(cardId).subscribe(); | ||
this.selectedCardId = cardId; | ||
} | ||
|
||
watchRoundEnd = (): Observable<boolean> => | ||
this.service.roundEnds.pipe(map(() => this.isEnabled = false)) | ||
|
||
watchRoundStart = (): Observable<void> => | ||
this.service.roundStarts.pipe(map(() => { | ||
this.isEnabled = true; | ||
this.selectedCardId = null; | ||
})) | ||
} |
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
Oops, something went wrong.