@gamepark/react-client 6.38.5 → 7.0.0-beta.2
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/Actions/ActionFailed.d.ts +6 -6
- package/dist/Actions/ActionFailed.js +4 -8
- package/dist/Actions/ActionFailed.js.map +1 -1
- package/dist/Actions/AnimationComplete.d.ts +6 -6
- package/dist/Actions/AnimationComplete.js +4 -8
- package/dist/Actions/AnimationComplete.js.map +1 -1
- package/dist/Actions/AnimationPaused.d.ts +6 -6
- package/dist/Actions/AnimationPaused.js +4 -8
- package/dist/Actions/AnimationPaused.js.map +1 -1
- package/dist/Actions/AnimationStart.d.ts +5 -5
- package/dist/Actions/AnimationStart.js +1 -4
- package/dist/Actions/AnimationStart.js.map +1 -1
- package/dist/Actions/ClearFailures.d.ts +1 -5
- package/dist/Actions/ClearFailures.js +3 -9
- package/dist/Actions/ClearFailures.js.map +1 -1
- package/dist/Actions/GameNotificationsReceived.d.ts +8 -10
- package/dist/Actions/GameNotificationsReceived.js +2 -9
- package/dist/Actions/GameNotificationsReceived.js.map +1 -1
- package/dist/Actions/GameOver.d.ts +16 -16
- package/dist/Actions/GameOver.js +4 -8
- package/dist/Actions/GameOver.js.map +1 -1
- package/dist/Actions/GameStateLoaded.d.ts +16 -16
- package/dist/Actions/GameStateLoaded.js +7 -20
- package/dist/Actions/GameStateLoaded.js.map +1 -1
- package/dist/Actions/MovePlayed.d.ts +11 -11
- package/dist/Actions/MovePlayed.js +3 -2
- package/dist/Actions/MovePlayed.js.map +1 -1
- package/dist/Actions/MoveUndone.d.ts +7 -7
- package/dist/Actions/MoveUndone.js +4 -9
- package/dist/Actions/MoveUndone.js.map +1 -1
- package/dist/Actions/PlayerQuit.d.ts +5 -11
- package/dist/Actions/PlayerQuit.js +2 -19
- package/dist/Actions/PlayerQuit.js.map +1 -1
- package/dist/Actions/SetAnimationsSpeed.d.ts +1 -6
- package/dist/Actions/SetAnimationsSpeed.js +3 -9
- package/dist/Actions/SetAnimationsSpeed.js.map +1 -1
- package/dist/Actions/giveUp.d.ts +1 -0
- package/dist/Actions/giveUp.js +3 -0
- package/dist/Actions/giveUp.js.map +1 -0
- package/dist/Actions/index.d.ts +7 -12
- package/dist/Actions/index.js +7 -28
- package/dist/Actions/index.js.map +1 -1
- package/dist/Actions/loadGameState.d.ts +14 -0
- package/dist/Actions/loadGameState.js +3 -0
- package/dist/Actions/loadGameState.js.map +1 -0
- package/dist/Actions/playMove.d.ts +10 -0
- package/dist/Actions/playMove.js +3 -0
- package/dist/Actions/playMove.js.map +1 -0
- package/dist/Actions/receiveNotifications.d.ts +8 -0
- package/dist/Actions/receiveNotifications.js +3 -0
- package/dist/Actions/receiveNotifications.js.map +1 -0
- package/dist/Actions/removePlayer.d.ts +5 -0
- package/dist/Actions/removePlayer.js +3 -0
- package/dist/Actions/removePlayer.js.map +1 -0
- package/dist/Actions/reportFailure.d.ts +1 -0
- package/dist/Actions/reportFailure.js +3 -0
- package/dist/Actions/reportFailure.js.map +1 -0
- package/dist/Actions/setGameOver.d.ts +2 -0
- package/dist/Actions/setGameOver.js +3 -0
- package/dist/Actions/setGameOver.js.map +1 -0
- package/dist/Actions/startAnimation.d.ts +1 -0
- package/dist/Actions/startAnimation.js +3 -0
- package/dist/Actions/startAnimation.js.map +1 -0
- package/dist/Actions/undoMove.d.ts +5 -0
- package/dist/Actions/undoMove.js +4 -0
- package/dist/Actions/undoMove.js.map +1 -0
- package/dist/Chat/ChatChannel.d.ts +5 -5
- package/dist/Chat/ChatChannel.js +1 -2
- package/dist/Chat/Message.d.ts +6 -6
- package/dist/Chat/Message.js +1 -2
- package/dist/Chat/index.d.ts +2 -2
- package/dist/Chat/index.js +2 -18
- package/dist/Chat/index.js.map +1 -1
- package/dist/Deckbuilding/Deck.d.ts +5 -5
- package/dist/Deckbuilding/Deck.js +1 -2
- package/dist/Deckbuilding/index.d.ts +4 -4
- package/dist/Deckbuilding/index.js +4 -24
- package/dist/Deckbuilding/index.js.map +1 -1
- package/dist/Deckbuilding/useDeleteDeck.d.ts +5 -2
- package/dist/Deckbuilding/useDeleteDeck.js +9 -15
- package/dist/Deckbuilding/useDeleteDeck.js.map +1 -1
- package/dist/Deckbuilding/useMyDecks.d.ts +3 -2
- package/dist/Deckbuilding/useMyDecks.js +8 -14
- package/dist/Deckbuilding/useMyDecks.js.map +1 -1
- package/dist/Deckbuilding/useSaveDeck.d.ts +5 -2
- package/dist/Deckbuilding/useSaveDeck.js +9 -15
- package/dist/Deckbuilding/useSaveDeck.js.map +1 -1
- package/dist/EjectPlayer/EjectPlayer.d.ts +1 -6
- package/dist/EjectPlayer/EjectPlayer.js +2 -8
- package/dist/EjectPlayer/EjectPlayer.js.map +1 -1
- package/dist/EjectPlayer/index.d.ts +1 -1
- package/dist/EjectPlayer/index.js +1 -17
- package/dist/EjectPlayer/index.js.map +1 -1
- package/dist/Failure/Failure.d.ts +6 -6
- package/dist/Failure/Failure.js +6 -9
- package/dist/Failure/Failure.js.map +1 -1
- package/dist/Failure/index.d.ts +1 -1
- package/dist/Failure/index.js +1 -17
- package/dist/Failure/index.js.map +1 -1
- package/dist/GiveUp/GiveUp.d.ts +7 -7
- package/dist/GiveUp/GiveUp.js +2 -5
- package/dist/GiveUp/GiveUp.js.map +1 -1
- package/dist/GiveUp/index.d.ts +1 -1
- package/dist/GiveUp/index.js +1 -17
- package/dist/GiveUp/index.js.map +1 -1
- package/dist/Hooks/index.d.ts +5 -5
- package/dist/Hooks/index.js +5 -21
- package/dist/Hooks/index.js.map +1 -1
- package/dist/Hooks/useChatMessages.d.ts +7 -12
- package/dist/Hooks/useChatMessages.js +44 -51
- package/dist/Hooks/useChatMessages.js.map +1 -1
- package/dist/Hooks/useMessageAuthor.d.ts +4 -4
- package/dist/Hooks/useMessageAuthor.js +13 -18
- package/dist/Hooks/useMessageAuthor.js.map +1 -1
- package/dist/Hooks/useOptions.d.ts +2 -2
- package/dist/Hooks/useOptions.js +4 -8
- package/dist/Hooks/useOptions.js.map +1 -1
- package/dist/Hooks/useRematch.d.ts +7 -7
- package/dist/Hooks/useRematch.js +18 -19
- package/dist/Hooks/useRematch.js.map +1 -1
- package/dist/Hooks/useSendMessage.d.ts +4 -1
- package/dist/Hooks/useSendMessage.js +6 -14
- package/dist/Hooks/useSendMessage.js.map +1 -1
- package/dist/Log/StartLiveLog.d.ts +1 -4
- package/dist/Log/StartLiveLog.js +3 -5
- package/dist/Log/StartLiveLog.js.map +1 -1
- package/dist/Log/StopLiveLog.d.ts +2 -5
- package/dist/Log/StopLiveLog.js +6 -9
- package/dist/Log/StopLiveLog.js.map +1 -1
- package/dist/Log/index.d.ts +4 -4
- package/dist/Log/index.js +4 -20
- package/dist/Log/index.js.map +1 -1
- package/dist/Log/useLogControls.d.ts +7 -7
- package/dist/Log/useLogControls.js +18 -22
- package/dist/Log/useLogControls.js.map +1 -1
- package/dist/PlayerTime/PlayerTime.d.ts +11 -11
- package/dist/PlayerTime/PlayerTime.js +1 -2
- package/dist/PlayerTime/index.d.ts +1 -1
- package/dist/PlayerTime/index.js +1 -17
- package/dist/PlayerTime/index.js.map +1 -1
- package/dist/Rematch/RematchQueries.d.ts +19 -19
- package/dist/Rematch/RematchQueries.js +23 -13
- package/dist/Rematch/RematchQueries.js.map +1 -1
- package/dist/Rematch/index.d.ts +1 -1
- package/dist/Rematch/index.js +1 -17
- package/dist/Rematch/index.js.map +1 -1
- package/dist/Sound/MuteSounds.d.ts +2 -5
- package/dist/Sound/MuteSounds.js +7 -10
- package/dist/Sound/MuteSounds.js.map +1 -1
- package/dist/Sound/UnmuteSounds.d.ts +1 -4
- package/dist/Sound/UnmuteSounds.js +3 -5
- package/dist/Sound/UnmuteSounds.js.map +1 -1
- package/dist/Sound/index.d.ts +3 -3
- package/dist/Sound/index.js +3 -19
- package/dist/Sound/index.js.map +1 -1
- package/dist/Sound/useSoundControls.d.ts +7 -7
- package/dist/Sound/useSoundControls.js +18 -22
- package/dist/Sound/useSoundControls.js.map +1 -1
- package/dist/Store/DisplayedAction.d.ts +15 -15
- package/dist/Store/DisplayedAction.js +12 -19
- package/dist/Store/DisplayedAction.js.map +1 -1
- package/dist/Store/GamePageState.d.ts +27 -28
- package/dist/Store/GamePageState.js +1 -2
- package/dist/Store/PlayedMove.d.ts +5 -5
- package/dist/Store/PlayedMove.js +1 -2
- package/dist/Store/endAnimation.d.ts +1 -0
- package/dist/Store/endAnimation.js +3 -0
- package/dist/Store/endAnimation.js.map +1 -0
- package/dist/Store/gameMiddleware.d.ts +4 -4
- package/dist/Store/gameMiddleware.js +34 -41
- package/dist/Store/gameMiddleware.js.map +1 -1
- package/dist/Store/gameReducer.d.ts +14 -20
- package/dist/Store/gameReducer.js +462 -525
- package/dist/Store/gameReducer.js.map +1 -1
- package/dist/Store/index.d.ts +4 -3
- package/dist/Store/index.js +4 -19
- package/dist/Store/index.js.map +1 -1
- package/dist/Store/localMovePreviewMiddleware.d.ts +4 -4
- package/dist/Store/localMovePreviewMiddleware.js +19 -18
- package/dist/Store/localMovePreviewMiddleware.js.map +1 -1
- package/dist/Store/store.d.ts +13 -0
- package/dist/Store/store.js +27 -0
- package/dist/Store/store.js.map +1 -0
- package/dist/Tutorial/PlayTutorialMoves.d.ts +1 -9
- package/dist/Tutorial/PlayTutorialMoves.js +2 -6
- package/dist/Tutorial/PlayTutorialMoves.js.map +1 -1
- package/dist/Tutorial/Tutorial.d.ts +5 -5
- package/dist/Tutorial/Tutorial.js +1 -2
- package/dist/Tutorial/TutorialDescription.d.ts +7 -7
- package/dist/Tutorial/TutorialDescription.js +1 -2
- package/dist/Tutorial/index.d.ts +4 -4
- package/dist/Tutorial/index.js +4 -20
- package/dist/Tutorial/index.js.map +1 -1
- package/dist/Tutorial/useTutorial.d.ts +2 -2
- package/dist/Tutorial/useTutorial.js +12 -22
- package/dist/Tutorial/useTutorial.js.map +1 -1
- package/dist/Types/GameAI.d.ts +1 -1
- package/dist/Types/GameAI.js +1 -2
- package/dist/Types/GameData.d.ts +18 -18
- package/dist/Types/GameData.js +1 -2
- package/dist/Types/GameMessage.d.ts +8 -8
- package/dist/Types/GameMessage.js +1 -2
- package/dist/Types/GameMode.d.ts +6 -6
- package/dist/Types/GameMode.js +7 -10
- package/dist/Types/GameMode.js.map +1 -1
- package/dist/Types/GameNotification.d.ts +6 -6
- package/dist/Types/GameNotification.js +1 -2
- package/dist/Types/GameOptions.d.ts +9 -9
- package/dist/Types/GameOptions.js +5 -8
- package/dist/Types/GameOptions.js.map +1 -1
- package/dist/Types/MovePlayedNotification.d.ts +9 -9
- package/dist/Types/MovePlayedNotification.js +6 -12
- package/dist/Types/MovePlayedNotification.js.map +1 -1
- package/dist/Types/MoveUndoneNotification.d.ts +8 -8
- package/dist/Types/MoveUndoneNotification.js +6 -12
- package/dist/Types/MoveUndoneNotification.js.map +1 -1
- package/dist/Types/Player.d.ts +13 -13
- package/dist/Types/Player.js +1 -2
- package/dist/Types/PlayerQuitReason.d.ts +4 -4
- package/dist/Types/PlayerQuitReason.js +5 -8
- package/dist/Types/PlayerQuitReason.js.map +1 -1
- package/dist/Types/ProxyGameData.d.ts +13 -13
- package/dist/Types/ProxyGameData.js +1 -2
- package/dist/Types/Tournament.d.ts +4 -4
- package/dist/Types/Tournament.js +1 -2
- package/dist/Types/index.d.ts +12 -12
- package/dist/Types/index.js +12 -28
- package/dist/Types/index.js.map +1 -1
- package/dist/User/User.d.ts +6 -6
- package/dist/User/User.js +1 -2
- package/dist/User/index.d.ts +2 -2
- package/dist/User/index.js +2 -18
- package/dist/User/index.js.map +1 -1
- package/dist/User/useMe.d.ts +4 -4
- package/dist/User/useMe.js +10 -21
- package/dist/User/useMe.js.map +1 -1
- package/dist/animations/Animation.d.ts +6 -6
- package/dist/animations/Animation.js +1 -2
- package/dist/animations/AnimationContext.d.ts +8 -8
- package/dist/animations/AnimationContext.js +1 -2
- package/dist/animations/AnimationState.d.ts +6 -6
- package/dist/animations/AnimationState.js +1 -2
- package/dist/animations/AnimationStep.d.ts +6 -6
- package/dist/animations/AnimationStep.js +7 -10
- package/dist/animations/AnimationStep.js.map +1 -1
- package/dist/animations/Animations.d.ts +8 -8
- package/dist/animations/Animations.js +15 -22
- package/dist/animations/Animations.js.map +1 -1
- package/dist/animations/AnimationsListener.d.ts +6 -0
- package/dist/animations/AnimationsListener.js +54 -0
- package/dist/animations/AnimationsListener.js.map +1 -0
- package/dist/animations/AnimationsListenerCreator.d.ts +2 -4
- package/dist/animations/AnimationsListenerCreator.js +40 -50
- package/dist/animations/AnimationsListenerCreator.js.map +1 -1
- package/dist/animations/animationMiddleware.d.ts +4 -0
- package/dist/animations/animationMiddleware.js +50 -0
- package/dist/animations/animationMiddleware.js.map +1 -0
- package/dist/animations/index.d.ts +5 -6
- package/dist/animations/index.js +5 -22
- package/dist/animations/index.js.map +1 -1
- package/dist/api/Client/GameClientAPI.d.ts +24 -24
- package/dist/api/Client/GameClientAPI.js +116 -165
- package/dist/api/Client/GameClientAPI.js.map +1 -1
- package/dist/api/Client/GameNotificationsListener.d.ts +5 -5
- package/dist/api/Client/GameNotificationsListener.js +62 -113
- package/dist/api/Client/GameNotificationsListener.js.map +1 -1
- package/dist/api/Client/RemoteGameLoader.d.ts +4 -5
- package/dist/api/Client/RemoteGameLoader.js +66 -62
- package/dist/api/Client/RemoteGameLoader.js.map +1 -1
- package/dist/api/Client/RemoteGameProvider.d.ts +7 -7
- package/dist/api/Client/RemoteGameProvider.js +19 -70
- package/dist/api/Client/RemoteGameProvider.js.map +1 -1
- package/dist/api/Client/apollo-client.d.ts +2 -2
- package/dist/api/Client/apollo-client.js +40 -58
- package/dist/api/Client/apollo-client.js.map +1 -1
- package/dist/api/Client/index.d.ts +4 -3
- package/dist/api/Client/index.js +4 -19
- package/dist/api/Client/index.js.map +1 -1
- package/dist/api/Client/pusher.d.ts +2 -0
- package/dist/api/Client/pusher.js +9 -0
- package/dist/api/Client/pusher.js.map +1 -0
- package/dist/api/GameAPI.d.ts +10 -10
- package/dist/api/GameAPI.js +1 -2
- package/dist/api/Local/ConsoleTools.d.ts +25 -25
- package/dist/api/Local/ConsoleTools.js +78 -86
- package/dist/api/Local/ConsoleTools.js.map +1 -1
- package/dist/api/Local/GameLocalAPI.d.ts +44 -44
- package/dist/api/Local/GameLocalAPI.js +442 -540
- package/dist/api/Local/GameLocalAPI.js.map +1 -1
- package/dist/api/Local/LocalGameProvider.d.ts +15 -15
- package/dist/api/Local/LocalGameProvider.js +18 -58
- package/dist/api/Local/LocalGameProvider.js.map +1 -1
- package/dist/api/Local/index.d.ts +1 -1
- package/dist/api/Local/index.js +1 -17
- package/dist/api/Local/index.js.map +1 -1
- package/dist/api/index.d.ts +2 -2
- package/dist/api/index.js +2 -18
- package/dist/api/index.js.map +1 -1
- package/dist/index.d.ts +16 -18
- package/dist/index.js +16 -36
- package/dist/index.js.map +1 -1
- package/dist/util/ArrayUtil.d.ts +2 -2
- package/dist/util/ArrayUtil.js +16 -21
- package/dist/util/ArrayUtil.js.map +1 -1
- package/package.json +66 -65
- package/dist/Actions/ActionType.d.ts +0 -3
- package/dist/Actions/ActionType.js +0 -8
- package/dist/Actions/ActionType.js.map +0 -1
- package/dist/Scoring/ScoringDescription.d.ts +0 -8
- package/dist/Scoring/ScoringDescription.js +0 -3
- package/dist/Scoring/ScoringDescription.js.map +0 -1
- package/dist/Scoring/index.d.ts +0 -1
- package/dist/Scoring/index.js +0 -18
- package/dist/Scoring/index.js.map +0 -1
- package/dist/util/TimeUtil.d.ts +0 -2
- package/dist/util/TimeUtil.js +0 -27
- package/dist/util/TimeUtil.js.map +0 -1
|
@@ -1,63 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (isOver) {
|
|
35
|
-
setTimeout(
|
|
36
|
-
}
|
|
37
|
-
}, [isOver]);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
getGame({ variables: { id: gameId } }).then(
|
|
41
|
-
if (result.data) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (remoteVersion && remoteVersion !== version) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
url.hostname =
|
|
48
|
-
window.location.href = url.href;
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
dispatch((
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { gql } from '@apollo/client';
|
|
3
|
+
import { useLazyQuery } from '@apollo/client/react';
|
|
4
|
+
import { useEffect, useState } from 'react';
|
|
5
|
+
import { loadGameState } from '../../Actions/loadGameState';
|
|
6
|
+
import { useGameDispatch, useGameSelector } from '../../Store';
|
|
7
|
+
import { AVATAR_INFO, NOTIFICATIONS, PLAYERS_TIME } from './GameClientAPI';
|
|
8
|
+
import { GameNotificationsListener } from './GameNotificationsListener';
|
|
9
|
+
const GET_GAME = gql `
|
|
10
|
+
query Game($id: String!) {
|
|
11
|
+
time
|
|
12
|
+
gameNotifications(gameId: $id, start: 0) { ...Notifications }
|
|
13
|
+
game(id: $id) {
|
|
14
|
+
id
|
|
15
|
+
players {
|
|
16
|
+
id userId name avatar {...AvatarInfo} quit quitReason gamePointsDelta tournamentPoints ...PlayerTime
|
|
17
|
+
}
|
|
18
|
+
options {
|
|
19
|
+
speed maxSpareTime maxExceedTime
|
|
20
|
+
}
|
|
21
|
+
notificationsChannel mode setup state myPlayerId endDate
|
|
22
|
+
tournament {
|
|
23
|
+
number signedUp
|
|
24
|
+
}
|
|
25
|
+
version
|
|
26
|
+
}
|
|
27
|
+
} ${PLAYERS_TIME} ${AVATAR_INFO} ${NOTIFICATIONS}
|
|
28
|
+
`;
|
|
29
|
+
export function RemoteGameLoader({ gameId, version = 1 }) {
|
|
30
|
+
const dispatch = useGameDispatch();
|
|
31
|
+
const isOver = useGameSelector(state => state.gameOver);
|
|
32
|
+
const [isOverForLongEnough, setIsOverForLongEnough] = useState(isOver);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (isOver) {
|
|
35
|
+
setTimeout(() => setIsOverForLongEnough(isOver), 10000);
|
|
36
|
+
}
|
|
37
|
+
}, [isOver]);
|
|
38
|
+
const [getGame, { data }] = useLazyQuery(GET_GAME);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
getGame({ variables: { id: gameId } }).then(result => {
|
|
41
|
+
if (result.data) {
|
|
42
|
+
const { game, time, gameNotifications } = result.data;
|
|
43
|
+
const remoteVersion = game.version;
|
|
44
|
+
if (remoteVersion && remoteVersion !== version) {
|
|
45
|
+
const url = new URL(window.location.href);
|
|
46
|
+
const path = url.hostname.split('.');
|
|
47
|
+
url.hostname = `${path[0]}.v${remoteVersion}.${path[path.length - 2]}.${path[path.length - 1]}`;
|
|
48
|
+
window.location.href = url.href;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
dispatch(loadGameState({
|
|
52
|
+
...({ ...game, notifications: gameNotifications }),
|
|
53
|
+
playerId: { ...game, notifications: gameNotifications }.myPlayerId ?? undefined,
|
|
54
|
+
serverTime: time,
|
|
55
|
+
endDate: { ...game, notifications: gameNotifications }.endDate ?? undefined,
|
|
56
|
+
tournament: { ...game, notifications: gameNotifications }.tournament ?? undefined
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}, []);
|
|
62
|
+
if (!data || data.game.endDate || isOverForLongEnough)
|
|
63
|
+
return null;
|
|
64
|
+
else
|
|
65
|
+
return _jsx(GameNotificationsListener, { channelName: data?.game?.notificationsChannel ?? `game=${gameId}`, gameId: gameId, notificationsCount: data.gameNotifications.length });
|
|
66
|
+
}
|
|
63
67
|
//# sourceMappingURL=RemoteGameLoader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteGameLoader.js","sourceRoot":"","sources":["../../../src/api/Client/RemoteGameLoader.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RemoteGameLoader.js","sourceRoot":"","sources":["../../../src/api/Client/RemoteGameLoader.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { GameReducerContext } from '../../Store/gameReducer';
|
|
3
|
-
type RemoveGameProviderProps<Game = any, Move = any, PlayerId = any> = {
|
|
4
|
-
gameId: string;
|
|
5
|
-
} & GameReducerContext<Game, Move, PlayerId>;
|
|
6
|
-
export declare function RemoteGameProvider<Game = any, Move = any, PlayerId = any>({ gameId, children, ...context }: PropsWithChildren<RemoveGameProviderProps<Game, Move, PlayerId>>): JSX.Element;
|
|
7
|
-
export {};
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { GameReducerContext } from '../../Store/gameReducer';
|
|
3
|
+
type RemoveGameProviderProps<Game = any, Move = any, PlayerId = any> = {
|
|
4
|
+
gameId: string;
|
|
5
|
+
} & GameReducerContext<Game, Move, PlayerId>;
|
|
6
|
+
export declare function RemoteGameProvider<Game = any, Move = any, PlayerId = any>({ gameId, children, ...context }: PropsWithChildren<RemoveGameProviderProps<Game, Move, PlayerId>>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -1,71 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
-
};
|
|
27
|
-
var _a, _b, _c;
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.RemoteGameProvider = void 0;
|
|
30
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
31
|
-
var use_pusher_1 = require("@harelpls/use-pusher");
|
|
32
|
-
var pusher_js_1 = __importDefault(require("pusher-js"));
|
|
33
|
-
var react_1 = require("react");
|
|
34
|
-
var react_redux_1 = require("react-redux");
|
|
35
|
-
var redux_1 = require("redux");
|
|
36
|
-
var rules_api_1 = require("../../../../rules-api");
|
|
37
|
-
var animations_1 = require("../../animations");
|
|
38
|
-
var index_1 = require("../../index");
|
|
39
|
-
var gameMiddleware_1 = require("../../Store/gameMiddleware");
|
|
40
|
-
var gameReducer_1 = require("../../Store/gameReducer");
|
|
41
|
-
var localMovePreviewMiddleware_1 = require("../../Store/localMovePreviewMiddleware");
|
|
42
|
-
var GameClientAPI_1 = require("./GameClientAPI");
|
|
43
|
-
var RemoteGameLoader_1 = require("./RemoteGameLoader");
|
|
44
|
-
pusher_js_1.default.logToConsole = true;
|
|
45
|
-
pusher_js_1.default.Runtime.createXHR = function () {
|
|
46
|
-
var xhr = new XMLHttpRequest();
|
|
47
|
-
xhr.withCredentials = true;
|
|
48
|
-
return xhr;
|
|
49
|
-
};
|
|
50
|
-
var authEndpoint = index_1.PLATFORM_URI + ((_a = process.env.REACT_APP_PUSHER_ENDPOINT) !== null && _a !== void 0 ? _a : '/api/pusher/auth');
|
|
51
|
-
var clientKey = (_b = process.env.REACT_APP_PUSHER_KEY) !== null && _b !== void 0 ? _b : '747557f1e8edf7fc2816';
|
|
52
|
-
var cluster = (_c = process.env.REACT_APP_PUSHER_CLUSTER) !== null && _c !== void 0 ? _c : 'eu';
|
|
53
|
-
function RemoteGameProvider(_a) {
|
|
54
|
-
var gameId = _a.gameId, children = _a.children, context = __rest(_a, ["gameId", "children"]);
|
|
55
|
-
var store = (0, react_1.useMemo)(function () { return createRemoteApiStore(gameId, context); }, []);
|
|
56
|
-
return ((0, jsx_runtime_1.jsx)(use_pusher_1.PusherProvider, __assign({ authEndpoint: authEndpoint, clientKey: clientKey, cluster: cluster }, { children: (0, jsx_runtime_1.jsxs)(react_redux_1.Provider, __assign({ store: store }, { children: [(0, jsx_runtime_1.jsx)(RemoteGameLoader_1.RemoteGameLoader, { gameId: gameId, version: context.version }), children] })) })));
|
|
57
|
-
}
|
|
58
|
-
exports.RemoteGameProvider = RemoteGameProvider;
|
|
59
|
-
function createRemoteApiStore(gameId, context) {
|
|
60
|
-
var api = new GameClientAPI_1.GameClientAPI(gameId);
|
|
61
|
-
var reducer = (0, gameReducer_1.gameReducer)(context);
|
|
62
|
-
var middlewares = [(0, gameMiddleware_1.gameMiddleware)(api)];
|
|
63
|
-
if ((0, rules_api_1.hasLocalMovePreview)(new context.Rules({}))) {
|
|
64
|
-
middlewares.unshift((0, localMovePreviewMiddleware_1.localMovePreviewMiddleware)(context));
|
|
65
|
-
}
|
|
66
|
-
var store = (0, redux_1.createStore)(reducer, redux_1.applyMiddleware.apply(void 0, middlewares));
|
|
67
|
-
store.subscribe((0, animations_1.createAnimationsListener)(store, context.Rules));
|
|
68
|
-
api.init(store.dispatch);
|
|
69
|
-
return store;
|
|
70
|
-
}
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Pusher from 'pusher-js';
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { Provider } from 'react-redux';
|
|
5
|
+
import { initStore, store } from '../../Store';
|
|
6
|
+
import { GameClientAPI } from './GameClientAPI';
|
|
7
|
+
import { RemoteGameLoader } from './RemoteGameLoader';
|
|
8
|
+
Pusher.logToConsole = true;
|
|
9
|
+
Pusher.Runtime.createXHR = function () {
|
|
10
|
+
const xhr = new XMLHttpRequest();
|
|
11
|
+
xhr.withCredentials = true;
|
|
12
|
+
return xhr;
|
|
13
|
+
};
|
|
14
|
+
export function RemoteGameProvider({ gameId, children, ...context }) {
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
initStore(context, () => new GameClientAPI(gameId));
|
|
17
|
+
}, []);
|
|
18
|
+
return (_jsxs(Provider, { store: store, children: [_jsx(RemoteGameLoader, { gameId: gameId, version: context.version }), children] }));
|
|
19
|
+
}
|
|
71
20
|
//# sourceMappingURL=RemoteGameProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteGameProvider.js","sourceRoot":"","sources":["../../../src/api/Client/RemoteGameProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RemoteGameProvider.js","sourceRoot":"","sources":["../../../src/api/Client/RemoteGameProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,WAAW,CAAA;AAE9B,OAAO,EAAqB,SAAS,EAAE,MAAM,OAAO,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,MAAM,CAAC,YAAY,GAAG,IAAI,CAAA;AAE1B,MAAM,CAAC,OAAO,CAAC,SAAS,GAAG;IACzB,MAAM,GAAG,GAAG,IAAI,cAAc,EAAU,CAAA;IACxC,GAAG,CAAC,eAAe,GAAG,IAAI,CAAA;IAC1B,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAMD,MAAM,UAAU,kBAAkB,CAChC,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAoE;IAElG,SAAS,CAAC,GAAG,EAAE;QACb,SAAS,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC,CAAA;IACrD,CAAC,EAAE,EAAE,CAAC,CAAA;IACN,OAAO,CACL,MAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,aACpB,KAAC,gBAAgB,IAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,GAAG,EAC5D,QAAQ,IACA,CACZ,CAAA;AACH,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ApolloClient } from '@apollo/client';
|
|
2
|
-
export declare function getApolloClient(): ApolloClient
|
|
1
|
+
import { ApolloClient } from '@apollo/client';
|
|
2
|
+
export declare function getApolloClient(): ApolloClient;
|
|
@@ -1,59 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (existing === void 0) { existing = []; }
|
|
42
|
-
if (incoming === void 0) { incoming = []; }
|
|
43
|
-
return __spreadArray(__spreadArray([], incoming, true), existing, true).sort(function (m1, m2) { return (0, dayjs_1.default)(m1.date).unix() - (0, dayjs_1.default)(m2.date).unix(); })
|
|
44
|
-
.filter(function (message, index, messages) { return index === 0 || message.id !== messages[index - 1].id; });
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
Message: {
|
|
50
|
-
keyFields: false
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
possibleTypes: {
|
|
54
|
-
GameNotification: ['MovePlayedNotification', 'MoveUndoneNotification']
|
|
55
|
-
}
|
|
56
|
-
})
|
|
57
|
-
});
|
|
58
|
-
}
|
|
1
|
+
import { ApolloClient, ApolloLink, HttpLink, InMemoryCache } from '@apollo/client';
|
|
2
|
+
import { RetryLink } from '@apollo/client/link/retry';
|
|
3
|
+
import dayjs from 'dayjs';
|
|
4
|
+
import { PLATFORM_URI } from './GameClientAPI';
|
|
5
|
+
let apolloClient;
|
|
6
|
+
export function getApolloClient() {
|
|
7
|
+
if (!apolloClient) {
|
|
8
|
+
apolloClient = initApolloClient();
|
|
9
|
+
}
|
|
10
|
+
return apolloClient;
|
|
11
|
+
}
|
|
12
|
+
function initApolloClient() {
|
|
13
|
+
const httpLink = new HttpLink({ uri: PLATFORM_URI + (process.env.GRAPHQL_ENDPOINT ?? '/api/graphql'), fetch, credentials: 'include' });
|
|
14
|
+
return new ApolloClient({
|
|
15
|
+
link: ApolloLink.from([new RetryLink(), httpLink]),
|
|
16
|
+
cache: new InMemoryCache({
|
|
17
|
+
typePolicies: {
|
|
18
|
+
ChatChannel: {
|
|
19
|
+
keyFields: ['name'],
|
|
20
|
+
fields: {
|
|
21
|
+
messages: {
|
|
22
|
+
keyArgs: false,
|
|
23
|
+
merge(existing = [], incoming = []) {
|
|
24
|
+
return [...incoming, ...existing]
|
|
25
|
+
.sort((m1, m2) => dayjs(m2.date).unix() - dayjs(m1.date).unix())
|
|
26
|
+
.filter((message, index, messages) => index === 0 || message.id !== messages[index - 1].id);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
Message: {
|
|
32
|
+
keyFields: false
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
possibleTypes: {
|
|
36
|
+
GameNotification: ['MovePlayedNotification', 'MoveUndoneNotification']
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
}
|
|
59
41
|
//# sourceMappingURL=apollo-client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apollo-client.js","sourceRoot":"","sources":["../../../src/api/Client/apollo-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apollo-client.js","sourceRoot":"","sources":["../../../src/api/Client/apollo-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,IAAI,YAAsC,CAAA;AAE1C,MAAM,UAAU,eAAe;IAC7B,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,YAAY,GAAG,gBAAgB,EAAE,CAAA;IACnC,CAAC;IACD,OAAO,YAAY,CAAA;AACrB,CAAC;AAED,SAAS,gBAAgB;IACvB,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,EAAE,GAAG,EAAE,YAAY,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,cAAc,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAA;IACtI,OAAO,IAAI,YAAY,CAAC;QACtB,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,SAAS,EAAE,EAAE,QAAQ,CAAC,CAAC;QAClD,KAAK,EAAE,IAAI,aAAa,CAAC;YACvB,YAAY,EAAE;gBACZ,WAAW,EAAE;oBACX,SAAS,EAAE,CAAC,MAAM,CAAC;oBACnB,MAAM,EAAE;wBACN,QAAQ,EAAE;4BACR,OAAO,EAAE,KAAK;4BACd,KAAK,CAAC,WAAsB,EAAE,EAAE,WAAsB,EAAE;gCACtD,OAAO,CAAC,GAAG,QAAQ,EAAE,GAAG,QAAQ,CAAC;qCAC9B,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;qCAC/D,MAAM,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,KAAK,KAAK,CAAC,IAAI,OAAO,CAAC,EAAE,KAAK,QAAQ,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;4BAC/F,CAAC;yBACF;qBACF;iBACF;gBACD,OAAO,EAAE;oBACP,SAAS,EAAE,KAAK;iBACjB;aACF;YACD,aAAa,EAAE;gBACb,gBAAgB,EAAE,CAAC,wBAAwB,EAAE,wBAAwB,CAAC;aACvE;SACF,CAAC;KACH,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export * from './apollo-client';
|
|
2
|
-
export * from './GameClientAPI';
|
|
3
|
-
export * from './
|
|
1
|
+
export * from './apollo-client';
|
|
2
|
+
export * from './GameClientAPI';
|
|
3
|
+
export * from './pusher';
|
|
4
|
+
export * from './RemoteGameProvider';
|
package/dist/api/Client/index.js
CHANGED
|
@@ -1,20 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./apollo-client"), exports);
|
|
18
|
-
__exportStar(require("./GameClientAPI"), exports);
|
|
19
|
-
__exportStar(require("./RemoteGameProvider"), exports);
|
|
1
|
+
export * from './apollo-client';
|
|
2
|
+
export * from './GameClientAPI';
|
|
3
|
+
export * from './pusher';
|
|
4
|
+
export * from './RemoteGameProvider';
|
|
20
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/Client/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/Client/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,UAAU,CAAA;AACxB,cAAc,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Pusher from 'pusher-js';
|
|
2
|
+
import { PLATFORM_URI } from './GameClientAPI';
|
|
3
|
+
export const pusherClient = new Pusher(process.env.PUSHER_KEY ?? '747557f1e8edf7fc2816', {
|
|
4
|
+
cluster: process.env.PUSHER_CLUSTER ?? 'eu',
|
|
5
|
+
authEndpoint: PLATFORM_URI + (process.env.PUSHER_ENDPOINT ?? '/api/pusher/auth'),
|
|
6
|
+
forceTLS: true,
|
|
7
|
+
disableStats: true
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=pusher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pusher.js","sourceRoot":"","sources":["../../../src/api/Client/pusher.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,WAAW,CAAA;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,sBAAsB,EAAE;IACvF,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,IAAI;IAC3C,YAAY,EAAE,YAAY,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,kBAAkB,CAAC;IAChF,QAAQ,EAAE,IAAI;IACd,YAAY,EAAE,IAAI;CACnB,CAAC,CAAA"}
|
package/dist/api/GameAPI.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Dispatch } from 'redux';
|
|
2
|
-
export interface GameAPI<Move =
|
|
3
|
-
init(dispatch: Dispatch): void;
|
|
4
|
-
play(move: Move): void;
|
|
5
|
-
undo(playerActionIndex: number): void;
|
|
6
|
-
undo(actionId: string): void;
|
|
7
|
-
eject(playerId: PlayerId): void;
|
|
8
|
-
giveUp(): void;
|
|
9
|
-
playTutorialMoves(quantity: number): void;
|
|
10
|
-
}
|
|
1
|
+
import { Dispatch } from 'redux';
|
|
2
|
+
export interface GameAPI<Move = any, PlayerId = any> {
|
|
3
|
+
init(dispatch: Dispatch): void;
|
|
4
|
+
play(move: Move): void;
|
|
5
|
+
undo(playerActionIndex: number): void;
|
|
6
|
+
undo(actionId: string): void;
|
|
7
|
+
eject(playerId: PlayerId): void;
|
|
8
|
+
giveUp(): void;
|
|
9
|
+
playTutorialMoves(quantity: number): void;
|
|
10
|
+
}
|
package/dist/api/GameAPI.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { Action } from '@gamepark/rules-api';
|
|
2
|
-
import { Store } from 'redux';
|
|
3
|
-
import { GamePageState } from '../../Store';
|
|
4
|
-
import { GameLocalAPI } from './GameLocalAPI';
|
|
5
|
-
declare global {
|
|
6
|
-
interface Window {
|
|
7
|
-
game: ConsoleTools;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
type ConsoleTools<Game = any, Move = any, PlayerId = any> = {
|
|
11
|
-
state: Game;
|
|
12
|
-
store: GamePageState<Game>;
|
|
13
|
-
moves: Action<Move, PlayerId>[];
|
|
14
|
-
new: (options?: any) => void;
|
|
15
|
-
undo: (quantity?: number) => void;
|
|
16
|
-
monkeyOpponents: (start?: boolean) => void;
|
|
17
|
-
bot: (start?: boolean) => void;
|
|
18
|
-
setPlayerName: (name: string, playerId?: PlayerId) => void;
|
|
19
|
-
setAnimationsSpeed: (speed?: number) => void;
|
|
20
|
-
tutorial: (options?: any) => void;
|
|
21
|
-
changePlayer: (playerId?: PlayerId) => void;
|
|
22
|
-
timer: (seconds: number, playerId?: PlayerId) => void;
|
|
23
|
-
};
|
|
24
|
-
export declare function consoleTools<Game, Move, PlayerId, View, MoveView>(gameServerProxy: GameLocalAPI<Game, Move, PlayerId, View, MoveView>, store: Store): ConsoleTools<Game, Move, PlayerId>;
|
|
25
|
-
export {};
|
|
1
|
+
import { Action } from '@gamepark/rules-api';
|
|
2
|
+
import { Store } from 'redux';
|
|
3
|
+
import { GamePageState } from '../../Store';
|
|
4
|
+
import { GameLocalAPI } from './GameLocalAPI';
|
|
5
|
+
declare global {
|
|
6
|
+
interface Window {
|
|
7
|
+
game: ConsoleTools;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
type ConsoleTools<Game = any, Move = any, PlayerId = any> = {
|
|
11
|
+
state: Game;
|
|
12
|
+
store: GamePageState<Game>;
|
|
13
|
+
moves: Action<Move, PlayerId>[];
|
|
14
|
+
new: (options?: any) => void;
|
|
15
|
+
undo: (quantity?: number) => void;
|
|
16
|
+
monkeyOpponents: (start?: boolean) => void;
|
|
17
|
+
bot: (start?: boolean) => void;
|
|
18
|
+
setPlayerName: (name: string, playerId?: PlayerId) => void;
|
|
19
|
+
setAnimationsSpeed: (speed?: number) => void;
|
|
20
|
+
tutorial: (options?: any) => void;
|
|
21
|
+
changePlayer: (playerId?: PlayerId) => void;
|
|
22
|
+
timer: (seconds: number, playerId?: PlayerId) => void;
|
|
23
|
+
};
|
|
24
|
+
export declare function consoleTools<Game, Move, PlayerId, View, MoveView>(gameServerProxy: GameLocalAPI<Game, Move, PlayerId, View, MoveView>, store: Store<GamePageState<Game, Move, PlayerId>>): ConsoleTools<Game, Move, PlayerId>;
|
|
25
|
+
export {};
|