@gamepark/react-game 6.0.0-alpha.0 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Avatar/Avatar.js +7 -5
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/GameProvider/GameContext.d.ts +1 -0
- package/dist/components/GameProvider/GameContext.js.map +1 -1
- package/dist/components/GameProvider/GameProvider.d.ts +1 -1
- package/dist/components/GameProvider/GameProvider.js +13 -4
- package/dist/components/GameProvider/GameProvider.js.map +1 -1
- package/dist/components/ImagesLoader/ImagesLoader.d.ts +2 -3
- package/dist/components/ImagesLoader/ImagesLoader.js.map +1 -1
- package/dist/components/buttons/PlayMoveButton/PlayMoveButton.js +25 -10
- package/dist/components/buttons/PlayMoveButton/PlayMoveButton.js.map +1 -1
- package/dist/components/dialogs/ResultDialog/ResultDialog.js +22 -17
- package/dist/components/dialogs/ResultDialog/ResultDialog.js.map +1 -1
- package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.d.ts +4 -9
- package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.js +7 -7
- package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.js.map +1 -1
- package/dist/components/dialogs/RulesDialog/MaterialRulesDialog.js +5 -17
- package/dist/components/dialogs/RulesDialog/MaterialRulesDialog.js.map +1 -1
- package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.d.ts +3 -6
- package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.js +8 -8
- package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.js.map +1 -1
- package/dist/components/dialogs/RulesDialog/RulesDialog.d.ts +1 -0
- package/dist/components/dialogs/RulesDialog/RulesDialog.js +3 -3
- package/dist/components/dialogs/RulesDialog/RulesDialog.js.map +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/material/DraggableMaterial.d.ts +14 -11
- package/dist/components/material/DraggableMaterial.js +102 -48
- package/dist/components/material/DraggableMaterial.js.map +1 -1
- package/dist/components/material/FlatMaterial/BoardDescription.d.ts +3 -0
- package/dist/components/material/FlatMaterial/BoardDescription.js +28 -0
- package/dist/components/material/FlatMaterial/BoardDescription.js.map +1 -0
- package/dist/components/material/FlatMaterial/CardDescription.d.ts +6 -0
- package/dist/components/material/FlatMaterial/CardDescription.js +32 -0
- package/dist/components/material/FlatMaterial/CardDescription.js.map +1 -0
- package/dist/components/material/FlatMaterial/FlatMaterial.d.ts +35 -0
- package/dist/components/material/FlatMaterial/FlatMaterial.js +128 -0
- package/dist/components/material/FlatMaterial/FlatMaterial.js.map +1 -0
- package/dist/components/material/FlatMaterial/TokenDescription.d.ts +10 -0
- package/dist/components/material/FlatMaterial/TokenDescription.js +44 -0
- package/dist/components/material/FlatMaterial/TokenDescription.js.map +1 -0
- package/dist/components/material/FlatMaterial/index.d.ts +4 -0
- package/dist/components/material/{Card → FlatMaterial}/index.js +4 -1
- package/dist/components/material/FlatMaterial/index.js.map +1 -0
- package/dist/components/material/GameTable/GameMaterialDisplay.js +64 -45
- package/dist/components/material/GameTable/GameMaterialDisplay.js.map +1 -1
- package/dist/components/material/GameTable/GameTable.d.ts +2 -2
- package/dist/components/material/GameTable/GameTable.js +64 -16
- package/dist/components/material/GameTable/GameTable.js.map +1 -1
- package/dist/components/material/GameTable/GameTableContent.js +22 -7
- package/dist/components/material/GameTable/GameTableContent.js.map +1 -1
- package/dist/components/material/ImageLoader/MaterialImageLoader.d.ts +5 -0
- package/dist/components/material/ImageLoader/MaterialImageLoader.js +33 -0
- package/dist/components/material/ImageLoader/MaterialImageLoader.js.map +1 -0
- package/dist/components/material/ImageLoader/index.d.ts +1 -0
- package/dist/components/material/{Token → ImageLoader}/index.js +1 -1
- package/dist/components/material/ImageLoader/index.js.map +1 -0
- package/dist/components/material/MaterialAnimations.d.ts +11 -14
- package/dist/components/material/MaterialAnimations.js +129 -82
- package/dist/components/material/MaterialAnimations.js.map +1 -1
- package/dist/components/material/MaterialComponent.d.ts +5 -10
- package/dist/components/material/MaterialComponent.js +8 -53
- package/dist/components/material/MaterialComponent.js.map +1 -1
- package/dist/components/material/MaterialDescription.d.ts +31 -18
- package/dist/components/material/MaterialDescription.js +36 -0
- package/dist/components/material/MaterialDescription.js.map +1 -1
- package/dist/components/material/animations/CreateItemAnimations.d.ts +14 -0
- package/dist/components/material/animations/CreateItemAnimations.js +72 -0
- package/dist/components/material/animations/CreateItemAnimations.js.map +1 -0
- package/dist/components/material/animations/DeleteItemAnimations.d.ts +14 -0
- package/dist/components/material/animations/DeleteItemAnimations.js +80 -0
- package/dist/components/material/animations/DeleteItemAnimations.js.map +1 -0
- package/dist/components/material/animations/ItemAnimations.d.ts +7 -0
- package/dist/components/material/animations/ItemAnimations.js +31 -0
- package/dist/components/material/animations/ItemAnimations.js.map +1 -0
- package/dist/components/material/animations/MaterialAnimations.d.ts +19 -0
- package/dist/components/material/animations/MaterialAnimations.js +51 -0
- package/dist/components/material/animations/MaterialAnimations.js.map +1 -0
- package/dist/components/material/animations/MaterialGameAnimations.d.ts +11 -0
- package/dist/components/material/animations/MaterialGameAnimations.js +42 -0
- package/dist/components/material/animations/MaterialGameAnimations.js.map +1 -0
- package/dist/components/material/animations/MoveItemAnimations.d.ts +16 -0
- package/dist/components/material/animations/MoveItemAnimations.js +105 -0
- package/dist/components/material/animations/MoveItemAnimations.js.map +1 -0
- package/dist/components/material/animations/ShuffleAnimations.d.ts +8 -0
- package/dist/components/material/animations/ShuffleAnimations.js +34 -0
- package/dist/components/material/animations/ShuffleAnimations.js.map +1 -0
- package/dist/components/material/animations/adjustRotation.d.ts +1 -0
- package/dist/components/material/animations/adjustRotation.js +37 -0
- package/dist/components/material/animations/adjustRotation.js.map +1 -0
- package/dist/components/material/animations/getFirstStockItemTransforms.util.d.ts +2 -0
- package/dist/components/material/animations/getFirstStockItemTransforms.util.js +32 -0
- package/dist/components/material/animations/getFirstStockItemTransforms.util.js.map +1 -0
- package/dist/components/material/animations/index.d.ts +9 -0
- package/dist/components/material/animations/index.js +29 -0
- package/dist/components/material/animations/index.js.map +1 -0
- package/dist/components/material/animations/isMovedOrDeletedItem.util.d.ts +3 -0
- package/dist/components/material/animations/isMovedOrDeletedItem.util.js +28 -0
- package/dist/components/material/animations/isMovedOrDeletedItem.util.js.map +1 -0
- package/dist/components/material/animations/itemMovementCss.util.d.ts +2 -0
- package/dist/components/material/animations/itemMovementCss.util.js +13 -0
- package/dist/components/material/animations/itemMovementCss.util.js.map +1 -0
- package/dist/components/material/animations/transformItem.util.d.ts +2 -0
- package/dist/components/material/animations/transformItem.util.js +11 -0
- package/dist/components/material/animations/transformItem.util.js.map +1 -0
- package/dist/components/material/index.d.ts +4 -7
- package/dist/components/material/index.js +4 -7
- package/dist/components/material/index.js.map +1 -1
- package/dist/components/material/locations/LocationDescription.d.ts +28 -0
- package/dist/components/material/locations/LocationDescription.js +54 -0
- package/dist/components/material/locations/LocationDescription.js.map +1 -0
- package/dist/components/material/locations/LocationsMask.d.ts +5 -0
- package/dist/components/material/locations/LocationsMask.js +48 -0
- package/dist/components/material/locations/LocationsMask.js.map +1 -0
- package/dist/components/material/locations/SimpleDropArea.d.ts +13 -0
- package/dist/components/material/{DropAreas → locations}/SimpleDropArea.js +44 -30
- package/dist/components/material/locations/SimpleDropArea.js.map +1 -0
- package/dist/components/material/locations/index.d.ts +3 -0
- package/dist/components/material/{Board → locations}/index.js +3 -1
- package/dist/components/material/locations/index.js.map +1 -0
- package/dist/components/material/utils/getItemFromContext.d.ts +3 -0
- package/dist/components/material/utils/getItemFromContext.js +10 -0
- package/dist/components/material/utils/getItemFromContext.js.map +1 -0
- package/dist/components/material/utils/index.d.ts +0 -3
- package/dist/components/material/utils/index.js +0 -3
- package/dist/components/material/utils/index.js.map +1 -1
- package/dist/components/material/utils/isDroppedItem.d.ts +2 -0
- package/dist/components/material/utils/isDroppedItem.js +15 -0
- package/dist/components/material/utils/isDroppedItem.js.map +1 -0
- package/dist/components/material/utils/isPlacedOnItem.d.ts +3 -0
- package/dist/components/material/utils/isPlacedOnItem.js +15 -0
- package/dist/components/material/utils/isPlacedOnItem.js.map +1 -0
- package/dist/components/material/utils/useIsAnimatingPlayerAction.d.ts +1 -0
- package/dist/components/material/utils/useIsAnimatingPlayerAction.js +10 -0
- package/dist/components/material/utils/useIsAnimatingPlayerAction.js.map +1 -0
- package/dist/components/menus/Menu/Menu.js +3 -3
- package/dist/components/menus/Menu/Menu.js.map +1 -1
- package/dist/components/menus/Result/ResultPopButton.js +1 -1
- package/dist/components/menus/Result/ResultPopButton.js.map +1 -1
- package/dist/components/tutorial/MaterialTutorial.d.ts +47 -0
- package/dist/components/tutorial/MaterialTutorial.js +95 -0
- package/dist/components/tutorial/MaterialTutorial.js.map +1 -0
- package/dist/components/tutorial/MaterialTutorialDisplay.d.ts +1 -0
- package/dist/components/tutorial/MaterialTutorialDisplay.js +73 -0
- package/dist/components/tutorial/MaterialTutorialDisplay.js.map +1 -0
- package/dist/components/tutorial/TutorialRulesWrapper.d.ts +3 -0
- package/dist/components/tutorial/TutorialRulesWrapper.js +60 -0
- package/dist/components/tutorial/TutorialRulesWrapper.js.map +1 -0
- package/dist/components/tutorial/index.d.ts +1 -0
- package/dist/components/{material/DropAreas → tutorial}/index.js +1 -1
- package/dist/components/tutorial/index.js.map +1 -0
- package/dist/css/componentSizeCss.d.ts +1 -5
- package/dist/css/componentSizeCss.js +1 -1
- package/dist/css/componentSizeCss.js.map +1 -1
- package/dist/css/fadeIn.d.ts +1 -0
- package/dist/css/fadeIn.js +13 -0
- package/dist/css/fadeIn.js.map +1 -0
- package/dist/css/index.d.ts +2 -0
- package/dist/css/index.js +2 -0
- package/dist/css/index.js.map +1 -1
- package/dist/css/shadowEffect.d.ts +1 -0
- package/dist/css/shadowEffect.js +11 -0
- package/dist/css/shadowEffect.js.map +1 -0
- package/dist/css/transformCss.d.ts +1 -0
- package/dist/css/transformCss.js +3 -2
- package/dist/css/transformCss.js.map +1 -1
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.js +3 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useItemLocator.js +2 -3
- package/dist/hooks/useItemLocator.js.map +1 -1
- package/dist/hooks/useLegalMoves.js +11 -6
- package/dist/hooks/useLegalMoves.js.map +1 -1
- package/dist/hooks/useLocators.d.ts +1 -0
- package/dist/hooks/useLocators.js +8 -0
- package/dist/hooks/useLocators.js.map +1 -0
- package/dist/hooks/useMaterialContext.d.ts +2 -0
- package/dist/hooks/useMaterialContext.js +18 -0
- package/dist/hooks/useMaterialContext.js.map +1 -0
- package/dist/hooks/useMaterials.d.ts +2 -0
- package/dist/hooks/useMaterials.js +10 -0
- package/dist/hooks/useMaterials.js.map +1 -0
- package/dist/hooks/usePlayerName.js +12 -1
- package/dist/hooks/usePlayerName.js.map +1 -1
- package/dist/hooks/usePlayers.js +1 -1
- package/dist/hooks/usePlayers.js.map +1 -1
- package/dist/hooks/useRulesStep.d.ts +2 -0
- package/dist/hooks/useRulesStep.js +10 -0
- package/dist/hooks/useRulesStep.js.map +1 -0
- package/dist/hooks/useTutorialStep.d.ts +2 -0
- package/dist/hooks/useTutorialStep.js +15 -0
- package/dist/hooks/useTutorialStep.js.map +1 -0
- package/dist/hooks/useZoomToElements.d.ts +5 -0
- package/dist/hooks/useZoomToElements.js +65 -0
- package/dist/hooks/useZoomToElements.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/locators/DeckLocator.d.ts +4 -4
- package/dist/locators/DeckLocator.js +3 -2
- package/dist/locators/DeckLocator.js.map +1 -1
- package/dist/locators/HandLocator.d.ts +11 -11
- package/dist/locators/HandLocator.js.map +1 -1
- package/dist/locators/ItemLocator.d.ts +31 -41
- package/dist/locators/ItemLocator.js +33 -90
- package/dist/locators/ItemLocator.js.map +1 -1
- package/dist/locators/LineLocator.d.ts +7 -5
- package/dist/locators/LineLocator.js +10 -1
- package/dist/locators/LineLocator.js.map +1 -1
- package/dist/locators/PileLocator.d.ts +8 -6
- package/dist/locators/PileLocator.js +13 -1
- package/dist/locators/PileLocator.js.map +1 -1
- package/dist/utilities/animations.constants.d.ts +16 -0
- package/dist/utilities/animations.constants.js +82 -0
- package/dist/utilities/animations.constants.js.map +1 -0
- package/dist/utilities/animations.util.d.ts +4 -0
- package/dist/utilities/animations.util.js +78 -0
- package/dist/utilities/animations.util.js.map +1 -0
- package/dist/utilities/bounds.util.d.ts +18 -0
- package/dist/utilities/bounds.util.js +85 -0
- package/dist/utilities/bounds.util.js.map +1 -0
- package/dist/utilities/calculation.util.d.ts +14 -0
- package/dist/utilities/calculation.util.js +24 -0
- package/dist/utilities/calculation.util.js.map +1 -0
- package/dist/utilities/zoom.util.d.ts +4 -0
- package/dist/utilities/zoom.util.js +17 -0
- package/dist/utilities/zoom.util.js.map +1 -0
- package/package.json +7 -5
- package/dist/components/material/Board/Board.d.ts +0 -17
- package/dist/components/material/Board/Board.js +0 -34
- package/dist/components/material/Board/Board.js.map +0 -1
- package/dist/components/material/Board/index.d.ts +0 -1
- package/dist/components/material/Board/index.js.map +0 -1
- package/dist/components/material/Card/Card.d.ts +0 -23
- package/dist/components/material/Card/Card.js +0 -49
- package/dist/components/material/Card/Card.js.map +0 -1
- package/dist/components/material/Card/index.d.ts +0 -1
- package/dist/components/material/Card/index.js.map +0 -1
- package/dist/components/material/DropAreas/SimpleDropArea.d.ts +0 -12
- package/dist/components/material/DropAreas/SimpleDropArea.js.map +0 -1
- package/dist/components/material/DropAreas/index.d.ts +0 -1
- package/dist/components/material/DropAreas/index.js.map +0 -1
- package/dist/components/material/Items.d.ts +0 -4
- package/dist/components/material/Items.js +0 -3
- package/dist/components/material/Items.js.map +0 -1
- package/dist/components/material/Token/Token.d.ts +0 -18
- package/dist/components/material/Token/Token.js +0 -34
- package/dist/components/material/Token/Token.js.map +0 -1
- package/dist/components/material/Token/index.d.ts +0 -1
- package/dist/components/material/Token/index.js.map +0 -1
- package/dist/components/material/utils/IsMoveThisItem.d.ts +0 -2
- package/dist/components/material/utils/IsMoveThisItem.js +0 -12
- package/dist/components/material/utils/IsMoveThisItem.js.map +0 -1
- package/dist/components/material/utils/IsMoveThisItemToLocation.d.ts +0 -3
- package/dist/components/material/utils/IsMoveThisItemToLocation.js +0 -11
- package/dist/components/material/utils/IsMoveThisItemToLocation.js.map +0 -1
- package/dist/components/material/utils/IsMoveToLocation.d.ts +0 -2
- package/dist/components/material/utils/IsMoveToLocation.js +0 -13
- package/dist/components/material/utils/IsMoveToLocation.js.map +0 -1
- package/dist/components/material/utils/IsMoveToStock.d.ts +0 -4
- package/dist/components/material/utils/IsMoveToStock.js +0 -18
- package/dist/components/material/utils/IsMoveToStock.js.map +0 -1
- package/dist/hooks/useStocks.d.ts +0 -2
- package/dist/hooks/useStocks.js +0 -12
- package/dist/hooks/useStocks.js.map +0 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
18
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
19
|
+
return cooked;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.CreateItemAnimations = void 0;
|
|
23
|
+
var ItemAnimations_1 = require("./ItemAnimations");
|
|
24
|
+
var rules_api_1 = require("@gamepark/rules-api");
|
|
25
|
+
var react_1 = require("@emotion/react");
|
|
26
|
+
var css_1 = require("../../../css");
|
|
27
|
+
var getFirstStockItemTransforms_util_1 = require("./getFirstStockItemTransforms.util");
|
|
28
|
+
var adjustRotation_1 = require("./adjustRotation");
|
|
29
|
+
var transformItem_util_1 = require("./transformItem.util");
|
|
30
|
+
var itemMovementCss_util_1 = require("./itemMovementCss.util");
|
|
31
|
+
var CreateItemAnimations = /** @class */ (function (_super) {
|
|
32
|
+
__extends(CreateItemAnimations, _super);
|
|
33
|
+
function CreateItemAnimations(duration) {
|
|
34
|
+
if (duration === void 0) { duration = 1; }
|
|
35
|
+
var _this = _super.call(this) || this;
|
|
36
|
+
_this.duration = duration;
|
|
37
|
+
return _this;
|
|
38
|
+
}
|
|
39
|
+
CreateItemAnimations.prototype.getPostDuration = function (_move, _context) {
|
|
40
|
+
return this.duration;
|
|
41
|
+
};
|
|
42
|
+
CreateItemAnimations.prototype.getItemAnimation = function (context, animation) {
|
|
43
|
+
if (!this.isItemToAnimate(context, animation))
|
|
44
|
+
return;
|
|
45
|
+
var stockTransforms = (0, getFirstStockItemTransforms_util_1.getFirstStockItemTransforms)(context);
|
|
46
|
+
if (stockTransforms) {
|
|
47
|
+
var targetTransform = (0, adjustRotation_1.adjustRotation)(stockTransforms, (0, transformItem_util_1.transformItem)(context)).join(' ');
|
|
48
|
+
var animationKeyframes = this.getKeyframesFromOrigin(targetTransform, animation, context);
|
|
49
|
+
return (0, itemMovementCss_util_1.movementAnimationCss)(animationKeyframes, animation.duration);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return (0, css_1.fadeIn)(animation.duration);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
CreateItemAnimations.prototype.isItemToAnimate = function (_a, animation) {
|
|
56
|
+
var _b, _c;
|
|
57
|
+
var game = _a.game, type = _a.type, index = _a.index, displayIndex = _a.displayIndex;
|
|
58
|
+
var item = game.items[type][index];
|
|
59
|
+
if (animation.move.itemType !== type || !(0, rules_api_1.itemsCanMerge)(item, animation.move.item))
|
|
60
|
+
return false;
|
|
61
|
+
var quantity = (_b = item.quantity) !== null && _b !== void 0 ? _b : 1;
|
|
62
|
+
var createdQuantity = (_c = animation.move.item.quantity) !== null && _c !== void 0 ? _c : 1;
|
|
63
|
+
return displayIndex >= quantity - createdQuantity;
|
|
64
|
+
};
|
|
65
|
+
CreateItemAnimations.prototype.getKeyframesFromOrigin = function (origin, _animation, _context) {
|
|
66
|
+
return (0, react_1.keyframes)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n from {\n transform: ", ";\n }\n "], ["\n from {\n transform: ", ";\n }\n "])), origin);
|
|
67
|
+
};
|
|
68
|
+
return CreateItemAnimations;
|
|
69
|
+
}(ItemAnimations_1.ItemAnimations));
|
|
70
|
+
exports.CreateItemAnimations = CreateItemAnimations;
|
|
71
|
+
var templateObject_1;
|
|
72
|
+
//# sourceMappingURL=CreateItemAnimations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateItemAnimations.js","sourceRoot":"","sources":["../../../../src/components/material/animations/CreateItemAnimations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAiD;AACjD,iDAAyE;AAGzE,wCAAgE;AAChE,oCAAqC;AACrC,uFAAgF;AAChF,mDAAiD;AACjD,2DAAoD;AACpD,+DAA6D;AAG7D;IACU,wCAAuB;IAE/B,8BAAsB,QAAY;QAAZ,yBAAA,EAAA,YAAY;QAAlC,YACE,iBAAO,SACR;QAFqB,cAAQ,GAAR,QAAQ,CAAI;;IAElC,CAAC;IAEQ,8CAAe,GAAxB,UAAyB,KAA0B,EAAE,QAA2C;Q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A;IACnD,CAAC;IAES,qDAAsB,GAAhC,UAAiC,MAAc,EAAE,UAAwC,EAAE,QAA8B;QACvH,WAAO,iBAAS,6HAAA,qCAEC,EAAM,kBAEtB,KAFgB,MAAM,EAEtB;IACH,CAAC;IACH,2BAAC;AAAD,CAAC,AAtCD,CACU,+BAAc,GAqCvB;AAtCY,oDAAoB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ItemContext } from '../../../locators';
|
|
2
|
+
import { Animation } from '@gamepark/react-client';
|
|
3
|
+
import { DeleteItem, ItemMove, MoveItem } from '@gamepark/rules-api';
|
|
4
|
+
import { Interpolation, Theme } from '@emotion/react';
|
|
5
|
+
import { ItemAnimations } from './ItemAnimations';
|
|
6
|
+
import { MaterialAnimationContext } from './MaterialGameAnimations';
|
|
7
|
+
export declare class DeleteItemAnimations<P extends number = number, M extends number = number, L extends number = number> extends ItemAnimations<P, M, L> {
|
|
8
|
+
protected duration: number;
|
|
9
|
+
protected droppedItemDuration: number;
|
|
10
|
+
constructor(duration?: number, droppedItemDuration?: number);
|
|
11
|
+
getPreDuration(move: MoveItem<P, M, L>, context: MaterialAnimationContext<P, M, L>): number;
|
|
12
|
+
getItemAnimation(context: ItemContext<P, M, L>, animation: Animation<DeleteItem<M>>): Interpolation<Theme>;
|
|
13
|
+
protected getKeyframesToDestination(destination: string, _animation: Animation<ItemMove<P, M, L>>, _context: ItemContext<P, M, L>): import("@emotion/serialize").Keyframes;
|
|
14
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
18
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
19
|
+
return cooked;
|
|
20
|
+
};
|
|
21
|
+
var __assign = (this && this.__assign) || function () {
|
|
22
|
+
__assign = Object.assign || function(t) {
|
|
23
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
24
|
+
s = arguments[i];
|
|
25
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
26
|
+
t[p] = s[p];
|
|
27
|
+
}
|
|
28
|
+
return t;
|
|
29
|
+
};
|
|
30
|
+
return __assign.apply(this, arguments);
|
|
31
|
+
};
|
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
exports.DeleteItemAnimations = void 0;
|
|
34
|
+
var react_1 = require("@emotion/react");
|
|
35
|
+
var adjustRotation_1 = require("./adjustRotation");
|
|
36
|
+
var transformItem_util_1 = require("./transformItem.util");
|
|
37
|
+
var itemMovementCss_util_1 = require("./itemMovementCss.util");
|
|
38
|
+
var getFirstStockItemTransforms_util_1 = require("./getFirstStockItemTransforms.util");
|
|
39
|
+
var ItemAnimations_1 = require("./ItemAnimations");
|
|
40
|
+
var isMovedOrDeletedItem_util_1 = require("./isMovedOrDeletedItem.util");
|
|
41
|
+
var isDroppedItem_1 = require("../utils/isDroppedItem");
|
|
42
|
+
var DeleteItemAnimations = /** @class */ (function (_super) {
|
|
43
|
+
__extends(DeleteItemAnimations, _super);
|
|
44
|
+
function DeleteItemAnimations(duration, droppedItemDuration) {
|
|
45
|
+
if (duration === void 0) { duration = 1; }
|
|
46
|
+
if (droppedItemDuration === void 0) { droppedItemDuration = 0.2; }
|
|
47
|
+
var _this = _super.call(this) || this;
|
|
48
|
+
_this.duration = duration;
|
|
49
|
+
_this.droppedItemDuration = droppedItemDuration;
|
|
50
|
+
return _this;
|
|
51
|
+
}
|
|
52
|
+
DeleteItemAnimations.prototype.getPreDuration = function (move, context) {
|
|
53
|
+
var _a, _b;
|
|
54
|
+
if ((0, isDroppedItem_1.isDroppedItem)(__assign(__assign({}, context), { type: move.itemType, index: move.itemIndex, displayIndex: (_b = (_a = context.game.droppedItem) === null || _a === void 0 ? void 0 : _a.displayIndex) !== null && _b !== void 0 ? _b : 0 }))) {
|
|
55
|
+
return this.droppedItemDuration;
|
|
56
|
+
}
|
|
57
|
+
return this.duration;
|
|
58
|
+
};
|
|
59
|
+
DeleteItemAnimations.prototype.getItemAnimation = function (context, animation) {
|
|
60
|
+
if (!(0, isMovedOrDeletedItem_util_1.isMovedOrDeletedItem)(context, animation.move))
|
|
61
|
+
return;
|
|
62
|
+
var stockLocation = (0, getFirstStockItemTransforms_util_1.getFirstStockItemTransforms)(context);
|
|
63
|
+
if (stockLocation) {
|
|
64
|
+
var targetTransform = (0, adjustRotation_1.adjustRotation)(stockLocation, (0, transformItem_util_1.transformItem)(context)).join(' ');
|
|
65
|
+
var animationKeyframes = this.getKeyframesToDestination(targetTransform, animation, context);
|
|
66
|
+
return (0, itemMovementCss_util_1.movementAnimationCss)(animationKeyframes, animation.duration);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
var fadeout = (0, react_1.keyframes)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n to {\n opacity: 0;\n }\n "], ["\n to {\n opacity: 0;\n }\n "])));
|
|
70
|
+
return (0, react_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["animation: ", " ", "s ease-in-out forwards"], ["animation: ", " ", "s ease-in-out forwards"])), fadeout, animation.duration);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
DeleteItemAnimations.prototype.getKeyframesToDestination = function (destination, _animation, _context) {
|
|
74
|
+
return (0, react_1.keyframes)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n to {\n transform: ", ";\n }\n "], ["\n to {\n transform: ", ";\n }\n "])), destination);
|
|
75
|
+
};
|
|
76
|
+
return DeleteItemAnimations;
|
|
77
|
+
}(ItemAnimations_1.ItemAnimations));
|
|
78
|
+
exports.DeleteItemAnimations = DeleteItemAnimations;
|
|
79
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
80
|
+
//# sourceMappingURL=DeleteItemAnimations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeleteItemAnimations.js","sourceRoot":"","sources":["../../../../src/components/material/animations/DeleteItemAnimations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,wCAAqE;AACrE,mDAAiD;AACjD,2DAAoD;AACpD,+DAA6D;AAC7D,uFAAgF;AAChF,mDAAiD;AACjD,yEAAkE;AAElE,wDAAsD;AAEtD;IACU,wCAAuB;IAE/B,8BAAsB,QAAY,EAAY,mBAAyB;QAAjD,yBAAA,EAAA,YAAY;QAAY,oCAAA,EAAA,yBAAyB;QAAvE,YACE,iBAAO,SACR;QAFqB,cAAQ,GAAR,QAAQ,CAAI;QAAY,yBAAmB,GAAnB,mBAAmB,CAAM;;IAEvE,CAAC;IAEQ,6CAAc,GAAvB,UAAwB,IAAuB,EAAE,OAA0C;;QACzF,IAAI,IAAA,6BAAa,wBAAM,OAAO,KAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,YAAY,EAAE,MAAA,MAAA,OAAO,CAAC,IAAI,CAAC,WAAW,0CAAE,YAAY,mCAAI,CAAC,IAAG,EAAE;YACxI,OAAO,IAAI,CAAC,mBAAmB,CAAA;SAChC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;IAED,+CAAgB,GAAhB,UAAiB,OAA6B,EAAE,SAAmC;QACjF,IAAI,CAAC,IAAA,gDAAoB,EAAC,OAAO,EAAE,SAAS,CAAC,IAAI,CAAC;YAAE,OAAM;QAC1D,IAAM,aAAa,GAAG,IAAA,8DAA2B,EAAC,OAAO,CAAC,CAAA;QAC1D,IAAI,aAAa,EAAE;YACjB,IAAM,eAAe,GAAG,IAAA,+BAAc,EAAC,aAAa,EAAE,IAAA,kCAAa,EAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACvF,IAAM,kBAAkB,GAAG,IAAI,CAAC,yBAAyB,CAAC,eAAe,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;YAC9F,OAAO,IAAA,2CAAoB,EAAC,kBAAkB,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAA;SACpE;aAAM;YACL,IAAM,OAAO,OAAG,iBAAS,8HAAA,0DAIxB,IAAA,CAAA;YACD,WAAO,WAAG,gHAAA,aAAc,EAAO,GAAI,EAAkB,wBAAwB,KAArD,OAAO,EAAI,SAAS,CAAC,QAAQ,EAAwB;SAC9E;IACH,CAAC;IAES,wDAAyB,GAAnC,UAAoC,WAAmB,EAAE,UAAwC,EAAE,QAA8B;QAC/H,WAAO,iBAAS,2HAAA,mCAEC,EAAW,kBAE3B,KAFgB,WAAW,EAE3B;IACH,CAAC;IACH,2BAAC;AAAD,CAAC,AAtCD,CACU,+BAAc,GAqCvB;AAtCY,oDAAoB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Animation, Animations } from '@gamepark/react-client';
|
|
2
|
+
import { MaterialGame, MaterialMove } from '@gamepark/rules-api';
|
|
3
|
+
import { ItemContext } from '../../../locators';
|
|
4
|
+
import { Interpolation, Theme } from '@emotion/react';
|
|
5
|
+
export declare class ItemAnimations<P extends number = number, M extends number = number, L extends number = number> extends Animations<MaterialGame<P, M, L>, MaterialMove<P, M, L>, P> {
|
|
6
|
+
getItemAnimation(_context: ItemContext<P, M, L>, _animation: Animation<MaterialMove<P, M, L>>): Interpolation<Theme>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ItemAnimations = void 0;
|
|
19
|
+
var react_client_1 = require("@gamepark/react-client");
|
|
20
|
+
var ItemAnimations = /** @class */ (function (_super) {
|
|
21
|
+
__extends(ItemAnimations, _super);
|
|
22
|
+
function ItemAnimations() {
|
|
23
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
+
}
|
|
25
|
+
ItemAnimations.prototype.getItemAnimation = function (_context, _animation) {
|
|
26
|
+
return;
|
|
27
|
+
};
|
|
28
|
+
return ItemAnimations;
|
|
29
|
+
}(react_client_1.Animations));
|
|
30
|
+
exports.ItemAnimations = ItemAnimations;
|
|
31
|
+
//# sourceMappingURL=ItemAnimations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ItemAnimations.js","sourceRoot":"","sources":["../../../../src/components/material/animations/ItemAnimations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uDAA8D;AAK9D;IACU,kCAA2D;IADrE;;IAMA,CAAC;IAHC,yCAAgB,GAAhB,UAAiB,QAA8B,EAAE,UAA4C;QAC3F,OAAM;IACR,CAAC;IACH,qBAAC;AAAD,CAAC,AAND,CACU,yBAAU,GAKnB;AANY,wCAAc"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Animation, Animations } from '@gamepark/react-client';
|
|
2
|
+
import { ItemMove, ItemMoveType, MaterialGame, MaterialMove, MaterialRules } from '@gamepark/rules-api';
|
|
3
|
+
import { Interpolation, Theme } from '@emotion/react';
|
|
4
|
+
import { ItemContext, ItemLocator } from '../../../locators';
|
|
5
|
+
import { MaterialDescription } from '../MaterialDescription';
|
|
6
|
+
import { ItemAnimations } from './ItemAnimations';
|
|
7
|
+
import { MaterialAnimationContext } from './MaterialGameAnimations';
|
|
8
|
+
export declare class MaterialAnimations<P extends number = number, M extends number = number, L extends number = number> extends Animations<MaterialGame<P, M, L>, MaterialMove<P, M, L>, P> {
|
|
9
|
+
protected readonly animations: Record<ItemMoveType, ItemAnimations<P, M, L>>;
|
|
10
|
+
constructor(duration?: number, droppedItemDuration?: number);
|
|
11
|
+
getDuration(move: ItemMove<P, M, L>, context: MaterialAnimationContext<P, M, L>): number;
|
|
12
|
+
getItemAnimation(context: ItemContext<P, M, L>, animation: Animation<MaterialMove<P, M, L>>): Interpolation<Theme>;
|
|
13
|
+
}
|
|
14
|
+
export type ItemAnimationContext<P extends number = number, M extends number = number, L extends number = number> = {
|
|
15
|
+
material: Record<M, MaterialDescription<P, M, L>>;
|
|
16
|
+
locators: Record<L, ItemLocator<P, M, L>>;
|
|
17
|
+
rules: MaterialRules<P, M, L>;
|
|
18
|
+
player?: P;
|
|
19
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.MaterialAnimations = void 0;
|
|
19
|
+
var react_client_1 = require("@gamepark/react-client");
|
|
20
|
+
var rules_api_1 = require("@gamepark/rules-api");
|
|
21
|
+
var CreateItemAnimations_1 = require("./CreateItemAnimations");
|
|
22
|
+
var ShuffleAnimations_1 = require("./ShuffleAnimations");
|
|
23
|
+
var DeleteItemAnimations_1 = require("./DeleteItemAnimations");
|
|
24
|
+
var MoveItemAnimations_1 = require("./MoveItemAnimations");
|
|
25
|
+
var MaterialAnimations = /** @class */ (function (_super) {
|
|
26
|
+
__extends(MaterialAnimations, _super);
|
|
27
|
+
function MaterialAnimations(duration, droppedItemDuration) {
|
|
28
|
+
var _a;
|
|
29
|
+
if (duration === void 0) { duration = 1; }
|
|
30
|
+
if (droppedItemDuration === void 0) { droppedItemDuration = 0.2; }
|
|
31
|
+
var _this = _super.call(this) || this;
|
|
32
|
+
_this.animations = (_a = {},
|
|
33
|
+
_a[rules_api_1.ItemMoveType.Create] = new CreateItemAnimations_1.CreateItemAnimations(duration),
|
|
34
|
+
_a[rules_api_1.ItemMoveType.Move] = new MoveItemAnimations_1.MoveItemAnimations(duration, droppedItemDuration),
|
|
35
|
+
_a[rules_api_1.ItemMoveType.Delete] = new DeleteItemAnimations_1.DeleteItemAnimations(duration, droppedItemDuration),
|
|
36
|
+
_a[rules_api_1.ItemMoveType.Shuffle] = new ShuffleAnimations_1.ShuffleAnimations(duration),
|
|
37
|
+
_a);
|
|
38
|
+
return _this;
|
|
39
|
+
}
|
|
40
|
+
MaterialAnimations.prototype.getDuration = function (move, context) {
|
|
41
|
+
return this.animations[move.type].getDuration(move, context);
|
|
42
|
+
};
|
|
43
|
+
MaterialAnimations.prototype.getItemAnimation = function (context, animation) {
|
|
44
|
+
if (animation.move.kind !== rules_api_1.MoveKind.ItemMove)
|
|
45
|
+
return;
|
|
46
|
+
return this.animations[animation.move.type].getItemAnimation(context, animation);
|
|
47
|
+
};
|
|
48
|
+
return MaterialAnimations;
|
|
49
|
+
}(react_client_1.Animations));
|
|
50
|
+
exports.MaterialAnimations = MaterialAnimations;
|
|
51
|
+
//# sourceMappingURL=MaterialAnimations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MaterialAnimations.js","sourceRoot":"","sources":["../../../../src/components/material/animations/MaterialAnimations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uDAA8D;AAC9D,iDAAiH;AAKjH,+DAA6D;AAC7D,yDAAuD;AACvD,+DAA6D;AAC7D,2DAAyD;AAGzD;IACU,sCAA2D;IAInE,4BAAY,QAAY,EAAE,mBAAyB;;QAAvC,yBAAA,EAAA,YAAY;QAAE,oCAAA,EAAA,yBAAyB;QAAnD,YACE,iBAAO,SAOR;QANC,KAAI,CAAC,UAAU;YACb,GAAC,wBAAY,CAAC,MAAM,IAAG,IAAI,2CAAoB,CAAC,QAAQ,CAAC;YACzD,GAAC,wBAAY,CAAC,IAAI,IAAG,IAAI,uCAAkB,CAAC,QAAQ,EAAE,mBAAmB,CAAC;YAC1E,GAAC,wBAAY,CAAC,MAAM,IAAG,IAAI,2CAAoB,CAAC,QAAQ,EAAE,mBAAmB,CAAC;YAC9E,GAAC,wBAAY,CAAC,OAAO,IAAG,IAAI,qCAAiB,CAAC,QAAQ,CAAC;eACxD,CAAA;;IACH,CAAC;IAED,wCAAW,GAAX,UAAY,IAAuB,EAAE,OAA0C;QAC7E,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAC9D,CAAC;IAED,6CAAgB,GAAhB,UAAiB,OAA6B,EAAE,SAA2C;QACzF,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,KAAK,oBAAQ,CAAC,QAAQ;YAAE,OAAM;QACrD,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;IAClF,CAAC;IACH,yBAAC;AAAD,CAAC,AAvBD,CACU,yBAAU,GAsBnB;AAvBY,gDAAkB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AnimationContext, Animations } from '@gamepark/react-client';
|
|
2
|
+
import { MaterialGame, MaterialMove } from '@gamepark/rules-api';
|
|
3
|
+
import { MaterialAnimations } from './MaterialAnimations';
|
|
4
|
+
import { MaterialContext } from '../../../locators';
|
|
5
|
+
export type MaterialAnimationContext<P extends number = number, M extends number = number, L extends number = number> = AnimationContext<MaterialGame<P, M, L>, MaterialMove<P, M, L>, P> & MaterialContext<P, M, L>;
|
|
6
|
+
export declare class MaterialGameAnimations<P extends number = number, M extends number = number, L extends number = number> extends Animations<MaterialGame<P, M, L>, MaterialMove<P, M, L>, P> {
|
|
7
|
+
readonly itemsAnimations: Partial<Record<M, MaterialAnimations<P, M, L>>>;
|
|
8
|
+
constructor(itemsAnimations?: Partial<Record<M, MaterialAnimations<P, M, L>>>);
|
|
9
|
+
getMaterialAnimations(materialType: M): MaterialAnimations<P, M, L>;
|
|
10
|
+
getDuration(move: MaterialMove<P, M, L>, context: MaterialAnimationContext<P, M, L>): number;
|
|
11
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.MaterialGameAnimations = void 0;
|
|
19
|
+
var react_client_1 = require("@gamepark/react-client");
|
|
20
|
+
var rules_api_1 = require("@gamepark/rules-api");
|
|
21
|
+
var MaterialAnimations_1 = require("./MaterialAnimations");
|
|
22
|
+
var MaterialGameAnimations = /** @class */ (function (_super) {
|
|
23
|
+
__extends(MaterialGameAnimations, _super);
|
|
24
|
+
function MaterialGameAnimations(itemsAnimations) {
|
|
25
|
+
if (itemsAnimations === void 0) { itemsAnimations = {}; }
|
|
26
|
+
var _this = _super.call(this) || this;
|
|
27
|
+
_this.itemsAnimations = itemsAnimations;
|
|
28
|
+
return _this;
|
|
29
|
+
}
|
|
30
|
+
MaterialGameAnimations.prototype.getMaterialAnimations = function (materialType) {
|
|
31
|
+
var _a;
|
|
32
|
+
return (_a = this.itemsAnimations[materialType]) !== null && _a !== void 0 ? _a : new MaterialAnimations_1.MaterialAnimations();
|
|
33
|
+
};
|
|
34
|
+
MaterialGameAnimations.prototype.getDuration = function (move, context) {
|
|
35
|
+
if (move.kind !== rules_api_1.MoveKind.ItemMove)
|
|
36
|
+
return 0;
|
|
37
|
+
return this.getMaterialAnimations(move.itemType).getDuration(move, context);
|
|
38
|
+
};
|
|
39
|
+
return MaterialGameAnimations;
|
|
40
|
+
}(react_client_1.Animations));
|
|
41
|
+
exports.MaterialGameAnimations = MaterialGameAnimations;
|
|
42
|
+
//# sourceMappingURL=MaterialGameAnimations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MaterialGameAnimations.js","sourceRoot":"","sources":["../../../../src/components/material/animations/MaterialGameAnimations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uDAAqE;AACrE,iDAA0E;AAC1E,2DAAyD;AAMzD;IACU,0CAA2D;IAInE,gCAAY,eAAqE;QAArE,gCAAA,EAAA,oBAAqE;QAAjF,YACE,iBAAO,SAER;QADC,KAAI,CAAC,eAAe,GAAG,eAAe,CAAA;;IACxC,CAAC;IAED,sDAAqB,GAArB,UAAsB,YAAe;;QACnC,OAAO,MAAA,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,mCAAI,IAAI,uCAAkB,EAAE,CAAA;IACvE,CAAC;IAEQ,4CAAW,GAApB,UAAqB,IAA2B,EAAE,OAA0C;QAC1F,IAAI,IAAI,CAAC,IAAI,KAAK,oBAAQ,CAAC,QAAQ;YAAE,OAAO,CAAC,CAAA;QAC7C,OAAO,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAC7E,CAAC;IACH,6BAAC;AAAD,CAAC,AAlBD,CACU,yBAAU,GAiBnB;AAlBY,wDAAsB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ItemAnimations } from './ItemAnimations';
|
|
2
|
+
import { ItemMove, MaterialItem, MoveItem } from '@gamepark/rules-api';
|
|
3
|
+
import { Animation } from '@gamepark/react-client';
|
|
4
|
+
import { ItemContext } from '../../../locators';
|
|
5
|
+
import { Interpolation, Theme } from '@emotion/react';
|
|
6
|
+
import { MaterialAnimationContext } from './MaterialGameAnimations';
|
|
7
|
+
export declare class MoveItemAnimations<P extends number = number, M extends number = number, L extends number = number> extends ItemAnimations<P, M, L> {
|
|
8
|
+
protected duration: number;
|
|
9
|
+
protected droppedItemDuration: number;
|
|
10
|
+
constructor(duration?: number, droppedItemDuration?: number);
|
|
11
|
+
getPreDuration(move: MoveItem<P, M, L>, context: MaterialAnimationContext<P, M, L>): number;
|
|
12
|
+
getItemAnimation(context: ItemContext<P, M, L>, animation: Animation<MoveItem<P, M, L>>): Interpolation<Theme>;
|
|
13
|
+
getMovedItemAnimation(context: ItemContext<P, M, L>, animation: Animation<MoveItem<P, M, L>>): Interpolation<Theme>;
|
|
14
|
+
getChildItemAnimation(item: MaterialItem<P, L>, context: ItemContext<P, M, L>, animation: Animation<MoveItem<P, M, L>>): Interpolation<Theme>;
|
|
15
|
+
protected getKeyframesToDestination(destination: string, _animation: Animation<ItemMove<P, M, L>>, _context: ItemContext<P, M, L>): import("@emotion/serialize").Keyframes;
|
|
16
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
18
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
19
|
+
return cooked;
|
|
20
|
+
};
|
|
21
|
+
var __assign = (this && this.__assign) || function () {
|
|
22
|
+
__assign = Object.assign || function(t) {
|
|
23
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
24
|
+
s = arguments[i];
|
|
25
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
26
|
+
t[p] = s[p];
|
|
27
|
+
}
|
|
28
|
+
return t;
|
|
29
|
+
};
|
|
30
|
+
return __assign.apply(this, arguments);
|
|
31
|
+
};
|
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
exports.MoveItemAnimations = void 0;
|
|
34
|
+
var ItemAnimations_1 = require("./ItemAnimations");
|
|
35
|
+
var react_1 = require("@emotion/react");
|
|
36
|
+
var adjustRotation_1 = require("./adjustRotation");
|
|
37
|
+
var transformItem_util_1 = require("./transformItem.util");
|
|
38
|
+
var itemMovementCss_util_1 = require("./itemMovementCss.util");
|
|
39
|
+
var isMovedOrDeletedItem_util_1 = require("./isMovedOrDeletedItem.util");
|
|
40
|
+
var isPlacedOnItem_1 = require("../utils/isPlacedOnItem");
|
|
41
|
+
var getItemFromContext_1 = require("../utils/getItemFromContext");
|
|
42
|
+
var isDroppedItem_1 = require("../utils/isDroppedItem");
|
|
43
|
+
var MoveItemAnimations = /** @class */ (function (_super) {
|
|
44
|
+
__extends(MoveItemAnimations, _super);
|
|
45
|
+
function MoveItemAnimations(duration, droppedItemDuration) {
|
|
46
|
+
if (duration === void 0) { duration = 1; }
|
|
47
|
+
if (droppedItemDuration === void 0) { droppedItemDuration = 0.2; }
|
|
48
|
+
var _this = _super.call(this) || this;
|
|
49
|
+
_this.duration = duration;
|
|
50
|
+
_this.droppedItemDuration = droppedItemDuration;
|
|
51
|
+
return _this;
|
|
52
|
+
}
|
|
53
|
+
MoveItemAnimations.prototype.getPreDuration = function (move, context) {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
if ((0, isDroppedItem_1.isDroppedItem)(__assign(__assign({}, context), { type: move.itemType, index: move.itemIndex, displayIndex: (_b = (_a = context.game.droppedItem) === null || _a === void 0 ? void 0 : _a.displayIndex) !== null && _b !== void 0 ? _b : 0 }))) {
|
|
56
|
+
return this.droppedItemDuration;
|
|
57
|
+
}
|
|
58
|
+
return this.duration;
|
|
59
|
+
};
|
|
60
|
+
MoveItemAnimations.prototype.getItemAnimation = function (context, animation) {
|
|
61
|
+
if ((0, isMovedOrDeletedItem_util_1.isMovedOrDeletedItem)(context, animation.move)) {
|
|
62
|
+
return this.getMovedItemAnimation(context, animation);
|
|
63
|
+
}
|
|
64
|
+
var item = (0, getItemFromContext_1.getItemFromContext)(context);
|
|
65
|
+
if ((0, isPlacedOnItem_1.isPlacedOnItem)(item, { type: animation.move.itemType, index: animation.move.itemIndex }, context)) {
|
|
66
|
+
return this.getChildItemAnimation(item, context, animation);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
MoveItemAnimations.prototype.getMovedItemAnimation = function (context, animation) {
|
|
70
|
+
var _a, _b;
|
|
71
|
+
var type = context.type, game = context.game, Rules = context.Rules, locators = context.locators;
|
|
72
|
+
var futureGame = JSON.parse(JSON.stringify(game));
|
|
73
|
+
var rules = new Rules(futureGame);
|
|
74
|
+
var mutator = rules.mutator(type);
|
|
75
|
+
var futureIndex = mutator.move(animation.move);
|
|
76
|
+
var futureItem = mutator.items[futureIndex];
|
|
77
|
+
// TODO: if animation.move.quantity > 1, we will have to give a different target to each moving item. Formula bellow works only if 1 item moves
|
|
78
|
+
var futureDisplayIndex = ((_a = futureItem.quantity) !== null && _a !== void 0 ? _a : 1) - ((_b = animation.move.quantity) !== null && _b !== void 0 ? _b : 1);
|
|
79
|
+
var targetLocator = locators[futureItem.location.type];
|
|
80
|
+
var futureContext = __assign(__assign({}, context), { game: futureGame, type: type, index: futureIndex, displayIndex: futureDisplayIndex });
|
|
81
|
+
var targetTransforms = targetLocator.transformItem(futureItem, futureContext);
|
|
82
|
+
var targetTransform = (0, adjustRotation_1.adjustRotation)(targetTransforms, (0, transformItem_util_1.transformItem)(context)).join(' ');
|
|
83
|
+
var animationKeyframes = this.getKeyframesToDestination(targetTransform, animation, context);
|
|
84
|
+
return (0, itemMovementCss_util_1.movementAnimationCss)(animationKeyframes, animation.duration);
|
|
85
|
+
};
|
|
86
|
+
MoveItemAnimations.prototype.getChildItemAnimation = function (item, context, animation) {
|
|
87
|
+
var game = context.game, Rules = context.Rules, locators = context.locators;
|
|
88
|
+
var futureGame = JSON.parse(JSON.stringify(game));
|
|
89
|
+
var rules = new Rules(futureGame);
|
|
90
|
+
rules.play(animation.move);
|
|
91
|
+
var targetLocator = locators[item.location.type];
|
|
92
|
+
var futureContext = __assign(__assign({}, context), { game: futureGame });
|
|
93
|
+
var targetTransforms = targetLocator.transformItem(item, futureContext);
|
|
94
|
+
var targetTransform = (0, adjustRotation_1.adjustRotation)(targetTransforms, (0, transformItem_util_1.transformItem)(context)).join(' ');
|
|
95
|
+
var animationKeyframes = this.getKeyframesToDestination(targetTransform, animation, context);
|
|
96
|
+
return (0, itemMovementCss_util_1.movementAnimationCss)(animationKeyframes, animation.duration);
|
|
97
|
+
};
|
|
98
|
+
MoveItemAnimations.prototype.getKeyframesToDestination = function (destination, _animation, _context) {
|
|
99
|
+
return (0, react_1.keyframes)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n to {\n transform: ", ";\n }\n "], ["\n to {\n transform: ", ";\n }\n "])), destination);
|
|
100
|
+
};
|
|
101
|
+
return MoveItemAnimations;
|
|
102
|
+
}(ItemAnimations_1.ItemAnimations));
|
|
103
|
+
exports.MoveItemAnimations = MoveItemAnimations;
|
|
104
|
+
var templateObject_1;
|
|
105
|
+
//# sourceMappingURL=MoveItemAnimations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MoveItemAnimations.js","sourceRoot":"","sources":["../../../../src/components/material/animations/MoveItemAnimations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAiD;AAIjD,wCAAgE;AAChE,mDAAiD;AACjD,2DAAoD;AACpD,+DAA6D;AAC7D,yEAAkE;AAClE,0DAAwD;AACxD,kEAAgE;AAEhE,wDAAsD;AAEtD;IACU,sCAAuB;IAE/B,4BAAsB,QAAY,EAAY,mBAAyB;QAAjD,yBAAA,EAAA,YAAY;QAAY,oCAAA,EAAA,yBAAyB;QAAvE,YACE,iBAAO,SACR;QAFqB,cAAQ,GAAR,QAAQ,CAAI;QAAY,yBAAmB,GAAnB,mBAAmB,CAAM;;IAEvE,CAAC;IAEQ,2CAAc,GAAvB,UAAwB,IAAuB,EAAE,OAA0C;;QACzF,IAAI,IAAA,6BAAa,wBAAM,OAAO,KAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,YAAY,EAAE,MAAA,MAAA,OAAO,CAAC,IAAI,CAAC,WAAW,0CAAE,YAAY,mCAAI,CAAC,IAAG,EAAE;YACxI,OAAO,IAAI,CAAC,mBAAmB,CAAA;SAChC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;IAED,6CAAgB,GAAhB,UAAiB,OAA6B,EAAE,SAAuC;QACrF,IAAI,IAAA,gDAAoB,EAAC,OAAO,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE;YACjD,OAAO,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;SACtD;QACD,IAAM,IAAI,GAAG,IAAA,uCAAkB,EAAC,OAAO,CAAC,CAAA;QACx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AO,IAAA,2CAAoB,EAAC,kBAAkB,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAA;IACrE,CAAC;IAES,sDAAyB,GAAnC,UAAoC,WAAmB,EAAE,UAAwC,EAAE,QAA8B;QAC/H,WAAO,iBAAS,2HAAA,mCAEC,EAAW,kBAE3B,KAFgB,WAAW,EAE3B;IACH,CAAC;IACH,yBAAC;AAAD,CAAC,AA7DD,CACU,+BAAc,GA4DvB;AA7DY,gDAAkB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ItemAnimations } from './ItemAnimations';
|
|
2
|
+
import { CreateItem } from '@gamepark/rules-api';
|
|
3
|
+
import { MaterialAnimationContext } from './MaterialGameAnimations';
|
|
4
|
+
export declare class ShuffleAnimations<P extends number = number, M extends number = number, L extends number = number> extends ItemAnimations<P, M, L> {
|
|
5
|
+
private duration;
|
|
6
|
+
constructor(duration?: number);
|
|
7
|
+
getPostDuration(_move: CreateItem<P, M, L>, _context: MaterialAnimationContext<P, M, L>): number;
|
|
8
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ShuffleAnimations = void 0;
|
|
19
|
+
var ItemAnimations_1 = require("./ItemAnimations");
|
|
20
|
+
var ShuffleAnimations = /** @class */ (function (_super) {
|
|
21
|
+
__extends(ShuffleAnimations, _super);
|
|
22
|
+
function ShuffleAnimations(duration) {
|
|
23
|
+
if (duration === void 0) { duration = 1; }
|
|
24
|
+
var _this = _super.call(this) || this;
|
|
25
|
+
_this.duration = duration;
|
|
26
|
+
return _this;
|
|
27
|
+
}
|
|
28
|
+
ShuffleAnimations.prototype.getPostDuration = function (_move, _context) {
|
|
29
|
+
return this.duration;
|
|
30
|
+
};
|
|
31
|
+
return ShuffleAnimations;
|
|
32
|
+
}(ItemAnimations_1.ItemAnimations));
|
|
33
|
+
exports.ShuffleAnimations = ShuffleAnimations;
|
|
34
|
+
//# sourceMappingURL=ShuffleAnimations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShuffleAnimations.js","sourceRoot":"","sources":["../../../../src/components/material/animations/ShuffleAnimations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,mDAAiD;AAIjD;IACU,qCAAuB;IAE/B,2BAAoB,QAAY;QAAZ,yBAAA,EAAA,YAAY;QAAhC,YACE,iBAAO,SACR;QAFmB,cAAQ,GAAR,QAAQ,CAAI;;IAEhC,CAAC;IAEQ,2CAAe,GAAxB,UAAyB,KAA0B,EAAE,QAA2C;QAC9F,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;IAGH,wBAAC;AAAD,CAAC,AAZD,CACU,+BAAc,GAWvB;AAZY,8CAAiB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const adjustRotation: (targetTransforms: string[], sourceTransforms: string[]) => string[];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.adjustRotation = void 0;
|
|
4
|
+
var adjustRotation = function (targetTransforms, sourceTransforms) {
|
|
5
|
+
var result = [];
|
|
6
|
+
var sourceRotation = sumRotationsDegrees(sourceTransforms);
|
|
7
|
+
var targetRotation = sumRotationsDegrees(targetTransforms);
|
|
8
|
+
for (var axis in sourceRotation) {
|
|
9
|
+
var delta = Math.round((sourceRotation[axis] - targetRotation[axis]) / 360);
|
|
10
|
+
if (delta)
|
|
11
|
+
result.push("rotate".concat(axis.toUpperCase(), "(").concat(delta * 360, "deg)"));
|
|
12
|
+
}
|
|
13
|
+
return targetTransforms.concat(result);
|
|
14
|
+
};
|
|
15
|
+
exports.adjustRotation = adjustRotation;
|
|
16
|
+
var sumRotationsDegrees = function (transforms) {
|
|
17
|
+
var rotations = { x: 0, y: 0, z: 0 };
|
|
18
|
+
for (var _i = 0, transforms_1 = transforms; _i < transforms_1.length; _i++) {
|
|
19
|
+
var transform = transforms_1[_i];
|
|
20
|
+
var rotateMatch = transform.match(/rotate([^(]*)\((-?\d+.?\d*)([^)]*)\)/);
|
|
21
|
+
if (rotateMatch) {
|
|
22
|
+
var axis = rotateMatch[1].toLowerCase(), value = parseFloat(rotateMatch[2]), unit = rotateMatch[3];
|
|
23
|
+
if (axis in rotations) {
|
|
24
|
+
switch (unit) {
|
|
25
|
+
case 'deg':
|
|
26
|
+
rotations[axis] += value;
|
|
27
|
+
break;
|
|
28
|
+
case 'rad':
|
|
29
|
+
rotations[axis] += value * 180 / Math.PI;
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return rotations;
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=adjustRotation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adjustRotation.js","sourceRoot":"","sources":["../../../../src/components/material/animations/adjustRotation.ts"],"names":[],"mappings":";;;AAEO,IAAM,cAAc,GAAG,UAAC,gBAA0B,EAAE,gBAA0B;IACnF,IAAM,MAAM,GAAa,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,CAAC,IAAI,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC,EAAE,CAAA;wBACxC,MAAK;iBACR;aACF;SACF;KACF;IACD,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.getFirstStockItemTransforms = void 0;
|
|
18
|
+
var fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
|
|
19
|
+
var getFirstStockItemTransforms = function (context) {
|
|
20
|
+
var game = context.game, type = context.type, index = context.index, locators = context.locators, material = context.material;
|
|
21
|
+
var item = game.items[type][index];
|
|
22
|
+
var description = material[type];
|
|
23
|
+
var stockLocation = description.getStockLocation(item, context);
|
|
24
|
+
if (!stockLocation)
|
|
25
|
+
return [];
|
|
26
|
+
var stockItem = description.getStaticItems(context).find(function (item) { return (0, fast_deep_equal_1.default)(item.location, stockLocation); });
|
|
27
|
+
var displayIndex = (stockItem === null || stockItem === void 0 ? void 0 : stockItem.quantity) ? stockItem.quantity - 1 : 0;
|
|
28
|
+
var stockLocator = locators[stockLocation.type];
|
|
29
|
+
return stockLocator.transformItem(stockItem !== null && stockItem !== void 0 ? stockItem : { location: stockLocation }, __assign(__assign({}, context), { index: 0, displayIndex: displayIndex }));
|
|
30
|
+
};
|
|
31
|
+
exports.getFirstStockItemTransforms = getFirstStockItemTransforms;
|
|
32
|
+
//# sourceMappingURL=getFirstStockItemTransforms.util.js.map
|