jp.ms.common.modules 1.0.29 → 1.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dto/app-screen/index.d.ts +1 -0
- package/dist/dto/app-screen/index.js +3 -1
- package/dist/dto/app-screen/index.js.map +1 -1
- package/dist/dto/{table-game/cards → app-table}/card.dto.d.ts +2 -2
- package/dist/dto/app-table/card.dto.js.map +1 -0
- package/dist/dto/app-table/cards-deck.dto.d.ts +6 -0
- package/dist/dto/app-table/cards-deck.dto.js +38 -0
- package/dist/dto/app-table/cards-deck.dto.js.map +1 -0
- package/dist/dto/{table-game/cards/card-pair-slot.dto.d.ts → app-table/cards-pair-slots-item.dto.d.ts} +2 -2
- package/dist/dto/{table-game/cards/card-pair-slot.dto.js → app-table/cards-pair-slots-item.dto.js} +9 -9
- package/dist/dto/app-table/cards-pair-slots-item.dto.js.map +1 -0
- package/dist/dto/app-table/cards-pair-slots.dto.d.ts +5 -0
- package/dist/dto/app-table/cards-pair-slots.dto.js +27 -0
- package/dist/dto/app-table/cards-pair-slots.dto.js.map +1 -0
- package/dist/dto/app-table/cards-panel.dto.d.ts +10 -0
- package/dist/dto/{table-game/cards → app-table}/cards-panel.dto.js +4 -4
- package/dist/dto/app-table/cards-panel.dto.js.map +1 -0
- package/dist/dto/app-table/cards-player.dto.d.ts +6 -0
- package/dist/dto/{table-game/cards/card-player.dto.js → app-table/cards-player.dto.js} +6 -6
- package/dist/dto/app-table/cards-player.dto.js.map +1 -0
- package/dist/dto/app-table/index.d.ts +11 -0
- package/dist/dto/app-table/index.js +26 -0
- package/dist/dto/app-table/index.js.map +1 -0
- package/dist/dto/app-table/moves-panel-button.dto.d.ts +5 -0
- package/dist/dto/{table-game/base/base-table-yours-action.dto.js → app-table/moves-panel-button.dto.js} +6 -6
- package/dist/dto/app-table/moves-panel-button.dto.js.map +1 -0
- package/dist/dto/app-table/moves-panel.dto.d.ts +6 -0
- package/dist/dto/{table-game/base/base-table-moves-panel.dto.js → app-table/moves-panel.dto.js} +9 -9
- package/dist/dto/app-table/moves-panel.dto.js.map +1 -0
- package/dist/dto/{table-game/base/game-player.dto.d.ts → app-table/player.dto.d.ts} +2 -2
- package/dist/dto/{table-game/base/game-player.dto.js → app-table/player.dto.js} +11 -11
- package/dist/dto/app-table/player.dto.js.map +1 -0
- package/dist/dto/app-table/summary-item.dto.d.ts +8 -0
- package/dist/dto/{table-game/base/base-table-summary-item.dto.js → app-table/summary-item.dto.js} +9 -9
- package/dist/dto/app-table/summary-item.dto.js.map +1 -0
- package/dist/dto/app-table/summary.dto.d.ts +5 -0
- package/dist/dto/{table-game/base/base-table-summary.dto.js → app-table/summary.dto.js} +7 -7
- package/dist/dto/app-table/summary.dto.js.map +1 -0
- package/dist/dto/games/fool/fool-player.dto.d.ts +3 -0
- package/dist/dto/games/fool/fool-player.dto.js +8 -0
- package/dist/dto/games/fool/fool-player.dto.js.map +1 -0
- package/dist/dto/games/fool/fool-table.dto.d.ts +18 -0
- package/dist/dto/games/fool/fool-table.dto.js +105 -0
- package/dist/dto/games/fool/fool-table.dto.js.map +1 -0
- package/dist/dto/games/index.d.ts +1 -0
- package/dist/dto/games/index.js +18 -0
- package/dist/dto/games/index.js.map +1 -0
- package/dist/dto/index.d.ts +2 -1
- package/dist/dto/index.js +2 -1
- package/dist/dto/index.js.map +1 -1
- package/dist/exception/error-code.enum.d.ts +4 -0
- package/dist/exception/error-code.enum.js +9 -0
- package/dist/exception/error-code.enum.js.map +1 -0
- package/dist/exception/global-exception-filter.d.ts +5 -0
- package/dist/exception/global-exception-filter.js +53 -0
- package/dist/exception/global-exception-filter.js.map +1 -0
- package/dist/exception/http-exception-wth-snackbar.d.ts +12 -0
- package/dist/exception/http-exception-wth-snackbar.js +17 -0
- package/dist/exception/http-exception-wth-snackbar.js.map +1 -0
- package/dist/exception/index.d.ts +4 -0
- package/dist/exception/index.js +12 -0
- package/dist/exception/index.js.map +1 -0
- package/dist/exception/not-enough-money-for-purchase.exception.d.ts +5 -0
- package/dist/exception/not-enough-money-for-purchase.exception.js +12 -0
- package/dist/exception/not-enough-money-for-purchase.exception.js.map +1 -0
- package/dist/exception/not-found-free-room-for-fast-game.exception.d.ts +5 -0
- package/dist/exception/not-found-free-room-for-fast-game.exception.js +12 -0
- package/dist/exception/not-found-free-room-for-fast-game.exception.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/modules/events/events.gateway.js +1 -1
- package/dist/modules/events/events.gateway.js.map +1 -1
- package/dist/modules/main/main-tables-list-screen.view.d.ts +11 -1
- package/dist/modules/main/main-tables-list-screen.view.js +97 -14
- package/dist/modules/main/main-tables-list-screen.view.js.map +1 -1
- package/dist/modules/main/main.controller.d.ts +4 -3
- package/dist/modules/main/main.controller.js +15 -3
- package/dist/modules/main/main.controller.js.map +1 -1
- package/dist/modules/main/main.module.js +2 -2
- package/dist/modules/main/main.module.js.map +1 -1
- package/dist/modules/main/main.service.d.ts +5 -4
- package/dist/modules/main/main.service.js +38 -12
- package/dist/modules/main/main.service.js.map +1 -1
- package/dist/modules/many-tables-tournament/many-tables-tournament-status-screen.view.d.ts +4 -0
- package/dist/modules/many-tables-tournament/many-tables-tournament-status-screen.view.js +56 -4
- package/dist/modules/many-tables-tournament/many-tables-tournament-status-screen.view.js.map +1 -1
- package/dist/modules/many-tables-tournament/many-tables-tournament-tables-list-screen.view.js +3 -3
- package/dist/modules/many-tables-tournament/many-tables-tournament-tables-list-screen.view.js.map +1 -1
- package/dist/modules/many-tables-tournament/many-tables-tournament.controller.d.ts +6 -7
- package/dist/modules/many-tables-tournament/many-tables-tournament.controller.js +5 -17
- package/dist/modules/many-tables-tournament/many-tables-tournament.controller.js.map +1 -1
- package/dist/modules/many-tables-tournament/many-tables-tournament.service.d.ts +6 -7
- package/dist/modules/many-tables-tournament/many-tables-tournament.service.js +20 -27
- package/dist/modules/many-tables-tournament/many-tables-tournament.service.js.map +1 -1
- package/dist/modules/menu/menu.service.js +1 -2
- package/dist/modules/menu/menu.service.js.map +1 -1
- package/dist/modules/one-table-tournament/one-table-tournament-status-screen.view.d.ts +1 -0
- package/dist/modules/one-table-tournament/one-table-tournament-status-screen.view.js +18 -5
- package/dist/modules/one-table-tournament/one-table-tournament-status-screen.view.js.map +1 -1
- package/dist/modules/one-table-tournament/one-table-tournament.controller.d.ts +3 -3
- package/dist/modules/one-table-tournament/one-table-tournament.controller.js.map +1 -1
- package/dist/modules/one-table-tournament/one-table-tournament.service.d.ts +3 -3
- package/dist/modules/one-table-tournament/one-table-tournament.service.js +1 -2
- package/dist/modules/one-table-tournament/one-table-tournament.service.js.map +1 -1
- package/dist/modules/simple-rooms/simple-rooms.controller.d.ts +5 -5
- package/dist/modules/simple-rooms/simple-rooms.service.d.ts +5 -5
- package/dist/modules/simple-rooms-manager/simple-rooms-manager.service.js.map +1 -1
- package/dist/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.module.d.ts +3 -1
- package/dist/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.module.js +14 -3
- package/dist/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.module.js.map +1 -1
- package/dist/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.service.d.ts +4 -3
- package/dist/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.service.js +49 -25
- package/dist/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.service.js.map +1 -1
- package/dist/modules/tournament-one-table-rooms-manager/tournament-one-table-rooms-manager.service.js +9 -6
- package/dist/modules/tournament-one-table-rooms-manager/tournament-one-table-rooms-manager.service.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/game-table-result.d.ts +1 -2
- package/dist/utils/game-table-result.js +0 -13
- package/dist/utils/game-table-result.js.map +1 -1
- package/dist/views/index.d.ts +3 -0
- package/dist/views/index.js +7 -1
- package/dist/views/index.js.map +1 -1
- package/dist/views/many-tables-tournament-conifrm-exit-dialog.view.d.ts +4 -0
- package/dist/views/many-tables-tournament-conifrm-exit-dialog.view.js +11 -0
- package/dist/views/many-tables-tournament-conifrm-exit-dialog.view.js.map +1 -0
- package/dist/views/one-table-tournament-conifrm-exit-dialog.view.d.ts +4 -0
- package/dist/views/one-table-tournament-conifrm-exit-dialog.view.js +11 -0
- package/dist/views/one-table-tournament-conifrm-exit-dialog.view.js.map +1 -0
- package/dist/views/table-summary.view.d.ts +11 -0
- package/dist/views/table-summary.view.js +47 -0
- package/dist/views/table-summary.view.js.map +1 -0
- package/dist/views/tournament-buy-ticket-dialog.view.js +1 -1
- package/dist/views/tournament-buy-ticket-dialog.view.js.map +1 -1
- package/package.json +4 -4
- package/src/dto/app-screen/index.ts +1 -0
- package/src/dto/{table-game/cards → app-table}/card.dto.ts +2 -2
- package/src/dto/app-table/cards-deck.dto.ts +22 -0
- package/src/dto/{table-game/cards/card-pair-slot.dto.ts → app-table/cards-pair-slots-item.dto.ts} +2 -2
- package/src/dto/app-table/cards-pair-slots.dto.ts +13 -0
- package/src/dto/{table-game/cards → app-table}/cards-panel.dto.ts +5 -6
- package/src/dto/app-table/cards-player.dto.ts +14 -0
- package/src/dto/app-table/index.ts +11 -0
- package/src/dto/{table-game/base/base-table-yours-action.dto.ts → app-table/moves-panel-button.dto.ts} +2 -3
- package/src/dto/{table-game/base/base-table-moves-panel.dto.ts → app-table/moves-panel.dto.ts} +5 -5
- package/src/dto/{table-game/base/game-player.dto.ts → app-table/player.dto.ts} +2 -2
- package/src/dto/{table-game/base/base-table-summary-item.dto.ts → app-table/summary-item.dto.ts} +2 -3
- package/src/dto/app-table/summary.dto.ts +13 -0
- package/src/dto/games/fool/fool-player.dto.ts +3 -0
- package/src/dto/games/fool/fool-table.dto.ts +79 -0
- package/src/dto/games/index.ts +1 -0
- package/src/dto/index.ts +2 -1
- package/src/exception/error-code.enum.ts +4 -0
- package/src/exception/global-exception-filter.ts +50 -0
- package/src/exception/http-exception-wth-snackbar.ts +23 -0
- package/src/exception/index.ts +4 -0
- package/src/exception/not-enough-money-for-purchase.exception.ts +15 -0
- package/src/exception/not-found-free-room-for-fast-game.exception.ts +15 -0
- package/src/index.ts +2 -1
- package/src/modules/events/events.gateway.ts +1 -1
- package/src/modules/main/main-tables-list-screen.view.ts +177 -55
- package/src/modules/main/main.controller.ts +23 -10
- package/src/modules/main/main.module.ts +2 -2
- package/src/modules/main/main.service.ts +53 -19
- package/src/modules/many-tables-tournament/many-tables-tournament-status-screen.view.ts +97 -31
- package/src/modules/many-tables-tournament/many-tables-tournament-tables-list-screen.view.ts +25 -17
- package/src/modules/many-tables-tournament/many-tables-tournament.controller.ts +8 -17
- package/src/modules/many-tables-tournament/many-tables-tournament.service.ts +46 -58
- package/src/modules/menu/menu.service.ts +6 -9
- package/src/modules/one-table-tournament/one-table-tournament-status-screen.view.ts +43 -17
- package/src/modules/one-table-tournament/one-table-tournament.controller.ts +3 -4
- package/src/modules/one-table-tournament/one-table-tournament.service.ts +9 -12
- package/src/modules/simple-rooms/simple-rooms.controller.ts +5 -5
- package/src/modules/simple-rooms/simple-rooms.service.ts +5 -5
- package/src/modules/simple-rooms-manager/simple-rooms-manager.service.ts +0 -2
- package/src/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.module.ts +17 -9
- package/src/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.service.ts +57 -26
- package/src/modules/tournament-one-table-rooms-manager/tournament-one-table-rooms-manager.service.ts +10 -7
- package/src/utils/game-table-result.ts +1 -16
- package/src/views/index.ts +4 -1
- package/src/views/many-tables-tournament-conifrm-exit-dialog.view.ts +21 -0
- package/src/views/one-table-tournament-conifrm-exit-dialog.view.ts +21 -0
- package/src/views/table-summary.view.ts +87 -0
- package/src/views/tournament-buy-ticket-dialog.view.ts +4 -4
- package/dist/adapter/base-table-game-state-adapter.d.ts +0 -36
- package/dist/adapter/base-table-game-state-adapter.js +0 -183
- package/dist/adapter/base-table-game-state-adapter.js.map +0 -1
- package/dist/adapter/card-table-game-state-adapter.d.ts +0 -14
- package/dist/adapter/card-table-game-state-adapter.js +0 -51
- package/dist/adapter/card-table-game-state-adapter.js.map +0 -1
- package/dist/adapter/index.d.ts +0 -1
- package/dist/adapter/index.js +0 -6
- package/dist/adapter/index.js.map +0 -1
- package/dist/dto/table-game/base/base-table-game-state.dto.d.ts +0 -17
- package/dist/dto/table-game/base/base-table-game-state.dto.js +0 -128
- package/dist/dto/table-game/base/base-table-game-state.dto.js.map +0 -1
- package/dist/dto/table-game/base/base-table-moves-panel.dto.d.ts +0 -6
- package/dist/dto/table-game/base/base-table-moves-panel.dto.js.map +0 -1
- package/dist/dto/table-game/base/base-table-summary-item.dto.d.ts +0 -8
- package/dist/dto/table-game/base/base-table-summary-item.dto.js.map +0 -1
- package/dist/dto/table-game/base/base-table-summary.dto.d.ts +0 -5
- package/dist/dto/table-game/base/base-table-summary.dto.js.map +0 -1
- package/dist/dto/table-game/base/base-table-yours-action.dto.d.ts +0 -5
- package/dist/dto/table-game/base/base-table-yours-action.dto.js.map +0 -1
- package/dist/dto/table-game/base/game-player.dto.js.map +0 -1
- package/dist/dto/table-game/cards/card-pair-slot.dto.js.map +0 -1
- package/dist/dto/table-game/cards/card-player.dto.d.ts +0 -6
- package/dist/dto/table-game/cards/card-player.dto.js.map +0 -1
- package/dist/dto/table-game/cards/card-table-game-state.dto.d.ts +0 -16
- package/dist/dto/table-game/cards/card-table-game-state.dto.js +0 -68
- package/dist/dto/table-game/cards/card-table-game-state.dto.js.map +0 -1
- package/dist/dto/table-game/cards/card.dto.js.map +0 -1
- package/dist/dto/table-game/cards/cards-panel.dto.d.ts +0 -10
- package/dist/dto/table-game/cards/cards-panel.dto.js.map +0 -1
- package/dist/dto/table-game/index.d.ts +0 -1
- package/dist/dto/table-game/index.js +0 -6
- package/dist/dto/table-game/index.js.map +0 -1
- package/src/adapter/base-table-game-state-adapter.ts +0 -272
- package/src/adapter/card-table-game-state-adapter.ts +0 -78
- package/src/adapter/index.ts +0 -1
- package/src/dto/table-game/base/base-table-game-state.dto.ts +0 -95
- package/src/dto/table-game/base/base-table-summary.dto.ts +0 -13
- package/src/dto/table-game/cards/card-player.dto.ts +0 -15
- package/src/dto/table-game/cards/card-table-game-state.dto.ts +0 -50
- package/src/dto/table-game/index.ts +0 -2
- /package/dist/dto/{table-game/cards → app-table}/card.dto.js +0 -0
|
@@ -1,18 +1,21 @@
|
|
|
1
|
+
import dayjs from "dayjs";
|
|
1
2
|
import {
|
|
2
|
-
AppScreen,
|
|
3
|
-
AppScreenAppBar,
|
|
4
3
|
AppScreenIconEnum,
|
|
5
4
|
AppScreenIdEnum,
|
|
6
|
-
AppScreenSection,
|
|
7
|
-
AppScreenSectionButton,
|
|
8
|
-
AppScreenSectionButtons,
|
|
9
|
-
AppScreenSectionImage,
|
|
10
|
-
AppScreenSectionListItem,
|
|
11
5
|
IAppScreen,
|
|
12
6
|
UniversalScreenView,
|
|
13
7
|
ILocaleService,
|
|
8
|
+
StandardScreenComponent,
|
|
9
|
+
StatusAppBarComponent,
|
|
10
|
+
StatusHeaderSectionComponent,
|
|
11
|
+
CardListSectionComponent,
|
|
12
|
+
ArrowBackButtonComponent,
|
|
13
|
+
IconImageComponent,
|
|
14
|
+
MiniCardSectionListItemComponent,
|
|
15
|
+
UrlImageComponent,
|
|
14
16
|
} from "jp.common.models";
|
|
15
|
-
import {
|
|
17
|
+
import { formatChips, formatDate, formatTime, replacePattern } from "jp.common.utils";
|
|
18
|
+
import { ManyTablesTournamentRoom, TournamentMaster } from "jp.ms.common.engine";
|
|
16
19
|
|
|
17
20
|
export class ManyTablesTournamentStatusScreenView extends UniversalScreenView {
|
|
18
21
|
private readonly tournament: ManyTablesTournamentRoom;
|
|
@@ -26,34 +29,97 @@ export class ManyTablesTournamentStatusScreenView extends UniversalScreenView {
|
|
|
26
29
|
this.tournament = tournament;
|
|
27
30
|
}
|
|
28
31
|
|
|
29
|
-
build(): IAppScreen {
|
|
30
|
-
return
|
|
32
|
+
build (): IAppScreen {
|
|
33
|
+
return new StandardScreenComponent(AppScreenIdEnum.ROOMS)
|
|
31
34
|
.addAppBar(
|
|
32
|
-
|
|
33
|
-
this.
|
|
34
|
-
|
|
35
|
+
new StatusAppBarComponent(
|
|
36
|
+
this.tournament.getTitle(this.lang),
|
|
37
|
+
new ArrowBackButtonComponent(
|
|
38
|
+
this.localeService.t('common.button.back', { lang: this.lang })
|
|
39
|
+
),
|
|
35
40
|
),
|
|
36
41
|
)
|
|
37
|
-
.addSection((
|
|
38
|
-
AppScreenSection.CreateStatusHeader(
|
|
39
|
-
'status',
|
|
40
|
-
'description',
|
|
41
|
-
AppScreenSectionImage.CreateIconImage(AppScreenIconEnum.EMOJI_EVENTS),
|
|
42
|
-
AppScreenSectionButtons.CreatePrimaryButtonSection(AppScreenSectionButton.CreateTextButton('button')),
|
|
43
|
-
)
|
|
44
|
-
))
|
|
45
42
|
.addSection(
|
|
46
|
-
|
|
43
|
+
this.getStatusHeader()
|
|
44
|
+
)
|
|
45
|
+
.addSection(
|
|
46
|
+
new CardListSectionComponent(
|
|
47
47
|
'id1',
|
|
48
|
-
this.
|
|
49
|
-
|
|
50
|
-
item.playerName,
|
|
51
|
-
'',
|
|
52
|
-
AppScreenSectionImage.CreateUrlImage(item.playerAvatarUrl),
|
|
53
|
-
true,
|
|
54
|
-
'',
|
|
55
|
-
))
|
|
56
|
-
),
|
|
48
|
+
this.getPlayersList()
|
|
49
|
+
)
|
|
57
50
|
);
|
|
58
51
|
}
|
|
52
|
+
|
|
53
|
+
private getPlayersList (): Array<MiniCardSectionListItemComponent> {
|
|
54
|
+
if (this.tournament.getRoomMaster<TournamentMaster>().isFinish()) {
|
|
55
|
+
return this.tournament.getWinners().map((item) => (
|
|
56
|
+
new MiniCardSectionListItemComponent(
|
|
57
|
+
item.playerId,
|
|
58
|
+
item.playerName,
|
|
59
|
+
this.localeService.t('common.tournaments.status.screen.finish.description', {
|
|
60
|
+
lang: this.lang,
|
|
61
|
+
args: {
|
|
62
|
+
RANK: item.rank.toString(),
|
|
63
|
+
PRIZE: formatChips(item.profit, this.lang, true),
|
|
64
|
+
}
|
|
65
|
+
}),
|
|
66
|
+
new UrlImageComponent(item.playerAvatarUrl),
|
|
67
|
+
true,
|
|
68
|
+
true,
|
|
69
|
+
'',
|
|
70
|
+
)
|
|
71
|
+
));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return this.tournament.getParticipants().map((item) => (
|
|
75
|
+
new MiniCardSectionListItemComponent(
|
|
76
|
+
item.playerId,
|
|
77
|
+
item.playerName,
|
|
78
|
+
'',
|
|
79
|
+
new UrlImageComponent(item.playerAvatarUrl),
|
|
80
|
+
true,
|
|
81
|
+
true,
|
|
82
|
+
'',
|
|
83
|
+
)
|
|
84
|
+
));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
private getStatusHeader (): StatusHeaderSectionComponent {
|
|
88
|
+
return new StatusHeaderSectionComponent(
|
|
89
|
+
'status',
|
|
90
|
+
this.getStatusDescription(),
|
|
91
|
+
new IconImageComponent(this.getStatusIcon())
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private getStatusIcon (): string {
|
|
96
|
+
if (this.tournament.getRoomMaster<TournamentMaster>().isCancelled()) {
|
|
97
|
+
return AppScreenIconEnum.INFO;
|
|
98
|
+
} else if (this.tournament.getRoomMaster<TournamentMaster>().isFinish()) {
|
|
99
|
+
return AppScreenIconEnum.EMOJI_EVENTS;
|
|
100
|
+
} else if (this.tournament.getRoomMaster<TournamentMaster>().isWaiting()) {
|
|
101
|
+
return AppScreenIconEnum.HOURGLASS_EMPTY;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return '';
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
private getStatusDescription (): string {
|
|
108
|
+
if (this.tournament.getRoomMaster<TournamentMaster>().isCancelled()) {
|
|
109
|
+
return this.localeService.t('common.tournaments.status.4', { lang: this.lang });
|
|
110
|
+
} else if (this.tournament.getRoomMaster<TournamentMaster>().isFinish()) {
|
|
111
|
+
return this.localeService.t('common.tournaments.status.3', { lang: this.lang });
|
|
112
|
+
} else if (this.tournament.getRoomMaster<TournamentMaster>().isInProgress()) {
|
|
113
|
+
return this.localeService.t('common.tournaments.status.2', { lang: this.lang });
|
|
114
|
+
} else if (this.tournament.getRoomMaster<TournamentMaster>().isWaiting()) {
|
|
115
|
+
return replacePattern(this.tournament.getSubtitle(this.lang), {
|
|
116
|
+
DATE: dayjs(this.tournament.getScheduleDate()).isToday() ?
|
|
117
|
+
this.localeService.t('common.tournaments.status.today', { lang: this.lang }) :
|
|
118
|
+
formatDate(this.tournament.getScheduleDate() ?? ''),
|
|
119
|
+
SCHEDULE_DATE: formatTime(this.tournament.getScheduleDate() ?? ''),
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return '';
|
|
124
|
+
}
|
|
59
125
|
}
|
package/src/modules/many-tables-tournament/many-tables-tournament-tables-list-screen.view.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
|
-
AppScreen,
|
|
3
|
-
AppScreenAppBar,
|
|
4
|
-
AppScreenIconEnum,
|
|
5
2
|
AppScreenIdEnum,
|
|
6
|
-
AppScreenSection,
|
|
7
|
-
AppScreenSectionButton,
|
|
8
|
-
AppScreenSectionImage,
|
|
9
|
-
AppScreenSectionListItem,
|
|
10
3
|
IAppScreen,
|
|
11
4
|
UniversalScreenView,
|
|
12
5
|
ILocaleService,
|
|
13
|
-
|
|
6
|
+
StandardScreenComponent,
|
|
7
|
+
AppScreenRouter,
|
|
8
|
+
StandardAppBarComponent,
|
|
9
|
+
ArrowBackButtonComponent,
|
|
10
|
+
CardListSectionComponent,
|
|
11
|
+
MiniCardSectionListItemComponent,
|
|
12
|
+
UrlImageComponent,
|
|
14
13
|
} from "jp.common.models";
|
|
15
14
|
import { ManyTablesTournamentRoom } from "jp.ms.common.engine";
|
|
16
15
|
|
|
@@ -26,25 +25,34 @@ export class ManyTablesTournamentTablesListScreenView extends UniversalScreenVie
|
|
|
26
25
|
this.tournament = tournament;
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
build(): IAppScreen {
|
|
30
|
-
return
|
|
28
|
+
build (): IAppScreen {
|
|
29
|
+
return new StandardScreenComponent(AppScreenIdEnum.ROOMS)
|
|
31
30
|
.addAppBar(
|
|
32
|
-
|
|
31
|
+
new StandardAppBarComponent(
|
|
33
32
|
this.localeService.t('common.rooms.screen.title', { lang: this.lang }),
|
|
34
|
-
|
|
33
|
+
new ArrowBackButtonComponent(
|
|
34
|
+
this.localeService.t(
|
|
35
|
+
'common.button.back',
|
|
36
|
+
{ lang: this.lang },
|
|
37
|
+
)
|
|
38
|
+
),
|
|
35
39
|
),
|
|
36
40
|
)
|
|
37
41
|
.addSection(
|
|
38
|
-
|
|
42
|
+
new CardListSectionComponent(
|
|
39
43
|
'id1',
|
|
40
44
|
this.tournament?.getTables().map((table) =>
|
|
41
|
-
|
|
45
|
+
new MiniCardSectionListItemComponent(
|
|
42
46
|
table.getId(),
|
|
43
47
|
table.getTitle(this.lang),
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
this.localeService.t(
|
|
49
|
+
'common.tournaments.screen.table.title',
|
|
50
|
+
{ lang: this.lang, args: { NUMBER: table.getNumber().toString() } }
|
|
51
|
+
),
|
|
52
|
+
new UrlImageComponent(`${table.getPlayers().length}/${table.getTableSize()}`),
|
|
53
|
+
true,
|
|
46
54
|
true,
|
|
47
|
-
|
|
55
|
+
AppScreenRouter.getManyTablesTournamentTablePath(table.getId()),
|
|
48
56
|
)
|
|
49
57
|
) ?? []
|
|
50
58
|
),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Body, Controller, Get, Param, Post, Headers, HttpStatus, HttpCode, Patch, Delete } from '@nestjs/common';
|
|
2
|
-
import { IAppHeaders, IBaseAppScreen, IBaseMoveData,
|
|
2
|
+
import { IAppHeaders, IBaseAppScreen, IBaseMoveData, IAppTableState } from 'jp.common.models';
|
|
3
3
|
|
|
4
4
|
import { ManyTablesTournamentService } from './many-tables-tournament.service';
|
|
5
5
|
import { JoinTournamentDto } from '../../dto/common/join-tournament.dto';
|
|
@@ -25,16 +25,16 @@ export class ManyTablesTournamentController {
|
|
|
25
25
|
subscribeOnStatusScreen(
|
|
26
26
|
@Param('tournamentId') tournamentId: string,
|
|
27
27
|
@Headers() headers: IAppHeaders,
|
|
28
|
-
):
|
|
29
|
-
return this.tournamentService.subscribeOnStatusScreen(tournamentId, headers.
|
|
28
|
+
): void {
|
|
29
|
+
return this.tournamentService.subscribeOnStatusScreen(tournamentId, headers.client_auth_token);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
@Get('status/unsubscribe/:tournamentId')
|
|
33
33
|
unsubscribeFromStatusScreen(
|
|
34
34
|
@Param('tournamentId') tournamentId: string,
|
|
35
35
|
@Headers() headers: IAppHeaders,
|
|
36
|
-
):
|
|
37
|
-
return this.tournamentService.unsubscribeFromStatusScreen(tournamentId, headers.
|
|
36
|
+
): void {
|
|
37
|
+
return this.tournamentService.unsubscribeFromStatusScreen(tournamentId, headers.client_auth_token);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
@Get('tables/:tournamentId')
|
|
@@ -50,7 +50,7 @@ export class ManyTablesTournamentController {
|
|
|
50
50
|
watchTheTable(
|
|
51
51
|
@Param('tableId') tableId: string,
|
|
52
52
|
@Headers() headers: IAppHeaders,
|
|
53
|
-
):
|
|
53
|
+
): IAppTableState {
|
|
54
54
|
return this.tournamentService.watchTheTable(tableId, headers.client_auth_token);
|
|
55
55
|
}
|
|
56
56
|
|
|
@@ -60,7 +60,7 @@ export class ManyTablesTournamentController {
|
|
|
60
60
|
@Param('tableId') tableId: string,
|
|
61
61
|
@Body() baseMoveData: IBaseMoveData,
|
|
62
62
|
@Headers() headers: IAppHeaders,
|
|
63
|
-
):
|
|
63
|
+
): IAppTableState {
|
|
64
64
|
return this.tournamentService.moveOnTheTable(tableId, headers.client_auth_token, baseMoveData);
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -78,19 +78,10 @@ export class ManyTablesTournamentController {
|
|
|
78
78
|
leaveTournament(
|
|
79
79
|
@Param('tournamentId') tournamentId: string,
|
|
80
80
|
@Headers() headers: IAppHeaders,
|
|
81
|
-
):
|
|
81
|
+
): void {
|
|
82
82
|
return this.tournamentService.leaveTournament(tournamentId, headers.client_auth_token);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
@Post('buy_ticket/:tournamentId')
|
|
86
|
-
@HttpCode(HttpStatus.OK)
|
|
87
|
-
buyTicket(
|
|
88
|
-
@Param('tournamentId') tournamentId: string,
|
|
89
|
-
@Headers() headers: IAppHeaders,
|
|
90
|
-
): Promise<void> {
|
|
91
|
-
return this.tournamentService.buyTicket(tournamentId, headers.client_auth_token);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
85
|
@Post('create')
|
|
95
86
|
@HttpCode(HttpStatus.OK)
|
|
96
87
|
createTournament(
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Inject, Injectable, InternalServerErrorException } from '@nestjs/common';
|
|
2
2
|
import {
|
|
3
|
-
BaseAppScreen,
|
|
4
3
|
IBaseMoveData,
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
IAppTableState,
|
|
5
|
+
AppScreenRouter,
|
|
7
6
|
} from 'jp.common.models';
|
|
7
|
+
import { ManyTablesTournamentMaster, TournamentMaster } from 'jp.ms.common.engine';
|
|
8
8
|
|
|
9
9
|
import { BaseAppScreenDto } from '../../dto';
|
|
10
10
|
import { TournamentManyTablesRoomsManagerService } from '../tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.service';
|
|
@@ -17,7 +17,6 @@ import { ManyTablesTournamentFactoryOptions } from './many-tables-tournament.int
|
|
|
17
17
|
import { MANY_TABLES_TOURNAMENT_OPTIONS } from './many-tables-tournament.constants';
|
|
18
18
|
import { ManyTablesTournamentStatusScreenView } from './many-tables-tournament-status-screen.view';
|
|
19
19
|
import { ManyTablesTournamentTablesListScreenView } from './many-tables-tournament-tables-list-screen.view';
|
|
20
|
-
import { TournamentMaster } from 'jp.ms.common.engine';
|
|
21
20
|
|
|
22
21
|
@Injectable()
|
|
23
22
|
export class ManyTablesTournamentService {
|
|
@@ -28,7 +27,7 @@ export class ManyTablesTournamentService {
|
|
|
28
27
|
) {
|
|
29
28
|
}
|
|
30
29
|
|
|
31
|
-
getStatusScreen(tournamentId: string, lang: string): BaseAppScreenDto {
|
|
30
|
+
getStatusScreen (tournamentId: string, lang: string): BaseAppScreenDto {
|
|
32
31
|
const tournament = this.manyTablesRoomsManagerService.getRoomById(tournamentId);
|
|
33
32
|
|
|
34
33
|
if (!tournament) {
|
|
@@ -36,39 +35,38 @@ export class ManyTablesTournamentService {
|
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
return new BaseAppScreenDto(
|
|
39
|
-
new
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
).build()
|
|
45
|
-
)
|
|
38
|
+
new ManyTablesTournamentStatusScreenView(
|
|
39
|
+
this.options.i18n,
|
|
40
|
+
lang,
|
|
41
|
+
tournament,
|
|
42
|
+
).buildBS()
|
|
46
43
|
);
|
|
47
44
|
}
|
|
48
45
|
|
|
49
|
-
subscribeOnStatusScreen(tournamentId: string, clientAuthToken: string):
|
|
46
|
+
subscribeOnStatusScreen (tournamentId: string, clientAuthToken: string): void {
|
|
50
47
|
const player = this.playersManager.getPlayerById(clientAuthToken);
|
|
51
48
|
const tournament = this.manyTablesRoomsManagerService.getRoomById(tournamentId);
|
|
52
49
|
|
|
53
|
-
if (player
|
|
54
|
-
|
|
50
|
+
if (!player || !tournament) {
|
|
51
|
+
throw new InternalServerErrorException();
|
|
55
52
|
}
|
|
56
53
|
|
|
57
|
-
|
|
54
|
+
tournament.addToStatusScreenWatchers(player);
|
|
55
|
+
|
|
58
56
|
}
|
|
59
57
|
|
|
60
|
-
unsubscribeFromStatusScreen(tournamentId: string, clientAuthToken: string):
|
|
58
|
+
unsubscribeFromStatusScreen (tournamentId: string, clientAuthToken: string): void {
|
|
61
59
|
const player = this.playersManager.getPlayerById(clientAuthToken);
|
|
62
60
|
const tournament = this.manyTablesRoomsManagerService.getRoomById(tournamentId);
|
|
63
61
|
|
|
64
|
-
if (player
|
|
65
|
-
|
|
62
|
+
if (!player || !tournament) {
|
|
63
|
+
throw new InternalServerErrorException();
|
|
66
64
|
}
|
|
67
65
|
|
|
68
|
-
|
|
66
|
+
tournament.removeFromStatusScreenWatchers(player);
|
|
69
67
|
}
|
|
70
68
|
|
|
71
|
-
async getTableListScreen(tournamentId: string, lang: string): Promise<BaseAppScreenDto> {
|
|
69
|
+
async getTableListScreen (tournamentId: string, lang: string): Promise<BaseAppScreenDto> {
|
|
72
70
|
const tournament = this.manyTablesRoomsManagerService.getRoomById(tournamentId);
|
|
73
71
|
|
|
74
72
|
if (!tournament) {
|
|
@@ -76,17 +74,15 @@ export class ManyTablesTournamentService {
|
|
|
76
74
|
}
|
|
77
75
|
|
|
78
76
|
return new BaseAppScreenDto(
|
|
79
|
-
new
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
).build()
|
|
85
|
-
)
|
|
77
|
+
new ManyTablesTournamentTablesListScreenView(
|
|
78
|
+
this.options.i18n,
|
|
79
|
+
lang,
|
|
80
|
+
tournament,
|
|
81
|
+
).buildBS()
|
|
86
82
|
);
|
|
87
83
|
}
|
|
88
84
|
|
|
89
|
-
watchTheTable(tableId: string, clientAuthToken: string):
|
|
85
|
+
watchTheTable (tableId: string, clientAuthToken: string): IAppTableState {
|
|
90
86
|
const player = this.playersManager.getPlayerById(clientAuthToken);
|
|
91
87
|
const room = this.manyTablesRoomsManagerService.getRoomByTableId(tableId);
|
|
92
88
|
const master = room?.getMasterById(tableId);
|
|
@@ -100,7 +96,7 @@ export class ManyTablesTournamentService {
|
|
|
100
96
|
throw new InternalServerErrorException();
|
|
101
97
|
}
|
|
102
98
|
|
|
103
|
-
moveOnTheTable(tableId: string, clientAuthToken: string, moveDto: IBaseMoveData):
|
|
99
|
+
moveOnTheTable (tableId: string, clientAuthToken: string, moveDto: IBaseMoveData): IAppTableState {
|
|
104
100
|
const player = this.playersManager.getPlayerById(clientAuthToken);
|
|
105
101
|
const room = this.manyTablesRoomsManagerService.getRoomByTableId(tableId);
|
|
106
102
|
const master = room?.getMasterById(tableId);
|
|
@@ -114,29 +110,36 @@ export class ManyTablesTournamentService {
|
|
|
114
110
|
throw new InternalServerErrorException();
|
|
115
111
|
}
|
|
116
112
|
|
|
117
|
-
joinTournament(tournamentId: string, clientAuthToken: string): JoinTournamentDto {
|
|
113
|
+
joinTournament (tournamentId: string, clientAuthToken: string): JoinTournamentDto {
|
|
118
114
|
const player = this.playersManager.getPlayerById(clientAuthToken);
|
|
119
115
|
const tournament = this.manyTablesRoomsManagerService.getRoomByTableId(tournamentId);
|
|
120
|
-
const master = tournament?.getMasterById(tournamentId);
|
|
121
116
|
|
|
122
|
-
if (player && tournament
|
|
117
|
+
if (player && tournament) {
|
|
123
118
|
tournament.handleJoinTournament(player);
|
|
124
119
|
|
|
125
120
|
if (tournament.getRoomMaster<TournamentMaster>().isInProgress()) {
|
|
126
121
|
if (player.isPlayer() || player.isTableQueuer()) {
|
|
127
122
|
return JoinTournamentDto.fromEntities(
|
|
128
|
-
|
|
123
|
+
AppScreenRouter.getManyTablesTournamentTablePath(player.tableId ?? ''),
|
|
124
|
+
player.id,
|
|
125
|
+
);
|
|
126
|
+
} else if (tournament.isParticipant(player.id)) {
|
|
127
|
+
tournament.getRoomMaster<ManyTablesTournamentMaster>()
|
|
128
|
+
.onTournamentProcessAlonePlayer(tournament.getRoomMaster(), player);
|
|
129
|
+
|
|
130
|
+
return JoinTournamentDto.fromEntities(
|
|
131
|
+
AppScreenRouter.getManyTablesTournamentTablePath(player.tableId ?? ''),
|
|
129
132
|
player.id,
|
|
130
133
|
);
|
|
131
134
|
} else {
|
|
132
135
|
return JoinTournamentDto.fromEntities(
|
|
133
|
-
|
|
136
|
+
AppScreenRouter.getManyTablesTournamentTableListPath(tournamentId),
|
|
134
137
|
player.id,
|
|
135
138
|
);
|
|
136
139
|
}
|
|
137
140
|
} else {
|
|
138
141
|
return JoinTournamentDto.fromEntities(
|
|
139
|
-
|
|
142
|
+
AppScreenRouter.getManyTablesTournamentStatusPath(tournament.getId()),
|
|
140
143
|
player.id,
|
|
141
144
|
);
|
|
142
145
|
}
|
|
@@ -145,41 +148,26 @@ export class ManyTablesTournamentService {
|
|
|
145
148
|
throw new InternalServerErrorException();
|
|
146
149
|
}
|
|
147
150
|
|
|
148
|
-
leaveTournament(tournamentId: string, clientAuthToken: string):
|
|
151
|
+
leaveTournament (tournamentId: string, clientAuthToken: string): void {
|
|
149
152
|
const player = this.playersManager.getPlayerById(clientAuthToken);
|
|
150
153
|
const tournament = this.manyTablesRoomsManagerService.getRoomByTableId(tournamentId);
|
|
151
|
-
const master = tournament?.getMasterById(tournamentId);
|
|
152
154
|
|
|
153
|
-
if (player
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
return master.createGameStateDto(player);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
throw new InternalServerErrorException();
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
async buyTicket(tournamentId: string, clientAuthToken: string) {
|
|
163
|
-
const player = this.playersManager.getPlayerById(clientAuthToken);
|
|
164
|
-
const tournament = this.manyTablesRoomsManagerService.getRoomByTableId(tournamentId);
|
|
165
|
-
const master = tournament?.getMasterById(tournamentId);
|
|
166
|
-
|
|
167
|
-
if (player && tournament && master) {
|
|
168
|
-
return this.manyTablesRoomsManagerService.buyTicket(tournamentId, player);
|
|
155
|
+
if (!player || !tournament) {
|
|
156
|
+
throw new InternalServerErrorException();
|
|
169
157
|
}
|
|
170
158
|
|
|
171
|
-
|
|
159
|
+
tournament.handleLeaveTournament(player);
|
|
172
160
|
}
|
|
173
161
|
|
|
174
|
-
async createTournament(createTournamentDto: ManyTablesTournamentCreateDto) {
|
|
162
|
+
async createTournament (createTournamentDto: ManyTablesTournamentCreateDto) {
|
|
175
163
|
return this.manyTablesRoomsManagerService.createTournament(createTournamentDto);
|
|
176
164
|
}
|
|
177
165
|
|
|
178
|
-
async updateTournament(tournamentId: string, updateTournamentDto: ManyTablesTournamentUpdateDto) {
|
|
166
|
+
async updateTournament (tournamentId: string, updateTournamentDto: ManyTablesTournamentUpdateDto) {
|
|
179
167
|
return this.manyTablesRoomsManagerService.updateTournament(tournamentId, updateTournamentDto);
|
|
180
168
|
}
|
|
181
169
|
|
|
182
|
-
async removeTournament(tournamentId: string) {
|
|
170
|
+
async removeTournament (tournamentId: string) {
|
|
183
171
|
return this.manyTablesRoomsManagerService.removeTournament(tournamentId);
|
|
184
172
|
}
|
|
185
173
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Inject, Injectable } from '@nestjs/common';
|
|
2
2
|
import { BannersRepository, MenuRepository } from 'jp.db.schemas';
|
|
3
3
|
import {
|
|
4
|
-
BaseAppScreen,
|
|
5
4
|
IAppHeaders,
|
|
6
5
|
} from 'jp.common.models';
|
|
7
6
|
|
|
@@ -25,14 +24,12 @@ export class MenuService {
|
|
|
25
24
|
const enabledBanner = await this.bannersRepository.findEnabledBanner(headers.client_game, headers.client_channel);
|
|
26
25
|
|
|
27
26
|
return new BaseAppScreenDto(
|
|
28
|
-
new
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
).build()
|
|
35
|
-
)
|
|
27
|
+
new MenuScreenView(
|
|
28
|
+
this.options.i18n,
|
|
29
|
+
headers.client_language,
|
|
30
|
+
menuItems,
|
|
31
|
+
enabledBanner,
|
|
32
|
+
).buildBS()
|
|
36
33
|
);
|
|
37
34
|
}
|
|
38
35
|
}
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
MiniCardSectionListItemComponent,
|
|
16
16
|
UrlImageComponent,
|
|
17
17
|
} from "jp.common.models";
|
|
18
|
+
import { formatChips } from "jp.common.utils";
|
|
18
19
|
import { OneTableTournamentRoom, TournamentMaster } from "jp.ms.common.engine";
|
|
19
20
|
|
|
20
21
|
export class OneTableTournamentStatusScreenView extends UniversalScreenView {
|
|
@@ -48,32 +49,57 @@ export class OneTableTournamentStatusScreenView extends UniversalScreenView {
|
|
|
48
49
|
.addSection(
|
|
49
50
|
new CardListSectionComponent(
|
|
50
51
|
'id1',
|
|
51
|
-
this.
|
|
52
|
-
|
|
53
|
-
item.playerId,
|
|
54
|
-
item.playerName,
|
|
55
|
-
'',
|
|
56
|
-
new UrlImageComponent(item.playerAvatarUrl),
|
|
57
|
-
true,
|
|
58
|
-
true,
|
|
59
|
-
'',
|
|
60
|
-
)
|
|
61
|
-
))
|
|
62
|
-
),
|
|
52
|
+
this.getPlayersList()
|
|
53
|
+
)
|
|
63
54
|
);
|
|
64
55
|
}
|
|
65
56
|
|
|
57
|
+
private getPlayersList (): Array<MiniCardSectionListItemComponent> {
|
|
58
|
+
if (this.tournament.getRoomMaster<TournamentMaster>().isFinish()) {
|
|
59
|
+
return this.tournament.getWinners().map((item) => (
|
|
60
|
+
new MiniCardSectionListItemComponent(
|
|
61
|
+
item.playerId,
|
|
62
|
+
item.playerName,
|
|
63
|
+
this.localeService.t('common.tournaments.status.screen.finish.description', {
|
|
64
|
+
lang: this.lang,
|
|
65
|
+
args: {
|
|
66
|
+
RANK: item.rank.toString(),
|
|
67
|
+
PRIZE: formatChips(item.profit, this.lang, true),
|
|
68
|
+
}
|
|
69
|
+
}),
|
|
70
|
+
new UrlImageComponent(item.playerAvatarUrl),
|
|
71
|
+
true,
|
|
72
|
+
true,
|
|
73
|
+
'',
|
|
74
|
+
)
|
|
75
|
+
));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return this.tournament.getParticipants().map((item) => (
|
|
79
|
+
new MiniCardSectionListItemComponent(
|
|
80
|
+
item.playerId,
|
|
81
|
+
item.playerName,
|
|
82
|
+
'',
|
|
83
|
+
new UrlImageComponent(item.playerAvatarUrl),
|
|
84
|
+
true,
|
|
85
|
+
true,
|
|
86
|
+
'',
|
|
87
|
+
)
|
|
88
|
+
));
|
|
89
|
+
}
|
|
90
|
+
|
|
66
91
|
private getStatusHeader (): StatusHeaderSectionComponent {
|
|
67
|
-
|
|
68
|
-
const foundPlayer = this.tournament.getParticipants().find((item) => item.playerId === this.playerId);
|
|
92
|
+
const foundPlayer = this.tournament.getParticipant(this.playerId)
|
|
69
93
|
|
|
70
94
|
return new StatusHeaderSectionComponent(
|
|
71
95
|
'status',
|
|
72
96
|
this.getStatusDescription(),
|
|
73
97
|
new IconImageComponent(this.getStatusIcon()),
|
|
74
|
-
!foundPlayer ?
|
|
98
|
+
!foundPlayer && this.tournament.getRoomMaster<TournamentMaster>().isWaiting() ?
|
|
75
99
|
new PrimaryButtonButtonsComponent(
|
|
76
|
-
new TextButtonComponent(
|
|
100
|
+
new TextButtonComponent(
|
|
101
|
+
this.localeService.t('common.tournaments.screen.button.join.tournament', { lang: this.lang })
|
|
102
|
+
)
|
|
77
103
|
) : undefined,
|
|
78
104
|
)
|
|
79
105
|
}
|
|
@@ -92,7 +118,7 @@ export class OneTableTournamentStatusScreenView extends UniversalScreenView {
|
|
|
92
118
|
|
|
93
119
|
private getStatusDescription (): string {
|
|
94
120
|
if (this.tournament.getRoomMaster<TournamentMaster>().isCancelled()) {
|
|
95
|
-
return this.localeService.t('common.tournaments.status.
|
|
121
|
+
return this.localeService.t('common.tournaments.status.4', { lang: this.lang });
|
|
96
122
|
} else if (this.tournament.getRoomMaster<TournamentMaster>().isFinish()) {
|
|
97
123
|
return this.localeService.t('common.tournaments.status.3', { lang: this.lang });
|
|
98
124
|
} else if (this.tournament.getRoomMaster<TournamentMaster>().isWaiting()) {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Body, Controller, Get, Param, Post, Headers, HttpStatus, HttpCode } from '@nestjs/common';
|
|
2
|
-
import { IAppHeaders, IBaseAppScreen, IBaseMoveData,
|
|
2
|
+
import { IAppHeaders, IBaseAppScreen, IBaseMoveData, IAppTableState } from 'jp.common.models';
|
|
3
3
|
|
|
4
4
|
import { OneTableTournamentService } from './one-table-tournament.service';
|
|
5
|
-
import { JoinTournamentDto } from '../../dto/common/join-tournament.dto';
|
|
6
5
|
|
|
7
6
|
@Controller('tournament/one_table')
|
|
8
7
|
export class OneTableTournamentController {
|
|
@@ -40,7 +39,7 @@ export class OneTableTournamentController {
|
|
|
40
39
|
watchTheTable(
|
|
41
40
|
@Param('tableId') tableId: string,
|
|
42
41
|
@Headers() headers: IAppHeaders,
|
|
43
|
-
):
|
|
42
|
+
): IAppTableState {
|
|
44
43
|
return this.tournamentService.watchTheTable(tableId, headers.client_auth_token);
|
|
45
44
|
}
|
|
46
45
|
|
|
@@ -50,7 +49,7 @@ export class OneTableTournamentController {
|
|
|
50
49
|
@Param('tableId') tableId: string,
|
|
51
50
|
@Body() baseMoveData: IBaseMoveData,
|
|
52
51
|
@Headers() headers: IAppHeaders,
|
|
53
|
-
):
|
|
52
|
+
): IAppTableState {
|
|
54
53
|
return this.tournamentService.moveOnTheTable(tableId, headers.client_auth_token, baseMoveData);
|
|
55
54
|
}
|
|
56
55
|
|