@rpg-engine/long-bow 0.1.794 → 0.2.2
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/LICENSE +20 -20
- package/README.md +181 -181
- package/dist/components/Button.d.ts +1 -0
- package/dist/components/Equipment/EquipmentSet.d.ts +5 -3
- package/dist/components/Item/Cards/ItemTooltip.d.ts +6 -0
- package/dist/components/Item/Inventory/ItemContainer.d.ts +4 -6
- package/dist/components/Item/Inventory/ItemContainerTypes.d.ts +6 -0
- package/dist/components/Item/Inventory/ItemSlot.d.ts +5 -9
- package/dist/components/Item/Inventory/itemContainerHelper.d.ts +2 -7
- package/dist/components/PropertySelect/PropertySelect.d.ts +12 -0
- package/dist/components/QuestInfo/QuestInfo.d.ts +14 -0
- package/dist/components/RelativeListMenu.d.ts +13 -0
- package/dist/index.d.ts +1 -1
- package/dist/long-bow.cjs.development.js +748 -1194
- 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 +748 -1196
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/mocks/equipmentSet.mocks.d.ts +2 -2
- package/dist/stories/Button.stories.d.ts +5 -0
- package/dist/stories/Chat.stories.d.ts +5 -0
- package/dist/stories/CheckButton.stories.d.ts +5 -0
- package/dist/stories/DraggableContainer.stories.d.ts +5 -0
- package/dist/stories/Dropdown.stories.d.ts +5 -0
- package/dist/stories/EquipmentSet.stories.d.ts +5 -0
- package/dist/stories/ItemContainer.stories.d.ts +5 -0
- package/dist/stories/ListMenu.stories.d.ts +5 -0
- package/dist/stories/Multitab.stories.d.ts +6 -0
- package/dist/stories/NPCDialog.stories.d.ts +7 -0
- package/dist/stories/ProgressBar.stories.d.ts +8 -0
- package/dist/stories/PropertySelect.stories.d.ts +5 -0
- package/dist/stories/QuestInfo.stories.d.ts +5 -0
- package/dist/stories/RPGUIContainers.stories.d.ts +5 -0
- package/dist/stories/RadioButton.stories.d.ts +5 -0
- package/dist/stories/RangeSlider.stories.d.ts +5 -0
- package/dist/stories/ScrollList.stories.d.ts +5 -0
- package/dist/stories/SimpleProgressBar.stories.d.ts +5 -0
- package/dist/stories/SkillProgressBar.stories.d.ts +5 -0
- package/dist/stories/SkillsContainer.stories.d.ts +5 -0
- package/dist/stories/Text.stories.d.ts +7 -0
- package/package.json +98 -96
- package/src/components/Abstractions/SlotsContainer.tsx +42 -42
- package/src/components/Button.tsx +30 -29
- package/src/components/Chat/Chat.tsx +193 -193
- package/src/components/CheckButton.tsx +65 -65
- package/src/components/DraggableContainer.tsx +150 -150
- package/src/components/Dropdown.tsx +57 -57
- package/src/components/Equipment/EquipmentSet.tsx +138 -180
- package/src/components/Input.tsx +11 -11
- package/src/components/Item/Cards/ItemTooltip.tsx +32 -0
- package/src/components/Item/Inventory/ItemContainer.tsx +68 -113
- package/src/components/Item/Inventory/ItemContainerTypes.ts +6 -0
- package/src/components/Item/Inventory/ItemSlot.tsx +212 -158
- package/src/components/Item/Inventory/itemContainerHelper.ts +146 -81
- package/src/components/ListMenu.tsx +65 -65
- package/src/components/Multitab/Tab.tsx +57 -57
- package/src/components/Multitab/TabBody.tsx +13 -13
- package/src/components/Multitab/TabsContainer.tsx +97 -97
- package/src/components/NPCDialog/NPCDialog.tsx +145 -145
- package/src/components/NPCDialog/NPCDialogText.tsx +53 -53
- package/src/components/NPCDialog/QuestionDialog/QuestionDialog.tsx +237 -242
- package/src/components/ProgressBar.tsx +91 -91
- package/src/components/PropertySelect/PropertySelect.tsx +101 -0
- package/src/components/PropertySelect/img/ui-arrows/arrow01-left-clicked.png +0 -0
- package/src/components/PropertySelect/img/ui-arrows/arrow01-left.png +0 -0
- package/src/components/PropertySelect/img/ui-arrows/arrow01-right-clicked.png +0 -0
- package/src/components/PropertySelect/img/ui-arrows/arrow01-right.png +0 -0
- package/src/components/PropertySelect/img/ui-arrows/arrow02-left-clicked.png +0 -0
- package/src/components/PropertySelect/img/ui-arrows/arrow02-left.png +0 -0
- package/src/components/PropertySelect/img/ui-arrows/arrow02-right-clicked.png +0 -0
- package/src/components/PropertySelect/img/ui-arrows/arrow02-right.png +0 -0
- package/src/components/QuestInfo/QuestInfo.tsx +143 -0
- package/src/components/QuestInfo/img/default.png +0 -0
- package/src/components/RPGUIContainer.tsx +47 -47
- package/src/components/RPGUIRoot.tsx +14 -14
- package/src/components/RadioButton.tsx +53 -53
- package/src/components/RangeSlider.tsx +68 -68
- package/src/components/RelativeListMenu.tsx +83 -0
- package/src/components/ScrollList.tsx +77 -77
- package/src/components/SimpleProgressBar.tsx +62 -62
- package/src/components/SkillProgressBar.tsx +123 -124
- package/src/components/SkillsContainer.tsx +196 -235
- package/src/components/TextArea.tsx +11 -11
- package/src/components/Truncate.tsx +25 -25
- package/src/components/shared/Column.tsx +16 -16
- package/src/components/shared/SpriteFromAtlas.tsx +99 -99
- package/src/components/typography/DynamicText.tsx +49 -49
- package/src/constants/uiColors.ts +10 -10
- package/src/hooks/useEventListener.ts +21 -21
- package/src/hooks/useOutsideAlerter.ts +25 -25
- package/src/index.tsx +25 -25
- package/src/libs/StringHelpers.ts +3 -3
- package/src/mocks/atlas/icons/icons.json +735 -303
- package/src/mocks/atlas/icons/icons.png +0 -0
- package/src/mocks/atlas/items/items.json +5215 -5195
- package/src/mocks/atlas/items/items.png +0 -0
- package/src/mocks/equipmentSet.mocks.ts +347 -347
- package/src/mocks/itemContainer.mocks.ts +281 -249
- package/src/mocks/skills.mocks.ts +122 -122
- package/src/stories/Button.stories.tsx +36 -0
- package/src/stories/Chat.stories.tsx +170 -0
- package/src/stories/CheckButton.stories.tsx +48 -0
- package/src/stories/DraggableContainer.stories.tsx +28 -0
- package/src/stories/Dropdown.stories.tsx +46 -0
- package/src/stories/EquipmentSet.stories.tsx +51 -0
- package/src/stories/ItemContainer.stories.tsx +51 -0
- package/src/stories/ListMenu.stories.tsx +56 -0
- package/src/stories/Multitab.stories.tsx +51 -0
- package/src/stories/NPCDialog.stories.tsx +130 -0
- package/src/stories/ProgressBar.stories.tsx +23 -0
- package/src/stories/PropertySelect.stories.tsx +41 -0
- package/src/stories/QuestInfo.stories.tsx +76 -0
- package/src/stories/RPGUIContainers.stories.tsx +42 -0
- package/src/stories/RadioButton.stories.tsx +49 -0
- package/src/stories/RangeSlider.stories.tsx +60 -0
- package/src/stories/ScrollList.stories.tsx +85 -0
- package/src/stories/SimpleProgressBar.stories.tsx +22 -0
- package/src/stories/SkillProgressBar.stories.tsx +30 -0
- package/src/stories/SkillsContainer.stories.tsx +31 -0
- package/src/stories/Text.stories.tsx +42 -0
- package/src/types/eventTypes.ts +4 -4
- package/src/types/index.d.ts +2 -2
- package/dist/components/Item/Cards/ItemCard.d.ts +0 -9
- package/dist/components/shared/SpriteIcon.d.ts +0 -9
- package/dist/components/store/UI.store.d.ts +0 -38
- package/src/components/Item/Cards/ItemCard.tsx +0 -36
- package/src/components/shared/SpriteIcon.tsx +0 -67
- package/src/components/store/UI.store.ts +0 -232
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { useOutsideClick } from '../hooks/useOutsideAlerter';
|
|
4
|
+
|
|
5
|
+
interface IListMenuOption {
|
|
6
|
+
id: string;
|
|
7
|
+
text: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface IRelativeMenuProps {
|
|
11
|
+
options: IListMenuOption[];
|
|
12
|
+
onSelected: (selectedOptionId: string) => void;
|
|
13
|
+
fontSize?: number;
|
|
14
|
+
onOutsideClick?: () => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const RelativeListMenu: React.FC<IRelativeMenuProps> = ({
|
|
18
|
+
options,
|
|
19
|
+
onSelected,
|
|
20
|
+
onOutsideClick,
|
|
21
|
+
fontSize = 0.8,
|
|
22
|
+
}) => {
|
|
23
|
+
const ref = useRef(null);
|
|
24
|
+
|
|
25
|
+
useOutsideClick(ref, 'relative-context-menu');
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
document.addEventListener('clickOutside', event => {
|
|
29
|
+
const e = event as CustomEvent;
|
|
30
|
+
|
|
31
|
+
if (e.detail.id === 'relative-context-menu') {
|
|
32
|
+
if (onOutsideClick) {
|
|
33
|
+
onOutsideClick();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return () => {
|
|
39
|
+
document.removeEventListener('clickOutside', _e => {});
|
|
40
|
+
};
|
|
41
|
+
}, []);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<Container fontSize={fontSize} ref={ref}>
|
|
45
|
+
<ul className="rpgui-list-imp" style={{ overflow: 'hidden' }}>
|
|
46
|
+
{options.map((params, index) => (
|
|
47
|
+
<ListElement
|
|
48
|
+
key={params?.id || index}
|
|
49
|
+
onClick={() => {
|
|
50
|
+
onSelected(params?.id);
|
|
51
|
+
}}
|
|
52
|
+
>
|
|
53
|
+
{params?.text || 'No text'}
|
|
54
|
+
</ListElement>
|
|
55
|
+
))}
|
|
56
|
+
</ul>
|
|
57
|
+
</Container>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
interface IContainerProps {
|
|
62
|
+
fontSize?: number;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const Container = styled.div<IContainerProps>`
|
|
66
|
+
position: absolute;
|
|
67
|
+
top: 1rem;
|
|
68
|
+
left: 4rem;
|
|
69
|
+
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-direction: column;
|
|
72
|
+
width: 100%;
|
|
73
|
+
justify-content: start;
|
|
74
|
+
align-items: flex-start;
|
|
75
|
+
|
|
76
|
+
li {
|
|
77
|
+
font-size: ${props => props.fontSize}em;
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
80
|
+
|
|
81
|
+
const ListElement = styled.li`
|
|
82
|
+
margin-right: 0.5rem;
|
|
83
|
+
`;
|
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import { DraggableContainer } from './DraggableContainer';
|
|
4
|
-
|
|
5
|
-
interface IListMenuOption {
|
|
6
|
-
id: string;
|
|
7
|
-
text: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface IListMenuProps {
|
|
11
|
-
x: number;
|
|
12
|
-
y: number;
|
|
13
|
-
options: IListMenuOption[];
|
|
14
|
-
onSelected: (selectedOptionId: string) => void;
|
|
15
|
-
fontSize?: number;
|
|
16
|
-
title: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const ListMenu: React.FC<IListMenuProps> = ({
|
|
20
|
-
options,
|
|
21
|
-
onSelected,
|
|
22
|
-
title,
|
|
23
|
-
}) => {
|
|
24
|
-
return (
|
|
25
|
-
<ScrollListContainer title={title}>
|
|
26
|
-
<SkillSplitDiv>
|
|
27
|
-
<hr className="golden" />
|
|
28
|
-
</SkillSplitDiv>
|
|
29
|
-
|
|
30
|
-
<ListContainer className="rpgui-list-imp">
|
|
31
|
-
{options.map(params => (
|
|
32
|
-
<ListElement
|
|
33
|
-
key={params?.id}
|
|
34
|
-
onClick={() => {
|
|
35
|
-
onSelected(params?.id);
|
|
36
|
-
}}
|
|
37
|
-
>
|
|
38
|
-
{params?.text || 'No text'}
|
|
39
|
-
</ListElement>
|
|
40
|
-
))}
|
|
41
|
-
</ListContainer>
|
|
42
|
-
</ScrollListContainer>
|
|
43
|
-
);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const ScrollListContainer = styled(DraggableContainer)`
|
|
47
|
-
border: 1px solid black;
|
|
48
|
-
width: 400px;
|
|
49
|
-
height: 400px;
|
|
50
|
-
.DraggableContainer__TitleContainer-sc-184mpyl-2 {
|
|
51
|
-
width: auto;
|
|
52
|
-
height: auto;
|
|
53
|
-
}
|
|
54
|
-
`;
|
|
55
|
-
|
|
56
|
-
const SkillSplitDiv = styled.div`
|
|
57
|
-
width: 100%;
|
|
58
|
-
font-size: 11px;
|
|
59
|
-
margin-bottom: 10px;
|
|
60
|
-
hr {
|
|
61
|
-
margin: 0px;
|
|
62
|
-
padding: 0px;
|
|
63
|
-
}
|
|
64
|
-
p {
|
|
65
|
-
margin-bottom: 0px;
|
|
66
|
-
}
|
|
67
|
-
`;
|
|
68
|
-
|
|
69
|
-
const ListContainer = styled.ul`
|
|
70
|
-
border: none;
|
|
71
|
-
width: 400px;
|
|
72
|
-
height: 250px;
|
|
73
|
-
overflow-y: scroll;
|
|
74
|
-
`;
|
|
75
|
-
const ListElement = styled.li`
|
|
76
|
-
margin-right: 0.5rem;
|
|
77
|
-
`;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { DraggableContainer } from './DraggableContainer';
|
|
4
|
+
|
|
5
|
+
interface IListMenuOption {
|
|
6
|
+
id: string;
|
|
7
|
+
text: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface IListMenuProps {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
options: IListMenuOption[];
|
|
14
|
+
onSelected: (selectedOptionId: string) => void;
|
|
15
|
+
fontSize?: number;
|
|
16
|
+
title: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const ListMenu: React.FC<IListMenuProps> = ({
|
|
20
|
+
options,
|
|
21
|
+
onSelected,
|
|
22
|
+
title,
|
|
23
|
+
}) => {
|
|
24
|
+
return (
|
|
25
|
+
<ScrollListContainer title={title}>
|
|
26
|
+
<SkillSplitDiv>
|
|
27
|
+
<hr className="golden" />
|
|
28
|
+
</SkillSplitDiv>
|
|
29
|
+
|
|
30
|
+
<ListContainer className="rpgui-list-imp">
|
|
31
|
+
{options.map(params => (
|
|
32
|
+
<ListElement
|
|
33
|
+
key={params?.id}
|
|
34
|
+
onClick={() => {
|
|
35
|
+
onSelected(params?.id);
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
{params?.text || 'No text'}
|
|
39
|
+
</ListElement>
|
|
40
|
+
))}
|
|
41
|
+
</ListContainer>
|
|
42
|
+
</ScrollListContainer>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const ScrollListContainer = styled(DraggableContainer)`
|
|
47
|
+
border: 1px solid black;
|
|
48
|
+
width: 400px;
|
|
49
|
+
height: 400px;
|
|
50
|
+
.DraggableContainer__TitleContainer-sc-184mpyl-2 {
|
|
51
|
+
width: auto;
|
|
52
|
+
height: auto;
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
|
|
56
|
+
const SkillSplitDiv = styled.div`
|
|
57
|
+
width: 100%;
|
|
58
|
+
font-size: 11px;
|
|
59
|
+
margin-bottom: 10px;
|
|
60
|
+
hr {
|
|
61
|
+
margin: 0px;
|
|
62
|
+
padding: 0px;
|
|
63
|
+
}
|
|
64
|
+
p {
|
|
65
|
+
margin-bottom: 0px;
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
const ListContainer = styled.ul`
|
|
70
|
+
border: none;
|
|
71
|
+
width: 400px;
|
|
72
|
+
height: 250px;
|
|
73
|
+
overflow-y: scroll;
|
|
74
|
+
`;
|
|
75
|
+
const ListElement = styled.li`
|
|
76
|
+
margin-right: 0.5rem;
|
|
77
|
+
`;
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
|
|
4
|
-
export interface ISimpleProgressBarProps {
|
|
5
|
-
value: number;
|
|
6
|
-
bgColor?: string;
|
|
7
|
-
margin?: number;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const SimpleProgressBar: React.FC<ISimpleProgressBarProps> = ({
|
|
11
|
-
value,
|
|
12
|
-
bgColor = 'red',
|
|
13
|
-
margin = 20,
|
|
14
|
-
}) => {
|
|
15
|
-
return (
|
|
16
|
-
<Container className="simple-progress-bar">
|
|
17
|
-
<ProgressBarContainer margin={margin}>
|
|
18
|
-
<BackgroundBar>
|
|
19
|
-
<Progress value={value} bgColor={bgColor} />
|
|
20
|
-
</BackgroundBar>
|
|
21
|
-
</ProgressBarContainer>
|
|
22
|
-
</Container>
|
|
23
|
-
);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const Container = styled.div`
|
|
27
|
-
display: flex;
|
|
28
|
-
justify-content: center;
|
|
29
|
-
align-items: center;
|
|
30
|
-
width: 100%;
|
|
31
|
-
`;
|
|
32
|
-
|
|
33
|
-
const BackgroundBar = styled.span`
|
|
34
|
-
background-color: rgba(0, 0, 0, 0.075);
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
|
-
interface ISimpleProgressBarThemeProps {
|
|
38
|
-
value: number;
|
|
39
|
-
bgColor: string;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const Progress = styled.span`
|
|
43
|
-
background-color: ${(props: ISimpleProgressBarThemeProps) => props.bgColor};
|
|
44
|
-
width: ${(props: ISimpleProgressBarThemeProps) => props.value}%;
|
|
45
|
-
`;
|
|
46
|
-
|
|
47
|
-
interface ISimpleProgressBarTheme2Props {
|
|
48
|
-
margin: number;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const ProgressBarContainer = styled.div`
|
|
52
|
-
border-radius: 60px;
|
|
53
|
-
border: 1px solid #282424;
|
|
54
|
-
overflow: hidden;
|
|
55
|
-
width: 100%;
|
|
56
|
-
span {
|
|
57
|
-
display: block;
|
|
58
|
-
height: 100%;
|
|
59
|
-
}
|
|
60
|
-
height: 8px;
|
|
61
|
-
margin-left: ${(props: ISimpleProgressBarTheme2Props) => props.margin}px;
|
|
62
|
-
`;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
export interface ISimpleProgressBarProps {
|
|
5
|
+
value: number;
|
|
6
|
+
bgColor?: string;
|
|
7
|
+
margin?: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const SimpleProgressBar: React.FC<ISimpleProgressBarProps> = ({
|
|
11
|
+
value,
|
|
12
|
+
bgColor = 'red',
|
|
13
|
+
margin = 20,
|
|
14
|
+
}) => {
|
|
15
|
+
return (
|
|
16
|
+
<Container className="simple-progress-bar">
|
|
17
|
+
<ProgressBarContainer margin={margin}>
|
|
18
|
+
<BackgroundBar>
|
|
19
|
+
<Progress value={value} bgColor={bgColor} />
|
|
20
|
+
</BackgroundBar>
|
|
21
|
+
</ProgressBarContainer>
|
|
22
|
+
</Container>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const Container = styled.div`
|
|
27
|
+
display: flex;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
align-items: center;
|
|
30
|
+
width: 100%;
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
const BackgroundBar = styled.span`
|
|
34
|
+
background-color: rgba(0, 0, 0, 0.075);
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
interface ISimpleProgressBarThemeProps {
|
|
38
|
+
value: number;
|
|
39
|
+
bgColor: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const Progress = styled.span`
|
|
43
|
+
background-color: ${(props: ISimpleProgressBarThemeProps) => props.bgColor};
|
|
44
|
+
width: ${(props: ISimpleProgressBarThemeProps) => props.value}%;
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
interface ISimpleProgressBarTheme2Props {
|
|
48
|
+
margin: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const ProgressBarContainer = styled.div`
|
|
52
|
+
border-radius: 60px;
|
|
53
|
+
border: 1px solid #282424;
|
|
54
|
+
overflow: hidden;
|
|
55
|
+
width: 100%;
|
|
56
|
+
span {
|
|
57
|
+
display: block;
|
|
58
|
+
height: 100%;
|
|
59
|
+
}
|
|
60
|
+
height: 8px;
|
|
61
|
+
margin-left: ${(props: ISimpleProgressBarTheme2Props) => props.margin}px;
|
|
62
|
+
`;
|
|
@@ -1,124 +1,123 @@
|
|
|
1
|
-
import { getSPForLevel } from '@rpg-engine/shared';
|
|
2
|
-
import React from 'react';
|
|
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
|
-
import { SpriteFromAtlas } from './shared/SpriteFromAtlas';
|
|
7
|
-
import { SimpleProgressBar } from './SimpleProgressBar';
|
|
8
|
-
|
|
9
|
-
export interface ISkillProgressBarProps {
|
|
10
|
-
skillName: string;
|
|
11
|
-
bgColor: string;
|
|
12
|
-
level: number;
|
|
13
|
-
skillPoints: number;
|
|
14
|
-
skillPointsToNextLevel?: number;
|
|
15
|
-
texturePath: string;
|
|
16
|
-
showSkillPoints?: boolean;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const SkillProgressBar: React.FC<ISkillProgressBarProps> = ({
|
|
20
|
-
bgColor,
|
|
21
|
-
skillName,
|
|
22
|
-
level,
|
|
23
|
-
skillPoints,
|
|
24
|
-
texturePath,
|
|
25
|
-
showSkillPoints = true,
|
|
26
|
-
}) => {
|
|
27
|
-
const spForNextLevel = getSPForLevel(level + 1);
|
|
28
|
-
|
|
29
|
-
const ratio = (skillPoints / spForNextLevel) * 100;
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<>
|
|
33
|
-
<ProgressTitle>
|
|
34
|
-
<TitleName>{skillName}</TitleName>
|
|
35
|
-
<ValueDisplay>lv {level}</ValueDisplay>
|
|
36
|
-
</ProgressTitle>
|
|
37
|
-
<ProgressBody>
|
|
38
|
-
<ProgressIconContainer>
|
|
39
|
-
{atlasIMG && atlasJSON ? (
|
|
40
|
-
<SpriteContainer>
|
|
41
|
-
<SpriteFromAtlas
|
|
42
|
-
atlasIMG={atlasIMG}
|
|
43
|
-
atlasJSON={atlasJSON}
|
|
44
|
-
spriteKey={texturePath}
|
|
45
|
-
imgScale={1}
|
|
46
|
-
grayScale
|
|
47
|
-
opacity={0.5}
|
|
48
|
-
/>
|
|
49
|
-
</SpriteContainer>
|
|
50
|
-
) : (
|
|
51
|
-
<></>
|
|
52
|
-
)}
|
|
53
|
-
</ProgressIconContainer>
|
|
54
|
-
|
|
55
|
-
<ProgressBarContainer>
|
|
56
|
-
<SimpleProgressBar value={ratio} bgColor={bgColor} />
|
|
57
|
-
</ProgressBarContainer>
|
|
58
|
-
</ProgressBody>
|
|
59
|
-
{showSkillPoints && (
|
|
60
|
-
<SkillDisplayContainer>
|
|
61
|
-
<SkillPointsDisplay>
|
|
62
|
-
{skillPoints}/{spForNextLevel}
|
|
63
|
-
</SkillPointsDisplay>
|
|
64
|
-
</SkillDisplayContainer>
|
|
65
|
-
)}
|
|
66
|
-
</>
|
|
67
|
-
);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const ProgressBarContainer = styled.div`
|
|
71
|
-
position: relative;
|
|
72
|
-
top: 8px;
|
|
73
|
-
width: 100%;
|
|
74
|
-
height: auto;
|
|
75
|
-
`;
|
|
76
|
-
|
|
77
|
-
const SpriteContainer = styled.div`
|
|
78
|
-
position: relative;
|
|
79
|
-
top: -3px;
|
|
80
|
-
left: 0;
|
|
81
|
-
`;
|
|
82
|
-
|
|
83
|
-
const SkillDisplayContainer = styled.div`
|
|
84
|
-
margin:
|
|
85
|
-
|
|
86
|
-
p {
|
|
87
|
-
margin: 0;
|
|
88
|
-
}
|
|
89
|
-
`;
|
|
90
|
-
|
|
91
|
-
const SkillPointsDisplay = styled.p`
|
|
92
|
-
font-size: 0.6rem !important;
|
|
93
|
-
font-weight: bold;
|
|
94
|
-
text-align: center;
|
|
95
|
-
`;
|
|
96
|
-
|
|
97
|
-
const TitleName = styled.span`
|
|
98
|
-
margin-left: 5px;
|
|
99
|
-
`;
|
|
100
|
-
|
|
101
|
-
const ValueDisplay = styled.span``;
|
|
102
|
-
|
|
103
|
-
const ProgressIconContainer = styled.div`
|
|
104
|
-
display: flex;
|
|
105
|
-
justify-content: center;
|
|
106
|
-
align-items: center;
|
|
107
|
-
`;
|
|
108
|
-
|
|
109
|
-
const ProgressBody = styled.div`
|
|
110
|
-
display: flex;
|
|
111
|
-
flex-direction: row;
|
|
112
|
-
width: 100%;
|
|
113
|
-
`;
|
|
114
|
-
|
|
115
|
-
const ProgressTitle = styled.div`
|
|
116
|
-
width: 100%;
|
|
117
|
-
display: flex;
|
|
118
|
-
flex-direction: row;
|
|
119
|
-
justify-content: space-between;
|
|
120
|
-
span {
|
|
121
|
-
font-size: 0.6rem;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
`;
|
|
1
|
+
import { getSPForLevel } from '@rpg-engine/shared';
|
|
2
|
+
import React from 'react';
|
|
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
|
+
import { SpriteFromAtlas } from './shared/SpriteFromAtlas';
|
|
7
|
+
import { SimpleProgressBar } from './SimpleProgressBar';
|
|
8
|
+
|
|
9
|
+
export interface ISkillProgressBarProps {
|
|
10
|
+
skillName: string;
|
|
11
|
+
bgColor: string;
|
|
12
|
+
level: number;
|
|
13
|
+
skillPoints: number;
|
|
14
|
+
skillPointsToNextLevel?: number;
|
|
15
|
+
texturePath: string;
|
|
16
|
+
showSkillPoints?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const SkillProgressBar: React.FC<ISkillProgressBarProps> = ({
|
|
20
|
+
bgColor,
|
|
21
|
+
skillName,
|
|
22
|
+
level,
|
|
23
|
+
skillPoints,
|
|
24
|
+
texturePath,
|
|
25
|
+
showSkillPoints = true,
|
|
26
|
+
}) => {
|
|
27
|
+
const spForNextLevel = getSPForLevel(level + 1);
|
|
28
|
+
|
|
29
|
+
const ratio = (skillPoints / spForNextLevel) * 100;
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
<ProgressTitle>
|
|
34
|
+
<TitleName>{skillName}</TitleName>
|
|
35
|
+
<ValueDisplay>lv {level}</ValueDisplay>
|
|
36
|
+
</ProgressTitle>
|
|
37
|
+
<ProgressBody>
|
|
38
|
+
<ProgressIconContainer>
|
|
39
|
+
{atlasIMG && atlasJSON ? (
|
|
40
|
+
<SpriteContainer>
|
|
41
|
+
<SpriteFromAtlas
|
|
42
|
+
atlasIMG={atlasIMG}
|
|
43
|
+
atlasJSON={atlasJSON}
|
|
44
|
+
spriteKey={texturePath}
|
|
45
|
+
imgScale={1}
|
|
46
|
+
grayScale
|
|
47
|
+
opacity={0.5}
|
|
48
|
+
/>
|
|
49
|
+
</SpriteContainer>
|
|
50
|
+
) : (
|
|
51
|
+
<></>
|
|
52
|
+
)}
|
|
53
|
+
</ProgressIconContainer>
|
|
54
|
+
|
|
55
|
+
<ProgressBarContainer>
|
|
56
|
+
<SimpleProgressBar value={ratio} bgColor={bgColor} />
|
|
57
|
+
</ProgressBarContainer>
|
|
58
|
+
</ProgressBody>
|
|
59
|
+
{showSkillPoints && (
|
|
60
|
+
<SkillDisplayContainer>
|
|
61
|
+
<SkillPointsDisplay>
|
|
62
|
+
{skillPoints}/{spForNextLevel}
|
|
63
|
+
</SkillPointsDisplay>
|
|
64
|
+
</SkillDisplayContainer>
|
|
65
|
+
)}
|
|
66
|
+
</>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const ProgressBarContainer = styled.div`
|
|
71
|
+
position: relative;
|
|
72
|
+
top: 8px;
|
|
73
|
+
width: 100%;
|
|
74
|
+
height: auto;
|
|
75
|
+
`;
|
|
76
|
+
|
|
77
|
+
const SpriteContainer = styled.div`
|
|
78
|
+
position: relative;
|
|
79
|
+
top: -3px;
|
|
80
|
+
left: 0;
|
|
81
|
+
`;
|
|
82
|
+
|
|
83
|
+
const SkillDisplayContainer = styled.div`
|
|
84
|
+
margin: 0 auto;
|
|
85
|
+
|
|
86
|
+
p {
|
|
87
|
+
margin: 0;
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
|
|
91
|
+
const SkillPointsDisplay = styled.p`
|
|
92
|
+
font-size: 0.6rem !important;
|
|
93
|
+
font-weight: bold;
|
|
94
|
+
text-align: center;
|
|
95
|
+
`;
|
|
96
|
+
|
|
97
|
+
const TitleName = styled.span`
|
|
98
|
+
margin-left: 5px;
|
|
99
|
+
`;
|
|
100
|
+
|
|
101
|
+
const ValueDisplay = styled.span``;
|
|
102
|
+
|
|
103
|
+
const ProgressIconContainer = styled.div`
|
|
104
|
+
display: flex;
|
|
105
|
+
justify-content: center;
|
|
106
|
+
align-items: center;
|
|
107
|
+
`;
|
|
108
|
+
|
|
109
|
+
const ProgressBody = styled.div`
|
|
110
|
+
display: flex;
|
|
111
|
+
flex-direction: row;
|
|
112
|
+
width: 100%;
|
|
113
|
+
`;
|
|
114
|
+
|
|
115
|
+
const ProgressTitle = styled.div`
|
|
116
|
+
width: 100%;
|
|
117
|
+
display: flex;
|
|
118
|
+
flex-direction: row;
|
|
119
|
+
justify-content: space-between;
|
|
120
|
+
span {
|
|
121
|
+
font-size: 0.6rem;
|
|
122
|
+
}
|
|
123
|
+
`;
|