@rpg-engine/long-bow 0.4.93 → 0.4.95
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/long-bow.cjs.development.js +15 -15
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +15 -15
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/mocks/shortcut.mocks.d.ts +17 -0
- package/package.json +2 -2
- package/src/components/CircularController/CircularController.tsx +31 -3
- package/src/components/DraggableContainer.tsx +1 -1
- package/src/components/Shortcuts/Shortcuts.tsx +4 -2
- package/src/components/Shortcuts/ShortcutsSetter.tsx +15 -8
- package/src/mocks/shortcut.mocks.ts +27 -0
- package/src/stories/CircullarController.stories.tsx +2 -2
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const shortcutMock: ({
|
|
2
|
+
type: number;
|
|
3
|
+
payload: {
|
|
4
|
+
key: string;
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
castingType: string;
|
|
8
|
+
magicWords: string;
|
|
9
|
+
manaCost: number;
|
|
10
|
+
minLevelRequired: number;
|
|
11
|
+
minMagicLevelRequired: number;
|
|
12
|
+
animationKey: string;
|
|
13
|
+
};
|
|
14
|
+
} | {
|
|
15
|
+
type: number;
|
|
16
|
+
payload: null;
|
|
17
|
+
})[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpg-engine/long-bow",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.95",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
85
|
"@rollup/plugin-image": "^2.1.1",
|
|
86
|
-
"@rpg-engine/shared": "^0.8.
|
|
86
|
+
"@rpg-engine/shared": "^0.8.49",
|
|
87
87
|
"dayjs": "^1.11.2",
|
|
88
88
|
"font-awesome": "^4.7.0",
|
|
89
89
|
"fs-extra": "^10.1.0",
|
|
@@ -167,7 +167,7 @@ export const CircularController: React.FC<CircularControllerProps> = ({
|
|
|
167
167
|
return (
|
|
168
168
|
<ButtonsContainer>
|
|
169
169
|
<ShortcutsContainer>
|
|
170
|
-
{Array.from({ length:
|
|
170
|
+
{Array.from({ length: 12 }).map((_, i) => renderShortcut(i))}
|
|
171
171
|
</ShortcutsContainer>
|
|
172
172
|
<Button
|
|
173
173
|
onTouchStart={onTouchStart}
|
|
@@ -201,6 +201,7 @@ const Button = styled.button`
|
|
|
201
201
|
position: relative;
|
|
202
202
|
transition: all 0.1s;
|
|
203
203
|
margin-top: -3rem;
|
|
204
|
+
top: -144px;
|
|
204
205
|
|
|
205
206
|
&.active {
|
|
206
207
|
background-color: ${uiColors.gray};
|
|
@@ -219,6 +220,8 @@ const CancelButton = styled(Button)`
|
|
|
219
220
|
width: 3rem;
|
|
220
221
|
height: 3rem;
|
|
221
222
|
font-size: 0.8rem;
|
|
223
|
+
position: relative;
|
|
224
|
+
left: 2.6rem;
|
|
222
225
|
|
|
223
226
|
span {
|
|
224
227
|
margin-top: 4px;
|
|
@@ -232,6 +235,8 @@ const ButtonsContainer = styled.div`
|
|
|
232
235
|
align-items: center;
|
|
233
236
|
justify-content: center;
|
|
234
237
|
gap: 0.5rem;
|
|
238
|
+
|
|
239
|
+
scale: 0.9;
|
|
235
240
|
`;
|
|
236
241
|
|
|
237
242
|
const ShortcutsContainer = styled.div`
|
|
@@ -251,11 +256,34 @@ const ShortcutsContainer = styled.div`
|
|
|
251
256
|
}
|
|
252
257
|
|
|
253
258
|
.bottom-1 {
|
|
254
|
-
transform: translate(
|
|
259
|
+
transform: translate(320%, calc(-4.5rem));
|
|
255
260
|
}
|
|
256
261
|
|
|
257
262
|
.bottom-2 {
|
|
258
|
-
transform: translate(-
|
|
263
|
+
transform: translate(-13.5%, calc(-5.6rem - 25%));
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.bottom-3 {
|
|
267
|
+
transform: translate(318%, calc(-15.8rem - 25%));
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.bottom-4 {
|
|
271
|
+
transform: translate(-15%, calc(-20.2rem - 25%));
|
|
272
|
+
}
|
|
273
|
+
.bottom-5 {
|
|
274
|
+
transform: translate(210%, calc(-15rem - 25%));
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.bottom-6 {
|
|
278
|
+
transform: translate(210%, calc(-25.7rem - 25%));
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.bottom-7 {
|
|
282
|
+
transform: translate(304%, calc(-24.9rem - 25%));
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.bottom-8 {
|
|
286
|
+
transform: translate(-101%, calc(-27.7rem - 25%));
|
|
259
287
|
}
|
|
260
288
|
`;
|
|
261
289
|
|
|
@@ -46,7 +46,7 @@ export const Shortcuts: React.FC<ShortcutsProps> = ({
|
|
|
46
46
|
if (isBlockedCastingByKeyboard) return;
|
|
47
47
|
|
|
48
48
|
const shortcutIndex = Number(e.key) - 1;
|
|
49
|
-
if (shortcutIndex >= 0 && shortcutIndex <=
|
|
49
|
+
if (shortcutIndex >= 0 && shortcutIndex <= 11) {
|
|
50
50
|
handleShortcutCast(shortcutIndex);
|
|
51
51
|
shortcutsRefs.current[shortcutIndex]?.classList.add('active');
|
|
52
52
|
setTimeout(() => {
|
|
@@ -64,7 +64,7 @@ export const Shortcuts: React.FC<ShortcutsProps> = ({
|
|
|
64
64
|
|
|
65
65
|
return (
|
|
66
66
|
<List>
|
|
67
|
-
{Array.from({ length:
|
|
67
|
+
{Array.from({ length: 12 }).map((_, i) => {
|
|
68
68
|
const buildClassName = (classBase: string, isOnCooldown: boolean) => {
|
|
69
69
|
return `${classBase} ${isOnCooldown ? 'onCooldown' : ''}`;
|
|
70
70
|
};
|
|
@@ -190,4 +190,6 @@ const List = styled.p`
|
|
|
190
190
|
gap: 0.5rem;
|
|
191
191
|
box-sizing: border-box;
|
|
192
192
|
margin: 0 !important;
|
|
193
|
+
|
|
194
|
+
scale: 0.9;
|
|
193
195
|
`;
|
|
@@ -48,8 +48,8 @@ export const ShortcutsSetter: React.FC<ShortcutsSetterProps> = ({
|
|
|
48
48
|
)}
|
|
49
49
|
width={32}
|
|
50
50
|
height={32}
|
|
51
|
-
imgScale={1.
|
|
52
|
-
imgStyle={{ left: '
|
|
51
|
+
imgScale={1.2}
|
|
52
|
+
imgStyle={{ left: '3px' }}
|
|
53
53
|
/>
|
|
54
54
|
);
|
|
55
55
|
}
|
|
@@ -63,7 +63,7 @@ export const ShortcutsSetter: React.FC<ShortcutsSetterProps> = ({
|
|
|
63
63
|
<Container>
|
|
64
64
|
<p>Shortcuts:</p>
|
|
65
65
|
<List id="shortcuts_list">
|
|
66
|
-
{Array.from({ length:
|
|
66
|
+
{Array.from({ length: 12 }).map((_, i) => (
|
|
67
67
|
<Shortcut
|
|
68
68
|
key={i}
|
|
69
69
|
onPointerDown={() => {
|
|
@@ -92,12 +92,16 @@ const Container = styled.div`
|
|
|
92
92
|
p {
|
|
93
93
|
margin: 0;
|
|
94
94
|
margin-left: 0.5rem;
|
|
95
|
+
font-size: 10px;
|
|
95
96
|
}
|
|
97
|
+
|
|
98
|
+
width: 100%;
|
|
96
99
|
`;
|
|
97
100
|
|
|
98
101
|
const Shortcut = styled.button<{ isBeingSet?: boolean }>`
|
|
99
|
-
width: 2.
|
|
100
|
-
height: 2.
|
|
102
|
+
width: 2.4rem;
|
|
103
|
+
height: 2.4rem;
|
|
104
|
+
|
|
101
105
|
background-color: ${uiColors.lightGray};
|
|
102
106
|
border: 2px solid
|
|
103
107
|
${({ isBeingSet }) => (isBeingSet ? uiColors.yellow : uiColors.darkGray)};
|
|
@@ -131,9 +135,12 @@ const List = styled.div`
|
|
|
131
135
|
width: 100%;
|
|
132
136
|
display: flex;
|
|
133
137
|
align-items: center;
|
|
134
|
-
gap: 0.
|
|
135
|
-
padding-bottom: 0.5rem;
|
|
136
|
-
padding-left: 0.5rem;
|
|
138
|
+
gap: 0.4rem;
|
|
137
139
|
box-sizing: border-box;
|
|
138
140
|
margin: 0 !important;
|
|
141
|
+
|
|
142
|
+
flex-wrap: wrap;
|
|
143
|
+
|
|
144
|
+
padding: 0.3rem;
|
|
145
|
+
padding-bottom: 1rem;
|
|
139
146
|
`;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const shortcutMock = [
|
|
2
|
+
{
|
|
3
|
+
type: 0,
|
|
4
|
+
payload: {
|
|
5
|
+
key: 'self-healing-spell',
|
|
6
|
+
name: 'Self Healing Spell',
|
|
7
|
+
description: 'A self healing spell.',
|
|
8
|
+
castingType: 'self-casting',
|
|
9
|
+
magicWords: 'talas faenya',
|
|
10
|
+
manaCost: 10,
|
|
11
|
+
minLevelRequired: 2,
|
|
12
|
+
minMagicLevelRequired: 1,
|
|
13
|
+
animationKey: 'life-heal',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
{ type: 2, payload: null },
|
|
17
|
+
{ type: 2, payload: null },
|
|
18
|
+
{ type: 2, payload: null },
|
|
19
|
+
{ type: 2, payload: null },
|
|
20
|
+
{ type: 2, payload: null },
|
|
21
|
+
{ type: 2, payload: null },
|
|
22
|
+
{ type: 2, payload: null },
|
|
23
|
+
{ type: 2, payload: null },
|
|
24
|
+
{ type: 2, payload: null },
|
|
25
|
+
{ type: 2, payload: null },
|
|
26
|
+
{ type: 2, payload: null },
|
|
27
|
+
];
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
CircularController,
|
|
6
6
|
CircularControllerProps,
|
|
7
7
|
} from '../components/CircularController/CircularController';
|
|
8
|
-
import { SHORTCUTS_STORAGE_KEY } from '../components/Spellbook/constants';
|
|
9
8
|
import atlasJSON from '../mocks/atlas/items/items.json';
|
|
10
9
|
import atlasIMG from '../mocks/atlas/items/items.png';
|
|
11
10
|
import { itemContainerMock } from '../mocks/itemContainer.mocks';
|
|
11
|
+
import { shortcutMock } from '../mocks/shortcut.mocks';
|
|
12
12
|
|
|
13
13
|
const meta: Meta = {
|
|
14
14
|
title: 'Circular Controller',
|
|
@@ -26,7 +26,7 @@ const Template: Story<CircularControllerProps> = args => (
|
|
|
26
26
|
export const Default = Template.bind({});
|
|
27
27
|
|
|
28
28
|
Default.args = {
|
|
29
|
-
shortcuts:
|
|
29
|
+
shortcuts: shortcutMock,
|
|
30
30
|
onShortcutClick: index => console.log(index),
|
|
31
31
|
onActionClick: () => console.log('action'),
|
|
32
32
|
onCancelClick: () => console.log('cancel attack'),
|