@rpg-engine/long-bow 0.3.59 → 0.3.60
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 +28 -8
- 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 +28 -8
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/CircularController/CircularController.tsx +5 -2
- package/src/components/Shortcuts/Shortcuts.tsx +27 -5
- package/src/components/Shortcuts/SingleShortcut.ts +1 -0
package/package.json
CHANGED
|
@@ -104,6 +104,7 @@ export const CircularController: React.FC<CircularControllerProps> = ({
|
|
|
104
104
|
height={32}
|
|
105
105
|
imgScale={1.4}
|
|
106
106
|
imgStyle={{ left: '4px' }}
|
|
107
|
+
containerStyle={{ pointerEvents: 'none' }}
|
|
107
108
|
/>
|
|
108
109
|
)}
|
|
109
110
|
<span className="qty">{totalQty}</span>
|
|
@@ -164,11 +165,12 @@ const Button = styled.button`
|
|
|
164
165
|
align-items: center;
|
|
165
166
|
justify-content: center;
|
|
166
167
|
position: relative;
|
|
167
|
-
transition:
|
|
168
|
+
transition: all 0.1s;
|
|
168
169
|
margin-top: -3rem;
|
|
169
170
|
|
|
170
171
|
&.active {
|
|
171
172
|
background-color: ${uiColors.gray};
|
|
173
|
+
border-color: ${uiColors.yellow};
|
|
172
174
|
}
|
|
173
175
|
|
|
174
176
|
.sword {
|
|
@@ -226,7 +228,7 @@ const ShortcutsContainer = styled.div`
|
|
|
226
228
|
const StyledShortcut = styled(SingleShortcut)`
|
|
227
229
|
width: 2.5rem;
|
|
228
230
|
height: 2.5rem;
|
|
229
|
-
transition:
|
|
231
|
+
transition: all 0.1s;
|
|
230
232
|
|
|
231
233
|
.mana,
|
|
232
234
|
.qty {
|
|
@@ -241,5 +243,6 @@ const StyledShortcut = styled(SingleShortcut)`
|
|
|
241
243
|
|
|
242
244
|
&.active {
|
|
243
245
|
background-color: ${uiColors.gray};
|
|
246
|
+
border-color: ${uiColors.yellow};
|
|
244
247
|
}
|
|
245
248
|
`;
|
|
@@ -6,8 +6,9 @@ import {
|
|
|
6
6
|
IShortcut,
|
|
7
7
|
ShortcutType,
|
|
8
8
|
} from '@rpg-engine/shared';
|
|
9
|
-
import React, { useEffect } from 'react';
|
|
9
|
+
import React, { useEffect, useRef } from 'react';
|
|
10
10
|
import styled from 'styled-components';
|
|
11
|
+
import { uiColors } from '../../constants/uiColors';
|
|
11
12
|
import { SpriteFromAtlas } from '../shared/SpriteFromAtlas';
|
|
12
13
|
import { SingleShortcut } from './SingleShortcut';
|
|
13
14
|
|
|
@@ -30,6 +31,8 @@ export const Shortcuts: React.FC<ShortcutsProps> = ({
|
|
|
30
31
|
atlasIMG,
|
|
31
32
|
inventory,
|
|
32
33
|
}) => {
|
|
34
|
+
const shortcutsRefs = useRef<HTMLButtonElement[]>([]);
|
|
35
|
+
|
|
33
36
|
useEffect(() => {
|
|
34
37
|
const handleKeyDown = (e: KeyboardEvent) => {
|
|
35
38
|
if (isBlockedCastingByKeyboard) return;
|
|
@@ -37,6 +40,10 @@ export const Shortcuts: React.FC<ShortcutsProps> = ({
|
|
|
37
40
|
const shortcutIndex = Number(e.key) - 1;
|
|
38
41
|
if (shortcutIndex >= 0 && shortcutIndex <= 5) {
|
|
39
42
|
onShortcutCast(shortcutIndex);
|
|
43
|
+
shortcutsRefs.current[shortcutIndex]?.classList.add('active');
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
shortcutsRefs.current[shortcutIndex]?.classList.remove('active');
|
|
46
|
+
}, 150);
|
|
40
47
|
}
|
|
41
48
|
};
|
|
42
49
|
|
|
@@ -71,10 +78,13 @@ export const Shortcuts: React.FC<ShortcutsProps> = ({
|
|
|
71
78
|
);
|
|
72
79
|
|
|
73
80
|
return (
|
|
74
|
-
<
|
|
81
|
+
<StyledShortcut
|
|
75
82
|
key={i}
|
|
76
83
|
onPointerDown={onShortcutCast.bind(null, i)}
|
|
77
84
|
disabled={false}
|
|
85
|
+
ref={el => {
|
|
86
|
+
if (el) shortcutsRefs.current[i] = el;
|
|
87
|
+
}}
|
|
78
88
|
>
|
|
79
89
|
{payload && (
|
|
80
90
|
<SpriteFromAtlas
|
|
@@ -94,30 +104,42 @@ export const Shortcuts: React.FC<ShortcutsProps> = ({
|
|
|
94
104
|
)}
|
|
95
105
|
<span className="qty">{totalQty}</span>
|
|
96
106
|
<span className="keyboard">{i + 1}</span>
|
|
97
|
-
</
|
|
107
|
+
</StyledShortcut>
|
|
98
108
|
);
|
|
99
109
|
}
|
|
100
110
|
|
|
101
111
|
const payload = shortcuts[i]?.payload as IRawSpell | undefined;
|
|
102
112
|
|
|
103
113
|
return (
|
|
104
|
-
<
|
|
114
|
+
<StyledShortcut
|
|
105
115
|
key={i}
|
|
106
116
|
onPointerDown={onShortcutCast.bind(null, i)}
|
|
107
117
|
disabled={mana < (payload?.manaCost ?? 0)}
|
|
118
|
+
ref={el => {
|
|
119
|
+
if (el) shortcutsRefs.current[i] = el;
|
|
120
|
+
}}
|
|
108
121
|
>
|
|
109
122
|
<span className="mana">{payload && payload.manaCost}</span>
|
|
110
123
|
<span className="magicWords">
|
|
111
124
|
{payload?.magicWords.split(' ').map(word => word[0])}
|
|
112
125
|
</span>
|
|
113
126
|
<span className="keyboard">{i + 1}</span>
|
|
114
|
-
</
|
|
127
|
+
</StyledShortcut>
|
|
115
128
|
);
|
|
116
129
|
})}
|
|
117
130
|
</List>
|
|
118
131
|
);
|
|
119
132
|
};
|
|
120
133
|
|
|
134
|
+
const StyledShortcut = styled(SingleShortcut)`
|
|
135
|
+
transition: all 0.15s;
|
|
136
|
+
|
|
137
|
+
&.active {
|
|
138
|
+
background-color: ${uiColors.gray};
|
|
139
|
+
border-color: ${uiColors.yellow};
|
|
140
|
+
}
|
|
141
|
+
`;
|
|
142
|
+
|
|
121
143
|
const List = styled.p`
|
|
122
144
|
width: 100%;
|
|
123
145
|
display: flex;
|