@vankosoft/game-platform 1.3.1 → 1.3.3
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/assets/i18n/bg.json +1 -0
- package/dist/assets/i18n/en.json +1 -0
- package/dist/cjs/Dto/Actions/opponentBidsActionDto.d.ts +1 -0
- package/dist/cjs/Dto/CardGame/gameDto.d.ts +1 -0
- package/dist/cjs/Utils/helper.d.ts +1 -0
- package/dist/cjs/Utils/player-positions.d.ts +10 -0
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.js +44 -10
- package/package.json +1 -1
package/dist/assets/i18n/bg.json
CHANGED
package/dist/assets/i18n/en.json
CHANGED
|
@@ -5,6 +5,7 @@ import { PlayerPosition } from '../Enum/playerPosition';
|
|
|
5
5
|
import { BidTrump } from '../Enum/bidTrump';
|
|
6
6
|
export declare class Helper {
|
|
7
7
|
static delay(ms: number): Promise<unknown>;
|
|
8
|
+
static splitAtN(arrayToSplit: any[], n: number): any[];
|
|
8
9
|
static cardSuit(suit: CardSuit): string;
|
|
9
10
|
static bridgeBeloteCardType(type: BridgeBeloteCardType): string;
|
|
10
11
|
static contractBridgeCardType(type: ContractBridgeCardType): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PlayerPosition } from '../Enum/playerPosition';
|
|
2
|
+
/**
|
|
3
|
+
* Help Get Player Positions Clockwise and Back-Clockwise
|
|
4
|
+
*/
|
|
5
|
+
export declare class PlayerPositions {
|
|
6
|
+
private static PlayerPositions;
|
|
7
|
+
static GetAll(): PlayerPosition[];
|
|
8
|
+
static Next(playerPosition: PlayerPosition): PlayerPosition;
|
|
9
|
+
static Prev(playerPosition: PlayerPosition): PlayerPosition;
|
|
10
|
+
}
|
package/dist/cjs/index.d.ts
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -16,6 +16,40 @@ class GameVariant {
|
|
|
16
16
|
static SVARA_CODE = 'svara';
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
exports.PlayerPosition = void 0;
|
|
20
|
+
(function (PlayerPosition) {
|
|
21
|
+
PlayerPosition[PlayerPosition["south"] = 0] = "south";
|
|
22
|
+
PlayerPosition[PlayerPosition["east"] = 1] = "east";
|
|
23
|
+
PlayerPosition[PlayerPosition["north"] = 2] = "north";
|
|
24
|
+
PlayerPosition[PlayerPosition["west"] = 3] = "west";
|
|
25
|
+
PlayerPosition[PlayerPosition["neither"] = 4] = "neither";
|
|
26
|
+
})(exports.PlayerPosition || (exports.PlayerPosition = {}));
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Help Get Player Positions Clockwise and Back-Clockwise
|
|
30
|
+
*/
|
|
31
|
+
class PlayerPositions {
|
|
32
|
+
static PlayerPositions = [
|
|
33
|
+
exports.PlayerPosition.south,
|
|
34
|
+
exports.PlayerPosition.west,
|
|
35
|
+
exports.PlayerPosition.north,
|
|
36
|
+
exports.PlayerPosition.east
|
|
37
|
+
];
|
|
38
|
+
static GetAll() {
|
|
39
|
+
return PlayerPositions.PlayerPositions;
|
|
40
|
+
}
|
|
41
|
+
static Next(playerPosition) {
|
|
42
|
+
const PlayerPositionIndex = PlayerPositions.PlayerPositions.findIndex((positions) => positions === playerPosition);
|
|
43
|
+
const NextPlayerPositionIndex = (PlayerPositionIndex + 1) % PlayerPositions.PlayerPositions.length;
|
|
44
|
+
return PlayerPositions.PlayerPositions[NextPlayerPositionIndex];
|
|
45
|
+
}
|
|
46
|
+
static Prev(playerPosition) {
|
|
47
|
+
const PlayerPositionIndex = PlayerPositions.PlayerPositions.findIndex((positions) => positions === playerPosition);
|
|
48
|
+
const NextPlayerPositionIndex = (PlayerPositionIndex - 1) % PlayerPositions.PlayerPositions.length;
|
|
49
|
+
return PlayerPositions.PlayerPositions[NextPlayerPositionIndex];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
19
53
|
exports.CardSuit = void 0;
|
|
20
54
|
(function (CardSuit) {
|
|
21
55
|
CardSuit[CardSuit["Club"] = 0] = "Club";
|
|
@@ -53,15 +87,6 @@ exports.ContractBridgeCardType = void 0;
|
|
|
53
87
|
ContractBridgeCardType[ContractBridgeCardType["Ace"] = 12] = "Ace";
|
|
54
88
|
})(exports.ContractBridgeCardType || (exports.ContractBridgeCardType = {}));
|
|
55
89
|
|
|
56
|
-
exports.PlayerPosition = void 0;
|
|
57
|
-
(function (PlayerPosition) {
|
|
58
|
-
PlayerPosition[PlayerPosition["south"] = 0] = "south";
|
|
59
|
-
PlayerPosition[PlayerPosition["east"] = 1] = "east";
|
|
60
|
-
PlayerPosition[PlayerPosition["north"] = 2] = "north";
|
|
61
|
-
PlayerPosition[PlayerPosition["west"] = 3] = "west";
|
|
62
|
-
PlayerPosition[PlayerPosition["neither"] = 4] = "neither";
|
|
63
|
-
})(exports.PlayerPosition || (exports.PlayerPosition = {}));
|
|
64
|
-
|
|
65
90
|
exports.BidTrump = void 0;
|
|
66
91
|
(function (BidTrump) {
|
|
67
92
|
BidTrump[BidTrump["Pass"] = 0] = "Pass";
|
|
@@ -79,6 +104,14 @@ class Helper {
|
|
|
79
104
|
static delay(ms) {
|
|
80
105
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
81
106
|
}
|
|
107
|
+
static splitAtN(arrayToSplit, n) {
|
|
108
|
+
const output = [], i = 0;
|
|
109
|
+
while (arrayToSplit.length) {
|
|
110
|
+
output.push(arrayToSplit.slice(0 , i + n));
|
|
111
|
+
arrayToSplit = arrayToSplit.slice(i + n);
|
|
112
|
+
}
|
|
113
|
+
return output;
|
|
114
|
+
}
|
|
82
115
|
static cardSuit(suit) {
|
|
83
116
|
switch (suit) {
|
|
84
117
|
case exports.CardSuit.Club:
|
|
@@ -605,7 +638,7 @@ function GetAnnounceSymbols() {
|
|
|
605
638
|
return AnnounceSymbols;
|
|
606
639
|
}
|
|
607
640
|
function GetAnnounceSymbol(symbolId) {
|
|
608
|
-
return AnnounceSymbols.find((
|
|
641
|
+
return AnnounceSymbols.find(({ id }) => id === symbolId);
|
|
609
642
|
}
|
|
610
643
|
|
|
611
644
|
class Card {
|
|
@@ -872,5 +905,6 @@ exports.LightTheme = LightTheme;
|
|
|
872
905
|
exports.MoveAnimation = MoveAnimation;
|
|
873
906
|
exports.Pile = Pile;
|
|
874
907
|
exports.PinkTheme = PinkTheme;
|
|
908
|
+
exports.PlayerPositions = PlayerPositions;
|
|
875
909
|
exports.Point = Point;
|
|
876
910
|
exports.StatusMessage = StatusMessage;
|