@rpg-engine/long-bow 0.1.71 → 0.1.72

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.
@@ -96,8 +96,8 @@ export const ItemContainer: React.FC<IItemContainerProps> = observer(
96
96
  {uiStore.onHoverDetail?.visible ? (
97
97
  <ItemCard
98
98
  item={uiStore.onHoverDetail.item}
99
- x={uiStore.onHoverDetail.posX}
100
- y={uiStore.onHoverDetail.posY}
99
+ x={uiStore.onHoverDetail.posX - draggablePosition.x}
100
+ y={uiStore.onHoverDetail.posY - draggablePosition.y}
101
101
  />
102
102
  ) : null}
103
103
  </SlotsContainer>
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import styled from 'styled-components';
4
4
  import atlasJSON from '../../../mocks/atlas/items/items.json';
5
5
  import atlasIMG from '../../../mocks/atlas/items/items.png';
6
- import { SpriteFromAtlas } from '../SpriteFromAtlas';
6
+ import { SpriteFromAtlas } from '../../shared/SpriteFromAtlas';
7
7
 
8
8
  export enum SlotContainerType {
9
9
  INVENTORY = 'Inventory',
@@ -71,7 +71,7 @@ export const ItemSlot: React.FC<IProps> = ({
71
71
  atlasIMG={atlasIMG}
72
72
  atlasJSON={atlasJSON}
73
73
  spriteKey={itemToRender.texturePath}
74
- scale={3}
74
+ imgScale={3}
75
75
  />
76
76
  );
77
77
  }
@@ -96,7 +96,7 @@ export const ItemSlot: React.FC<IProps> = ({
96
96
  atlasIMG={atlasIMG}
97
97
  atlasJSON={atlasJSON}
98
98
  spriteKey={itemToRender.texturePath}
99
- scale={3}
99
+ imgScale={3}
100
100
  />
101
101
  );
102
102
  } else {
@@ -105,7 +105,7 @@ export const ItemSlot: React.FC<IProps> = ({
105
105
  atlasIMG={atlasIMG}
106
106
  atlasJSON={atlasJSON}
107
107
  spriteKey={EquipmentSlotSpriteByType[slotSpriteMask!]}
108
- scale={3}
108
+ imgScale={3}
109
109
  grayScale={true}
110
110
  opacity={0.4}
111
111
  />
@@ -24,9 +24,9 @@ export const ListMenu: React.FC<IListMenuProps> = ({
24
24
  return (
25
25
  <Container x={x} y={y} fontSize={fontSize}>
26
26
  <ul className="rpgui-list-imp" style={{ overflow: 'hidden' }}>
27
- {options.map(params => (
27
+ {options.map((params, index) => (
28
28
  <ListElement
29
- key={params?.id}
29
+ key={params?.id || index}
30
30
  onClick={() => {
31
31
  onSelected(params?.id);
32
32
  }}
@@ -48,6 +48,8 @@ export const TabsContainer: React.FC<ITabsContainer> = ({
48
48
  return RPGUIContainerTypes.FramedGold;
49
49
  case 'gray':
50
50
  return RPGUIContainerTypes.Framed;
51
+ default:
52
+ return RPGUIContainerTypes.Framed;
51
53
  }
52
54
  };
53
55
 
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import styled from 'styled-components';
4
4
  import atlasJSON from '../mocks/atlas/items/items.json';
5
5
  import atlasIMG from '../mocks/atlas/items/items.png';
6
- import { SpriteFromAtlas } from './Item/SpriteFromAtlas';
6
+ import { SpriteFromAtlas } from './shared/SpriteFromAtlas';
7
7
  import { SimpleProgressBar } from './SimpleProgressBar';
8
8
 
9
9
  export interface ISkillProgressBarProps {
@@ -42,7 +42,7 @@ export const SkillProgressBar: React.FC<ISkillProgressBarProps> = ({
42
42
  atlasIMG={atlasIMG}
43
43
  atlasJSON={atlasJSON}
44
44
  spriteKey={texturePath}
45
- scale={1}
45
+ imgScale={1}
46
46
  grayScale
47
47
  opacity={0.5}
48
48
  />
@@ -8,9 +8,12 @@ interface IProps {
8
8
  spriteKey: string;
9
9
  width?: number;
10
10
  height?: number;
11
- scale?: number;
12
11
  grayScale?: boolean;
13
12
  opacity?: number;
13
+ onClick?: () => void;
14
+ containerStyle?: any;
15
+ imgStyle?: any;
16
+ imgScale?: number;
14
17
  }
15
18
 
16
19
  export const SpriteFromAtlas: React.FC<IProps> = ({
@@ -19,7 +22,10 @@ export const SpriteFromAtlas: React.FC<IProps> = ({
19
22
  spriteKey,
20
23
  width = GRID_WIDTH,
21
24
  height = GRID_HEIGHT,
22
- scale = 2,
25
+ imgScale = 2,
26
+ imgStyle,
27
+ onClick,
28
+ containerStyle,
23
29
  grayScale = false,
24
30
  opacity = 1,
25
31
  }) => {
@@ -29,14 +35,21 @@ export const SpriteFromAtlas: React.FC<IProps> = ({
29
35
  const spriteData = atlasJSON.frames[spriteKey];
30
36
 
31
37
  return (
32
- <Container width={width} height={height} hasHover={grayScale}>
38
+ <Container
39
+ width={width}
40
+ height={height}
41
+ hasHover={grayScale}
42
+ onClick={onClick}
43
+ style={containerStyle}
44
+ >
33
45
  <ImgSprite
34
46
  className="sprite-from-atlas-img"
35
47
  atlasIMG={atlasIMG}
36
48
  frame={spriteData.frame}
37
- scale={scale}
49
+ scale={imgScale}
38
50
  grayScale={grayScale}
39
51
  opacity={opacity}
52
+ style={imgStyle}
40
53
  />
41
54
  </Container>
42
55
  );
@@ -0,0 +1,67 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import iconsAtlasJSON from '../../mocks/atlas/icons/icons.json';
4
+ import iconsAtlasIMG from '../../mocks/atlas/icons/icons.png';
5
+ import { SpriteFromAtlas } from './SpriteFromAtlas';
6
+
7
+ interface IProps {
8
+ onClick?: () => void;
9
+ spriteKey: string;
10
+ baseSpriteKey?: string;
11
+ imgStyle?: any;
12
+ }
13
+
14
+ export const SpriteIcon: React.FC<IProps> = ({
15
+ onClick,
16
+ spriteKey,
17
+ baseSpriteKey,
18
+ imgStyle,
19
+ }) => {
20
+ return (
21
+ <Container>
22
+ {baseSpriteKey && (
23
+ <Slot>
24
+ <SpriteFromAtlas
25
+ onClick={onClick}
26
+ atlasJSON={iconsAtlasJSON}
27
+ atlasIMG={iconsAtlasIMG}
28
+ spriteKey={baseSpriteKey}
29
+ width={32}
30
+ height={32}
31
+ containerStyle={{
32
+ zIndex: -1,
33
+ }}
34
+ />
35
+ </Slot>
36
+ )}
37
+ <Slot>
38
+ <SpriteFromAtlas
39
+ onClick={onClick}
40
+ atlasJSON={iconsAtlasJSON}
41
+ atlasIMG={iconsAtlasIMG}
42
+ spriteKey={spriteKey}
43
+ width={28}
44
+ height={28}
45
+ containerStyle={{
46
+ zIndex: 0,
47
+ }}
48
+ imgScale={baseSpriteKey ? 1.5 : 2}
49
+ imgStyle={imgStyle}
50
+ />
51
+ </Slot>
52
+ </Container>
53
+ );
54
+ };
55
+
56
+ const Container = styled.div`
57
+ position: relative;
58
+ width: 32px;
59
+ height: 32px;
60
+ display: flex;
61
+ justify-content: center;
62
+ align-items: center;
63
+ `;
64
+
65
+ const Slot = styled.div`
66
+ position: absolute;
67
+ `;
package/src/index.tsx CHANGED
@@ -3,10 +3,10 @@ export * from './components/Chat/Chat';
3
3
  export * from './components/CheckButton';
4
4
  export * from './components/DraggableContainer';
5
5
  export * from './components/Dropdown';
6
+ export * from './components/Equipment/EquipmentSet';
6
7
  export * from './components/Input';
7
8
  export * from './components/Item/Inventory/ItemContainer';
8
9
  export * from './components/Item/Inventory/ItemSlot';
9
- export * from './components/Item/SpriteFromAtlas';
10
10
  export * from './components/ListMenu';
11
11
  export * from './components/NPCDialog/NPCDialog';
12
12
  export * from './components/NPCDialog/QuestionDialog/QuestionDialog';
@@ -15,9 +15,10 @@ export * from './components/RadioButton';
15
15
  export * from './components/RangeSlider';
16
16
  export * from './components/RPGUIContainer';
17
17
  export * from './components/RPGUIRoot';
18
+ export * from './components/shared/SpriteFromAtlas';
19
+ export * from './components/shared/SpriteIcon';
18
20
  export * from './components/SkillProgressBar';
19
21
  export * from './components/TextArea';
20
22
  export * from './components/Truncate';
21
23
  export * from './components/typography/DynamicText';
22
- export * from './components/Equipment/EquipmentSet';
23
24
  export { useEventListener } from './hooks/useEventListener';
@@ -0,0 +1,303 @@
1
+ {
2
+ "frames": {
3
+ "metamask-large.png": {
4
+ "frame": {
5
+ "x": 0,
6
+ "y": 0,
7
+ "w": 33,
8
+ "h": 30
9
+ },
10
+ "rotated": false,
11
+ "trimmed": false,
12
+ "spriteSourceSize": {
13
+ "x": 0,
14
+ "y": 0,
15
+ "w": 33,
16
+ "h": 30
17
+ },
18
+ "sourceSize": {
19
+ "w": 33,
20
+ "h": 30
21
+ },
22
+ "pivot": {
23
+ "x": 0.5,
24
+ "y": 0.5
25
+ }
26
+ },
27
+ "chat-large.png": {
28
+ "frame": {
29
+ "x": 0,
30
+ "y": 30,
31
+ "w": 31,
32
+ "h": 29
33
+ },
34
+ "rotated": false,
35
+ "trimmed": true,
36
+ "spriteSourceSize": {
37
+ "x": 1,
38
+ "y": 3,
39
+ "w": 31,
40
+ "h": 29
41
+ },
42
+ "sourceSize": {
43
+ "w": 32,
44
+ "h": 32
45
+ },
46
+ "pivot": {
47
+ "x": 0.5,
48
+ "y": 0.5
49
+ }
50
+ },
51
+ "equipment.png": {
52
+ "frame": {
53
+ "x": 33,
54
+ "y": 0,
55
+ "w": 17,
56
+ "h": 16
57
+ },
58
+ "rotated": false,
59
+ "trimmed": false,
60
+ "spriteSourceSize": {
61
+ "x": 0,
62
+ "y": 0,
63
+ "w": 17,
64
+ "h": 16
65
+ },
66
+ "sourceSize": {
67
+ "w": 17,
68
+ "h": 16
69
+ },
70
+ "pivot": {
71
+ "x": 0.5,
72
+ "y": 0.5
73
+ }
74
+ },
75
+ "inventory.png": {
76
+ "frame": {
77
+ "x": 33,
78
+ "y": 16,
79
+ "w": 17,
80
+ "h": 16
81
+ },
82
+ "rotated": false,
83
+ "trimmed": false,
84
+ "spriteSourceSize": {
85
+ "x": 0,
86
+ "y": 0,
87
+ "w": 17,
88
+ "h": 16
89
+ },
90
+ "sourceSize": {
91
+ "w": 17,
92
+ "h": 16
93
+ },
94
+ "pivot": {
95
+ "x": 0.5,
96
+ "y": 0.5
97
+ }
98
+ },
99
+ "icon-base-blue.png": {
100
+ "frame": {
101
+ "x": 31,
102
+ "y": 32,
103
+ "w": 16,
104
+ "h": 16
105
+ },
106
+ "rotated": false,
107
+ "trimmed": false,
108
+ "spriteSourceSize": {
109
+ "x": 0,
110
+ "y": 0,
111
+ "w": 16,
112
+ "h": 16
113
+ },
114
+ "sourceSize": {
115
+ "w": 16,
116
+ "h": 16
117
+ },
118
+ "pivot": {
119
+ "x": 0.5,
120
+ "y": 0.5
121
+ }
122
+ },
123
+ "icon-base-brown.png": {
124
+ "frame": {
125
+ "x": 50,
126
+ "y": 0,
127
+ "w": 16,
128
+ "h": 16
129
+ },
130
+ "rotated": false,
131
+ "trimmed": false,
132
+ "spriteSourceSize": {
133
+ "x": 0,
134
+ "y": 0,
135
+ "w": 16,
136
+ "h": 16
137
+ },
138
+ "sourceSize": {
139
+ "w": 16,
140
+ "h": 16
141
+ },
142
+ "pivot": {
143
+ "x": 0.5,
144
+ "y": 0.5
145
+ }
146
+ },
147
+ "chat-small.png": {
148
+ "frame": {
149
+ "x": 50,
150
+ "y": 16,
151
+ "w": 16,
152
+ "h": 16
153
+ },
154
+ "rotated": false,
155
+ "trimmed": true,
156
+ "spriteSourceSize": {
157
+ "x": 1,
158
+ "y": 0,
159
+ "w": 16,
160
+ "h": 16
161
+ },
162
+ "sourceSize": {
163
+ "w": 17,
164
+ "h": 16
165
+ },
166
+ "pivot": {
167
+ "x": 0.5,
168
+ "y": 0.5
169
+ }
170
+ },
171
+ "icon-base-gold.png": {
172
+ "frame": {
173
+ "x": 47,
174
+ "y": 32,
175
+ "w": 16,
176
+ "h": 16
177
+ },
178
+ "rotated": false,
179
+ "trimmed": false,
180
+ "spriteSourceSize": {
181
+ "x": 0,
182
+ "y": 0,
183
+ "w": 16,
184
+ "h": 16
185
+ },
186
+ "sourceSize": {
187
+ "w": 16,
188
+ "h": 16
189
+ },
190
+ "pivot": {
191
+ "x": 0.5,
192
+ "y": 0.5
193
+ }
194
+ },
195
+ "equipment-raw.png": {
196
+ "frame": {
197
+ "x": 0,
198
+ "y": 59,
199
+ "w": 15,
200
+ "h": 13
201
+ },
202
+ "rotated": false,
203
+ "trimmed": true,
204
+ "spriteSourceSize": {
205
+ "x": 0,
206
+ "y": 0,
207
+ "w": 15,
208
+ "h": 13
209
+ },
210
+ "sourceSize": {
211
+ "w": 16,
212
+ "h": 13
213
+ },
214
+ "pivot": {
215
+ "x": 0.5,
216
+ "y": 0.5
217
+ }
218
+ },
219
+ "metamask-small.png": {
220
+ "frame": {
221
+ "x": 31,
222
+ "y": 48,
223
+ "w": 15,
224
+ "h": 15
225
+ },
226
+ "rotated": false,
227
+ "trimmed": true,
228
+ "spriteSourceSize": {
229
+ "x": 1,
230
+ "y": 0,
231
+ "w": 15,
232
+ "h": 15
233
+ },
234
+ "sourceSize": {
235
+ "w": 16,
236
+ "h": 16
237
+ },
238
+ "pivot": {
239
+ "x": 0.5,
240
+ "y": 0.5
241
+ }
242
+ },
243
+ "settings.png": {
244
+ "frame": {
245
+ "x": 46,
246
+ "y": 48,
247
+ "w": 14,
248
+ "h": 14
249
+ },
250
+ "rotated": false,
251
+ "trimmed": true,
252
+ "spriteSourceSize": {
253
+ "x": 1,
254
+ "y": 1,
255
+ "w": 14,
256
+ "h": 14
257
+ },
258
+ "sourceSize": {
259
+ "w": 16,
260
+ "h": 16
261
+ },
262
+ "pivot": {
263
+ "x": 0.5,
264
+ "y": 0.5
265
+ }
266
+ },
267
+ "inventory-raw.png": {
268
+ "frame": {
269
+ "x": 15,
270
+ "y": 59,
271
+ "w": 13,
272
+ "h": 13
273
+ },
274
+ "rotated": false,
275
+ "trimmed": true,
276
+ "spriteSourceSize": {
277
+ "x": 1,
278
+ "y": 2,
279
+ "w": 13,
280
+ "h": 13
281
+ },
282
+ "sourceSize": {
283
+ "w": 16,
284
+ "h": 16
285
+ },
286
+ "pivot": {
287
+ "x": 0.5,
288
+ "y": 0.5
289
+ }
290
+ }
291
+ },
292
+ "meta": {
293
+ "app": "http://free-tex-packer.com",
294
+ "version": "0.6.7",
295
+ "image": "icons.png",
296
+ "format": "RGBA8888",
297
+ "size": {
298
+ "w": 66,
299
+ "h": 72
300
+ },
301
+ "scale": 1
302
+ }
303
+ }
Binary file