@vankosoft/game-platform 0.3.0 → 1.1.0
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/CHANGELOG.md +10 -0
- package/VERSION +1 -1
- package/dist/cjs/Dto/Actions/actionDto.d.ts +5 -0
- package/dist/cjs/Dto/Actions/announceMadeActionDto.d.ts +7 -0
- package/dist/cjs/Dto/Actions/bidMadeActionDto.d.ts +7 -0
- package/dist/cjs/Dto/Actions/biddingStartedActionDto.d.ts +13 -0
- package/dist/cjs/Dto/Actions/boardGameCreatedActionDto.d.ts +9 -0
- package/dist/cjs/Dto/Actions/boardGameEndedActionDto.d.ts +9 -0
- package/dist/cjs/Dto/Actions/boardGameRestoreActionDto.d.ts +11 -0
- package/dist/cjs/Dto/Actions/cardGameCreatedActionDto.d.ts +9 -0
- package/dist/cjs/Dto/Actions/cardGameEndedActionDto.d.ts +9 -0
- package/dist/cjs/Dto/Actions/cardGameRestoreActionDto.d.ts +9 -0
- package/dist/cjs/Dto/Actions/chessGameStartedActionDto.d.ts +10 -0
- package/dist/cjs/Dto/Actions/chessInvalidMoveMadeActionDto.d.ts +7 -0
- package/dist/cjs/Dto/Actions/chessMoveMadeActionDto.d.ts +7 -0
- package/dist/cjs/Dto/Actions/chessOpponentMoveActionDto.d.ts +13 -0
- package/dist/cjs/Dto/Actions/connectionInfoActionDto.d.ts +6 -0
- package/dist/cjs/Dto/Actions/dicesRolledActionDto.d.ts +12 -0
- package/dist/cjs/Dto/Actions/doublingActionDto.d.ts +7 -0
- package/dist/cjs/Dto/Actions/hintMovesActionDto.d.ts +8 -0
- package/dist/cjs/Dto/Actions/movesMadeActionDto.d.ts +7 -0
- package/dist/cjs/Dto/Actions/opponentBidsActionDto.d.ts +15 -0
- package/dist/cjs/Dto/Actions/opponentMoveActionDto.d.ts +7 -0
- package/dist/cjs/Dto/Actions/opponentPlayCardActionDto.d.ts +14 -0
- package/dist/cjs/Dto/Actions/playCardActionDto.d.ts +11 -0
- package/dist/cjs/Dto/Actions/playingStartedActionDto.d.ts +16 -0
- package/dist/cjs/Dto/Actions/rolledActionDto.d.ts +5 -0
- package/dist/cjs/Dto/Actions/roundEndedActionDto.d.ts +13 -0
- package/dist/cjs/Dto/Actions/serverWasTerminatedActionDto.d.ts +4 -0
- package/dist/cjs/Dto/Actions/startGamePlayActionDto.d.ts +9 -0
- package/dist/cjs/Dto/Actions/startNewGameActionDto.d.ts +5 -0
- package/dist/cjs/Dto/Actions/startNewRoundActionDto.d.ts +5 -0
- package/dist/cjs/Dto/Actions/trickEndedActionDto.d.ts +7 -0
- package/dist/cjs/Dto/Actions/undoActionDto.d.ts +4 -0
- package/dist/cjs/Dto/BoardGame/checkerDto.d.ts +5 -0
- package/dist/cjs/{Types → Dto}/BoardGame/chessMoveDto.d.ts +3 -3
- package/dist/cjs/Dto/BoardGame/chessPieceDto.d.ts +9 -0
- package/dist/cjs/{Types → Dto}/BoardGame/gameDto.d.ts +3 -2
- package/dist/cjs/Dto/BoardGame/index.d.ts +9 -0
- package/dist/cjs/Dto/BoardGame/index.ts +9 -0
- package/dist/cjs/{Types → Dto}/BoardGame/moveDto.d.ts +1 -1
- package/dist/cjs/{Types → Dto}/BoardGame/playerDto.d.ts +2 -2
- package/dist/cjs/{Types → Dto}/CardGame/announceDto.d.ts +2 -2
- package/dist/cjs/{Types → Dto}/CardGame/bidDto.d.ts +3 -3
- package/dist/cjs/Dto/CardGame/bridgeBeloteBidDto.d.ts +6 -0
- package/dist/cjs/Dto/CardGame/cardDto.d.ts +14 -0
- package/dist/cjs/Dto/CardGame/contractBridgeBidDto.d.ts +6 -0
- package/dist/cjs/{Types → Dto}/CardGame/gameDto.d.ts +3 -3
- package/dist/cjs/Dto/CardGame/index.d.ts +6 -0
- package/dist/cjs/Dto/CardGame/index.ts +6 -0
- package/dist/cjs/Dto/CardGame/playerDto.d.ts +6 -0
- package/dist/cjs/Dto/admin/playedGameDto.d.ts +10 -0
- package/dist/cjs/Dto/admin/playedGameListDto.d.ts +7 -0
- package/dist/cjs/Dto/chat/chatDto.d.ts +5 -0
- package/dist/cjs/Dto/chat/chatMessageDto.d.ts +9 -0
- package/dist/cjs/Dto/chat/joinedChatDto.d.ts +7 -0
- package/dist/cjs/Dto/chat/leftChatDto.d.ts +7 -0
- package/dist/cjs/Dto/editor/gameStringRequest.d.ts +10 -0
- package/dist/cjs/Dto/editor/gameStringResponseDto.d.ts +6 -0
- package/dist/cjs/Dto/feedback/feedbackDto.d.ts +8 -0
- package/dist/cjs/{Types/Core → Dto}/gameCookieDto.d.ts +2 -2
- package/dist/cjs/{Types/Core → Dto}/gameDto.d.ts +1 -1
- package/dist/cjs/Dto/index.d.ts +9 -0
- package/dist/cjs/Dto/index.ts +12 -0
- package/dist/cjs/Dto/message/messageDto.d.ts +12 -0
- package/dist/cjs/Dto/rest/inviteResponseDto.d.ts +6 -0
- package/dist/cjs/Enum/actionNames.d.ts +33 -0
- package/dist/cjs/{CardGame/bidType.d.ts → Enum/bidTrump.d.ts} +1 -1
- package/dist/cjs/Enum/messageType.d.ts +6 -0
- package/dist/cjs/Model/announce.d.ts +4 -0
- package/dist/cjs/Model/card-area.d.ts +13 -0
- package/dist/cjs/Model/card-drag.d.ts +13 -0
- package/dist/cjs/Model/card-game-player-area.d.ts +11 -0
- package/dist/cjs/Model/card.d.ts +7 -0
- package/dist/cjs/Model/checker-area.d.ts +18 -0
- package/dist/cjs/Model/checker-drag.d.ts +10 -0
- package/dist/cjs/Model/checker.d.ts +6 -0
- package/dist/cjs/Model/index.d.ts +9 -0
- package/dist/cjs/Model/move-animation.d.ts +17 -0
- package/dist/cjs/Model/pile.d.ts +6 -0
- package/dist/cjs/Model/point.d.ts +5 -0
- package/dist/cjs/Model/themes.d.ts +91 -0
- package/dist/cjs/{Types/CardGame → Type}/CardGameAnnounceSymbolModel.d.ts +2 -2
- package/dist/cjs/Type/auth.d.ts +15 -0
- package/dist/cjs/Type/index.d.ts +8 -0
- package/dist/cjs/Type/index.ts +11 -0
- package/dist/cjs/Type/mercure-action.d.ts +6 -0
- package/dist/cjs/Type/signed-url-response.d.ts +5 -0
- package/dist/cjs/Type/toggle-sound-mute-response.d.ts +5 -0
- package/dist/cjs/Utils/helper.d.ts +9 -0
- package/dist/cjs/Utils/keys.d.ts +5 -0
- package/dist/cjs/Utils/status-message.d.ts +15 -0
- package/dist/cjs/game.variant.d.ts +10 -0
- package/dist/cjs/index.d.ts +110 -46
- package/dist/cjs/index.js +747 -52
- package/package.json +1 -1
- package/rollup.config.mjs +3 -1
- package/dist/cjs/Types/BoardGame/checkerDto.d.ts +0 -5
- package/dist/cjs/Types/BoardGame/chessPieceDto.d.ts +0 -9
- package/dist/cjs/Types/CardGame/cardDto.d.ts +0 -14
- package/dist/cjs/Types/CardGame/playerDto.d.ts +0 -6
- /package/dist/cjs/{Types → Dto}/BoardGame/chessSquareDto.d.ts +0 -0
- /package/dist/cjs/{Types → Dto}/BoardGame/diceDto.d.ts +0 -0
- /package/dist/cjs/{Types → Dto}/BoardGame/pointDto.d.ts +0 -0
- /package/dist/cjs/{Types → Dto}/CardGame/bridgeBeloteScoreDto.d.ts +0 -0
- /package/dist/cjs/{Types/Core → Dto}/connectionDto.d.ts +0 -0
- /package/dist/cjs/{Types/Core → Dto}/errorReportDto.d.ts +0 -0
- /package/dist/cjs/{Types/Core → Dto}/newScoreDto.d.ts +0 -0
- /package/dist/cjs/{Types/Core → Dto}/playerDto.d.ts +0 -0
- /package/dist/cjs/{Types/Core → Dto}/userDto.d.ts +0 -0
- /package/dist/cjs/{CardGame → Enum}/announceType.d.ts +0 -0
- /package/dist/cjs/{CardGame → Enum}/bridgeBeloteCardType.d.ts +0 -0
- /package/dist/cjs/{CardGame → Enum}/cardGameTeam.d.ts +0 -0
- /package/dist/cjs/{CardGame → Enum}/cardSuit.d.ts +0 -0
- /package/dist/cjs/{BoardGame → Enum}/chessMoveType.d.ts +0 -0
- /package/dist/cjs/{BoardGame → Enum}/chessPieceType.d.ts +0 -0
- /package/dist/cjs/{CardGame → Enum}/contractBridgeCardType.d.ts +0 -0
- /package/dist/cjs/{gameState.d.ts → Enum/gameState.d.ts} +0 -0
- /package/dist/cjs/{BoardGame → Enum}/playerColor.d.ts +0 -0
- /package/dist/cjs/{CardGame → Enum}/playerPosition.d.ts +0 -0
- /package/dist/cjs/{Types → Type}/GameInterface.d.ts +0 -0
- /package/dist/cjs/{Types → Type}/GamePlayInterface.d.ts +0 -0
- /package/dist/cjs/{Types → Type}/GamePlayerModel.d.ts +0 -0
- /package/dist/cjs/{Types → Type}/GameRoomInterface.d.ts +0 -0
- /package/dist/cjs/{Types → Type}/GameRoomModel.d.ts +0 -0
- /package/dist/cjs/{Types → Type}/PlayerInterface.d.ts +0 -0
- /package/dist/cjs/{Types/BoardGame → Type}/toplist.d.ts +0 -0
- /package/dist/cjs/{Types/BoardGame → Type}/toplistResult.d.ts +0 -0
package/dist/cjs/index.js
CHANGED
|
@@ -1,5 +1,167 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
class GameVariant {
|
|
4
|
+
// Backgammon
|
|
5
|
+
static BACKGAMMON_CODE = 'backgammon';
|
|
6
|
+
static BACKGAMMON_NORMAL = 'normal';
|
|
7
|
+
static BACKGAMMON_TAPA = 'tapa';
|
|
8
|
+
static BACKGAMMON_GULBARA = 'gulbara';
|
|
9
|
+
// Chess
|
|
10
|
+
static CHESS_CODE = 'chess';
|
|
11
|
+
// Bridge Belote
|
|
12
|
+
static BRIDGE_BELOTE_CODE = 'bridge-belote';
|
|
13
|
+
// Contarct Bridge
|
|
14
|
+
static CONTRACT_BRIDGE_CODE = 'contract-bridge';
|
|
15
|
+
// Svara
|
|
16
|
+
static SVARA_CODE = 'svara';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
exports.CardSuit = void 0;
|
|
20
|
+
(function (CardSuit) {
|
|
21
|
+
CardSuit[CardSuit["Club"] = 0] = "Club";
|
|
22
|
+
CardSuit[CardSuit["Diamond"] = 1] = "Diamond";
|
|
23
|
+
CardSuit[CardSuit["Heart"] = 2] = "Heart";
|
|
24
|
+
CardSuit[CardSuit["Spade"] = 3] = "Spade";
|
|
25
|
+
})(exports.CardSuit || (exports.CardSuit = {}));
|
|
26
|
+
|
|
27
|
+
exports.BridgeBeloteCardType = void 0;
|
|
28
|
+
(function (BridgeBeloteCardType) {
|
|
29
|
+
BridgeBeloteCardType[BridgeBeloteCardType["Seven"] = 0] = "Seven";
|
|
30
|
+
BridgeBeloteCardType[BridgeBeloteCardType["Eight"] = 1] = "Eight";
|
|
31
|
+
BridgeBeloteCardType[BridgeBeloteCardType["Nine"] = 2] = "Nine";
|
|
32
|
+
BridgeBeloteCardType[BridgeBeloteCardType["Ten"] = 3] = "Ten";
|
|
33
|
+
BridgeBeloteCardType[BridgeBeloteCardType["Jack"] = 4] = "Jack";
|
|
34
|
+
BridgeBeloteCardType[BridgeBeloteCardType["Queen"] = 5] = "Queen";
|
|
35
|
+
BridgeBeloteCardType[BridgeBeloteCardType["King"] = 6] = "King";
|
|
36
|
+
BridgeBeloteCardType[BridgeBeloteCardType["Ace"] = 7] = "Ace";
|
|
37
|
+
})(exports.BridgeBeloteCardType || (exports.BridgeBeloteCardType = {}));
|
|
38
|
+
|
|
39
|
+
exports.ContractBridgeCardType = void 0;
|
|
40
|
+
(function (ContractBridgeCardType) {
|
|
41
|
+
ContractBridgeCardType[ContractBridgeCardType["Two"] = 0] = "Two";
|
|
42
|
+
ContractBridgeCardType[ContractBridgeCardType["Three"] = 1] = "Three";
|
|
43
|
+
ContractBridgeCardType[ContractBridgeCardType["Four"] = 2] = "Four";
|
|
44
|
+
ContractBridgeCardType[ContractBridgeCardType["Five"] = 3] = "Five";
|
|
45
|
+
ContractBridgeCardType[ContractBridgeCardType["Six"] = 4] = "Six";
|
|
46
|
+
ContractBridgeCardType[ContractBridgeCardType["Seven"] = 5] = "Seven";
|
|
47
|
+
ContractBridgeCardType[ContractBridgeCardType["Eight"] = 6] = "Eight";
|
|
48
|
+
ContractBridgeCardType[ContractBridgeCardType["Nine"] = 7] = "Nine";
|
|
49
|
+
ContractBridgeCardType[ContractBridgeCardType["Ten"] = 8] = "Ten";
|
|
50
|
+
ContractBridgeCardType[ContractBridgeCardType["Jack"] = 9] = "Jack";
|
|
51
|
+
ContractBridgeCardType[ContractBridgeCardType["Queen"] = 10] = "Queen";
|
|
52
|
+
ContractBridgeCardType[ContractBridgeCardType["King"] = 11] = "King";
|
|
53
|
+
ContractBridgeCardType[ContractBridgeCardType["Ace"] = 12] = "Ace";
|
|
54
|
+
})(exports.ContractBridgeCardType || (exports.ContractBridgeCardType = {}));
|
|
55
|
+
|
|
56
|
+
class Helper {
|
|
57
|
+
static delay(ms) {
|
|
58
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
59
|
+
}
|
|
60
|
+
static cardSuit(suit) {
|
|
61
|
+
switch (suit) {
|
|
62
|
+
case exports.CardSuit.Club:
|
|
63
|
+
return 'Club';
|
|
64
|
+
case exports.CardSuit.Diamond:
|
|
65
|
+
return 'Diamond';
|
|
66
|
+
case exports.CardSuit.Heart:
|
|
67
|
+
return 'Heart';
|
|
68
|
+
case exports.CardSuit.Spade:
|
|
69
|
+
return 'Spade';
|
|
70
|
+
default:
|
|
71
|
+
throw new Error(`Invalid Card Suit ${suit}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
static bridgeBeloteCardType(type) {
|
|
75
|
+
switch (type) {
|
|
76
|
+
case exports.BridgeBeloteCardType.Seven:
|
|
77
|
+
return 'Seven';
|
|
78
|
+
case exports.BridgeBeloteCardType.Eight:
|
|
79
|
+
return 'Eight';
|
|
80
|
+
case exports.BridgeBeloteCardType.Nine:
|
|
81
|
+
return 'Nine';
|
|
82
|
+
case exports.BridgeBeloteCardType.Ten:
|
|
83
|
+
return 'Ten';
|
|
84
|
+
case exports.BridgeBeloteCardType.Jack:
|
|
85
|
+
return 'Jack';
|
|
86
|
+
case exports.BridgeBeloteCardType.Queen:
|
|
87
|
+
return 'Queen';
|
|
88
|
+
case exports.BridgeBeloteCardType.King:
|
|
89
|
+
return 'King';
|
|
90
|
+
case exports.BridgeBeloteCardType.Ace:
|
|
91
|
+
return 'Ace';
|
|
92
|
+
default:
|
|
93
|
+
throw new Error(`Invalid Card Type ${type}`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
static contractBridgeCardType(type) {
|
|
97
|
+
switch (type) {
|
|
98
|
+
case exports.ContractBridgeCardType.Two:
|
|
99
|
+
return 'Two';
|
|
100
|
+
case exports.ContractBridgeCardType.Three:
|
|
101
|
+
return 'Three';
|
|
102
|
+
case exports.ContractBridgeCardType.Four:
|
|
103
|
+
return 'Four';
|
|
104
|
+
case exports.ContractBridgeCardType.Five:
|
|
105
|
+
return 'Five';
|
|
106
|
+
case exports.ContractBridgeCardType.Six:
|
|
107
|
+
return 'Six';
|
|
108
|
+
case exports.ContractBridgeCardType.Seven:
|
|
109
|
+
return 'Seven';
|
|
110
|
+
case exports.ContractBridgeCardType.Eight:
|
|
111
|
+
return 'Eight';
|
|
112
|
+
case exports.ContractBridgeCardType.Nine:
|
|
113
|
+
return 'Nine';
|
|
114
|
+
case exports.ContractBridgeCardType.Ten:
|
|
115
|
+
return 'Ten';
|
|
116
|
+
case exports.ContractBridgeCardType.Jack:
|
|
117
|
+
return 'Jack';
|
|
118
|
+
case exports.ContractBridgeCardType.Queen:
|
|
119
|
+
return 'Queen';
|
|
120
|
+
case exports.ContractBridgeCardType.King:
|
|
121
|
+
return 'King';
|
|
122
|
+
case exports.ContractBridgeCardType.Ace:
|
|
123
|
+
return 'Ace';
|
|
124
|
+
default:
|
|
125
|
+
throw new Error(`Invalid Card Type ${type}`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
class Keys {
|
|
131
|
+
static loginKey = 'FB5046FE-DE10-48A7-901E-E5E95251E996';
|
|
132
|
+
static gameIdKey = 'game-platform-game-id';
|
|
133
|
+
static inviteId = 'inviteId';
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
class StatusMessage {
|
|
137
|
+
text;
|
|
138
|
+
level;
|
|
139
|
+
startTimerSec;
|
|
140
|
+
constructor(text, level, startTimerSec) {
|
|
141
|
+
this.text = text;
|
|
142
|
+
this.level = level;
|
|
143
|
+
this.startTimerSec = startTimerSec;
|
|
144
|
+
}
|
|
145
|
+
static getDefault() {
|
|
146
|
+
return new StatusMessage('', exports.MessageLevel.info);
|
|
147
|
+
}
|
|
148
|
+
static info(text) {
|
|
149
|
+
return new StatusMessage(text, exports.MessageLevel.info);
|
|
150
|
+
}
|
|
151
|
+
static error(text) {
|
|
152
|
+
return new StatusMessage(text, exports.MessageLevel.error);
|
|
153
|
+
}
|
|
154
|
+
static warning(text) {
|
|
155
|
+
return new StatusMessage(text, exports.MessageLevel.warning);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
exports.MessageLevel = void 0;
|
|
159
|
+
(function (MessageLevel) {
|
|
160
|
+
MessageLevel[MessageLevel["info"] = 0] = "info";
|
|
161
|
+
MessageLevel[MessageLevel["warning"] = 1] = "warning";
|
|
162
|
+
MessageLevel[MessageLevel["error"] = 2] = "error";
|
|
163
|
+
})(exports.MessageLevel || (exports.MessageLevel = {}));
|
|
164
|
+
|
|
3
165
|
exports.GameState = void 0;
|
|
4
166
|
(function (GameState) {
|
|
5
167
|
GameState[GameState["opponentConnectWaiting"] = 0] = "opponentConnectWaiting";
|
|
@@ -16,6 +178,52 @@ exports.GameState = void 0;
|
|
|
16
178
|
GameState[GameState["roundEnded"] = 9] = "roundEnded";
|
|
17
179
|
})(exports.GameState || (exports.GameState = {}));
|
|
18
180
|
|
|
181
|
+
exports.ActionNames = void 0;
|
|
182
|
+
(function (ActionNames) {
|
|
183
|
+
ActionNames[ActionNames["gameCreated"] = 0] = "gameCreated";
|
|
184
|
+
ActionNames[ActionNames["dicesRolled"] = 1] = "dicesRolled";
|
|
185
|
+
ActionNames[ActionNames["movesMade"] = 2] = "movesMade";
|
|
186
|
+
ActionNames[ActionNames["gameEnded"] = 3] = "gameEnded";
|
|
187
|
+
ActionNames[ActionNames["opponentMove"] = 4] = "opponentMove";
|
|
188
|
+
ActionNames[ActionNames["undoMove"] = 5] = "undoMove";
|
|
189
|
+
ActionNames[ActionNames["connectionInfo"] = 6] = "connectionInfo";
|
|
190
|
+
ActionNames[ActionNames["gameRestore"] = 7] = "gameRestore";
|
|
191
|
+
ActionNames[ActionNames["resign"] = 8] = "resign";
|
|
192
|
+
ActionNames[ActionNames["exitGame"] = 9] = "exitGame";
|
|
193
|
+
ActionNames[ActionNames["requestedDoubling"] = 10] = "requestedDoubling";
|
|
194
|
+
ActionNames[ActionNames["acceptedDoubling"] = 11] = "acceptedDoubling";
|
|
195
|
+
ActionNames[ActionNames["rolled"] = 12] = "rolled";
|
|
196
|
+
ActionNames[ActionNames["requestHint"] = 13] = "requestHint";
|
|
197
|
+
ActionNames[ActionNames["hintMoves"] = 14] = "hintMoves";
|
|
198
|
+
// Card Game Actions
|
|
199
|
+
ActionNames[ActionNames["biddingStarted"] = 15] = "biddingStarted";
|
|
200
|
+
ActionNames[ActionNames["bidMade"] = 16] = "bidMade";
|
|
201
|
+
ActionNames[ActionNames["opponentBids"] = 17] = "opponentBids";
|
|
202
|
+
ActionNames[ActionNames["playingStarted"] = 18] = "playingStarted";
|
|
203
|
+
ActionNames[ActionNames["playCard"] = 19] = "playCard";
|
|
204
|
+
ActionNames[ActionNames["opponentPlayCard"] = 20] = "opponentPlayCard";
|
|
205
|
+
ActionNames[ActionNames["trickEnded"] = 21] = "trickEnded";
|
|
206
|
+
ActionNames[ActionNames["roundEnded"] = 22] = "roundEnded";
|
|
207
|
+
ActionNames[ActionNames["startNewRound"] = 23] = "startNewRound";
|
|
208
|
+
ActionNames[ActionNames["announceMade"] = 24] = "announceMade";
|
|
209
|
+
ActionNames[ActionNames["startNewGame"] = 25] = "startNewGame";
|
|
210
|
+
// Chess Game Actions
|
|
211
|
+
ActionNames[ActionNames["chessGameStarted"] = 26] = "chessGameStarted";
|
|
212
|
+
ActionNames[ActionNames["chessMoveMade"] = 27] = "chessMoveMade";
|
|
213
|
+
ActionNames[ActionNames["chessOpponentMove"] = 28] = "chessOpponentMove";
|
|
214
|
+
ActionNames[ActionNames["chessInvalidMoveMade"] = 29] = "chessInvalidMoveMade";
|
|
215
|
+
ActionNames[ActionNames["serverWasTerminated"] = 30] = "serverWasTerminated";
|
|
216
|
+
})(exports.ActionNames || (exports.ActionNames = {}));
|
|
217
|
+
|
|
218
|
+
/* Auto Generated */
|
|
219
|
+
exports.MessageType = void 0;
|
|
220
|
+
(function (MessageType) {
|
|
221
|
+
MessageType[MessageType["sharePrompt"] = 0] = "sharePrompt";
|
|
222
|
+
MessageType[MessageType["version2Info"] = 1] = "version2Info";
|
|
223
|
+
MessageType[MessageType["version3Info"] = 2] = "version3Info";
|
|
224
|
+
MessageType[MessageType["version36Info"] = 3] = "version36Info";
|
|
225
|
+
})(exports.MessageType || (exports.MessageType = {}));
|
|
226
|
+
|
|
19
227
|
exports.PlayerColor = void 0;
|
|
20
228
|
(function (PlayerColor) {
|
|
21
229
|
PlayerColor[PlayerColor["black"] = 0] = "black";
|
|
@@ -58,58 +266,19 @@ exports.CardGameTeam = void 0;
|
|
|
58
266
|
CardGameTeam[CardGameTeam["Neither"] = 2] = "Neither";
|
|
59
267
|
})(exports.CardGameTeam || (exports.CardGameTeam = {}));
|
|
60
268
|
|
|
61
|
-
exports.
|
|
62
|
-
(function (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
exports.ContractBridgeCardType = void 0;
|
|
74
|
-
(function (ContractBridgeCardType) {
|
|
75
|
-
ContractBridgeCardType[ContractBridgeCardType["Two"] = 0] = "Two";
|
|
76
|
-
ContractBridgeCardType[ContractBridgeCardType["Three"] = 1] = "Three";
|
|
77
|
-
ContractBridgeCardType[ContractBridgeCardType["Four"] = 2] = "Four";
|
|
78
|
-
ContractBridgeCardType[ContractBridgeCardType["Five"] = 3] = "Five";
|
|
79
|
-
ContractBridgeCardType[ContractBridgeCardType["Six"] = 4] = "Six";
|
|
80
|
-
ContractBridgeCardType[ContractBridgeCardType["Seven"] = 5] = "Seven";
|
|
81
|
-
ContractBridgeCardType[ContractBridgeCardType["Eight"] = 6] = "Eight";
|
|
82
|
-
ContractBridgeCardType[ContractBridgeCardType["Nine"] = 7] = "Nine";
|
|
83
|
-
ContractBridgeCardType[ContractBridgeCardType["Ten"] = 8] = "Ten";
|
|
84
|
-
ContractBridgeCardType[ContractBridgeCardType["Jack"] = 9] = "Jack";
|
|
85
|
-
ContractBridgeCardType[ContractBridgeCardType["Queen"] = 10] = "Queen";
|
|
86
|
-
ContractBridgeCardType[ContractBridgeCardType["King"] = 11] = "King";
|
|
87
|
-
ContractBridgeCardType[ContractBridgeCardType["Ace"] = 12] = "Ace";
|
|
88
|
-
})(exports.ContractBridgeCardType || (exports.ContractBridgeCardType = {}));
|
|
89
|
-
|
|
90
|
-
exports.CardSuit = void 0;
|
|
91
|
-
(function (CardSuit) {
|
|
92
|
-
CardSuit[CardSuit["Club"] = 0] = "Club";
|
|
93
|
-
CardSuit[CardSuit["Diamond"] = 1] = "Diamond";
|
|
94
|
-
CardSuit[CardSuit["Heart"] = 2] = "Heart";
|
|
95
|
-
CardSuit[CardSuit["Spade"] = 3] = "Spade";
|
|
96
|
-
})(exports.CardSuit || (exports.CardSuit = {}));
|
|
269
|
+
exports.BidTrump = void 0;
|
|
270
|
+
(function (BidTrump) {
|
|
271
|
+
BidTrump[BidTrump["Pass"] = 0] = "Pass";
|
|
272
|
+
BidTrump[BidTrump["Clubs"] = 1] = "Clubs";
|
|
273
|
+
BidTrump[BidTrump["Diamonds"] = 2] = "Diamonds";
|
|
274
|
+
BidTrump[BidTrump["Hearts"] = 3] = "Hearts";
|
|
275
|
+
BidTrump[BidTrump["Spades"] = 4] = "Spades";
|
|
276
|
+
BidTrump[BidTrump["NoTrumps"] = 5] = "NoTrumps";
|
|
277
|
+
BidTrump[BidTrump["AllTrumps"] = 6] = "AllTrumps";
|
|
278
|
+
BidTrump[BidTrump["Double"] = 7] = "Double";
|
|
279
|
+
BidTrump[BidTrump["ReDouble"] = 8] = "ReDouble";
|
|
280
|
+
})(exports.BidTrump || (exports.BidTrump = {}));
|
|
97
281
|
|
|
98
|
-
exports.BidType = void 0;
|
|
99
|
-
(function (BidType) {
|
|
100
|
-
BidType[BidType["Pass"] = 0] = "Pass";
|
|
101
|
-
BidType[BidType["Clubs"] = 1] = "Clubs";
|
|
102
|
-
BidType[BidType["Diamonds"] = 2] = "Diamonds";
|
|
103
|
-
BidType[BidType["Hearts"] = 3] = "Hearts";
|
|
104
|
-
BidType[BidType["Spades"] = 4] = "Spades";
|
|
105
|
-
BidType[BidType["NoTrumps"] = 5] = "NoTrumps";
|
|
106
|
-
BidType[BidType["AllTrumps"] = 6] = "AllTrumps";
|
|
107
|
-
BidType[BidType["Double"] = 7] = "Double";
|
|
108
|
-
BidType[BidType["ReDouble"] = 8] = "ReDouble";
|
|
109
|
-
})(exports.BidType || (exports.BidType = {}));
|
|
110
|
-
|
|
111
|
-
//export type AnnounceType = "Belot" | "SequenceOf3" | "SequenceOf4" | "SequenceOf5";
|
|
112
|
-
/* */
|
|
113
282
|
exports.AnnounceType = void 0;
|
|
114
283
|
(function (AnnounceType) {
|
|
115
284
|
AnnounceType[AnnounceType["Belot"] = 0] = "Belot";
|
|
@@ -123,4 +292,530 @@ exports.AnnounceType = void 0;
|
|
|
123
292
|
AnnounceType[AnnounceType["FourNines"] = 8] = "FourNines";
|
|
124
293
|
AnnounceType[AnnounceType["FourJacks"] = 9] = "FourJacks";
|
|
125
294
|
})(exports.AnnounceType || (exports.AnnounceType = {}));
|
|
126
|
-
|
|
295
|
+
|
|
296
|
+
class Checker {
|
|
297
|
+
static draw(cx, point, width, theme, color, highLighted, shaddow, flipped, hint) {
|
|
298
|
+
if (!cx) {
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
const { x, y } = point;
|
|
302
|
+
if (shaddow) {
|
|
303
|
+
const off = flipped ? -8 : 8;
|
|
304
|
+
cx.shadowColor = 'rgba(0, 0, 0, 0.4)';
|
|
305
|
+
cx.shadowBlur = 8;
|
|
306
|
+
cx.shadowOffsetX = off;
|
|
307
|
+
cx.shadowOffsetY = off;
|
|
308
|
+
}
|
|
309
|
+
cx.strokeStyle = theme.checkerBorder;
|
|
310
|
+
if (color === exports.PlayerColor.black) {
|
|
311
|
+
cx.fillStyle = theme.blackChecker;
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
cx.fillStyle = theme.whiteChecker;
|
|
315
|
+
}
|
|
316
|
+
cx.beginPath();
|
|
317
|
+
cx.ellipse(x, y, width, width, 0, 0, 2 * Math.PI);
|
|
318
|
+
cx.closePath();
|
|
319
|
+
if (hint) {
|
|
320
|
+
cx.globalAlpha = 0.5;
|
|
321
|
+
}
|
|
322
|
+
cx.fill();
|
|
323
|
+
cx.globalAlpha = 1;
|
|
324
|
+
if (highLighted) {
|
|
325
|
+
cx.fillStyle = 'rgba(40, 221, 46, 0.3)'; // todo: get from theme
|
|
326
|
+
cx.fill();
|
|
327
|
+
}
|
|
328
|
+
// clossy checker
|
|
329
|
+
const glossyW = width * 0.9;
|
|
330
|
+
if (!flipped) {
|
|
331
|
+
const glossy = cx.createLinearGradient(x, y - width / 2, x, y);
|
|
332
|
+
glossy.addColorStop(0, 'rgba(255, 255, 255, 0.25)');
|
|
333
|
+
glossy.addColorStop(1, 'rgba(255, 255, 255, 0.15');
|
|
334
|
+
cx.fillStyle = glossy;
|
|
335
|
+
cx.beginPath();
|
|
336
|
+
cx.ellipse(x, y, glossyW, glossyW, 0, Math.PI, 2 * Math.PI);
|
|
337
|
+
cx.closePath();
|
|
338
|
+
cx.fill();
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
const glossy = cx.createLinearGradient(x, y, x, y + width / 2);
|
|
342
|
+
glossy.addColorStop(0, 'rgba(255, 255, 255, 0.15)');
|
|
343
|
+
glossy.addColorStop(1, 'rgba(255, 255, 255, 0.25');
|
|
344
|
+
cx.fillStyle = glossy;
|
|
345
|
+
cx.beginPath();
|
|
346
|
+
cx.ellipse(x, y, glossyW, glossyW, 0, 2 * Math.PI, Math.PI);
|
|
347
|
+
cx.closePath();
|
|
348
|
+
cx.fill();
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
class CheckerArea {
|
|
354
|
+
x;
|
|
355
|
+
y;
|
|
356
|
+
width;
|
|
357
|
+
height;
|
|
358
|
+
pointIdx;
|
|
359
|
+
constructor(x, y, width, height, pointIdx) {
|
|
360
|
+
this.x = x;
|
|
361
|
+
this.y = y;
|
|
362
|
+
this.width = width;
|
|
363
|
+
this.height = height;
|
|
364
|
+
this.pointIdx = pointIdx;
|
|
365
|
+
}
|
|
366
|
+
hasValidMove = false;
|
|
367
|
+
canBeMovedTo = false;
|
|
368
|
+
set(x, y, width, height, pointIdx) {
|
|
369
|
+
this.x = x;
|
|
370
|
+
this.y = y;
|
|
371
|
+
this.width = width;
|
|
372
|
+
this.height = height;
|
|
373
|
+
this.pointIdx = pointIdx;
|
|
374
|
+
}
|
|
375
|
+
contains(x, y) {
|
|
376
|
+
return (x >= this.x &&
|
|
377
|
+
x <= this.x + this.width &&
|
|
378
|
+
y >= this.y &&
|
|
379
|
+
y <= this.y + this.height);
|
|
380
|
+
}
|
|
381
|
+
// private _checkers: Checker[] = [];
|
|
382
|
+
// get checkers(): Checker[] {
|
|
383
|
+
// return this._checkers;
|
|
384
|
+
// }
|
|
385
|
+
drawBorder(cx, text) {
|
|
386
|
+
cx.strokeRect(this.x, this.y, this.width, this.height);
|
|
387
|
+
if (text) {
|
|
388
|
+
cx.fillText(this.pointIdx.toString(), this.x, this.y);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
fill(cx, fillStyle) {
|
|
392
|
+
cx.fillStyle = fillStyle;
|
|
393
|
+
cx.fillRect(this.x, this.y, this.width, this.height);
|
|
394
|
+
}
|
|
395
|
+
highLightTop(cx) {
|
|
396
|
+
cx.beginPath();
|
|
397
|
+
const y = this.y;
|
|
398
|
+
cx.moveTo(this.x, y);
|
|
399
|
+
cx.lineTo(this.x + this.width, y);
|
|
400
|
+
cx.closePath();
|
|
401
|
+
cx.strokeStyle = '#28DD2E';
|
|
402
|
+
cx.lineWidth = 2;
|
|
403
|
+
cx.stroke();
|
|
404
|
+
}
|
|
405
|
+
highLightBottom(cx) {
|
|
406
|
+
cx.beginPath();
|
|
407
|
+
const y = this.y + this.height;
|
|
408
|
+
cx.moveTo(this.x, y);
|
|
409
|
+
cx.lineTo(this.x + this.width, y);
|
|
410
|
+
cx.closePath();
|
|
411
|
+
cx.strokeStyle = '#28DD2E';
|
|
412
|
+
cx.lineWidth = 2;
|
|
413
|
+
cx.stroke();
|
|
414
|
+
}
|
|
415
|
+
getCenter() {
|
|
416
|
+
return { x: this.x + this.width / 2, y: this.y + this.height / 2 };
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
class CheckerDrag {
|
|
421
|
+
checkerArea;
|
|
422
|
+
xDown;
|
|
423
|
+
yDown;
|
|
424
|
+
fromIdx;
|
|
425
|
+
color;
|
|
426
|
+
constructor(checkerArea, xDown, yDown, fromIdx, color) {
|
|
427
|
+
this.checkerArea = checkerArea;
|
|
428
|
+
this.xDown = xDown;
|
|
429
|
+
this.yDown = yDown;
|
|
430
|
+
this.fromIdx = fromIdx;
|
|
431
|
+
this.color = color;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
class MoveAnimation {
|
|
436
|
+
move;
|
|
437
|
+
from;
|
|
438
|
+
to;
|
|
439
|
+
theme;
|
|
440
|
+
flipped;
|
|
441
|
+
frames = 20;
|
|
442
|
+
currentFrame = 0;
|
|
443
|
+
incrementX;
|
|
444
|
+
incrementY;
|
|
445
|
+
currentPos;
|
|
446
|
+
constructor(move, from, to, theme, flipped, finished, step) {
|
|
447
|
+
this.move = move;
|
|
448
|
+
this.from = from;
|
|
449
|
+
this.to = to;
|
|
450
|
+
this.theme = theme;
|
|
451
|
+
this.flipped = flipped;
|
|
452
|
+
if (move.hint) {
|
|
453
|
+
this.frames = 60;
|
|
454
|
+
}
|
|
455
|
+
this.incrementX = (to.x - from.x) / this.frames;
|
|
456
|
+
this.incrementY = (to.y - from.y) / this.frames;
|
|
457
|
+
this.currentPos = { ...from };
|
|
458
|
+
const timerID = setInterval(() => {
|
|
459
|
+
this.currentFrame++;
|
|
460
|
+
this.currentPos = {
|
|
461
|
+
x: this.from.x + this.incrementX * this.currentFrame,
|
|
462
|
+
y: this.from.y + this.incrementY * this.currentFrame
|
|
463
|
+
};
|
|
464
|
+
step();
|
|
465
|
+
if (this.currentFrame >= this.frames) {
|
|
466
|
+
clearInterval(timerID);
|
|
467
|
+
finished(this.move);
|
|
468
|
+
}
|
|
469
|
+
}, 20);
|
|
470
|
+
}
|
|
471
|
+
draw(cx, width) {
|
|
472
|
+
Checker.draw(cx, this.currentPos, width, this.theme, this.move.color, false, true, this.flipped, this.move.hint);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
class Point {
|
|
477
|
+
x;
|
|
478
|
+
y;
|
|
479
|
+
constructor(x, y) {
|
|
480
|
+
this.x = x;
|
|
481
|
+
this.y = y;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
class AnnounceClover {
|
|
486
|
+
id = exports.BidTrump.Clubs;
|
|
487
|
+
key = "btnClover";
|
|
488
|
+
tooltip = "Clover";
|
|
489
|
+
value = '<i class="fi fi-sr-club"></i>';
|
|
490
|
+
}
|
|
491
|
+
class AnnounceDiamond {
|
|
492
|
+
id = exports.BidTrump.Diamonds;
|
|
493
|
+
key = "btnDiamond";
|
|
494
|
+
tooltip = "Diamond";
|
|
495
|
+
value = '<i class="fi fi-sr-card-diamond"></i>';
|
|
496
|
+
}
|
|
497
|
+
class AnnounceHeart {
|
|
498
|
+
id = exports.BidTrump.Hearts;
|
|
499
|
+
key = "btnHeart";
|
|
500
|
+
tooltip = "Heart";
|
|
501
|
+
value = '<i class="fi fi-sr-heart"></i>';
|
|
502
|
+
}
|
|
503
|
+
class AnnounceSpade {
|
|
504
|
+
id = exports.BidTrump.Spades;
|
|
505
|
+
key = "btnSpade";
|
|
506
|
+
tooltip = "Spade";
|
|
507
|
+
value = '<i class="fi fi-sr-spade"></i>';
|
|
508
|
+
}
|
|
509
|
+
class AnnounceBezKoz {
|
|
510
|
+
id = exports.BidTrump.NoTrumps;
|
|
511
|
+
key = "btnBezKoz";
|
|
512
|
+
tooltip = "Bez Koz";
|
|
513
|
+
value = 'a';
|
|
514
|
+
}
|
|
515
|
+
class AnnounceVsichkoKoz {
|
|
516
|
+
id = exports.BidTrump.AllTrumps;
|
|
517
|
+
key = "btnVsichkoKoz";
|
|
518
|
+
tooltip = "Vsichko Koz";
|
|
519
|
+
value = 'j';
|
|
520
|
+
}
|
|
521
|
+
class AnnounceKontra {
|
|
522
|
+
id = exports.BidTrump.Double;
|
|
523
|
+
key = "btnKontra";
|
|
524
|
+
tooltip = "Kontra";
|
|
525
|
+
value = 'kr';
|
|
526
|
+
}
|
|
527
|
+
class AnnounceReKontra {
|
|
528
|
+
id = exports.BidTrump.ReDouble;
|
|
529
|
+
key = "btnReKontra";
|
|
530
|
+
tooltip = "Re-Kontra";
|
|
531
|
+
value = 're-kr';
|
|
532
|
+
}
|
|
533
|
+
class AnnouncePass {
|
|
534
|
+
id = exports.BidTrump.Pass;
|
|
535
|
+
key = "btnPass";
|
|
536
|
+
tooltip = "Pass";
|
|
537
|
+
value = '<span class="announce-button">pass</span>';
|
|
538
|
+
}
|
|
539
|
+
var AnnounceSymbols = [
|
|
540
|
+
new AnnounceClover(),
|
|
541
|
+
new AnnounceDiamond(),
|
|
542
|
+
new AnnounceHeart(),
|
|
543
|
+
new AnnounceSpade(),
|
|
544
|
+
new AnnounceBezKoz(),
|
|
545
|
+
new AnnounceVsichkoKoz(),
|
|
546
|
+
new AnnounceKontra(),
|
|
547
|
+
new AnnounceReKontra(),
|
|
548
|
+
new AnnouncePass()
|
|
549
|
+
];
|
|
550
|
+
function GetAnnounceSymbols() {
|
|
551
|
+
return AnnounceSymbols;
|
|
552
|
+
}
|
|
553
|
+
function GetAnnounceSymbol(symbolId) {
|
|
554
|
+
return AnnounceSymbols.find((x) => x.id === symbolId);
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
class Card {
|
|
558
|
+
static draw(cx, cardImagesPath, cardBack, card, point, width, height, angle, theme, position, highLighted, debugCards) {
|
|
559
|
+
if (!cx) {
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
const { x, y } = point;
|
|
563
|
+
const image = new Image(width, height);
|
|
564
|
+
if (position === exports.PlayerPosition.south || debugCards) {
|
|
565
|
+
let imgSrc = `${cardImagesPath}/${card.cardIndex}.png`;
|
|
566
|
+
image.src = imgSrc;
|
|
567
|
+
}
|
|
568
|
+
else {
|
|
569
|
+
image.src = cardBack;
|
|
570
|
+
}
|
|
571
|
+
cx.save();
|
|
572
|
+
cx.translate(x, y);
|
|
573
|
+
cx.rotate(angle);
|
|
574
|
+
cx.drawImage(image, 0, 0, width, height);
|
|
575
|
+
if (highLighted) {
|
|
576
|
+
cx.globalAlpha = .50;
|
|
577
|
+
cx.fillStyle = "black";
|
|
578
|
+
cx.fillRect(0, 0, width, height);
|
|
579
|
+
}
|
|
580
|
+
cx.restore();
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
class CardArea {
|
|
585
|
+
x;
|
|
586
|
+
y;
|
|
587
|
+
width;
|
|
588
|
+
height;
|
|
589
|
+
cardIdx;
|
|
590
|
+
constructor(x, y, width, height, cardIdx) {
|
|
591
|
+
this.x = x;
|
|
592
|
+
this.y = y;
|
|
593
|
+
this.width = width;
|
|
594
|
+
this.height = height;
|
|
595
|
+
this.cardIdx = cardIdx;
|
|
596
|
+
}
|
|
597
|
+
hasValidCard = false;
|
|
598
|
+
canBePlayed = false;
|
|
599
|
+
set(x, y, width, height, cardIdx) {
|
|
600
|
+
this.x = x;
|
|
601
|
+
this.y = y;
|
|
602
|
+
this.width = width;
|
|
603
|
+
this.height = height;
|
|
604
|
+
this.cardIdx = cardIdx;
|
|
605
|
+
}
|
|
606
|
+
contains(x, y) {
|
|
607
|
+
return (x >= this.x &&
|
|
608
|
+
x <= this.x + this.width &&
|
|
609
|
+
y >= this.y &&
|
|
610
|
+
y <= this.y + this.height);
|
|
611
|
+
}
|
|
612
|
+
drawBorder(cx) {
|
|
613
|
+
cx.strokeRect(this.x, this.y, this.width, this.height);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* May be will be used if I Create Solitaires ( Пасианси )
|
|
619
|
+
*/
|
|
620
|
+
class CardDrag {
|
|
621
|
+
cardArea;
|
|
622
|
+
xDown;
|
|
623
|
+
yDown;
|
|
624
|
+
cardIdx;
|
|
625
|
+
position;
|
|
626
|
+
constructor(cardArea, xDown, yDown, cardIdx, position) {
|
|
627
|
+
this.cardArea = cardArea;
|
|
628
|
+
this.xDown = xDown;
|
|
629
|
+
this.yDown = yDown;
|
|
630
|
+
this.cardIdx = cardIdx;
|
|
631
|
+
this.position = position;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
class CardGamePlayerArea {
|
|
636
|
+
x;
|
|
637
|
+
y;
|
|
638
|
+
width;
|
|
639
|
+
height;
|
|
640
|
+
playerPosition;
|
|
641
|
+
constructor(x, y, width, height, playerPosition) {
|
|
642
|
+
this.x = x;
|
|
643
|
+
this.y = y;
|
|
644
|
+
this.width = width;
|
|
645
|
+
this.height = height;
|
|
646
|
+
this.playerPosition = playerPosition;
|
|
647
|
+
}
|
|
648
|
+
set(x, y, width, height, playerPosition) {
|
|
649
|
+
this.x = x;
|
|
650
|
+
this.y = y;
|
|
651
|
+
this.width = width;
|
|
652
|
+
this.height = height;
|
|
653
|
+
this.playerPosition = playerPosition;
|
|
654
|
+
}
|
|
655
|
+
drawBorder(cx) {
|
|
656
|
+
cx.strokeRect(this.x, this.y, this.width, this.height);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
class Pile {
|
|
661
|
+
static drawAsPile(cx, pile, boardWidth, boardHeight, cardWidth, cardHeight, theme) {
|
|
662
|
+
if (!cx) {
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
var cardX, cardY, angle, image;
|
|
666
|
+
for (let c = 0; c < pile.length; c++) {
|
|
667
|
+
cardX = boardWidth / 2 - (pile.length - c) * cardWidth / Math.PI;
|
|
668
|
+
if (c == 0 || c == 3) {
|
|
669
|
+
cardY = boardHeight / 2 - cardHeight / 2 + 25;
|
|
670
|
+
}
|
|
671
|
+
else {
|
|
672
|
+
cardY = boardHeight / 2 - cardHeight / 2 + 5;
|
|
673
|
+
}
|
|
674
|
+
if (c < 2) {
|
|
675
|
+
angle = -(Math.PI / 4);
|
|
676
|
+
}
|
|
677
|
+
else {
|
|
678
|
+
angle = Math.PI / 4;
|
|
679
|
+
}
|
|
680
|
+
image = new Image(cardWidth, cardHeight);
|
|
681
|
+
image.src = `/build/gameplatform-velzonsaas-theme/images/CardGame/Cards/BridgeBelote/${pile[c].cardIndex}.png`;
|
|
682
|
+
cx.save();
|
|
683
|
+
cx.translate(cardX, cardY);
|
|
684
|
+
cx.rotate(angle);
|
|
685
|
+
cx.drawImage(image, 0, 0, cardWidth, cardHeight);
|
|
686
|
+
cx.restore();
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
static drawAsRound(cx, pile, boardWidth, boardHeight, cardWidth, cardHeight, theme) {
|
|
690
|
+
if (!cx) {
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
var cardX, cardY, angle, image;
|
|
694
|
+
var pileOffset = 3;
|
|
695
|
+
for (let c = 0; c < pile.length; c++) {
|
|
696
|
+
cardX = boardWidth / 2 - ((pile.length - c) * cardWidth + pileOffset * 20) / 2;
|
|
697
|
+
if (c == 0 || c == 3) {
|
|
698
|
+
cardY = boardHeight / 2 - cardHeight / 2 + 40;
|
|
699
|
+
}
|
|
700
|
+
else {
|
|
701
|
+
cardY = boardHeight / 2 - cardHeight / 2 + 20;
|
|
702
|
+
}
|
|
703
|
+
if (c < 2) {
|
|
704
|
+
angle = -(Math.PI / 4);
|
|
705
|
+
}
|
|
706
|
+
else {
|
|
707
|
+
angle = Math.PI / 4;
|
|
708
|
+
}
|
|
709
|
+
image = new Image(cardWidth, cardHeight);
|
|
710
|
+
image.src = `/build/gameplatform-velzonsaas-theme/images/CardGame/Cards/BridgeBelote/${pile[c].cardIndex}.png`;
|
|
711
|
+
cx.save();
|
|
712
|
+
cx.translate(cardX, cardY);
|
|
713
|
+
cx.rotate(angle);
|
|
714
|
+
cx.drawImage(image, 0, 0, cardWidth, cardHeight);
|
|
715
|
+
cx.restore();
|
|
716
|
+
pileOffset--;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
class DarkTheme {
|
|
722
|
+
name = 'dark';
|
|
723
|
+
boardBackground = '#222';
|
|
724
|
+
homeBackground = '#444';
|
|
725
|
+
border = '#333';
|
|
726
|
+
whiteTriangle = '#666';
|
|
727
|
+
blackTriangle = '#333';
|
|
728
|
+
whiteChecker = '#888';
|
|
729
|
+
blackChecker = '#000';
|
|
730
|
+
textColor = '#ddd';
|
|
731
|
+
highLight = '#28DD2E';
|
|
732
|
+
checkerBorder = '#777';
|
|
733
|
+
}
|
|
734
|
+
class LightTheme {
|
|
735
|
+
name = 'light';
|
|
736
|
+
boardBackground = '#808080';
|
|
737
|
+
homeBackground = '#444';
|
|
738
|
+
border = '#333';
|
|
739
|
+
whiteTriangle = '#666';
|
|
740
|
+
blackTriangle = '#444';
|
|
741
|
+
whiteChecker = '#aaa';
|
|
742
|
+
blackChecker = '#000';
|
|
743
|
+
textColor = '#222';
|
|
744
|
+
highLight = '#28DD2E';
|
|
745
|
+
checkerBorder = '#777';
|
|
746
|
+
}
|
|
747
|
+
class BlueTheme {
|
|
748
|
+
name = 'blue';
|
|
749
|
+
boardBackground = '#808096';
|
|
750
|
+
homeBackground = '#445';
|
|
751
|
+
border = '#334';
|
|
752
|
+
whiteTriangle = '#667';
|
|
753
|
+
blackTriangle = '#334';
|
|
754
|
+
whiteChecker = '#aaa';
|
|
755
|
+
blackChecker = '#000';
|
|
756
|
+
textColor = '#223';
|
|
757
|
+
highLight = '#28DD2E';
|
|
758
|
+
checkerBorder = '#778';
|
|
759
|
+
}
|
|
760
|
+
class PinkTheme {
|
|
761
|
+
name = 'pink';
|
|
762
|
+
boardBackground = '#968080';
|
|
763
|
+
homeBackground = '#544';
|
|
764
|
+
border = '#433';
|
|
765
|
+
whiteTriangle = '#766';
|
|
766
|
+
blackTriangle = '#433';
|
|
767
|
+
whiteChecker = '#aaa';
|
|
768
|
+
blackChecker = '#000';
|
|
769
|
+
textColor = '#322';
|
|
770
|
+
highLight = '#28DD2E';
|
|
771
|
+
checkerBorder = '#877';
|
|
772
|
+
}
|
|
773
|
+
class GreenTheme {
|
|
774
|
+
name = 'green';
|
|
775
|
+
boardBackground = '#809680';
|
|
776
|
+
homeBackground = '#454';
|
|
777
|
+
border = '#343';
|
|
778
|
+
whiteTriangle = '#676';
|
|
779
|
+
blackTriangle = '#343';
|
|
780
|
+
whiteChecker = '#aaa';
|
|
781
|
+
blackChecker = '#000';
|
|
782
|
+
textColor = '#232';
|
|
783
|
+
highLight = '#28DD2E';
|
|
784
|
+
checkerBorder = '#787';
|
|
785
|
+
}
|
|
786
|
+
class CardGameTheme {
|
|
787
|
+
name = 'card-game';
|
|
788
|
+
boardBackground = 'green';
|
|
789
|
+
homeBackground = '#454';
|
|
790
|
+
border = 'brown';
|
|
791
|
+
whiteTriangle = '#676';
|
|
792
|
+
blackTriangle = '#343';
|
|
793
|
+
whiteChecker = '#aaa';
|
|
794
|
+
blackChecker = '#000';
|
|
795
|
+
textColor = '#232';
|
|
796
|
+
highLight = '#28DD2E';
|
|
797
|
+
checkerBorder = '#787';
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
exports.BlueTheme = BlueTheme;
|
|
801
|
+
exports.Card = Card;
|
|
802
|
+
exports.CardArea = CardArea;
|
|
803
|
+
exports.CardDrag = CardDrag;
|
|
804
|
+
exports.CardGamePlayerArea = CardGamePlayerArea;
|
|
805
|
+
exports.CardGameTheme = CardGameTheme;
|
|
806
|
+
exports.Checker = Checker;
|
|
807
|
+
exports.CheckerArea = CheckerArea;
|
|
808
|
+
exports.CheckerDrag = CheckerDrag;
|
|
809
|
+
exports.DarkTheme = DarkTheme;
|
|
810
|
+
exports.GameVariant = GameVariant;
|
|
811
|
+
exports.GetAnnounceSymbol = GetAnnounceSymbol;
|
|
812
|
+
exports.GetAnnounceSymbols = GetAnnounceSymbols;
|
|
813
|
+
exports.GreenTheme = GreenTheme;
|
|
814
|
+
exports.Helper = Helper;
|
|
815
|
+
exports.Keys = Keys;
|
|
816
|
+
exports.LightTheme = LightTheme;
|
|
817
|
+
exports.MoveAnimation = MoveAnimation;
|
|
818
|
+
exports.Pile = Pile;
|
|
819
|
+
exports.PinkTheme = PinkTheme;
|
|
820
|
+
exports.Point = Point;
|
|
821
|
+
exports.StatusMessage = StatusMessage;
|