@gamepark/react-game 6.25.0 → 6.27.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/Header/MaterialHeader.js +2 -1
- package/dist/components/Header/MaterialHeader.js.map +1 -1
- package/dist/components/buttons/PlayMoveButton/PlayMoveButton.d.ts +3 -3
- package/dist/components/buttons/PlayMoveButton/PlayMoveButton.js +1 -1
- package/dist/components/buttons/PlayMoveButton/PlayMoveButton.js.map +1 -1
- package/dist/components/material/Dices/CubicDiceDescription.d.ts +1 -1
- package/dist/components/material/Dices/CubicDiceDescription.js +1 -1
- package/dist/components/material/Dices/CubicDiceDescription.js.map +1 -1
- package/dist/components/material/DraggableMaterial.js +1 -1
- package/dist/components/material/DraggableMaterial.js.map +1 -1
- package/dist/components/material/FlatMaterial/FlatMaterial.d.ts +1 -1
- package/dist/components/material/FlatMaterial/FlatMaterial.js +7 -4
- package/dist/components/material/FlatMaterial/FlatMaterial.js.map +1 -1
- package/dist/components/material/FlatMaterial/PolyhexDescription.d.ts +9 -0
- package/dist/components/material/FlatMaterial/PolyhexDescription.js +35 -0
- package/dist/components/material/FlatMaterial/PolyhexDescription.js.map +1 -0
- package/dist/components/material/FlatMaterial/index.d.ts +1 -0
- package/dist/components/material/FlatMaterial/index.js +1 -0
- package/dist/components/material/FlatMaterial/index.js.map +1 -1
- package/dist/components/material/GameTable/DropPreview.d.ts +2 -0
- package/dist/components/material/GameTable/DropPreview.js +60 -0
- package/dist/components/material/GameTable/DropPreview.js.map +1 -0
- package/dist/components/material/GameTable/GameMaterialDisplay.js +2 -1
- package/dist/components/material/GameTable/GameMaterialDisplay.js.map +1 -1
- package/dist/components/material/GameTable/GameTable.js +7 -15
- package/dist/components/material/GameTable/GameTable.js.map +1 -1
- package/dist/components/material/GameTable/ItemDisplay.d.ts +1 -0
- package/dist/components/material/GameTable/ItemDisplay.js +8 -5
- package/dist/components/material/GameTable/ItemDisplay.js.map +1 -1
- package/dist/components/material/ItemMenu.js.map +1 -0
- package/dist/components/material/ItemMenuButton.d.ts +10 -0
- package/dist/components/material/ItemMenuButton.js +46 -0
- package/dist/components/material/ItemMenuButton.js.map +1 -0
- package/dist/components/material/MaterialComponent.d.ts +2 -0
- package/dist/components/material/MaterialComponent.js +2 -2
- package/dist/components/material/MaterialComponent.js.map +1 -1
- package/dist/components/material/MaterialDescription.d.ts +14 -3
- package/dist/components/material/MaterialDescription.js +64 -3
- package/dist/components/material/MaterialDescription.js.map +1 -1
- package/dist/components/material/MobileMaterialDescription.d.ts +1 -1
- package/dist/components/material/MobileMaterialDescription.js +4 -5
- package/dist/components/material/MobileMaterialDescription.js.map +1 -1
- package/dist/components/material/Wheel/WheelDescription.d.ts +2 -1
- package/dist/components/material/Wheel/WheelDescription.js +10 -0
- package/dist/components/material/Wheel/WheelDescription.js.map +1 -1
- package/dist/components/material/Writing/WritingDescription.d.ts +1 -1
- package/dist/components/material/Writing/WritingDescription.js +1 -1
- package/dist/components/material/Writing/WritingDescription.js.map +1 -1
- package/dist/components/material/animations/CreateItemAnimations.d.ts +1 -1
- package/dist/components/material/animations/CreateItemAnimations.js +8 -8
- package/dist/components/material/animations/CreateItemAnimations.js.map +1 -1
- package/dist/components/material/animations/DeleteItemAnimations.js +5 -5
- package/dist/components/material/animations/DeleteItemAnimations.js.map +1 -1
- package/dist/components/material/animations/MoveItemAnimations.js +11 -10
- package/dist/components/material/animations/MoveItemAnimations.js.map +1 -1
- package/dist/components/material/animations/MoveItemAtOnceAnimations.js +8 -7
- package/dist/components/material/animations/MoveItemAtOnceAnimations.js.map +1 -1
- package/dist/components/material/animations/RollItemAnimations.js +4 -4
- package/dist/components/material/animations/RollItemAnimations.js.map +1 -1
- package/dist/components/material/animations/getFirstStockItemTransforms.util.js +3 -3
- package/dist/components/material/animations/getFirstStockItemTransforms.util.js.map +1 -1
- package/dist/components/material/animations/index.d.ts +0 -1
- package/dist/components/material/animations/index.js +1 -3
- package/dist/components/material/animations/index.js.map +1 -1
- package/dist/components/material/animations/rotations.utils.d.ts +1 -0
- package/dist/components/material/animations/rotations.utils.js +3 -7
- package/dist/components/material/animations/rotations.utils.js.map +1 -1
- package/dist/components/material/animations/transformItem.util.js +6 -5
- package/dist/components/material/animations/transformItem.util.js.map +1 -1
- package/dist/components/material/index.d.ts +1 -0
- package/dist/components/material/index.js +1 -0
- package/dist/components/material/index.js.map +1 -1
- package/dist/components/material/locations/DropAreaDescription.d.ts +2 -1
- package/dist/components/material/locations/DropAreaDescription.js +1 -1
- package/dist/components/material/locations/DropAreaDescription.js.map +1 -1
- package/dist/components/material/locations/HexGridDropArea.d.ts +11 -0
- package/dist/components/material/locations/HexGridDropArea.js +74 -0
- package/dist/components/material/locations/HexGridDropArea.js.map +1 -0
- package/dist/components/material/locations/HexGridDropAreaDescription.d.ts +10 -0
- package/dist/components/material/locations/HexGridDropAreaDescription.js +90 -0
- package/dist/components/material/locations/HexGridDropAreaDescription.js.map +1 -0
- package/dist/components/material/locations/LocationDescription.d.ts +1 -0
- package/dist/components/material/locations/LocationDescription.js +5 -4
- package/dist/components/material/locations/LocationDescription.js.map +1 -1
- package/dist/components/material/locations/index.d.ts +1 -0
- package/dist/components/material/locations/index.js +1 -0
- package/dist/components/material/locations/index.js.map +1 -1
- package/dist/components/material/utils/IsLocationSubset.js +7 -1
- package/dist/components/material/utils/IsLocationSubset.js.map +1 -1
- package/dist/components/material/utils/getBestDropMove.d.ts +4 -0
- package/dist/components/material/utils/getBestDropMove.js +34 -0
- package/dist/components/material/utils/getBestDropMove.js.map +1 -0
- package/dist/components/material/utils/isDroppedItem.js +2 -1
- package/dist/components/material/utils/isDroppedItem.js.map +1 -1
- package/dist/components/material/utils/isRotationMove.d.ts +3 -0
- package/dist/components/material/utils/isRotationMove.js +25 -0
- package/dist/components/material/utils/isRotationMove.js.map +1 -0
- package/dist/hooks/useItemLocations.js +5 -19
- package/dist/hooks/useItemLocations.js.map +1 -1
- package/dist/locators/HandLocator.js +1 -1
- package/dist/locators/HandLocator.js.map +1 -1
- package/dist/locators/HexagonalGridLocator.d.ts +81 -0
- package/dist/locators/HexagonalGridLocator.js +219 -0
- package/dist/locators/HexagonalGridLocator.js.map +1 -0
- package/dist/locators/ListLocator.js +1 -3
- package/dist/locators/ListLocator.js.map +1 -1
- package/dist/locators/Locator.d.ts +25 -0
- package/dist/locators/Locator.js +33 -1
- package/dist/locators/Locator.js.map +1 -1
- package/dist/locators/PileLocator.js +1 -1
- package/dist/locators/PileLocator.js.map +1 -1
- package/dist/locators/index.d.ts +1 -0
- package/dist/locators/index.js +1 -0
- package/dist/locators/index.js.map +1 -1
- package/dist/locators/utils/grid.hex.util.d.ts +43 -0
- package/dist/locators/utils/grid.hex.util.js +92 -0
- package/dist/locators/utils/grid.hex.util.js.map +1 -0
- package/dist/utilities/combineEventListeners.js.map +1 -1
- package/dist/utilities/zoom-pan-pinch/animations.util.d.ts +6 -2
- package/dist/utilities/zoom-pan-pinch/animations.util.js.map +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ItemMenu.js","sourceRoot":"","sources":["../../../src/components/material/ItemMenu.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAsC;AACtC,wCAAoC;AAGpC,qCAAqC;AAM9B,IAAM,QAAQ,GAAG,UAAC,EAAoC;IAAlC,IAAA,OAAO,aAAA,EAAK,KAAK,cAAnB,WAAqB,CAAF;IAC1C,OAAO,2CAAS,KAAK,cAClB,OAAO,CAAC,GAAG,CAAC,UAAC,MAAM,EAAE,KAAK;YACzB,OAAA,uBAAC,sBAAc,eAAiB,MAAM,GAAjB,KAAK,CAAe;QAAzC,CAAyC,CAC1C,IACG,CAAA;AACR,CAAC,CAAA;AANY,QAAA,QAAQ,YAMpB;AAWM,IAAM,cAAc,GAAG,UAC5B,EAAgH;IAA9G,IAAA,IAAI,UAAA,EAAE,KAAK,WAAA,EAAE,KAAK,WAAA,EAAE,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ButtonProps = {
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
angle: number;
|
|
6
|
+
radius?: number;
|
|
7
|
+
move: any;
|
|
8
|
+
options: PlayOptions;
|
|
9
|
+
};
|
|
10
|
+
export declare const ItemMenuButton: ({ label, angle, radius, move, options, children, ...props }: ItemButtonProps & HTMLAttributes<HTMLButtonElement>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __assign = (this && this.__assign) || function () {
|
|
7
|
+
__assign = Object.assign || function(t) {
|
|
8
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
9
|
+
s = arguments[i];
|
|
10
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
11
|
+
t[p] = s[p];
|
|
12
|
+
}
|
|
13
|
+
return t;
|
|
14
|
+
};
|
|
15
|
+
return __assign.apply(this, arguments);
|
|
16
|
+
};
|
|
17
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
18
|
+
var t = {};
|
|
19
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
20
|
+
t[p] = s[p];
|
|
21
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
22
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
23
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
24
|
+
t[p[i]] = s[p[i]];
|
|
25
|
+
}
|
|
26
|
+
return t;
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.ItemMenuButton = void 0;
|
|
30
|
+
var jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
31
|
+
/** @jsxImportSource @emotion/react */
|
|
32
|
+
var react_1 = require("@emotion/react");
|
|
33
|
+
var hooks_1 = require("../../hooks");
|
|
34
|
+
var ItemMenuButton = function (_a) {
|
|
35
|
+
var label = _a.label, angle = _a.angle, _b = _a.radius, radius = _b === void 0 ? 3 : _b, move = _a.move, options = _a.options, children = _a.children, props = __rest(_a, ["label", "angle", "radius", "move", "options", "children"]);
|
|
36
|
+
var play = (0, hooks_1.usePlay)();
|
|
37
|
+
return (0, jsx_runtime_1.jsxs)("button", __assign({ css: [itemMenuButtonCss, buttonPositionCss(angle * Math.PI / 180, radius)], onClick: function () { return play(move, options); } }, props, { children: [children, label && (0, jsx_runtime_1.jsx)("span", __assign({ css: [buttonLabelCss, (angle % 360 + 360) % 360 < 180 ? labelLeft : labelRight] }, { children: label }))] }));
|
|
38
|
+
};
|
|
39
|
+
exports.ItemMenuButton = ItemMenuButton;
|
|
40
|
+
var itemMenuButtonCss = (0, react_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n transform-style: preserve-3d;\n width: 2em;\n height: 2em;\n border-radius: 1em;\n background-color: white;\n color: black;\n cursor: pointer;\n"], ["\n transform-style: preserve-3d;\n width: 2em;\n height: 2em;\n border-radius: 1em;\n background-color: white;\n color: black;\n cursor: pointer;\n"])));
|
|
41
|
+
var buttonPositionCss = function (angle, radius) { return (0, react_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n transform: translate(-50%, -50%) translate(", "em, ", "em);\n"], ["\n transform: translate(-50%, -50%) translate(", "em, ", "em);\n"])), radius * Math.sin(angle), radius * -Math.cos(angle)); };
|
|
42
|
+
var buttonLabelCss = (0, react_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: absolute;\n white-space: nowrap;\n background: rgba(0, 0, 0, 0.5);\n color: white;\n border-radius: 0.3em;\n"], ["\n position: absolute;\n white-space: nowrap;\n background: rgba(0, 0, 0, 0.5);\n color: white;\n border-radius: 0.3em;\n"])));
|
|
43
|
+
var labelLeft = (0, react_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n padding: 0 0.2em 0 0.5em;\n top: 50%;\n right: 0.2em;\n transform: translate(100%, -50%) translateZ(-0.1em);\n"], ["\n padding: 0 0.2em 0 0.5em;\n top: 50%;\n right: 0.2em;\n transform: translate(100%, -50%) translateZ(-0.1em);\n"])));
|
|
44
|
+
var labelRight = (0, react_1.css)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n padding: 0 0.5em 0 0.2em;\n top: 50%;\n left: 0.2em;\n transform: translate(-100%, -50%) translateZ(-0.1em);\n"], ["\n padding: 0 0.5em 0 0.2em;\n top: 50%;\n left: 0.2em;\n transform: translate(-100%, -50%) translateZ(-0.1em);\n"])));
|
|
45
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
46
|
+
//# sourceMappingURL=ItemMenuButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ItemMenuButton.js","sourceRoot":"","sources":["../../../src/components/material/ItemMenuButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAsC;AACtC,wCAAoC;AAGpC,qCAAqC;AAU9B,IAAM,cAAc,GAAG,UAC5B,EAAoH;IAAlH,IAAA,KAAK,WAAA,EAAE,KAAK,WAAA,EAAE,cAAU,EAAV,MAAM,mBAAG,CAAC,KAAA,EAAE,IAAI,UAAA,EAAE,OAAO,aAAA,EAAE,QAAQ,cAAA,EAAK,KAAK,cAA7D,2DAA+D,CAAF;IAE7D,IAAM,IAAI,GAAG,IAAA,eAAO,GAAE,CAAA;IACtB,OAAO,6CAAQ,GAAG,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,EAAE,MAAM,CAAC,CAAC,EAC1E,OAAO,EAAE,cAAM,OAAA,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,EAAnB,CAAmB,IAAM,KAAK,eACzD,QAAQ,EACR,KAAK,IAAI,0CAAM,GAAG,EAAE,CAAC,cAAc,EAAE,CAAC,KAAK,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,gBAAG,KAAK,IAAQ,KACxG,CAAA;AACX,CAAC,CAAA;AATY,QAAA,cAAc,kBAS1B;AAED,IAAM,iBAAiB,OAAG,WAAG,gOAAA,4JAQ5B,IAAA,CAAA;AAED,IAAM,iBAAiB,GAAG,UAAC,KAAa,EAAE,MAAc,IAAK,WAAA,WAAG,uIAAA,iDACjB,EAAwB,MAAO,EAAyB,QACtG,KAD8C,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAO,MAAM,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAD1C,CAE5D,CAAA;AAED,IAAM,cAAc,OAAG,WAAG,oMAAA,gIAMzB,IAAA,CAAA;AAED,IAAM,SAAS,OAAG,WAAG,2LAAA,uHAKpB,IAAA,CAAA;AAED,IAAM,UAAU,OAAG,WAAG,2LAAA,uHAKrB,IAAA,CAAA"}
|
|
@@ -5,6 +5,7 @@ export type MaterialComponentProps<M extends number = number, ItemId = any> = {
|
|
|
5
5
|
itemIndex?: number;
|
|
6
6
|
highlight?: boolean;
|
|
7
7
|
playDown?: boolean;
|
|
8
|
+
preview?: boolean;
|
|
8
9
|
} & HTMLAttributes<HTMLElement>;
|
|
9
10
|
export declare const MaterialComponent: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<{
|
|
10
11
|
type: number;
|
|
@@ -12,4 +13,5 @@ export declare const MaterialComponent: import("react").MemoExoticComponent<impo
|
|
|
12
13
|
itemIndex?: number | undefined;
|
|
13
14
|
highlight?: boolean | undefined;
|
|
14
15
|
playDown?: boolean | undefined;
|
|
16
|
+
preview?: boolean | undefined;
|
|
15
17
|
} & HTMLAttributes<HTMLElement> & import("react").RefAttributes<HTMLDivElement>>>;
|
|
@@ -34,13 +34,13 @@ var react_2 = require("react");
|
|
|
34
34
|
var css_1 = require("../../css");
|
|
35
35
|
var hooks_1 = require("../../hooks");
|
|
36
36
|
exports.MaterialComponent = (0, react_2.memo)((0, react_2.forwardRef)(function (_a, ref) {
|
|
37
|
-
var type = _a.type, itemId = _a.itemId, itemIndex = _a.itemIndex, highlight = _a.highlight, playDown = _a.playDown, props = __rest(_a, ["type", "itemId", "itemIndex", "highlight", "playDown"]);
|
|
37
|
+
var type = _a.type, itemId = _a.itemId, itemIndex = _a.itemIndex, highlight = _a.highlight, playDown = _a.playDown, preview = _a.preview, props = __rest(_a, ["type", "itemId", "itemIndex", "highlight", "playDown", "preview"]);
|
|
38
38
|
var description = (0, hooks_1.useMaterialDescription)(type);
|
|
39
39
|
if (!description)
|
|
40
40
|
return null;
|
|
41
41
|
var _b = description.getSize(itemId), width = _b.width, height = _b.height;
|
|
42
42
|
var componentCss = (0, react_2.useMemo)(function () { return [materialCss, (0, css_1.sizeCss)(width, height)]; }, [width, height]);
|
|
43
|
-
return ((0, jsx_runtime_1.jsx)("div", __assign({ ref: ref, css: componentCss }, props, { children: (0, jsx_runtime_1.jsx)("div", __assign({ css: hoverWrapper }, { children: description.content(__assign({ type: type, itemId: itemId, highlight: highlight, playDown: playDown, itemIndex: itemIndex }, props)) })) })));
|
|
43
|
+
return ((0, jsx_runtime_1.jsx)("div", __assign({ ref: ref, css: componentCss }, props, { children: (0, jsx_runtime_1.jsx)("div", __assign({ css: hoverWrapper }, { children: description.content(__assign({ type: type, itemId: itemId, highlight: highlight, playDown: playDown, preview: preview, itemIndex: itemIndex }, props)) })) })));
|
|
44
44
|
}));
|
|
45
45
|
var hoverWrapper = (0, react_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n transform-style: preserve-3d;\n -webkit-tap-highlight-color: transparent;\n transform-origin: center;\n width: 100%;\n height: 100%;\n"], ["\n transform-style: preserve-3d;\n -webkit-tap-highlight-color: transparent;\n transform-origin: center;\n width: 100%;\n height: 100%;\n"])));
|
|
46
46
|
exports.MaterialComponent.displayName = 'MaterialComponent';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MaterialComponent.js","sourceRoot":"","sources":["../../../src/components/material/MaterialComponent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAsC;AACtC,wCAAoC;AACpC,+BAAiE;AACjE,iCAAmC;AACnC,qCAAoD;
|
|
1
|
+
{"version":3,"file":"MaterialComponent.js","sourceRoot":"","sources":["../../../src/components/material/MaterialComponent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAsC;AACtC,wCAAoC;AACpC,+BAAiE;AACjE,iCAAmC;AACnC,qCAAoD;AAWvC,QAAA,iBAAiB,GAAG,IAAA,YAAI,EAAC,IAAA,kBAAU,EAAyC,UACvF,EAAmE,EAAE,GAAG;IAAtE,IAAA,IAAI,UAAA,EAAE,MAAM,YAAA,EAAE,SAAS,eAAA,EAAE,SAAS,eAAA,EAAE,QAAQ,cAAA,EAAE,OAAO,aAAA,EAAK,KAAK,cAAjE,mEAAmE,CAAF;IAEjE,IAAM,WAAW,GAAG,IAAA,8BAAsB,EAAC,IAAI,CAAC,CAAA;IAEhD,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAA;IAEvB,IAAA,KAAoB,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,EAA7C,KAAK,WAAA,EAAE,MAAM,YAAgC,CAAA;IAErD,IAAM,YAAY,GAAG,IAAA,eAAO,EAAC,cAAM,OAAA,CAAC,WAAW,EAAE,IAAA,aAAO,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC,EAArC,CAAqC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAA;IAE1F,OAAO,CACL,yCAAK,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,YAAY,IAAM,KAAK,cACzC,yCAAK,GAAG,EAAE,YAAY,gBACnB,WAAW,CAAC,OAAO,YAAG,IAAI,MAAA,EAAE,MAAM,QAAA,EAAE,SAAS,WAAA,EAAE,QAAQ,UAAA,EAAE,OAAO,SAAA,EAAE,SAAS,WAAA,IAAK,KAAK,EAAG,IACrF,IACF,CACP,CAAA;AACH,CAAC,CAAC,CAAC,CAAA;AAEH,IAAM,YAAY,OAAG,WAAG,oNAAA,gJAMvB,IAAA,CAAA;AAED,yBAAiB,CAAC,WAAW,GAAG,mBAAmB,CAAA;AAEnD,IAAM,WAAW,OAAG,WAAG,sJAAA,kFAGtB,IAAA,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** @jsxImportSource @emotion/react */
|
|
2
|
-
import { Interpolation, Theme } from '@emotion/react';
|
|
2
|
+
import { Interpolation, Keyframes, Theme } from '@emotion/react';
|
|
3
3
|
import { Location, MaterialHelpDisplay, MaterialItem, MaterialMove } from '@gamepark/rules-api';
|
|
4
4
|
import { TFunction } from 'i18next';
|
|
5
|
-
import { ComponentType, FC, HTMLAttributes } from 'react';
|
|
5
|
+
import { ComponentType, FC, HTMLAttributes, ReactNode } from 'react';
|
|
6
6
|
import { ItemContext, MaterialContext } from '../../locators';
|
|
7
7
|
import { ComponentDescription } from './ComponentDescription';
|
|
8
8
|
export type MaterialHelpProps<P extends number = number, M extends number = number, L extends number = number> = {
|
|
@@ -14,6 +14,7 @@ export type MaterialContentProps<ItemId = any, M extends number = number> = {
|
|
|
14
14
|
type?: M;
|
|
15
15
|
highlight?: boolean;
|
|
16
16
|
playDown?: boolean;
|
|
17
|
+
preview?: boolean;
|
|
17
18
|
} & HTMLAttributes<HTMLElement>;
|
|
18
19
|
/**
|
|
19
20
|
* Base class to describe the material in a game
|
|
@@ -155,7 +156,17 @@ export declare abstract class MaterialDescription<P extends number = number, M e
|
|
|
155
156
|
* @returns {string[]} a list of CSS transformations
|
|
156
157
|
*/
|
|
157
158
|
getHoverTransform(_item: MaterialItem<P, L>, _context: ItemContext<P, M, L>): string[];
|
|
158
|
-
|
|
159
|
+
/**
|
|
160
|
+
* Provide the locations that are required to drop an item given the legal moves that currently allow to drag the item.
|
|
161
|
+
* @param context Context of the item. Use {@link getItemFromContext} to get the item from it.
|
|
162
|
+
* @param dragMoves Legal moves filtered to only keep those that allows the item to be dragged
|
|
163
|
+
* @return All the locations where the item can be dropped
|
|
164
|
+
*/
|
|
165
|
+
getDropLocations(context: ItemContext<P, M, L>, dragMoves: MaterialMove<P, M, L>[]): Location<P, L>[];
|
|
166
|
+
getMoveDropLocations(context: ItemContext<P, M, L>, move: MaterialMove<P, M, L>): Location<P, L>[];
|
|
159
167
|
getTooltip(item: MaterialItem<P, L>, t: TFunction, _context: ItemContext<P, M, L>): string | null | undefined;
|
|
168
|
+
getItemMenu(_item: MaterialItem<P, L>, _context: ItemContext<P, M, L>, _legalMoves: MaterialMove<P, M, L>[]): ReactNode;
|
|
169
|
+
getHelpButton(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
170
|
+
getAnimationCss(keyframes: Keyframes, duration: number): Interpolation<Theme>;
|
|
160
171
|
}
|
|
161
172
|
export type MaterialDescriptionRecord<P extends number = number, M extends number = number, L extends number = number> = Record<M, MaterialDescription<P, M, L>>;
|
|
@@ -14,10 +14,38 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
15
|
};
|
|
16
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
33
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
34
|
+
};
|
|
17
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
36
|
exports.MaterialDescription = void 0;
|
|
37
|
+
var jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
38
|
+
/** @jsxImportSource @emotion/react */
|
|
39
|
+
var react_1 = require("@emotion/react");
|
|
40
|
+
var faQuestion_1 = require("@fortawesome/free-solid-svg-icons/faQuestion");
|
|
41
|
+
var react_fontawesome_1 = require("@fortawesome/react-fontawesome");
|
|
19
42
|
var rules_api_1 = require("@gamepark/rules-api");
|
|
43
|
+
var groupBy_1 = __importDefault(require("lodash/groupBy"));
|
|
44
|
+
var partition_1 = __importDefault(require("lodash/partition"));
|
|
45
|
+
var react_i18next_1 = require("react-i18next");
|
|
46
|
+
var locators_1 = require("../../locators");
|
|
20
47
|
var ComponentDescription_1 = require("./ComponentDescription");
|
|
48
|
+
var ItemMenuButton_1 = require("./ItemMenuButton");
|
|
21
49
|
var displayMaterialHelp = rules_api_1.MaterialMoveBuilder.displayMaterialHelp;
|
|
22
50
|
/**
|
|
23
51
|
* Base class to describe the material in a game
|
|
@@ -177,13 +205,35 @@ var MaterialDescription = /** @class */ (function (_super) {
|
|
|
177
205
|
MaterialDescription.prototype.getHoverTransform = function (_item, _context) {
|
|
178
206
|
return [];
|
|
179
207
|
};
|
|
180
|
-
|
|
181
|
-
|
|
208
|
+
/**
|
|
209
|
+
* Provide the locations that are required to drop an item given the legal moves that currently allow to drag the item.
|
|
210
|
+
* @param context Context of the item. Use {@link getItemFromContext} to get the item from it.
|
|
211
|
+
* @param dragMoves Legal moves filtered to only keep those that allows the item to be dragged
|
|
212
|
+
* @return All the locations where the item can be dropped
|
|
213
|
+
*/
|
|
214
|
+
MaterialDescription.prototype.getDropLocations = function (context, dragMoves) {
|
|
215
|
+
var _this = this;
|
|
216
|
+
var locations = [];
|
|
217
|
+
var _a = (0, partition_1.default)(dragMoves, rules_api_1.isMoveItem), itemMoves = _a[0], otherMoves = _a[1];
|
|
218
|
+
var itemMovesByType = (0, groupBy_1.default)(itemMoves, 'location.type');
|
|
219
|
+
for (var type in itemMovesByType) {
|
|
220
|
+
var locator = context.locators[parseInt(type)];
|
|
221
|
+
if (locator) {
|
|
222
|
+
locations.push.apply(locations, locator.getDropLocations(itemMovesByType[type], context));
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
locations.push.apply(locations, itemMovesByType[type].flatMap(function (move) { return _this.getMoveDropLocations(context, move); }));
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
locations.push.apply(locations, otherMoves.flatMap(function (move) { return _this.getMoveDropLocations(context, move); }));
|
|
229
|
+
return locations;
|
|
230
|
+
};
|
|
231
|
+
MaterialDescription.prototype.getMoveDropLocations = function (context, move) {
|
|
182
232
|
if ((0, rules_api_1.isMoveItem)(move) && move.location.type !== undefined) {
|
|
183
233
|
return [move.location];
|
|
184
234
|
}
|
|
185
235
|
else if ((0, rules_api_1.isDeleteItem)(move)) {
|
|
186
|
-
var stockLocation = (
|
|
236
|
+
var stockLocation = this.getStockLocation((0, locators_1.getItemFromContext)(context), context);
|
|
187
237
|
return stockLocation ? [stockLocation] : [];
|
|
188
238
|
}
|
|
189
239
|
return [];
|
|
@@ -193,7 +243,18 @@ var MaterialDescription = /** @class */ (function (_super) {
|
|
|
193
243
|
return t('quantity.tooltip', { n: item.quantity });
|
|
194
244
|
return;
|
|
195
245
|
};
|
|
246
|
+
MaterialDescription.prototype.getItemMenu = function (_item, _context, _legalMoves) {
|
|
247
|
+
return;
|
|
248
|
+
};
|
|
249
|
+
MaterialDescription.prototype.getHelpButton = function (item, context) {
|
|
250
|
+
return (0, jsx_runtime_1.jsx)(ItemMenuButton_1.ItemMenuButton, __assign({ label: (0, jsx_runtime_1.jsx)(react_i18next_1.Trans, { defaults: "Help" }), move: this.displayHelp(item, context), options: { local: true }, angle: 30 }, { children: (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: faQuestion_1.faQuestion }) }));
|
|
251
|
+
};
|
|
252
|
+
MaterialDescription.prototype.getAnimationCss = function (keyframes, duration) {
|
|
253
|
+
return (0, react_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n animation: ", " ", "s linear infinite;\n\n > * {\n animation: ", " ", "s ease-in-out forwards;\n }\n "], ["\n animation: ", " ", "s linear infinite;\n\n > * {\n animation: ", " ", "s ease-in-out forwards;\n }\n "])), upAndDown, duration, keyframes, duration);
|
|
254
|
+
};
|
|
196
255
|
return MaterialDescription;
|
|
197
256
|
}(ComponentDescription_1.ComponentDescription));
|
|
198
257
|
exports.MaterialDescription = MaterialDescription;
|
|
258
|
+
var upAndDown = (0, react_1.keyframes)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n from, to {\n transform: none;\n }\n 50% {\n transform: translateZ(10em);\n }\n"], ["\n from, to {\n transform: none;\n }\n 50% {\n transform: translateZ(10em);\n }\n"])));
|
|
259
|
+
var templateObject_1, templateObject_2;
|
|
199
260
|
//# sourceMappingURL=MaterialDescription.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MaterialDescription.js","sourceRoot":"","sources":["../../../src/components/material/MaterialDescription.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MaterialDescription.js","sourceRoot":"","sources":["../../../src/components/material/MaterialDescription.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,EAAQ,wCAErC,KALc,SAAS,EAAI,QAAQ,EAGnB,SAAS,EAAI,QAAQ,EAErC;IACH,CAAC;IACH,0BAAC;AAAD,CAAC,AA5PD,CACU,2CAAoB,GA2P7B;AA5PqB,kDAAmB;AA8PzC,IAAM,SAAS,OAAG,iBAAS,iKAAA,6FAO1B,IAAA,CAAA"}
|
|
@@ -5,6 +5,6 @@ import { MaterialDescription } from './MaterialDescription';
|
|
|
5
5
|
export declare abstract class MobileMaterialDescription<P extends number = number, M extends number = number, L extends number = number, ItemId = any> extends MaterialDescription<P, M, L, ItemId> {
|
|
6
6
|
isMobile: boolean;
|
|
7
7
|
canDrag(move: MaterialMove<P, M, L>, context: ItemContext<P, M, L>): boolean;
|
|
8
|
-
protected canDragToMove(move: MoveItem<P, M, L>,
|
|
8
|
+
protected canDragToMove(move: MoveItem<P, M, L>, context: ItemContext<P, M, L>): boolean;
|
|
9
9
|
protected canDragToDelete(_move: DeleteItem<M>, _context: ItemContext<P, M, L>): boolean;
|
|
10
10
|
}
|
|
@@ -33,6 +33,7 @@ exports.MobileMaterialDescription = void 0;
|
|
|
33
33
|
/** @jsxImportSource @emotion/react */
|
|
34
34
|
var rules_api_1 = require("@gamepark/rules-api");
|
|
35
35
|
var isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
36
|
+
var locators_1 = require("../../locators");
|
|
36
37
|
var MaterialDescription_1 = require("./MaterialDescription");
|
|
37
38
|
var MobileMaterialDescription = /** @class */ (function (_super) {
|
|
38
39
|
__extends(MobileMaterialDescription, _super);
|
|
@@ -53,11 +54,9 @@ var MobileMaterialDescription = /** @class */ (function (_super) {
|
|
|
53
54
|
return false;
|
|
54
55
|
}
|
|
55
56
|
};
|
|
56
|
-
MobileMaterialDescription.prototype.canDragToMove = function (move,
|
|
57
|
-
var
|
|
58
|
-
var
|
|
59
|
-
var _c = (_b = rules.material(type).getItem(index)) === null || _b === void 0 ? void 0 : _b.location, rotation = _c.rotation, actualLocation = __rest(_c, ["rotation"]);
|
|
60
|
-
var _d = move.location, nextRotation = _d.rotation, nextLocation = __rest(_d, ["rotation"]);
|
|
57
|
+
MobileMaterialDescription.prototype.canDragToMove = function (move, context) {
|
|
58
|
+
var _a = (0, locators_1.getItemFromContext)(context).location, rotation = _a.rotation, actualLocation = __rest(_a, ["rotation"]);
|
|
59
|
+
var _b = move.location, nextRotation = _b.rotation, nextLocation = __rest(_b, ["rotation"]);
|
|
61
60
|
return !(0, isEqual_1.default)(actualLocation, nextLocation);
|
|
62
61
|
};
|
|
63
62
|
MobileMaterialDescription.prototype.canDragToDelete = function (_move, _context) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileMaterialDescription.js","sourceRoot":"","sources":["../../../src/components/material/MobileMaterialDescription.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAsC;AACtC,iDAAkG;AAClG,2DAAoC;
|
|
1
|
+
{"version":3,"file":"MobileMaterialDescription.js","sourceRoot":"","sources":["../../../src/components/material/MobileMaterialDescription.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAsC;AACtC,iDAAkG;AAClG,2DAAoC;AACpC,2CAAgE;AAChE,6DAA2D;AAE3D;IACU,6CAAoC;IAD9C;QAAA,qEAuBC;QArBC,cAAQ,GAAG,IAAI,CAAA;;IAqBjB,CAAC;IAnBC,2CAAO,GAAP,UAAQ,IAA2B,EAAE,OAA6B;;QAChE,IAAI,IAAA,sBAAU,EAAC,IAAI,CAAC,EAAE;YACpB,OAAO,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,IAAI,MAAK,SAAS,IAAI,IAAI,CAAC,QAAQ,KAAK,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,SAAS,KAAK,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;SACpJ;aAAM,IAAI,IAAA,wBAAY,EAAC,IAAI,CAAC,EAAE;YAC7B,OAAO,IAAI,CAAC,QAAQ,KAAK,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,SAAS,KAAK,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;SACjH;aAAM;YACL,OAAO,KAAK,CAAA;SACb;IACH,CAAC;IAES,iDAAa,GAAvB,UAAwB,IAAuB,EAAE,OAA6B;QAC5E,IAAM,KAAkC,IAAA,6BAAkB,EAAC,OAAO,CAAC,CAAC,QAAQ,EAApE,QAAQ,cAAA,EAAK,cAAc,cAA7B,YAA+B,CAAuC,CAAA;QAC5E,IAAM,KAA8C,IAAI,CAAC,QAAQ,EAA/C,YAAY,cAAA,EAAK,YAAY,cAAzC,YAA2C,CAAgB,CAAA;QACjE,OAAO,CAAC,IAAA,iBAAO,EAAC,cAAc,EAAE,YAAY,CAAC,CAAA;IAC/C,CAAC;IAES,mDAAe,GAAzB,UAA0B,KAAoB,EAAE,QAA8B;QAC5E,OAAO,IAAI,CAAC,aAAa,KAAK,SAAS,CAAA;IACzC,CAAC;IACH,gCAAC;AAAD,CAAC,AAvBD,CACU,yCAAmB,GAsB5B;AAvBqB,8DAAyB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @jsxImportSource @emotion/react */
|
|
2
|
-
import { Interpolation, Theme } from '@emotion/react';
|
|
2
|
+
import { Interpolation, Keyframes, Theme } from '@emotion/react';
|
|
3
3
|
import { MaterialContentProps } from '../MaterialDescription';
|
|
4
4
|
import { MobileMaterialDescription } from '../MobileMaterialDescription';
|
|
5
5
|
export declare class WheelDescription<P extends number = number, M extends number = number, L extends number = number, ItemId = any> extends MobileMaterialDescription<P, M, L, ItemId> {
|
|
@@ -16,4 +16,5 @@ export declare class WheelDescription<P extends number = number, M extends numbe
|
|
|
16
16
|
getWheelExtraCss(_itemId: ItemId): Interpolation<Theme>;
|
|
17
17
|
getImages(): string[];
|
|
18
18
|
content: (props: MaterialContentProps<ItemId>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
19
|
+
getAnimationCss(keyframes: Keyframes, duration: number): Interpolation<Theme>;
|
|
19
20
|
}
|
|
@@ -14,6 +14,10 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
15
|
};
|
|
16
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
|
+
};
|
|
17
21
|
var __assign = (this && this.__assign) || function () {
|
|
18
22
|
__assign = Object.assign || function(t) {
|
|
19
23
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -28,6 +32,8 @@ var __assign = (this && this.__assign) || function () {
|
|
|
28
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
33
|
exports.WheelDescription = void 0;
|
|
30
34
|
var jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
35
|
+
/** @jsxImportSource @emotion/react */
|
|
36
|
+
var react_1 = require("@emotion/react");
|
|
31
37
|
var MobileMaterialDescription_1 = require("../MobileMaterialDescription");
|
|
32
38
|
var WheelItem_1 = require("./WheelItem");
|
|
33
39
|
var WheelDescription = /** @class */ (function (_super) {
|
|
@@ -85,7 +91,11 @@ var WheelDescription = /** @class */ (function (_super) {
|
|
|
85
91
|
images.push.apply(images, Object.values(this.wheelImages));
|
|
86
92
|
return images;
|
|
87
93
|
};
|
|
94
|
+
WheelDescription.prototype.getAnimationCss = function (keyframes, duration) {
|
|
95
|
+
return (0, react_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n > * {\n animation: ", " ", "s ease-in-out forwards;\n }\n "], ["\n > * {\n animation: ", " ", "s ease-in-out forwards;\n }\n "])), keyframes, duration);
|
|
96
|
+
};
|
|
88
97
|
return WheelDescription;
|
|
89
98
|
}(MobileMaterialDescription_1.MobileMaterialDescription));
|
|
90
99
|
exports.WheelDescription = WheelDescription;
|
|
100
|
+
var templateObject_1;
|
|
91
101
|
//# sourceMappingURL=WheelDescription.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WheelDescription.js","sourceRoot":"","sources":["../../../../src/components/material/Wheel/WheelDescription.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WheelDescription.js","sourceRoot":"","sources":["../../../../src/components/material/Wheel/WheelDescription.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAsC;AACtC,wCAAqE;AAErE,0EAAwE;AACxE,yCAAuC;AAEvC;IACU,oCAA0C;IADpD;QAAA,qEAgFC;QA/DC,WAAK,GAAW,EAAE,CAAA;QAiClB,aAAO,GAAG,UAAC,KAAmC;YACpC,IAAA,MAAM,GAAK,KAAK,OAAV,CAAU;YACxB,IAAM,KAAK,GAAG,KAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;YACnC,IAAM,UAAU,GAAG,KAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;YAC7C,IAAM,IAAI,GAAG,KAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YACjC,IAAM,YAAY,GAAG,KAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAA;YACjD,IAAM,MAAM,GAAG,KAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;YACrC,IAAM,QAAQ,GAAG,KAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;YACzC,IAAM,aAAa,GAAG,KAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAA;YACnD,OAAO,CACL,uBAAC,qBAAS,aACR,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,YAAY,EAC1B,MAAM,E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IAAI,IAAI,CAAC,WAAW;YAAE,MAAM,CAAC,IAAI,OAAX,MAAM,EAAS,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAa,EAAC;QACjF,OAAO,MAAM,CAAA;IACf,CAAC;IAyBD,0CAAe,GAAf,UAAgB,SAAoB,EAAE,QAAgB;QACpD,WAAO,WAAG,uJAAA,oCAEO,EAAS,GAAI,EAAQ,wCAErC,KAFgB,SAAS,EAAI,QAAQ,EAErC;IACH,CAAC;IACH,uBAAC;AAAD,CAAC,AAhFD,CACU,qDAAyB,GA+ElC;AAhFY,4CAAgB"}
|
|
@@ -5,7 +5,7 @@ export declare abstract class WritingDescription<P extends number = number, M ex
|
|
|
5
5
|
images?: Record<ItemId extends keyof any ? ItemId : never, string>;
|
|
6
6
|
getImage(itemId: ItemId): string | undefined;
|
|
7
7
|
getImages(): string[];
|
|
8
|
-
protected getFrontId(itemId: ItemId):
|
|
8
|
+
protected getFrontId(itemId: ItemId): keyof typeof this.images;
|
|
9
9
|
getFrontContent(_itemId: ItemId): ReactNode | undefined;
|
|
10
10
|
content: ({ itemId, highlight, playDown }: MaterialContentProps<ItemId>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
11
11
|
}
|
|
@@ -68,7 +68,7 @@ var WritingDescription = /** @class */ (function (_super) {
|
|
|
68
68
|
return images;
|
|
69
69
|
};
|
|
70
70
|
WritingDescription.prototype.getFrontId = function (itemId) {
|
|
71
|
-
return typeof itemId === 'object' ? itemId.front : itemId;
|
|
71
|
+
return (typeof itemId === 'object' ? itemId.front : itemId);
|
|
72
72
|
};
|
|
73
73
|
WritingDescription.prototype.getFrontContent = function (_itemId) {
|
|
74
74
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WritingDescription.js","sourceRoot":"","sources":["../../../../src/components/material/Writing/WritingDescription.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAsC;AACtC,wCAAoC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AC,MAAM,CAAa,EAAC;QACvE,OAAO,MAAM,CAAA;IACf,CAAC;IAES,uCAAU,GAApB,UAAqB,MAAc;QACjC,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAE,MAAc,CAAC,KAAK,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"WritingDescription.js","sourceRoot":"","sources":["../../../../src/components/material/Writing/WritingDescription.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAsC;AACtC,wCAAoC;AAEpC,oCAA4G;AAC5G,8DAAkF;AAElF;IACU,sCAAoC;IAD9C;QAAA,qEAuCC;QAdC,aAAO,GAAG,UAAC,EAA6D;gBAA3D,MAAM,YAAA,EAAE,SAAS,eAAA,EAAE,QAAQ,cAAA;YACtC,IAAM,KAAK,GAAG,KAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;YACnC,IAAM,IAAI,GAAG,KAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YACjC,IAAM,YAAY,GAAG,KAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAA;YACjD,OAAO,yCAAK,GAAG,EAAE;oBACf,OAAO;oBACP,IAAA,aAAO,EAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC;oBAChC,KAAK,IAAI,CAAC,IAAA,mBAAa,EAAC,KAAK,CAAC,EAAE,IAAA,eAAS,EAAC,KAAK,CAAC,CAAC;oBACjD,YAAY,IAAI,IAAA,qBAAe,EAAC,YAAY,CAAC;oBAC7C,SAAS,CAAC,CAAC,CAAC,iBAAW,CAAC,CAAC,CAAC,QAAQ,IAAI,WAAW,CAAC,KAAK,CAAC;iBACzD,gBACE,KAAI,CAAC,eAAe,CAAC,MAAM,CAAC,IACzB,CAAA;QACR,CAAC,CAAA;;IACH,CAAC;IAjCC,qCAAQ,GAAR,UAAS,MAAc;;QACrB,OAAO,MAAA,MAAA,IAAI,CAAC,MAAM,0CAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,mCAAI,IAAI,CAAC,KAAK,CAAA;IAC7D,CAAC;IAED,sCAAS,GAAT;QACE,IAAM,MAAM,GAAa,EAAE,CAAA;QAC3B,IAAI,IAAI,CAAC,KAAK;YAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACvC,IAAI,IAAI,CAAC,MAAM;YAAE,MAAM,CAAC,IAAI,OAAX,MAAM,EAAS,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAa,EAAC;QACvE,OAAO,MAAM,CAAA;IACf,CAAC;IAES,uCAAU,GAApB,UAAqB,MAAc;QACjC,OAAO,CAAC,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAE,MAAc,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAA6B,CAAA;IAClG,CAAC;IAED,4CAAe,GAAf,UAAgB,OAAe;QAC7B,OAAM;IACR,CAAC;IAgBH,yBAAC;AAAD,CAAC,AAvCD,CACU,yCAAmB,GAsC5B;AAvCqB,gDAAkB;AAyCjC,IAAM,oBAAoB,GAAG,UAAgG,WAAiD;IACnL,OAAO,OAAQ,WAAmD,CAAC,eAAe,KAAK,UAAU,CAAA;AACnG,CAAC,CAAA;AAFY,QAAA,oBAAoB,wBAEhC;AAED,IAAM,OAAO,OAAG,WAAG,sOAAA,kKAOlB,IAAA,CAAA;AAED,IAAM,WAAW,GAAG,UAAC,KAAc;IACjC,IAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,CAAC,MAAM,CAAC,EAAE;QAC3B,OAAO,kBAAY,CAAA;KACpB;SAAM;QACL,WAAO,WAAG,4GAAA,wCAET,KAAA;KACF;AACH,CAAC,CAAA"}
|
|
@@ -10,6 +10,6 @@ export declare class CreateItemAnimations<P extends number = number, M extends n
|
|
|
10
10
|
getPreDuration(move: CreateItem<P, M, L>, context: MaterialGameAnimationContext<P, M, L>): number;
|
|
11
11
|
getPostDuration(move: CreateItem<P, M, L>, _context: MaterialGameAnimationContext<P, M, L>): number;
|
|
12
12
|
getItemAnimation(context: ItemContext<P, M, L>, animation: Animation<CreateItem<P, M, L>>): Interpolation<Theme>;
|
|
13
|
-
isItemToAnimate(
|
|
13
|
+
isItemToAnimate(context: ItemContext<P, M, L>, animation: Animation<CreateItem<P, M, L>>): boolean;
|
|
14
14
|
protected getKeyframesFromOrigin(origin: string, _animation: Animation<ItemMove<P, M, L>>, _context: ItemContext<P, M, L>): import("@emotion/serialize").Keyframes;
|
|
15
15
|
}
|
|
@@ -22,9 +22,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
22
22
|
exports.CreateItemAnimations = void 0;
|
|
23
23
|
var react_1 = require("@emotion/react");
|
|
24
24
|
var css_1 = require("../../../css");
|
|
25
|
+
var locators_1 = require("../../../locators");
|
|
25
26
|
var getFirstStockItemTransforms_util_1 = require("./getFirstStockItemTransforms.util");
|
|
26
27
|
var ItemAnimations_1 = require("./ItemAnimations");
|
|
27
|
-
var itemMovementCss_util_1 = require("./itemMovementCss.util");
|
|
28
28
|
var rotations_utils_1 = require("./rotations.utils");
|
|
29
29
|
var transformItem_util_1 = require("./transformItem.util");
|
|
30
30
|
var lastCreatedItemsIndexes = {};
|
|
@@ -55,20 +55,20 @@ var CreateItemAnimations = /** @class */ (function (_super) {
|
|
|
55
55
|
var targetTransforms = (0, rotations_utils_1.toSingleRotation)((0, transformItem_util_1.transformItem)(context));
|
|
56
56
|
(0, rotations_utils_1.toClosestRotations)(originTransforms, targetTransforms);
|
|
57
57
|
var animationKeyframes = this.getTransformKeyframes(originTransforms.join(' '), targetTransforms.join(' '), animation, context);
|
|
58
|
-
|
|
58
|
+
var description = context.material[context.type];
|
|
59
|
+
return description === null || description === void 0 ? void 0 : description.getAnimationCss(animationKeyframes, animation.duration);
|
|
59
60
|
}
|
|
60
61
|
else {
|
|
61
62
|
return (0, css_1.fadeIn)(animation.duration);
|
|
62
63
|
}
|
|
63
64
|
};
|
|
64
|
-
CreateItemAnimations.prototype.isItemToAnimate = function (
|
|
65
|
-
var
|
|
66
|
-
var
|
|
67
|
-
var item = rules.material(type).getItem(index);
|
|
65
|
+
CreateItemAnimations.prototype.isItemToAnimate = function (context, animation) {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
var type = context.type, index = context.index, displayIndex = context.displayIndex;
|
|
68
68
|
if (animation.move.itemType !== type || lastCreatedItemsIndexes[JSON.stringify(animation.move)] !== index)
|
|
69
69
|
return false;
|
|
70
|
-
var quantity = (
|
|
71
|
-
var createdQuantity = (
|
|
70
|
+
var quantity = (_a = (0, locators_1.getItemFromContext)(context).quantity) !== null && _a !== void 0 ? _a : 1;
|
|
71
|
+
var createdQuantity = (_b = animation.move.item.quantity) !== null && _b !== void 0 ? _b : 1;
|
|
72
72
|
return displayIndex >= quantity - createdQuantity;
|
|
73
73
|
};
|
|
74
74
|
CreateItemAnimations.prototype.getKeyframesFromOrigin = function (origin, _animation, _context) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateItemAnimations.js","sourceRoot":"","sources":["../../../../src/components/material/animations/CreateItemAnimations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,wCAAgE;AAGhE,oCAAqC;
|
|
1
|
+
{"version":3,"file":"CreateItemAnimations.js","sourceRoot":"","sources":["../../../../src/components/material/animations/CreateItemAnimations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,wCAAgE;AAGhE,oCAAqC;AACrC,8CAAmE;AACnE,uFAAgF;AAChF,mDAAiD;AAEjD,qDAAwE;AACxE,2DAAoD;AAEpD,IAAM,uBAAuB,GAA2B,EAAE,CAAA;AAE1D;IACU,wCAAuB;IAE/B,8BAAsB,QAAY;QAAZ,yBAAA,EAAA,YAAY;QAAlC,YACE,iBAAO,SACR;QAFqB,cAAQ,GAAR,QAAQ,CAAI;;IAElC,CAAC;IAEQ,6CAAc,GAAvB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E,SAAS,EAAE,OAAO,CAAC,CAAA;YACjI,IAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;YAClD,OAAO,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,eAAe,CAAC,kBAAkB,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAA;SAC5E;aAAM;YACL,OAAO,IAAA,YAAM,EAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;SAClC;IACH,CAAC;IAED,8CAAe,GAAf,UAAgB,OAA6B,EAAE,SAAyC;;QAC9E,IAAA,IAAI,GAA0B,OAAO,KAAjC,EAAE,KAAK,GAAmB,OAAO,MAA1B,EAAE,YAAY,GAAK,OAAO,aAAZ,CAAY;QAC7C,IAAI,SAAS,CAAC,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,uBAAuB,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK;YAAE,OAAO,KAAK,CAAA;QACvH,IAAM,QAAQ,GAAG,MAAA,IAAA,6BAAkB,EAAC,OAAO,CAAC,CAAC,QAAQ,mCAAI,CAAC,CAAA;QAC1D,IAAM,eAAe,GAAG,MAAA,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,mCAAI,CAAC,CAAA;QACzD,OAAO,YAAY,IAAI,QAAQ,GAAG,eAAe,CAAA;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,AAjDD,CACU,+BAAc,GAgDvB;AAjDY,oDAAoB"}
|
|
@@ -21,10 +21,10 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
22
|
exports.DeleteItemAnimations = void 0;
|
|
23
23
|
var react_1 = require("@emotion/react");
|
|
24
|
+
var locators_1 = require("../../../locators");
|
|
24
25
|
var isDroppedItem_1 = require("../utils/isDroppedItem");
|
|
25
26
|
var getFirstStockItemTransforms_util_1 = require("./getFirstStockItemTransforms.util");
|
|
26
27
|
var ItemAnimations_1 = require("./ItemAnimations");
|
|
27
|
-
var itemMovementCss_util_1 = require("./itemMovementCss.util");
|
|
28
28
|
var rotations_utils_1 = require("./rotations.utils");
|
|
29
29
|
var transformItem_util_1 = require("./transformItem.util");
|
|
30
30
|
var DeleteItemAnimations = /** @class */ (function (_super) {
|
|
@@ -46,9 +46,8 @@ var DeleteItemAnimations = /** @class */ (function (_super) {
|
|
|
46
46
|
return this.duration;
|
|
47
47
|
};
|
|
48
48
|
DeleteItemAnimations.prototype.getItemAnimation = function (context, animation) {
|
|
49
|
-
var
|
|
50
|
-
var
|
|
51
|
-
var itemLocator = locators[item.location.type];
|
|
49
|
+
var item = (0, locators_1.getItemFromContext)(context);
|
|
50
|
+
var itemLocator = context.locators[item.location.type];
|
|
52
51
|
if (!(itemLocator === null || itemLocator === void 0 ? void 0 : itemLocator.isItemToAnimate(item, context, animation.move)))
|
|
53
52
|
return;
|
|
54
53
|
var stockTransforms = (0, getFirstStockItemTransforms_util_1.getFirstStockItemTransforms)(context);
|
|
@@ -57,7 +56,8 @@ var DeleteItemAnimations = /** @class */ (function (_super) {
|
|
|
57
56
|
var targetTransforms = (0, rotations_utils_1.toSingleRotation)(stockTransforms);
|
|
58
57
|
(0, rotations_utils_1.toClosestRotations)(originTransforms, targetTransforms);
|
|
59
58
|
var animationKeyframes = this.getTransformKeyframes(originTransforms.join(' '), targetTransforms.join(' '), animation, context);
|
|
60
|
-
|
|
59
|
+
var description = context.material[context.type];
|
|
60
|
+
return description === null || description === void 0 ? void 0 : description.getAnimationCss(animationKeyframes, animation.duration);
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
63
63
|
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 "])));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeleteItemAnimations.js","sourceRoot":"","sources":["../../../../src/components/material/animations/DeleteItemAnimations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,wCAAqE;
|
|
1
|
+
{"version":3,"file":"DeleteItemAnimations.js","sourceRoot":"","sources":["../../../../src/components/material/animations/DeleteItemAnimations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,wCAAqE;AAGrE,8CAAmE;AACnE,wDAAsD;AACtD,uFAAgF;AAChF,mDAAiD;AAEjD,qDAAwE;AACxE,2DAAoD;AAEpD;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,OAA8C;;QAC7F,IAAM,oBAAoB,GAAG,EAAE,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,EAAE,CAAA;QACtI,IAAI,IAAA,6BAAa,EAAC,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC,EAAE;YACrE,OAAO,IAAI,CAAC,mBAAmB,CAAA;SAChC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;IAED,+CAAgB,GAAhB,UAAiB,OAA6B,EAAE,SAAmC;QACjF,IAAM,IAAI,GAAG,IAAA,6BAAkB,EAAC,OAAO,CAAC,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AC;IACH,2BAAC;AAAD,CAAC,AA5CD,CACU,+BAAc,GA2CvB;AA5CY,oDAAoB"}
|
|
@@ -28,10 +28,10 @@ var __assign = (this && this.__assign) || function () {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.MoveItemAnimations = void 0;
|
|
30
30
|
var lodash_1 = require("lodash");
|
|
31
|
+
var locators_1 = require("../../../locators");
|
|
31
32
|
var isDroppedItem_1 = require("../utils/isDroppedItem");
|
|
32
33
|
var isPlacedOnItem_1 = require("../utils/isPlacedOnItem");
|
|
33
34
|
var ItemAnimations_1 = require("./ItemAnimations");
|
|
34
|
-
var itemMovementCss_util_1 = require("./itemMovementCss.util");
|
|
35
35
|
var rotations_utils_1 = require("./rotations.utils");
|
|
36
36
|
var transformItem_util_1 = require("./transformItem.util");
|
|
37
37
|
var MoveItemAnimations = /** @class */ (function (_super) {
|
|
@@ -56,9 +56,8 @@ var MoveItemAnimations = /** @class */ (function (_super) {
|
|
|
56
56
|
return this.duration;
|
|
57
57
|
};
|
|
58
58
|
MoveItemAnimations.prototype.getItemAnimation = function (context, animation) {
|
|
59
|
-
var
|
|
60
|
-
var
|
|
61
|
-
var itemLocator = locators[item.location.type];
|
|
59
|
+
var item = (0, locators_1.getItemFromContext)(context);
|
|
60
|
+
var itemLocator = context.locators[item.location.type];
|
|
62
61
|
if (itemLocator === null || itemLocator === void 0 ? void 0 : itemLocator.isItemToAnimate(item, context, animation.move)) {
|
|
63
62
|
return this.getMovedItemAnimation(context, animation);
|
|
64
63
|
}
|
|
@@ -68,8 +67,9 @@ var MoveItemAnimations = /** @class */ (function (_super) {
|
|
|
68
67
|
}
|
|
69
68
|
};
|
|
70
69
|
MoveItemAnimations.prototype.getMovedItemAnimation = function (context, animation) {
|
|
71
|
-
var _a, _b, _c
|
|
70
|
+
var _a, _b, _c;
|
|
72
71
|
var type = context.type, rules = context.rules, material = context.material, player = context.player;
|
|
72
|
+
var description = material[type];
|
|
73
73
|
var Rules = rules.constructor;
|
|
74
74
|
var futureIndex = this.getItemIndexAfterMove(context, animation.move);
|
|
75
75
|
var futureRules = new Rules(JSON.parse(JSON.stringify(rules.game)), { player: player });
|
|
@@ -79,10 +79,10 @@ var MoveItemAnimations = /** @class */ (function (_super) {
|
|
|
79
79
|
var futureDisplayIndex = ((_a = futureItem.quantity) !== null && _a !== void 0 ? _a : 1) - ((_b = animation.move.quantity) !== null && _b !== void 0 ? _b : 1);
|
|
80
80
|
var futureContext = __assign(__assign({}, context), { rules: futureRules, index: futureIndex, displayIndex: futureDisplayIndex });
|
|
81
81
|
var originTransforms = (0, rotations_utils_1.toSingleRotation)((0, transformItem_util_1.transformItem)(context));
|
|
82
|
-
var targetTransforms = (0, rotations_utils_1.toSingleRotation)((
|
|
82
|
+
var targetTransforms = (0, rotations_utils_1.toSingleRotation)((_c = description === null || description === void 0 ? void 0 : description.getItemTransform(futureItem, futureContext)) !== null && _c !== void 0 ? _c : []);
|
|
83
83
|
(0, rotations_utils_1.toClosestRotations)(originTransforms, targetTransforms);
|
|
84
84
|
var animationKeyframes = this.getTransformKeyframes(originTransforms.join(' '), targetTransforms.join(' '), animation, context);
|
|
85
|
-
return
|
|
85
|
+
return description === null || description === void 0 ? void 0 : description.getAnimationCss(animationKeyframes, animation.duration);
|
|
86
86
|
};
|
|
87
87
|
MoveItemAnimations.prototype.getItemIndexAfterMove = function (_a, move) {
|
|
88
88
|
var _b, _c;
|
|
@@ -103,17 +103,18 @@ var MoveItemAnimations = /** @class */ (function (_super) {
|
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
105
|
MoveItemAnimations.prototype.getChildItemAnimation = function (item, context, animation) {
|
|
106
|
-
var _a
|
|
106
|
+
var _a;
|
|
107
107
|
var type = context.type, rules = context.rules, material = context.material, player = context.player;
|
|
108
|
+
var description = material[type];
|
|
108
109
|
var Rules = rules.constructor;
|
|
109
110
|
var futureRules = new Rules(JSON.parse(JSON.stringify(rules.game)), { player: player });
|
|
110
111
|
futureRules.play(animation.move);
|
|
111
112
|
var futureContext = __assign(__assign({}, context), { rules: futureRules });
|
|
112
113
|
var originTransforms = (0, transformItem_util_1.transformItem)(context);
|
|
113
|
-
var targetTransforms = (
|
|
114
|
+
var targetTransforms = (_a = description === null || description === void 0 ? void 0 : description.getItemTransform(item, futureContext)) !== null && _a !== void 0 ? _a : [];
|
|
114
115
|
(0, rotations_utils_1.toClosestRotations)(originTransforms, targetTransforms);
|
|
115
116
|
var animationKeyframes = this.getTransformKeyframes(originTransforms.join(' '), targetTransforms.join(' '), animation, context);
|
|
116
|
-
return
|
|
117
|
+
return description === null || description === void 0 ? void 0 : description.getAnimationCss(animationKeyframes, animation.duration);
|
|
117
118
|
};
|
|
118
119
|
return MoveItemAnimations;
|
|
119
120
|
}(ItemAnimations_1.ItemAnimations));
|