@rpg-engine/long-bow 0.2.28 → 0.2.33
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/Arrow/SelectArrow.d.ts +8 -0
- package/dist/components/SkillProgressBar.d.ts +2 -0
- package/dist/components/SkillsContainer.d.ts +2 -0
- package/dist/components/TradingMenu/TradingItemRow.d.ts +9 -0
- package/dist/components/TradingMenu/TradingMenu.d.ts +12 -0
- package/dist/components/TradingMenu/items.mock.d.ts +2 -0
- package/dist/components/shared/Ellipsis.d.ts +3 -1
- package/dist/index.d.ts +3 -2
- package/dist/long-bow.cjs.development.js +748 -686
- 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 +749 -692
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/stories/Arrow.stories.d.ts +5 -0
- package/dist/stories/ItemTradingComponent.stories.d.ts +5 -0
- package/dist/stories/TradingMenu.stories.d.ts +5 -0
- package/package.json +2 -2
- package/src/components/Arrow/SelectArrow.tsx +65 -0
- package/src/components/{PropertySelect/img/ui-arrows → Arrow/img}/arrow01-left-clicked.png +0 -0
- package/src/components/{PropertySelect/img/ui-arrows → Arrow/img}/arrow01-left.png +0 -0
- package/src/components/{PropertySelect/img/ui-arrows → Arrow/img}/arrow01-right-clicked.png +0 -0
- package/src/components/{PropertySelect/img/ui-arrows → Arrow/img}/arrow01-right.png +0 -0
- package/src/components/{PropertySelect/img/ui-arrows → Arrow/img}/arrow02-left-clicked.png +0 -0
- package/src/components/{PropertySelect/img/ui-arrows → Arrow/img}/arrow02-left.png +0 -0
- package/src/components/{PropertySelect/img/ui-arrows → Arrow/img}/arrow02-right-clicked.png +0 -0
- package/src/components/{PropertySelect/img/ui-arrows → Arrow/img}/arrow02-right.png +0 -0
- package/src/components/Item/Inventory/ItemSlot.tsx +5 -3
- package/src/components/NPCDialog/.DS_Store +0 -0
- package/src/components/NPCDialog/img/.DS_Store +0 -0
- package/src/components/PropertySelect/PropertySelect.tsx +12 -34
- package/src/components/QuestInfo/QuestInfo.tsx +8 -34
- package/src/components/ScrollList.tsx +2 -1
- package/src/components/SkillProgressBar.tsx +4 -2
- package/src/components/SkillsContainer.tsx +8 -37
- package/src/components/TradingMenu/TradingItemRow.tsx +172 -0
- package/src/components/TradingMenu/TradingMenu.tsx +188 -0
- package/src/components/TradingMenu/items.mock.ts +88 -0
- package/src/components/shared/Ellipsis.tsx +25 -6
- package/src/index.tsx +3 -2
- package/src/mocks/.DS_Store +0 -0
- package/src/stories/Arrow.stories.tsx +26 -0
- package/src/stories/ItemTradingComponent.stories.tsx +39 -0
- package/src/stories/SkillProgressBar.stories.tsx +4 -0
- package/src/stories/SkillsContainer.stories.tsx +4 -0
- package/src/stories/TradingMenu.stories.tsx +38 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { ArrowBarProps } from '../components/Arrow/SelectArrow';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, ArrowBarProps>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { ITradeComponentProps } from '../components/TradingMenu/TradingItemRow';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, ITradeComponentProps>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { ITrandingMenu } from '../components/TradingMenu/TradingMenu';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, ITrandingMenu>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpg-engine/long-bow",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.33",
|
|
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.5.
|
|
86
|
+
"@rpg-engine/shared": "^0.5.69",
|
|
87
87
|
"dayjs": "^1.11.2",
|
|
88
88
|
"fs-extra": "^10.1.0",
|
|
89
89
|
"lodash": "^4.17.21",
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import LeftArrowClickIcon from './img/arrow01-left-clicked.png';
|
|
4
|
+
import LeftArrowIcon from './img/arrow01-left.png';
|
|
5
|
+
import RightArrowClickIcon from './img/arrow01-right-clicked.png';
|
|
6
|
+
import RightArrowIcon from './img/arrow01-right.png';
|
|
7
|
+
|
|
8
|
+
export interface ArrowBarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
direction: 'right' | 'left';
|
|
10
|
+
onClick: () => void;
|
|
11
|
+
size?: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const SelectArrow: React.FC<ArrowBarProps> = ({
|
|
15
|
+
direction = 'left',
|
|
16
|
+
size,
|
|
17
|
+
onClick,
|
|
18
|
+
...props
|
|
19
|
+
}) => {
|
|
20
|
+
return (
|
|
21
|
+
<>
|
|
22
|
+
{direction === 'left' ? (
|
|
23
|
+
<LeftArrow size={size} onClick={() => onClick()} {...props}></LeftArrow>
|
|
24
|
+
) : (
|
|
25
|
+
<RightArrow
|
|
26
|
+
size={size}
|
|
27
|
+
onClick={() => onClick()}
|
|
28
|
+
{...props}
|
|
29
|
+
></RightArrow>
|
|
30
|
+
)}
|
|
31
|
+
</>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
interface IArrowProps {
|
|
36
|
+
size?: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const LeftArrow = styled.span<IArrowProps>`
|
|
40
|
+
background-image: url(${LeftArrowIcon});
|
|
41
|
+
background-size: 100% 100%;
|
|
42
|
+
left: 0;
|
|
43
|
+
position: absolute;
|
|
44
|
+
width: ${props => props.size || 40}px;
|
|
45
|
+
height: ${props => props.size || 42}px;
|
|
46
|
+
:active {
|
|
47
|
+
background-image: url(${LeftArrowClickIcon});
|
|
48
|
+
}
|
|
49
|
+
z-index: 2;
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
const RightArrow = styled.span<IArrowProps>`
|
|
53
|
+
background-image: url(${RightArrowIcon});
|
|
54
|
+
right: 0;
|
|
55
|
+
position: absolute;
|
|
56
|
+
width: ${props => props.size || 40}px;
|
|
57
|
+
height: ${props => props.size || 42}px;
|
|
58
|
+
background-size: 100% 100%;
|
|
59
|
+
:active {
|
|
60
|
+
background-image: url(${RightArrowClickIcon});
|
|
61
|
+
}
|
|
62
|
+
z-index: 2;
|
|
63
|
+
`;
|
|
64
|
+
|
|
65
|
+
export default SelectArrow;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -15,6 +15,7 @@ import { SpriteFromAtlas } from '../../shared/SpriteFromAtlas';
|
|
|
15
15
|
import { ItemTooltip } from '../Cards/ItemTooltip';
|
|
16
16
|
import { ErrorBoundary } from './ErrorBoundary';
|
|
17
17
|
import { generateContextMenu, IContextMenuItem } from './itemContainerHelper';
|
|
18
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
18
19
|
|
|
19
20
|
const EquipmentSlotSpriteByType: any = {
|
|
20
21
|
Neck: 'accessories/corruption-necklace.png',
|
|
@@ -104,7 +105,7 @@ export const ItemSlot: React.FC<IProps> = observer(
|
|
|
104
105
|
const element = [];
|
|
105
106
|
if (itemToRender?.texturePath) {
|
|
106
107
|
element.push(
|
|
107
|
-
<ErrorBoundary>
|
|
108
|
+
<ErrorBoundary key={itemToRender._id}>
|
|
108
109
|
<SpriteFromAtlas
|
|
109
110
|
key={itemToRender._id}
|
|
110
111
|
atlasIMG={atlasIMG}
|
|
@@ -133,7 +134,7 @@ export const ItemSlot: React.FC<IProps> = observer(
|
|
|
133
134
|
) {
|
|
134
135
|
const element = [];
|
|
135
136
|
element.push(
|
|
136
|
-
<ErrorBoundary>
|
|
137
|
+
<ErrorBoundary key={itemToRender._id}>
|
|
137
138
|
<SpriteFromAtlas
|
|
138
139
|
key={itemToRender._id}
|
|
139
140
|
atlasIMG={atlasIMG}
|
|
@@ -153,8 +154,9 @@ export const ItemSlot: React.FC<IProps> = observer(
|
|
|
153
154
|
return element;
|
|
154
155
|
} else {
|
|
155
156
|
return (
|
|
156
|
-
<ErrorBoundary>
|
|
157
|
+
<ErrorBoundary key={uuidv4()}>
|
|
157
158
|
<SpriteFromAtlas
|
|
159
|
+
key={uuidv4()}
|
|
158
160
|
atlasIMG={atlasIMG}
|
|
159
161
|
atlasJSON={atlasJSON}
|
|
160
162
|
spriteKey={EquipmentSlotSpriteByType[slotSpriteMask!]}
|
|
Binary file
|
|
Binary file
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
+
import SelectArrow from '../Arrow/SelectArrow';
|
|
3
4
|
import { Ellipsis } from '../shared/Ellipsis';
|
|
4
|
-
import LeftArrowClickIcon from './img/ui-arrows/arrow01-left-clicked.png';
|
|
5
|
-
import LeftArrowIcon from './img/ui-arrows/arrow01-left.png';
|
|
6
|
-
import RightArrowClickIcon from './img/ui-arrows/arrow01-right-clicked.png';
|
|
7
|
-
import RightArrowIcon from './img/ui-arrows/arrow01-right.png';
|
|
8
5
|
|
|
9
6
|
export interface IPropertySelectProps {
|
|
10
7
|
availableProperties: Array<IPropertiesProps>;
|
|
@@ -54,16 +51,23 @@ export const PropertySelect: React.FC<IPropertySelectProps> = ({
|
|
|
54
51
|
<Container>
|
|
55
52
|
<TextOverlay>
|
|
56
53
|
<Item>
|
|
57
|
-
<Ellipsis maxLines={1}
|
|
54
|
+
<Ellipsis maxLines={1} maxWidth={200}>
|
|
55
|
+
{getCurrentSelectionName()}
|
|
56
|
+
</Ellipsis>
|
|
58
57
|
</Item>
|
|
59
58
|
</TextOverlay>
|
|
60
59
|
<div className="rpgui-progress-track"></div>
|
|
61
60
|
|
|
62
|
-
<
|
|
63
|
-
|
|
61
|
+
<SelectArrow
|
|
62
|
+
direction="left"
|
|
63
|
+
onClick={onLeftClick}
|
|
64
|
+
onTouchStart={onLeftClick}
|
|
65
|
+
></SelectArrow>
|
|
66
|
+
<SelectArrow
|
|
67
|
+
direction="right"
|
|
64
68
|
onClick={onRightClick}
|
|
65
69
|
onTouchStart={onRightClick}
|
|
66
|
-
></
|
|
70
|
+
></SelectArrow>
|
|
67
71
|
</Container>
|
|
68
72
|
);
|
|
69
73
|
};
|
|
@@ -99,30 +103,4 @@ const Container = styled.div<IContainerProps>`
|
|
|
99
103
|
width: 40%;
|
|
100
104
|
`;
|
|
101
105
|
|
|
102
|
-
const LeftArrow = styled.div`
|
|
103
|
-
background-image: url(${LeftArrowIcon});
|
|
104
|
-
background-size: 100% 100%;
|
|
105
|
-
left: 0;
|
|
106
|
-
position: absolute;
|
|
107
|
-
width: 40px;
|
|
108
|
-
height: 42px;
|
|
109
|
-
:active {
|
|
110
|
-
background-image: url(${LeftArrowClickIcon});
|
|
111
|
-
}
|
|
112
|
-
z-index: 2;
|
|
113
|
-
`;
|
|
114
|
-
|
|
115
|
-
const RightArrow = styled.div`
|
|
116
|
-
background-image: url(${RightArrowIcon});
|
|
117
|
-
right: 0;
|
|
118
|
-
position: absolute;
|
|
119
|
-
width: 40px;
|
|
120
|
-
background-size: 100% 100%;
|
|
121
|
-
height: 42px;
|
|
122
|
-
:active {
|
|
123
|
-
background-image: url(${RightArrowClickIcon});
|
|
124
|
-
}
|
|
125
|
-
z-index: 2;
|
|
126
|
-
`;
|
|
127
|
-
|
|
128
106
|
export default PropertySelect;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { IQuest } from '@rpg-engine/shared';
|
|
2
2
|
import React, { useEffect, useState } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
+
import SelectArrow from '../Arrow/SelectArrow';
|
|
4
5
|
import { Button, ButtonTypes } from '../Button';
|
|
5
6
|
import { DraggableContainer } from '../DraggableContainer';
|
|
6
|
-
|
|
7
|
-
import LeftArrowIcon from '../PropertySelect/img/ui-arrows/arrow01-left.png';
|
|
8
|
-
import RightArrowClickIcon from '../PropertySelect/img/ui-arrows/arrow01-right-clicked.png';
|
|
9
|
-
import RightArrowIcon from '../PropertySelect/img/ui-arrows/arrow01-right.png';
|
|
7
|
+
|
|
10
8
|
import { RPGUIContainerTypes } from '../RPGUIContainer';
|
|
11
9
|
import { Column } from '../shared/Column';
|
|
12
10
|
import thumbnailDefault from './img/default.png';
|
|
@@ -60,18 +58,18 @@ export const QuestInfo: React.FC<IQuestInfoProps> = ({
|
|
|
60
58
|
{quests.length >= 2 ? (
|
|
61
59
|
<QuestsContainer>
|
|
62
60
|
{currentIndex !== 0 && (
|
|
63
|
-
<
|
|
64
|
-
|
|
61
|
+
<SelectArrow
|
|
62
|
+
direction="left"
|
|
65
63
|
onClick={onLeftClick}
|
|
66
64
|
onTouchStart={onLeftClick}
|
|
67
|
-
></
|
|
65
|
+
></SelectArrow>
|
|
68
66
|
)}
|
|
69
67
|
{currentIndex !== quests.length - 1 && (
|
|
70
|
-
<
|
|
71
|
-
|
|
68
|
+
<SelectArrow
|
|
69
|
+
direction="right"
|
|
72
70
|
onClick={onRightClick}
|
|
73
71
|
onTouchStart={onRightClick}
|
|
74
|
-
></
|
|
72
|
+
></SelectArrow>
|
|
75
73
|
)}
|
|
76
74
|
|
|
77
75
|
<QuestContainer>
|
|
@@ -229,27 +227,3 @@ const Thumbnail = styled.img`
|
|
|
229
227
|
width: 64px;
|
|
230
228
|
margin-right: 0.5rem;
|
|
231
229
|
`;
|
|
232
|
-
|
|
233
|
-
const LeftArrow = styled.div`
|
|
234
|
-
background-image: url(${LeftArrowIcon});
|
|
235
|
-
background-size: 100% 100%;
|
|
236
|
-
left: 0;
|
|
237
|
-
position: absolute;
|
|
238
|
-
width: 40px;
|
|
239
|
-
height: 42px;
|
|
240
|
-
:active {
|
|
241
|
-
background-image: url(${LeftArrowClickIcon});
|
|
242
|
-
}
|
|
243
|
-
`;
|
|
244
|
-
|
|
245
|
-
const RightArrow = styled.div`
|
|
246
|
-
background-image: url(${RightArrowIcon});
|
|
247
|
-
right: 0;
|
|
248
|
-
position: absolute;
|
|
249
|
-
width: 40px;
|
|
250
|
-
background-size: 100% 100%;
|
|
251
|
-
height: 42px;
|
|
252
|
-
:active {
|
|
253
|
-
background-image: url(${RightArrowClickIcon});
|
|
254
|
-
}
|
|
255
|
-
`;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { DraggableContainer } from './DraggableContainer';
|
|
4
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
4
5
|
|
|
5
6
|
interface IListMenuOption {
|
|
6
7
|
id: string;
|
|
@@ -30,7 +31,7 @@ export const ListMenu: React.FC<IListMenuProps> = ({
|
|
|
30
31
|
<ListContainer className="rpgui-list-imp">
|
|
31
32
|
{options.map(params => (
|
|
32
33
|
<ListElement
|
|
33
|
-
key={
|
|
34
|
+
key={uuidv4()}
|
|
34
35
|
onClick={() => {
|
|
35
36
|
onSelected(params?.id);
|
|
36
37
|
}}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { getSPForLevel } from '@rpg-engine/shared';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
-
import atlasJSON from '../mocks/atlas/items/items.json';
|
|
5
|
-
import atlasIMG from '../mocks/atlas/items/items.png';
|
|
6
4
|
import { ErrorBoundary } from './Item/Inventory/ErrorBoundary';
|
|
7
5
|
import { SpriteFromAtlas } from './shared/SpriteFromAtlas';
|
|
8
6
|
import { SimpleProgressBar } from './SimpleProgressBar';
|
|
@@ -15,6 +13,8 @@ export interface ISkillProgressBarProps {
|
|
|
15
13
|
skillPointsToNextLevel?: number;
|
|
16
14
|
texturePath: string;
|
|
17
15
|
showSkillPoints?: boolean;
|
|
16
|
+
atlasJSON: any;
|
|
17
|
+
atlasIMG: any;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export const SkillProgressBar: React.FC<ISkillProgressBarProps> = ({
|
|
@@ -24,6 +24,8 @@ export const SkillProgressBar: React.FC<ISkillProgressBarProps> = ({
|
|
|
24
24
|
skillPoints,
|
|
25
25
|
texturePath,
|
|
26
26
|
showSkillPoints = true,
|
|
27
|
+
atlasIMG,
|
|
28
|
+
atlasJSON,
|
|
27
29
|
}) => {
|
|
28
30
|
const spForNextLevel = getSPForLevel(level + 1);
|
|
29
31
|
|
|
@@ -9,6 +9,8 @@ import { SkillProgressBar } from './SkillProgressBar';
|
|
|
9
9
|
export interface ISkillContainerProps {
|
|
10
10
|
skill: ISkill;
|
|
11
11
|
onCloseButton: () => void;
|
|
12
|
+
atlasJSON: any;
|
|
13
|
+
atlasIMG: any;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
const skillProps = {
|
|
@@ -50,6 +52,8 @@ const skillProps = {
|
|
|
50
52
|
export const SkillsContainer: React.FC<ISkillContainerProps> = ({
|
|
51
53
|
onCloseButton,
|
|
52
54
|
skill,
|
|
55
|
+
atlasIMG,
|
|
56
|
+
atlasJSON,
|
|
53
57
|
}) => {
|
|
54
58
|
const onRenderSkillCategory = (
|
|
55
59
|
category: 'attributes' | 'combat' | 'crafting'
|
|
@@ -75,6 +79,8 @@ export const SkillsContainer: React.FC<ISkillContainerProps> = ({
|
|
|
75
79
|
Math.round(skillDetails.skillPointsToNextLevel) || 0
|
|
76
80
|
}
|
|
77
81
|
texturePath={value}
|
|
82
|
+
atlasIMG={atlasIMG}
|
|
83
|
+
atlasJSON={atlasJSON}
|
|
78
84
|
/>
|
|
79
85
|
);
|
|
80
86
|
}
|
|
@@ -100,6 +106,8 @@ export const SkillsContainer: React.FC<ISkillContainerProps> = ({
|
|
|
100
106
|
skillPoints={Math.round(skill.experience) || 0}
|
|
101
107
|
skillPointsToNextLevel={Math.round(skill.xpToNextLevel) || 0}
|
|
102
108
|
texturePath={'swords/broad-sword.png'}
|
|
109
|
+
atlasIMG={atlasIMG}
|
|
110
|
+
atlasJSON={atlasJSON}
|
|
103
111
|
/>
|
|
104
112
|
|
|
105
113
|
<p>Combat Skills</p>
|
|
@@ -121,43 +129,6 @@ export const SkillsContainer: React.FC<ISkillContainerProps> = ({
|
|
|
121
129
|
</SkillSplitDiv>
|
|
122
130
|
|
|
123
131
|
{onRenderSkillCategory('attributes')}
|
|
124
|
-
|
|
125
|
-
{/* <SkillSplitDiv>
|
|
126
|
-
<p>Magic Skills</p>
|
|
127
|
-
<hr className="golden" />
|
|
128
|
-
</SkillSplitDiv>
|
|
129
|
-
<SkillProgressBar
|
|
130
|
-
skillName={'Ice'}
|
|
131
|
-
bgColor={'red'}
|
|
132
|
-
level={skill?.ice?.level || 0}
|
|
133
|
-
skillPoints={skill?.ice?.skillPoints || 0}
|
|
134
|
-
skillPointsToNextLevel={skill?.ice?.skillPointsToNextLevel || 0}
|
|
135
|
-
texturePath={'spell-icons/freeze.png'}
|
|
136
|
-
/>
|
|
137
|
-
<SkillProgressBar
|
|
138
|
-
skillName={'Earth'}
|
|
139
|
-
bgColor={'red'}
|
|
140
|
-
level={skill?.earth?.level || 0}
|
|
141
|
-
skillPoints={skill?.earth?.skillPoints || 0}
|
|
142
|
-
skillPointsToNextLevel={skill?.earth?.skillPointsToNextLevel || 0}
|
|
143
|
-
texturePath={'spell-icons/earth-barrier.png'}
|
|
144
|
-
/>
|
|
145
|
-
<SkillProgressBar
|
|
146
|
-
skillName={'Air'}
|
|
147
|
-
bgColor={'red'}
|
|
148
|
-
level={skill?.air?.level || 0}
|
|
149
|
-
skillPoints={skill?.air?.skillPoints || 0}
|
|
150
|
-
skillPointsToNextLevel={skill?.air?.skillPointsToNextLevel || 0}
|
|
151
|
-
texturePath={'spell-icons/poison-tornado.png'}
|
|
152
|
-
/>
|
|
153
|
-
<SkillProgressBar
|
|
154
|
-
skillName={'Water'}
|
|
155
|
-
bgColor={'red'}
|
|
156
|
-
level={skill?.water?.level || 0}
|
|
157
|
-
skillPoints={skill?.water?.skillPoints || 0}
|
|
158
|
-
skillPointsToNextLevel={skill?.water?.skillPointsToNextLevel || 0}
|
|
159
|
-
texturePath={'spell-icons/tsunami.png'}
|
|
160
|
-
/> */}
|
|
161
132
|
</SkillsDraggableContainer>
|
|
162
133
|
);
|
|
163
134
|
};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { ITradeResponseItem } from '@rpg-engine/shared';
|
|
2
|
+
import capitalize from 'lodash/capitalize';
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { colors } from '../../constants/uiColors';
|
|
6
|
+
import SelectArrow from '../Arrow/SelectArrow';
|
|
7
|
+
import { Ellipsis } from '../shared/Ellipsis';
|
|
8
|
+
import { SpriteFromAtlas } from '../shared/SpriteFromAtlas';
|
|
9
|
+
|
|
10
|
+
export interface ITradeComponentProps {
|
|
11
|
+
traderItem: ITradeResponseItem;
|
|
12
|
+
updateChartTotals: (traderItem: ITradeResponseItem) => void;
|
|
13
|
+
atlasJSON: any;
|
|
14
|
+
atlasIMG: any;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const TradingItemRow: React.FC<ITradeComponentProps> = ({
|
|
18
|
+
atlasIMG,
|
|
19
|
+
atlasJSON,
|
|
20
|
+
updateChartTotals,
|
|
21
|
+
traderItem,
|
|
22
|
+
}) => {
|
|
23
|
+
const [itemQuantity, setItemQuantity] = useState(0);
|
|
24
|
+
|
|
25
|
+
const onLeftClick = () => {
|
|
26
|
+
if (itemQuantity > 0) {
|
|
27
|
+
const newQuantity = itemQuantity - 1;
|
|
28
|
+
setItemQuantity(newQuantity);
|
|
29
|
+
updateChartTotals({
|
|
30
|
+
key: traderItem.key,
|
|
31
|
+
itemId: traderItem.itemId,
|
|
32
|
+
qty: newQuantity,
|
|
33
|
+
price: traderItem.price,
|
|
34
|
+
texturePath: traderItem.texturePath,
|
|
35
|
+
name: traderItem.name,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const onRightClick = () => {
|
|
40
|
+
if (itemQuantity < 999) {
|
|
41
|
+
const newQuantity = itemQuantity + 1;
|
|
42
|
+
setItemQuantity(newQuantity);
|
|
43
|
+
updateChartTotals({
|
|
44
|
+
key: traderItem.key,
|
|
45
|
+
itemId: traderItem.itemId,
|
|
46
|
+
qty: newQuantity,
|
|
47
|
+
price: traderItem.price,
|
|
48
|
+
texturePath: traderItem.texturePath,
|
|
49
|
+
name: traderItem.name,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<ItemWrapper>
|
|
56
|
+
<ItemIconContainer>
|
|
57
|
+
<SpriteContainer>
|
|
58
|
+
<SpriteFromAtlas
|
|
59
|
+
atlasIMG={atlasIMG}
|
|
60
|
+
atlasJSON={atlasJSON}
|
|
61
|
+
spriteKey={traderItem.texturePath}
|
|
62
|
+
imgScale={2.5}
|
|
63
|
+
/>
|
|
64
|
+
</SpriteContainer>
|
|
65
|
+
</ItemIconContainer>
|
|
66
|
+
<ItemNameContainer>
|
|
67
|
+
<NameValue>
|
|
68
|
+
<Ellipsis maxLines={1} maxWidth={250}>
|
|
69
|
+
{capitalize(traderItem.name)}
|
|
70
|
+
</Ellipsis>
|
|
71
|
+
<p>${traderItem.price}</p>
|
|
72
|
+
</NameValue>
|
|
73
|
+
</ItemNameContainer>
|
|
74
|
+
|
|
75
|
+
<QuantityContainer>
|
|
76
|
+
<SelectArrow
|
|
77
|
+
size={32}
|
|
78
|
+
className="arrow-selector"
|
|
79
|
+
direction="left"
|
|
80
|
+
onClick={onLeftClick}
|
|
81
|
+
onTouchStart={onLeftClick}
|
|
82
|
+
></SelectArrow>
|
|
83
|
+
<QuantityDisplay>
|
|
84
|
+
<TextOverlay>
|
|
85
|
+
<Item>{itemQuantity}</Item>
|
|
86
|
+
</TextOverlay>
|
|
87
|
+
</QuantityDisplay>
|
|
88
|
+
<SelectArrow
|
|
89
|
+
size={32}
|
|
90
|
+
className="arrow-selector"
|
|
91
|
+
direction="right"
|
|
92
|
+
onClick={onRightClick}
|
|
93
|
+
onTouchStart={onRightClick}
|
|
94
|
+
></SelectArrow>
|
|
95
|
+
</QuantityContainer>
|
|
96
|
+
</ItemWrapper>
|
|
97
|
+
);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const ItemWrapper = styled.div`
|
|
101
|
+
width: 100%;
|
|
102
|
+
margin: auto;
|
|
103
|
+
display: flex;
|
|
104
|
+
justify-content: space-between;
|
|
105
|
+
margin-bottom: 1rem;
|
|
106
|
+
|
|
107
|
+
&:hover {
|
|
108
|
+
background-color: ${colors.darkGrey};
|
|
109
|
+
}
|
|
110
|
+
padding: 0.5rem;
|
|
111
|
+
`;
|
|
112
|
+
|
|
113
|
+
const ItemNameContainer = styled.div`
|
|
114
|
+
flex: 60%;
|
|
115
|
+
`;
|
|
116
|
+
|
|
117
|
+
const ItemIconContainer = styled.div`
|
|
118
|
+
display: flex;
|
|
119
|
+
justify-content: flex-start;
|
|
120
|
+
align-items: center;
|
|
121
|
+
|
|
122
|
+
flex: 0 0 58px;
|
|
123
|
+
`;
|
|
124
|
+
|
|
125
|
+
const SpriteContainer = styled.div`
|
|
126
|
+
position: relative;
|
|
127
|
+
top: -0.5rem;
|
|
128
|
+
left: 0.5rem;
|
|
129
|
+
`;
|
|
130
|
+
|
|
131
|
+
const NameValue = styled.div`
|
|
132
|
+
p {
|
|
133
|
+
font-size: 0.75rem;
|
|
134
|
+
margin: 0;
|
|
135
|
+
}
|
|
136
|
+
`;
|
|
137
|
+
|
|
138
|
+
const Item = styled.span`
|
|
139
|
+
font-size: 1rem;
|
|
140
|
+
color: white;
|
|
141
|
+
text-align: center;
|
|
142
|
+
z-index: 1;
|
|
143
|
+
|
|
144
|
+
width: 100%;
|
|
145
|
+
`;
|
|
146
|
+
|
|
147
|
+
const TextOverlay = styled.div`
|
|
148
|
+
width: 100%;
|
|
149
|
+
position: relative;
|
|
150
|
+
`;
|
|
151
|
+
|
|
152
|
+
interface IContainerProps {
|
|
153
|
+
percentageWidth?: number;
|
|
154
|
+
minWidth?: number;
|
|
155
|
+
style?: Record<string, any>;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const QuantityContainer = styled.div<IContainerProps>`
|
|
159
|
+
position: relative;
|
|
160
|
+
display: flex;
|
|
161
|
+
|
|
162
|
+
min-width: 100px;
|
|
163
|
+
width: 40%;
|
|
164
|
+
justify-content: center;
|
|
165
|
+
align-items: center;
|
|
166
|
+
|
|
167
|
+
flex: 20%;
|
|
168
|
+
`;
|
|
169
|
+
|
|
170
|
+
const QuantityDisplay = styled.div`
|
|
171
|
+
font-size: 0.8rem;
|
|
172
|
+
`;
|