@gamepark/react-client 7.0.0-beta.0 → 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.js +3 -7
- package/dist/Actions/ActionFailed.js.map +1 -1
- package/dist/Actions/AnimationComplete.js +3 -7
- package/dist/Actions/AnimationComplete.js.map +1 -1
- package/dist/Actions/AnimationPaused.js +3 -7
- package/dist/Actions/AnimationPaused.js.map +1 -1
- 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 +2 -4
- package/dist/Actions/GameNotificationsReceived.js +2 -9
- package/dist/Actions/GameNotificationsReceived.js.map +1 -1
- package/dist/Actions/GameOver.js +3 -7
- package/dist/Actions/GameOver.js.map +1 -1
- package/dist/Actions/GameStateLoaded.js +5 -18
- package/dist/Actions/GameStateLoaded.js.map +1 -1
- package/dist/Actions/MovePlayed.d.ts +4 -4
- package/dist/Actions/MovePlayed.js +3 -4
- package/dist/Actions/MovePlayed.js.map +1 -1
- package/dist/Actions/MoveUndone.js +3 -8
- package/dist/Actions/MoveUndone.js.map +1 -1
- package/dist/Actions/PlayerQuit.d.ts +3 -9
- 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 -11
- package/dist/Actions/index.js +7 -27
- 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.js +1 -2
- package/dist/Chat/Message.js +1 -2
- package/dist/Chat/index.js +2 -18
- package/dist/Chat/index.js.map +1 -1
- package/dist/Deckbuilding/Deck.js +1 -2
- package/dist/Deckbuilding/index.js +4 -24
- package/dist/Deckbuilding/index.js.map +1 -1
- package/dist/Deckbuilding/useDeleteDeck.d.ts +4 -1
- package/dist/Deckbuilding/useDeleteDeck.js +8 -14
- package/dist/Deckbuilding/useDeleteDeck.js.map +1 -1
- package/dist/Deckbuilding/useMyDecks.d.ts +2 -1
- package/dist/Deckbuilding/useMyDecks.js +7 -13
- package/dist/Deckbuilding/useMyDecks.js.map +1 -1
- package/dist/Deckbuilding/useSaveDeck.d.ts +4 -1
- package/dist/Deckbuilding/useSaveDeck.js +8 -14
- 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.js +1 -17
- package/dist/EjectPlayer/index.js.map +1 -1
- package/dist/Failure/Failure.js +1 -4
- package/dist/Failure/Failure.js.map +1 -1
- package/dist/Failure/index.js +1 -17
- package/dist/Failure/index.js.map +1 -1
- package/dist/GiveUp/GiveUp.js +2 -5
- package/dist/GiveUp/GiveUp.js.map +1 -1
- package/dist/GiveUp/index.js +1 -17
- package/dist/GiveUp/index.js.map +1 -1
- package/dist/Hooks/index.js +5 -21
- package/dist/Hooks/index.js.map +1 -1
- package/dist/Hooks/useChatMessages.d.ts +1 -6
- package/dist/Hooks/useChatMessages.js +35 -44
- package/dist/Hooks/useChatMessages.js.map +1 -1
- package/dist/Hooks/useMessageAuthor.js +12 -16
- package/dist/Hooks/useMessageAuthor.js.map +1 -1
- package/dist/Hooks/useOptions.js +3 -6
- package/dist/Hooks/useOptions.js.map +1 -1
- package/dist/Hooks/useRematch.d.ts +1 -1
- package/dist/Hooks/useRematch.js +16 -20
- package/dist/Hooks/useRematch.js.map +1 -1
- package/dist/Hooks/useSendMessage.d.ts +4 -1
- package/dist/Hooks/useSendMessage.js +5 -12
- 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 +1 -4
- package/dist/Log/StopLiveLog.js +4 -7
- package/dist/Log/StopLiveLog.js.map +1 -1
- package/dist/Log/index.d.ts +2 -2
- package/dist/Log/index.js +4 -20
- package/dist/Log/index.js.map +1 -1
- package/dist/Log/useLogControls.js +11 -14
- package/dist/Log/useLogControls.js.map +1 -1
- package/dist/PlayerTime/PlayerTime.js +1 -2
- package/dist/PlayerTime/index.js +1 -17
- package/dist/PlayerTime/index.js.map +1 -1
- package/dist/Rematch/RematchQueries.js +23 -13
- package/dist/Rematch/RematchQueries.js.map +1 -1
- package/dist/Rematch/index.js +1 -17
- package/dist/Rematch/index.js.map +1 -1
- package/dist/Sound/MuteSounds.d.ts +1 -4
- package/dist/Sound/MuteSounds.js +5 -8
- 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 +2 -2
- package/dist/Sound/index.js +3 -19
- package/dist/Sound/index.js.map +1 -1
- package/dist/Sound/useSoundControls.js +11 -14
- package/dist/Sound/useSoundControls.js.map +1 -1
- package/dist/Store/DisplayedAction.js +4 -10
- package/dist/Store/DisplayedAction.js.map +1 -1
- package/dist/Store/GamePageState.d.ts +0 -1
- package/dist/Store/GamePageState.js +1 -2
- 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.js +30 -41
- package/dist/Store/gameMiddleware.js.map +1 -1
- package/dist/Store/gameReducer.d.ts +2 -11
- package/dist/Store/gameReducer.js +301 -377
- package/dist/Store/gameReducer.js.map +1 -1
- package/dist/Store/index.d.ts +1 -0
- package/dist/Store/index.js +4 -19
- package/dist/Store/index.js.map +1 -1
- package/dist/Store/localMovePreviewMiddleware.js +15 -13
- 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.js +1 -2
- package/dist/Tutorial/TutorialDescription.d.ts +1 -1
- package/dist/Tutorial/TutorialDescription.js +1 -2
- package/dist/Tutorial/index.js +4 -20
- package/dist/Tutorial/index.js.map +1 -1
- package/dist/Tutorial/useTutorial.js +11 -20
- package/dist/Tutorial/useTutorial.js.map +1 -1
- package/dist/Types/GameAI.js +1 -2
- package/dist/Types/GameData.js +1 -2
- package/dist/Types/GameMessage.js +1 -2
- package/dist/Types/GameMode.js +2 -5
- package/dist/Types/GameMode.js.map +1 -1
- package/dist/Types/GameNotification.js +1 -2
- package/dist/Types/GameOptions.js +2 -5
- package/dist/Types/GameOptions.js.map +1 -1
- package/dist/Types/MovePlayedNotification.d.ts +1 -1
- package/dist/Types/MovePlayedNotification.js +3 -8
- package/dist/Types/MovePlayedNotification.js.map +1 -1
- package/dist/Types/MoveUndoneNotification.d.ts +1 -1
- package/dist/Types/MoveUndoneNotification.js +3 -8
- package/dist/Types/MoveUndoneNotification.js.map +1 -1
- package/dist/Types/Player.js +1 -2
- package/dist/Types/PlayerQuitReason.js +2 -5
- package/dist/Types/PlayerQuitReason.js.map +1 -1
- package/dist/Types/ProxyGameData.js +1 -2
- package/dist/Types/Tournament.js +1 -2
- package/dist/Types/index.js +12 -28
- package/dist/Types/index.js.map +1 -1
- package/dist/User/User.js +1 -2
- package/dist/User/index.js +2 -18
- package/dist/User/index.js.map +1 -1
- package/dist/User/useMe.js +9 -19
- package/dist/User/useMe.js.map +1 -1
- package/dist/animations/Animation.js +1 -2
- package/dist/animations/AnimationContext.d.ts +1 -1
- package/dist/animations/AnimationContext.js +1 -2
- package/dist/animations/AnimationState.js +1 -2
- package/dist/animations/AnimationStep.js +2 -5
- package/dist/animations/AnimationStep.js.map +1 -1
- package/dist/animations/Animations.js +9 -16
- 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 +1 -4
- package/dist/animations/AnimationsListenerCreator.js +24 -30
- 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 +0 -1
- package/dist/animations/index.js +5 -22
- package/dist/animations/index.js.map +1 -1
- package/dist/api/Client/GameClientAPI.d.ts +5 -6
- package/dist/api/Client/GameClientAPI.js +70 -119
- package/dist/api/Client/GameClientAPI.js.map +1 -1
- package/dist/api/Client/GameNotificationsListener.js +51 -104
- package/dist/api/Client/GameNotificationsListener.js.map +1 -1
- package/dist/api/Client/RemoteGameLoader.js +50 -45
- package/dist/api/Client/RemoteGameLoader.js.map +1 -1
- package/dist/api/Client/RemoteGameProvider.js +15 -51
- package/dist/api/Client/RemoteGameProvider.js.map +1 -1
- package/dist/api/Client/apollo-client.d.ts +1 -1
- package/dist/api/Client/apollo-client.js +14 -31
- package/dist/api/Client/apollo-client.js.map +1 -1
- package/dist/api/Client/index.js +4 -20
- package/dist/api/Client/index.js.map +1 -1
- package/dist/api/Client/pusher.js +5 -12
- package/dist/api/Client/pusher.js.map +1 -1
- package/dist/api/GameAPI.d.ts +2 -3
- package/dist/api/GameAPI.js +1 -2
- package/dist/api/Local/ConsoleTools.d.ts +1 -2
- package/dist/api/Local/ConsoleTools.js +15 -22
- package/dist/api/Local/ConsoleTools.js.map +1 -1
- package/dist/api/Local/GameLocalAPI.d.ts +4 -5
- package/dist/api/Local/GameLocalAPI.js +264 -363
- package/dist/api/Local/GameLocalAPI.js.map +1 -1
- package/dist/api/Local/LocalGameProvider.d.ts +1 -1
- package/dist/api/Local/LocalGameProvider.js +17 -48
- package/dist/api/Local/LocalGameProvider.js.map +1 -1
- package/dist/api/Local/index.js +1 -17
- package/dist/api/Local/index.js.map +1 -1
- package/dist/api/index.js +2 -18
- package/dist/api/index.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +16 -36
- package/dist/index.js.map +1 -1
- package/dist/util/ArrayUtil.js +4 -8
- package/dist/util/ArrayUtil.js.map +1 -1
- package/package.json +66 -62
- 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
package/dist/User/index.js
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
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("./User"), exports);
|
|
18
|
-
__exportStar(require("./useMe"), exports);
|
|
1
|
+
export * from './User';
|
|
2
|
+
export * from './useMe';
|
|
19
3
|
//# sourceMappingURL=index.js.map
|
package/dist/User/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/User/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/User/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA"}
|
package/dist/User/useMe.js
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var api_1 = require("../api");
|
|
11
|
-
var GET_ME = (0, client_1.gql)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["query Me { me { user { id name subscriptionSince avatar {...AvatarInfo} } } } ", ""], ["query Me { me { user { id name subscriptionSince avatar {...AvatarInfo} } } } ", ""])), api_1.AVATAR_INFO);
|
|
12
|
-
function useMe() {
|
|
13
|
-
var _a;
|
|
14
|
-
var urlSearchParams = new URLSearchParams(window.location.search);
|
|
15
|
-
var fetchPolicy = (0, react_1.useMemo)(function () {
|
|
16
|
-
return process.env.NODE_ENV !== 'production' && !urlSearchParams.get('game') && !urlSearchParams.get('mode') ? 'cache-only' : 'cache-first';
|
|
17
|
-
}, []);
|
|
18
|
-
return (_a = (0, client_1.useQuery)(GET_ME, { ssr: false, fetchPolicy: fetchPolicy }).data) === null || _a === void 0 ? void 0 : _a.me;
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
import { useQuery } from '@apollo/client/react';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { AVATAR_INFO } from '../api';
|
|
5
|
+
const GET_ME = gql `query Me { me { user { id name subscriptionSince avatar {...AvatarInfo} } } } ${AVATAR_INFO}`;
|
|
6
|
+
export function useMe() {
|
|
7
|
+
const urlSearchParams = new URLSearchParams(window.location.search);
|
|
8
|
+
const fetchPolicy = useMemo(() => process.env.NODE_ENV !== 'production' && !urlSearchParams.get('game') && !urlSearchParams.get('mode') ? 'cache-only' : 'cache-first', []);
|
|
9
|
+
return useQuery(GET_ME, { ssr: false, fetchPolicy }).data?.me;
|
|
19
10
|
}
|
|
20
|
-
var templateObject_1;
|
|
21
11
|
//# sourceMappingURL=useMe.js.map
|
package/dist/User/useMe.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMe.js","sourceRoot":"","sources":["../../src/User/useMe.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useMe.js","sourceRoot":"","sources":["../../src/User/useMe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAGpC,MAAM,MAAM,GAAG,GAAG,CAAA,iFAAiF,WAAW,EAAE,CAAA;AAEhH,MAAM,UAAU,KAAK;IACnB,MAAM,eAAe,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IACnE,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAC7B,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,EACpI,EAAE,CAAC,CAAA;IACP,OAAO,QAAQ,CAAyB,MAAM,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAA;AACvF,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnimationStep } from './AnimationStep';
|
|
2
2
|
import { DisplayedAction } from '../Store';
|
|
3
|
-
export type AnimationContext<Game, Move, PlayerId> = {
|
|
3
|
+
export type AnimationContext<Game = any, Move = any, PlayerId = any> = {
|
|
4
4
|
action: DisplayedAction<Move, PlayerId>;
|
|
5
5
|
game: Game;
|
|
6
6
|
step: AnimationStep;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AnimationStep = void 0;
|
|
4
|
-
var AnimationStep;
|
|
1
|
+
export var AnimationStep;
|
|
5
2
|
(function (AnimationStep) {
|
|
6
3
|
AnimationStep[AnimationStep["BEFORE_MOVE"] = 1] = "BEFORE_MOVE";
|
|
7
4
|
AnimationStep[AnimationStep["AFTER_MOVE"] = 2] = "AFTER_MOVE";
|
|
8
5
|
AnimationStep[AnimationStep["BEFORE_UNDO"] = 3] = "BEFORE_UNDO";
|
|
9
6
|
AnimationStep[AnimationStep["AFTER_UNDO"] = 4] = "AFTER_UNDO";
|
|
10
|
-
})(AnimationStep || (
|
|
7
|
+
})(AnimationStep || (AnimationStep = {}));
|
|
11
8
|
//# sourceMappingURL=AnimationStep.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimationStep.js","sourceRoot":"","sources":["../../src/animations/AnimationStep.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AnimationStep.js","sourceRoot":"","sources":["../../src/animations/AnimationStep.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,aAEX;AAFD,WAAY,aAAa;IACvB,+DAAe,CAAA;IAAE,6DAAU,CAAA;IAAE,+DAAW,CAAA;IAAE,6DAAU,CAAA;AACtD,CAAC,EAFW,aAAa,KAAb,aAAa,QAExB"}
|
|
@@ -1,23 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var AnimationStep_1 = require("./AnimationStep");
|
|
5
|
-
var Animations = (function () {
|
|
6
|
-
function Animations() {
|
|
7
|
-
}
|
|
8
|
-
Animations.prototype.getDuration = function (move, context) {
|
|
1
|
+
import { AnimationStep } from './AnimationStep';
|
|
2
|
+
export class Animations {
|
|
3
|
+
getDuration(move, context) {
|
|
9
4
|
switch (context.step) {
|
|
10
|
-
case
|
|
5
|
+
case AnimationStep.BEFORE_MOVE:
|
|
11
6
|
return this.getPreDuration ? this.getPreDuration(move, context) : 0;
|
|
12
|
-
case
|
|
7
|
+
case AnimationStep.AFTER_MOVE:
|
|
13
8
|
return this.getPostDuration ? this.getPostDuration(move, context) : 0;
|
|
14
|
-
case
|
|
9
|
+
case AnimationStep.BEFORE_UNDO:
|
|
15
10
|
return this.getUndoPreDuration ? this.getUndoPreDuration(move, context) : 0;
|
|
16
|
-
case
|
|
11
|
+
case AnimationStep.AFTER_UNDO:
|
|
17
12
|
return this.getUndoPostDuration ? this.getUndoPostDuration(move, context) : 0;
|
|
18
13
|
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
}());
|
|
22
|
-
exports.Animations = Animations;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
23
16
|
//# sourceMappingURL=Animations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Animations.js","sourceRoot":"","sources":["../../src/animations/Animations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Animations.js","sourceRoot":"","sources":["../../src/animations/Animations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,MAAM,OAAO,UAAU;IAErB,WAAW,CAAC,IAAU,EAAE,OAA+C;QACrE,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;YACrB,KAAK,aAAa,CAAC,WAAW;gBAC5B,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;YACrE,KAAK,aAAa,CAAC,UAAU;gBAC3B,OAAO,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;YACvE,KAAK,aAAa,CAAC,WAAW;gBAC5B,OAAO,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;YAC7E,KAAK,aAAa,CAAC,UAAU;gBAC3B,OAAO,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QACjF,CAAC;IACH,CAAC;CASF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { RulesCreator } from '../../../rules-api';
|
|
2
|
+
type Props<Game = any, Move = any, PlayerId = any> = {
|
|
3
|
+
Rules: RulesCreator<Game, Move, PlayerId>;
|
|
4
|
+
};
|
|
5
|
+
export declare function AnimationsListener<Game = any, Move = any, PlayerId = any>({ Rules }: Props<Game, Move, PlayerId>): null;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { intersection } from 'es-toolkit';
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
import { useDispatch } from 'react-redux';
|
|
4
|
+
import { startAnimation } from '../Actions/startAnimation';
|
|
5
|
+
import { isActionToAnimate, useGameSelector } from '../Store';
|
|
6
|
+
import { endAnimation } from '../Store/endAnimation';
|
|
7
|
+
export function AnimationsListener({ Rules }) {
|
|
8
|
+
const dispatch = useDispatch();
|
|
9
|
+
const actions = useGameSelector((state) => state.actions) ?? [];
|
|
10
|
+
const state = useGameSelector((state) => state.state) ?? [];
|
|
11
|
+
const players = useGameSelector((state) => state.players) ?? [];
|
|
12
|
+
const timers = useRef(new Map());
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (!actions || !state)
|
|
15
|
+
return;
|
|
16
|
+
const rules = new Rules(state);
|
|
17
|
+
let playersToAnimateAction = players
|
|
18
|
+
.filter(player => rules.isTurnToPlay(player.id))
|
|
19
|
+
.map(player => player.id);
|
|
20
|
+
let isAnimating = false;
|
|
21
|
+
for (const action of actions) {
|
|
22
|
+
const animation = action.animation;
|
|
23
|
+
if (animation) {
|
|
24
|
+
isAnimating = true;
|
|
25
|
+
if (action.activePlayers) {
|
|
26
|
+
playersToAnimateAction = intersection(playersToAnimateAction, action.activePlayers);
|
|
27
|
+
}
|
|
28
|
+
const index = playersToAnimateAction.findIndex(p => p === action.playerId);
|
|
29
|
+
if (index !== -1) {
|
|
30
|
+
playersToAnimateAction.splice(index, 1);
|
|
31
|
+
}
|
|
32
|
+
if (!timers.current.has(animation.id)) {
|
|
33
|
+
console.log(`schedule timer for ${animation.id} at ${Date.now()} for ${animation.duration}`);
|
|
34
|
+
const timer = setTimeout(() => {
|
|
35
|
+
timers.current.delete(animation.id);
|
|
36
|
+
console.log(`end animation for ${animation.id} at ${Date.now()}`);
|
|
37
|
+
dispatch(endAnimation(animation.id));
|
|
38
|
+
}, animation.duration * 1000);
|
|
39
|
+
timers.current.set(animation.id, timer);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else if (isActionToAnimate(action) && (!isAnimating || playersToAnimateAction.includes(action.playerId))) {
|
|
43
|
+
dispatch(startAnimation(action.id));
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return () => {
|
|
48
|
+
timers.current.forEach(timer => clearTimeout(timer));
|
|
49
|
+
timers.current.clear();
|
|
50
|
+
};
|
|
51
|
+
}, [actions, players, state, Rules, dispatch]);
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=AnimationsListener.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimationsListener.js","sourceRoot":"","sources":["../../src/animations/AnimationsListener.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,SAAS,EAA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M,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;gBAC3G,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,EAAG,CAAC,CAAC,CAAA;gBACpC,OAAM;YACR,CAAC;QACH,CAAC;QAGD,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAA;YACpD,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAA;QACxB,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAA;IAC9C,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -1,5 +1,2 @@
|
|
|
1
1
|
import { RulesCreator } from '@gamepark/rules-api';
|
|
2
|
-
|
|
3
|
-
import { GamePageState } from '../Store';
|
|
4
|
-
import { GameActions } from '../Store/gameReducer';
|
|
5
|
-
export declare function createAnimationsListener<Game = any, Move = any, PlayerId = any>(store: Store<GamePageState<Game, Move, PlayerId>, GameActions<Game, Move, PlayerId>>, Rules: RulesCreator<Game, Move, PlayerId>): () => void;
|
|
2
|
+
export declare function createAnimationsListener<Game = any, Move = any, PlayerId = any>(Rules: RulesCreator<Game, Move, PlayerId>): () => void;
|
|
@@ -1,46 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return function () {
|
|
10
|
-
var _a = store.getState(), actions = _a.actions, animationPaused = _a.animationPaused, players = _a.players, state = _a.state;
|
|
1
|
+
import { intersection } from 'es-toolkit';
|
|
2
|
+
import { startAnimation } from '../Actions/startAnimation';
|
|
3
|
+
import { isActionToAnimate, store } from '../Store';
|
|
4
|
+
import { endAnimation } from '../Store/endAnimation';
|
|
5
|
+
export function createAnimationsListener(Rules) {
|
|
6
|
+
const timers = new Map();
|
|
7
|
+
return () => {
|
|
8
|
+
const { actions, players, state } = store.getState();
|
|
11
9
|
if (!actions || !state)
|
|
12
10
|
return;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
const rules = new Rules(state);
|
|
12
|
+
let playersToAnimateAction = players.filter(player => rules.isTurnToPlay(player.id)).map(player => player.id);
|
|
13
|
+
let isAnimating = false;
|
|
14
|
+
for (const action of actions) {
|
|
15
|
+
const animation = action.animation;
|
|
18
16
|
if (animation) {
|
|
19
17
|
isAnimating = true;
|
|
20
18
|
if (action.activePlayers) {
|
|
21
|
-
playersToAnimateAction =
|
|
19
|
+
playersToAnimateAction = intersection(playersToAnimateAction, action.activePlayers);
|
|
22
20
|
}
|
|
23
|
-
|
|
21
|
+
const index = playersToAnimateAction.findIndex(p => p === action.playerId);
|
|
24
22
|
if (index !== -1) {
|
|
25
23
|
playersToAnimateAction.splice(index, 1);
|
|
26
24
|
}
|
|
27
25
|
if (!timers.has(animation.id)) {
|
|
28
|
-
|
|
29
|
-
timers.
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
requestAnimationFrame(() => {
|
|
27
|
+
timers.set(animation.id, setTimeout(() => {
|
|
28
|
+
timers.delete(animation.id);
|
|
29
|
+
store.dispatch(endAnimation(animation.id));
|
|
30
|
+
}, animation.duration * 1000));
|
|
31
|
+
});
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
else if (
|
|
35
|
-
store.dispatch(
|
|
36
|
-
return
|
|
34
|
+
else if (isActionToAnimate(action) && (!isAnimating || playersToAnimateAction.includes(action.playerId))) {
|
|
35
|
+
store.dispatch(startAnimation(action.id));
|
|
36
|
+
return;
|
|
37
37
|
}
|
|
38
|
-
};
|
|
39
|
-
for (var _i = 0, actions_1 = actions; _i < actions_1.length; _i++) {
|
|
40
|
-
var action = actions_1[_i];
|
|
41
|
-
var state_1 = _loop_1(action);
|
|
42
|
-
if (typeof state_1 === "object")
|
|
43
|
-
return state_1.value;
|
|
44
38
|
}
|
|
45
39
|
};
|
|
46
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimationsListenerCreator.js","sourceRoot":"","sources":["../../src/animations/AnimationsListenerCreator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AnimationsListenerCreator.js","sourceRoot":"","sources":["../../src/animations/AnimationsListenerCreator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEpD,MAAM,UAAU,wBAAwB,CACtC,KAAyC;IAEzC,MAAM,MAAM,GAAG,IAAI,GAAG,EAA0B,CAAA;IAChD,OAAO,GAAG,EAAE;QACV,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAA;QACpD,IAAI,CAAC,OAAO,IAAI,CAAC,KAAK;YAAE,OAAM;QAC9B,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,CAAA;QAC9B,IAAI,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;QAC7G,IAAI,WAAW,GAAG,KAAK,CAAA;QACvB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAA;YAClC,IAAI,SAAS,EAAE,CAAC;gBACd,WAAW,GAAG,IAAI,CAAA;gBAClB,IAA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GamePageState } from '../Store';
|
|
4
|
+
export declare function createAnimationMiddleware<Game = any, Move = any, PlayerId = any>(Rules: RulesCreator<Game, Move, PlayerId>): Middleware<{}, GamePageState<Game, Move, PlayerId>>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { intersection } from 'es-toolkit';
|
|
2
|
+
import { startAnimation } from '../Actions/startAnimation';
|
|
3
|
+
import { isActionToAnimate } from '../Store';
|
|
4
|
+
import { endAnimation } from '../Store/endAnimation';
|
|
5
|
+
export function createAnimationMiddleware(Rules) {
|
|
6
|
+
const timers = new Map();
|
|
7
|
+
return store => next => action => {
|
|
8
|
+
const result = next(action);
|
|
9
|
+
const { actions, players, state } = store.getState();
|
|
10
|
+
if (!actions || !state)
|
|
11
|
+
return result;
|
|
12
|
+
const rules = new Rules(state);
|
|
13
|
+
let playersToAnimateAction = players
|
|
14
|
+
.filter((player) => rules.isTurnToPlay(player.id))
|
|
15
|
+
.map((player) => player.id);
|
|
16
|
+
let isAnimating = false;
|
|
17
|
+
for (const action of actions) {
|
|
18
|
+
const animation = action.animation;
|
|
19
|
+
if (animation) {
|
|
20
|
+
isAnimating = true;
|
|
21
|
+
if (action.activePlayers) {
|
|
22
|
+
playersToAnimateAction = intersection(playersToAnimateAction, action.activePlayers);
|
|
23
|
+
}
|
|
24
|
+
const index = playersToAnimateAction.findIndex((p) => p === action.playerId);
|
|
25
|
+
if (index !== -1) {
|
|
26
|
+
playersToAnimateAction.splice(index, 1);
|
|
27
|
+
}
|
|
28
|
+
if (!timers.has(animation.id)) {
|
|
29
|
+
const start = performance.now();
|
|
30
|
+
requestAnimationFrame(() => {
|
|
31
|
+
const rafDelay = performance.now() - start;
|
|
32
|
+
const timeoutDuration = Math.max(0, animation.duration * 1000 - rafDelay);
|
|
33
|
+
console.log(timeoutDuration);
|
|
34
|
+
const timer = setTimeout(() => {
|
|
35
|
+
timers.delete(animation.id);
|
|
36
|
+
store.dispatch(endAnimation(animation.id));
|
|
37
|
+
}, animation.duration * 1000);
|
|
38
|
+
timers.set(animation.id, timer);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else if (isActionToAnimate(action) && (!isAnimating || playersToAnimateAction.includes(action.playerId))) {
|
|
43
|
+
store.dispatch(startAnimation(action.id));
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return result;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=animationMiddleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animationMiddleware.js","sourceRoot":"","sources":["../../src/animations/animationMiddleware.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAiB,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEpD,MAAM,UAAU,yBAAyB,CACvC,KAAyC;IAEzC,MAAM,MAAM,GAAG,IAAI,GAAG,EAA0B,CAAA;IAEhD,OAAO,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE;QAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAA;QAE3B,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAA;QAEpD,IAAI,CAAC,OAAO,IAAI,CAAC,KAAK;YAAE,OAAO,MAAM,CAAA;QAErC,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,CAAA;QAC9B,IAAI,sBAAsB,GAAG,OAAO;aACjC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;aACjD,GAAG,CAAC,CAAC,MA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AA;wBAC5C,CAAC,EAAE,SAAS,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAA;wBAE7B,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;oBACjC,CAAC,CAAC,CAAA;gBACJ,CAAC;YACH,CAAC;iBAAM,IAAI,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,IAAI,sBAAsB,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;gBAC3G,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,EAAG,CAAC,CAAC,CAAA;gBAC1C,OAAM;YACR,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC,CAAA;AACH,CAAC"}
|
package/dist/animations/index.js
CHANGED
|
@@ -1,23 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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("./Animation"), exports);
|
|
18
|
-
__exportStar(require("./AnimationContext"), exports);
|
|
19
|
-
__exportStar(require("./Animations"), exports);
|
|
20
|
-
__exportStar(require("./AnimationsListenerCreator"), exports);
|
|
21
|
-
__exportStar(require("./AnimationState"), exports);
|
|
22
|
-
__exportStar(require("./AnimationStep"), exports);
|
|
1
|
+
export * from './Animation';
|
|
2
|
+
export * from './AnimationContext';
|
|
3
|
+
export * from './Animations';
|
|
4
|
+
export * from './AnimationState';
|
|
5
|
+
export * from './AnimationStep';
|
|
23
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/animations/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/animations/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA"}
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import { ApolloError } from '@apollo/client';
|
|
2
1
|
import { Dispatch } from 'redux';
|
|
3
|
-
import { GameActions } from '../../Store/gameReducer';
|
|
4
2
|
import { GameAPI } from '../GameAPI';
|
|
3
|
+
export declare const PLATFORM_URI: string;
|
|
5
4
|
export declare const AVATAR_INFO: import("@apollo/client").DocumentNode;
|
|
6
5
|
export declare const PLAYERS_TIME: import("@apollo/client").DocumentNode;
|
|
7
6
|
export declare const NOTIFICATIONS: import("@apollo/client").DocumentNode;
|
|
8
7
|
export declare const GET_MESSAGE_AUTHOR: import("@apollo/client").DocumentNode;
|
|
9
|
-
export declare class GameClientAPI<
|
|
8
|
+
export declare class GameClientAPI<Move = any, PlayerId = any> implements GameAPI<Move, PlayerId> {
|
|
10
9
|
private dispatch?;
|
|
11
10
|
private readonly gameId;
|
|
12
11
|
private ongoingAction?;
|
|
13
12
|
private pendingActions;
|
|
14
13
|
constructor(gameId: string);
|
|
15
|
-
init(dispatch: Dispatch
|
|
14
|
+
init(dispatch: Dispatch): Promise<void>;
|
|
16
15
|
play(move: Move): void;
|
|
17
16
|
undo(action: number | string): void;
|
|
18
17
|
private executePendingActions;
|
|
19
18
|
private handleGameMessageResult;
|
|
20
19
|
eject(playerId: PlayerId): void;
|
|
21
20
|
giveUp(): void;
|
|
22
|
-
onError(
|
|
21
|
+
onError(error: unknown): void;
|
|
23
22
|
playTutorialMoves(): void;
|
|
24
|
-
claimVictory(): Promise<import("@apollo/client").
|
|
23
|
+
claimVictory(): Promise<import("@apollo/client").ApolloClient.MutateResult<unknown>>;
|
|
25
24
|
}
|