@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
|
@@ -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,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAMpD,MAAM,UAAU,kBAAkB,CAAyC,EAAE,KAAK,EAA+B;IAC/G,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAA;IAC9B,MAAM,OAAO,GAAG,eAAe,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAA;IAC/D,MAAM,KAAK,GAAG,eAAe,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;IAC3D,MAAM,OAAO,GAAG,eAAe,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAA;IAC/D,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,GAAG,EAA0B,CAAC,CAAA;IACxD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,IAAI,CAAC,KAAK;YAAE,OAAM;QAE9B,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,CAAA;QAC9B,IAAI,sBAAsB,GAAG,OAAO;aACj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S,CAAC,EAAE,CAAC,CAAC,CAAA;oBACtC,CAAC,EAAE,SAAS,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAA;oBAE7B,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;gBACzC,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,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,4 +1,2 @@
|
|
|
1
|
-
import { RulesCreator } from '@gamepark/rules-api';
|
|
2
|
-
|
|
3
|
-
import { GamePageState } from '../Store';
|
|
4
|
-
export declare function createAnimationsListener<Game = any, Move = any, PlayerId = any>(store: Store<GamePageState<Game, Move, PlayerId>>, Rules: RulesCreator<Game, Move, PlayerId>): () => void;
|
|
1
|
+
import { RulesCreator } from '@gamepark/rules-api';
|
|
2
|
+
export declare function createAnimationsListener<Game = any, Move = any, PlayerId = any>(Rules: RulesCreator<Game, Move, PlayerId>): () => void;
|
|
@@ -1,51 +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
|
-
};
|
|
42
|
-
for (var _i = 0, actions_1 = actions; _i < actions_1.length; _i++) {
|
|
43
|
-
var action = actions_1[_i];
|
|
44
|
-
var state_1 = _loop_1(action);
|
|
45
|
-
if (typeof state_1 === "object")
|
|
46
|
-
return state_1.value;
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
exports.createAnimationsListener = createAnimationsListener;
|
|
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();
|
|
9
|
+
if (!actions || !state)
|
|
10
|
+
return;
|
|
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;
|
|
16
|
+
if (animation) {
|
|
17
|
+
isAnimating = true;
|
|
18
|
+
if (action.activePlayers) {
|
|
19
|
+
playersToAnimateAction = intersection(playersToAnimateAction, action.activePlayers);
|
|
20
|
+
}
|
|
21
|
+
const index = playersToAnimateAction.findIndex(p => p === action.playerId);
|
|
22
|
+
if (index !== -1) {
|
|
23
|
+
playersToAnimateAction.splice(index, 1);
|
|
24
|
+
}
|
|
25
|
+
if (!timers.has(animation.id)) {
|
|
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
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else if (isActionToAnimate(action) && (!isAnimating || playersToAnimateAction.includes(action.playerId))) {
|
|
35
|
+
store.dispatch(startAnimation(action.id));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
51
41
|
//# sourceMappingURL=AnimationsListenerCreator.js.map
|
|
@@ -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,C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AE,SAAS,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAA;oBAChC,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;IACH,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RulesCreator } from '@gamepark/rules-api';
|
|
2
|
+
import { Middleware } from '@reduxjs/toolkit';
|
|
3
|
+
import { 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,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AAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAA;oBAC/B,qBAAqB,CAAC,GAAG,EAAE;wBACzB,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,CAAA;wBAC1C,MAAM,eAAe,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,QAAQ,GAAG,IAAI,GAAG,QAAQ,CAAC,CAAA;wBACzE,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;wBAE5B,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;4BAC5B,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;4BAC3B,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAA;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"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export * from './Animation';
|
|
2
|
-
export * from './AnimationContext';
|
|
3
|
-
export * from './Animations';
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './AnimationStep';
|
|
1
|
+
export * from './Animation';
|
|
2
|
+
export * from './AnimationContext';
|
|
3
|
+
export * from './Animations';
|
|
4
|
+
export * from './AnimationState';
|
|
5
|
+
export * from './AnimationStep';
|
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,24 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare const AVATAR_INFO: import("@apollo/client").DocumentNode;
|
|
5
|
-
export declare const PLAYERS_TIME: import("@apollo/client").DocumentNode;
|
|
6
|
-
export declare const NOTIFICATIONS: import("@apollo/client").DocumentNode;
|
|
7
|
-
export declare const GET_MESSAGE_AUTHOR: import("@apollo/client").DocumentNode;
|
|
8
|
-
export declare class GameClientAPI<Move = any, PlayerId = any> implements GameAPI<Move, PlayerId> {
|
|
9
|
-
private dispatch?;
|
|
10
|
-
private readonly gameId;
|
|
11
|
-
private ongoingAction?;
|
|
12
|
-
private pendingActions;
|
|
13
|
-
constructor(gameId: string);
|
|
14
|
-
init(dispatch: Dispatch): Promise<void>;
|
|
15
|
-
play(move: Move): void;
|
|
16
|
-
undo(action: number | string): void;
|
|
17
|
-
private executePendingActions;
|
|
18
|
-
private handleGameMessageResult;
|
|
19
|
-
eject(playerId: PlayerId): void;
|
|
20
|
-
giveUp(): void;
|
|
21
|
-
onError(
|
|
22
|
-
playTutorialMoves(): void;
|
|
23
|
-
claimVictory(): Promise<import("@apollo/client").
|
|
24
|
-
}
|
|
1
|
+
import { Dispatch } from 'redux';
|
|
2
|
+
import { GameAPI } from '../GameAPI';
|
|
3
|
+
export declare const PLATFORM_URI: string;
|
|
4
|
+
export declare const AVATAR_INFO: import("@apollo/client").DocumentNode;
|
|
5
|
+
export declare const PLAYERS_TIME: import("@apollo/client").DocumentNode;
|
|
6
|
+
export declare const NOTIFICATIONS: import("@apollo/client").DocumentNode;
|
|
7
|
+
export declare const GET_MESSAGE_AUTHOR: import("@apollo/client").DocumentNode;
|
|
8
|
+
export declare class GameClientAPI<Move = any, PlayerId = any> implements GameAPI<Move, PlayerId> {
|
|
9
|
+
private dispatch?;
|
|
10
|
+
private readonly gameId;
|
|
11
|
+
private ongoingAction?;
|
|
12
|
+
private pendingActions;
|
|
13
|
+
constructor(gameId: string);
|
|
14
|
+
init(dispatch: Dispatch): Promise<void>;
|
|
15
|
+
play(move: Move): void;
|
|
16
|
+
undo(action: number | string): void;
|
|
17
|
+
private executePendingActions;
|
|
18
|
+
private handleGameMessageResult;
|
|
19
|
+
eject(playerId: PlayerId): void;
|
|
20
|
+
giveUp(): void;
|
|
21
|
+
onError(error: unknown): void;
|
|
22
|
+
playTutorialMoves(): void;
|
|
23
|
+
claimVictory(): Promise<import("@apollo/client").ApolloClient.MutateResult<unknown>>;
|
|
24
|
+
}
|