|
@@ -30,7 +30,9 @@ module rpgcards {
|
30
|
30
|
this._selectedDeck = "";
|
31
|
31
|
|
32
|
32
|
dispatcher.register((action) => {
|
33
|
|
- if(action instanceof ActionNewDeck) {
|
|
33
|
+ if(action instanceof ActionReset) {
|
|
34
|
+ this._reset()
|
|
35
|
+ } else if(action instanceof ActionNewDeck) {
|
34
|
36
|
this._newDeck()
|
35
|
37
|
} else if (action instanceof ActionDeleteDeck) {
|
36
|
38
|
this._deleteDeck(action.id);
|
|
@@ -86,6 +88,12 @@ module rpgcards {
|
86
|
88
|
// ---------------------------------------------------------------------
|
87
|
89
|
// Methods for changing the state
|
88
|
90
|
// ---------------------------------------------------------------------
|
|
91
|
+ private _reset(): void {
|
|
92
|
+ this._decks = [];
|
|
93
|
+ this._cards = [];
|
|
94
|
+ this._selectDeck = null;
|
|
95
|
+ this._selectCard = null;
|
|
96
|
+ }
|
89
|
97
|
private _newDeck(): void {
|
90
|
98
|
this._decks.push(new Deck(randomID()));
|
91
|
99
|
}
|