@rpg-engine/long-bow 0.3.43 → 0.3.44

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.
Files changed (115) hide show
  1. package/dist/components/Abstractions/SlotsContainer.d.ts +0 -1
  2. package/dist/components/Button.d.ts +2 -3
  3. package/dist/components/Chat/Chat.d.ts +2 -12
  4. package/dist/components/CheckButton.d.ts +2 -1
  5. package/dist/components/DraggableContainer.d.ts +0 -1
  6. package/dist/components/Equipment/EquipmentSet.d.ts +0 -8
  7. package/dist/components/Input.d.ts +0 -1
  8. package/dist/components/Item/Inventory/ItemContainer.d.ts +0 -12
  9. package/dist/components/Item/Inventory/ItemSlot.d.ts +0 -9
  10. package/dist/components/NPCDialog/NPCDialogText.d.ts +2 -4
  11. package/dist/components/RangeSlider.d.ts +0 -1
  12. package/dist/index.d.ts +0 -8
  13. package/dist/long-bow.cjs.development.js +515 -7465
  14. package/dist/long-bow.cjs.development.js.map +1 -1
  15. package/dist/long-bow.cjs.production.min.js +1 -1
  16. package/dist/long-bow.cjs.production.min.js.map +1 -1
  17. package/dist/long-bow.esm.js +520 -7461
  18. package/dist/long-bow.esm.js.map +1 -1
  19. package/dist/mocks/equipmentSet.mocks.d.ts +2 -15
  20. package/dist/mocks/skills.mocks.d.ts +121 -2
  21. package/package.json +2 -5
  22. package/src/components/Abstractions/SlotsContainer.tsx +0 -3
  23. package/src/components/Button.tsx +8 -18
  24. package/src/components/Chat/Chat.tsx +105 -106
  25. package/src/components/CheckButton.tsx +1 -1
  26. package/src/components/DraggableContainer.tsx +1 -4
  27. package/src/components/Dropdown.tsx +1 -7
  28. package/src/components/Equipment/EquipmentSet.tsx +0 -46
  29. package/src/components/Input.tsx +2 -6
  30. package/src/components/Item/Inventory/ItemContainer.tsx +6 -104
  31. package/src/components/Item/Inventory/ItemSlot.tsx +34 -234
  32. package/src/components/NPCDialog/NPCDialog.tsx +28 -4
  33. package/src/components/NPCDialog/NPCDialogText.tsx +15 -75
  34. package/src/components/RangeSlider.tsx +14 -37
  35. package/src/components/SkillsContainer.tsx +1 -1
  36. package/src/components/TimeWidget/TimeWidget.tsx +0 -1
  37. package/src/components/TradingMenu/TradingItemRow.tsx +6 -43
  38. package/src/components/TradingMenu/TradingMenu.tsx +1 -1
  39. package/src/components/TradingMenu/items.mock.ts +0 -1
  40. package/src/components/shared/SpriteFromAtlas.tsx +1 -4
  41. package/src/hooks/useOutsideAlerter.ts +2 -2
  42. package/src/index.tsx +0 -8
  43. package/src/mocks/atlas/items/items.json +314 -6086
  44. package/src/mocks/atlas/items/items.png +0 -0
  45. package/src/mocks/equipmentSet.mocks.ts +4 -49
  46. package/src/mocks/itemContainer.mocks.ts +6 -54
  47. package/src/mocks/skills.mocks.ts +2 -8
  48. package/src/stories/Chat.stories.tsx +3 -20
  49. package/src/stories/EquipmentSet.stories.tsx +0 -10
  50. package/src/stories/ItemContainer.stories.tsx +15 -84
  51. package/src/stories/RangeSlider.stories.tsx +9 -10
  52. package/dist/components/CaracterStatus/CaracterStatus.d.ts +0 -9
  53. package/dist/components/Chatdeprecated/ChatDeprecated.d.ts +0 -13
  54. package/dist/components/CircularController/CircularController.d.ts +0 -10
  55. package/dist/components/CraftBook/CraftBook.d.ts +0 -15
  56. package/dist/components/CraftBook/MockItems.d.ts +0 -2
  57. package/dist/components/DropdownSelectorContainer.d.ts +0 -13
  58. package/dist/components/Item/Inventory/ItemQuantitySelector.d.ts +0 -7
  59. package/dist/components/RadioInput/RadioButton.d.ts +0 -8
  60. package/dist/components/RadioInput/RadioInput.d.ts +0 -13
  61. package/dist/components/RadioInput/instruments.d.ts +0 -4
  62. package/dist/components/Spellbook/QuickSpells.d.ts +0 -10
  63. package/dist/components/Spellbook/Spell.d.ts +0 -11
  64. package/dist/components/Spellbook/Spellbook.d.ts +0 -15
  65. package/dist/components/Spellbook/SpellbookShortcuts.d.ts +0 -10
  66. package/dist/components/Spellbook/constants.d.ts +0 -3
  67. package/dist/components/Spellbook/mockSpells.d.ts +0 -2
  68. package/dist/components/itemSelector/ItemSelector.d.ts +0 -14
  69. package/dist/constants/uiDevices.d.ts +0 -1
  70. package/dist/stories/CaracterStatus.stories.d.ts +0 -5
  71. package/dist/stories/ChatDeprecated.stories.d.ts +0 -5
  72. package/dist/stories/CircullarController.stories.d.ts +0 -5
  73. package/dist/stories/CraftBook.stories.d.ts +0 -4
  74. package/dist/stories/DropdownSelectorContainer.stories.d.ts +0 -5
  75. package/dist/stories/ItemQuantitySelector.stories.d.ts +0 -5
  76. package/dist/stories/ItemSelector.stories.d.ts +0 -4
  77. package/dist/stories/QuickSpells.stories.d.ts +0 -5
  78. package/dist/stories/RadioInput.stories.d.ts +0 -5
  79. package/dist/stories/Spellbook.stories.d.ts +0 -5
  80. package/src/.DS_Store +0 -0
  81. package/src/components/.DS_Store +0 -0
  82. package/src/components/CaracterStatus/CaracterStatus.tsx +0 -86
  83. package/src/components/CaracterStatus/Character.png +0 -0
  84. package/src/components/Chatdeprecated/ChatDeprecated.tsx +0 -200
  85. package/src/components/CircularController/CircularController.tsx +0 -162
  86. package/src/components/CraftBook/CraftBook.tsx +0 -230
  87. package/src/components/CraftBook/MockItems.ts +0 -46
  88. package/src/components/DropdownSelectorContainer.tsx +0 -42
  89. package/src/components/Item/Inventory/ItemQuantitySelector.tsx +0 -142
  90. package/src/components/NPCDialog/.DS_Store +0 -0
  91. package/src/components/NPCDialog/img/.DS_Store +0 -0
  92. package/src/components/NPCDialog/img/press-button.gif +0 -0
  93. package/src/components/RadioInput/RadioButton.tsx +0 -98
  94. package/src/components/RadioInput/RadioInput.tsx +0 -99
  95. package/src/components/RadioInput/instruments.ts +0 -16
  96. package/src/components/Spellbook/QuickSpells.tsx +0 -120
  97. package/src/components/Spellbook/Spell.tsx +0 -201
  98. package/src/components/Spellbook/Spellbook.tsx +0 -144
  99. package/src/components/Spellbook/SpellbookShortcuts.tsx +0 -77
  100. package/src/components/Spellbook/constants.ts +0 -12
  101. package/src/components/Spellbook/mockSpells.ts +0 -60
  102. package/src/components/itemSelector/ItemSelector.tsx +0 -136
  103. package/src/constants/uiDevices.ts +0 -5
  104. package/src/mocks/.DS_Store +0 -0
  105. package/src/mocks/atlas/.DS_Store +0 -0
  106. package/src/stories/CaracterStatus.stories.tsx +0 -29
  107. package/src/stories/ChatDeprecated.stories.tsx +0 -170
  108. package/src/stories/CircullarController.stories.tsx +0 -33
  109. package/src/stories/CraftBook.stories.tsx +0 -40
  110. package/src/stories/DropdownSelectorContainer.stories.tsx +0 -41
  111. package/src/stories/ItemQuantitySelector.stories.tsx +0 -26
  112. package/src/stories/ItemSelector.stories.tsx +0 -77
  113. package/src/stories/QuickSpells.stories.tsx +0 -38
  114. package/src/stories/RadioInput.stories.tsx +0 -35
  115. package/src/stories/Spellbook.stories.tsx +0 -107
@@ -1,230 +0,0 @@
1
- import { ICraftableItem, ItemSubType } from '@rpg-engine/shared';
2
- import React, { useState } from 'react';
3
- import styled from 'styled-components';
4
- import { Button, ButtonTypes } from '../Button';
5
- import { DraggableContainer } from '../DraggableContainer';
6
- import { Dropdown, IOptionsProps } from '../Dropdown';
7
- import { RPGUIContainerTypes } from '../RPGUIContainer';
8
- import { SpriteFromAtlas } from '../shared/SpriteFromAtlas';
9
-
10
- export interface IItemCraftSelectorProps {
11
- atlasJSON: any;
12
- atlasIMG: any;
13
- onClose: () => void;
14
- onSelect: (value: string) => void;
15
- onCraftItem: (value: string | undefined) => void;
16
- craftablesItems: ICraftableItem[];
17
- }
18
-
19
- export interface ShowMessage {
20
- show: boolean;
21
- index: number;
22
- }
23
-
24
- export const CraftBook: React.FC<IItemCraftSelectorProps> = ({
25
- atlasIMG,
26
- atlasJSON,
27
- onClose,
28
- onSelect,
29
- onCraftItem,
30
- craftablesItems,
31
- }) => {
32
- let optionsId: number = 0;
33
- const [isShown, setIsShown] = useState<ShowMessage>({
34
- show: false,
35
- index: 200,
36
- });
37
- const [craftItem, setCraftItem] = useState<string>();
38
-
39
- const getDropdownOptions = () => {
40
- const options: IOptionsProps[] = [];
41
-
42
- Object.keys(ItemSubType).forEach(key => {
43
- if (key === 'CraftingResource' || key === 'DeadBody') {
44
- return; // we can't craft crafting resouces...
45
- }
46
-
47
- options.push({
48
- id: optionsId,
49
- value: key,
50
- option: key,
51
- });
52
- optionsId += 1;
53
- });
54
-
55
- return options;
56
- };
57
-
58
- const modifyString = (str: string) => {
59
- // Split the string by "/" and "."
60
- let parts = str.split('/');
61
- let fileName = parts[parts.length - 1];
62
- parts = fileName.split('.');
63
- let name = parts[0];
64
-
65
- // Replace all occurrences of "-" with " "
66
- name = name.replace(/-/g, ' ');
67
-
68
- // Uppercase the first word
69
- let words = name.split(' ');
70
- let firstWord = words[0].slice(0, 1).toUpperCase() + words[0].slice(1);
71
- let modifiedWords = [firstWord].concat(words.slice(1));
72
- name = modifiedWords.join(' ');
73
-
74
- return name;
75
- };
76
-
77
- const handleClick = (value: string) => {
78
- setCraftItem(value);
79
- };
80
-
81
- return (
82
- <DraggableContainer
83
- type={RPGUIContainerTypes.Framed}
84
- width="500px"
85
- cancelDrag=".equipment-container-body .arrow-selector .rpgui-dropdown-imp"
86
- onCloseButton={() => {
87
- if (onClose) {
88
- onClose();
89
- }
90
- }}
91
- >
92
- <div style={{ width: '100%' }}>
93
- <Title>{'Craftbook'}</Title>
94
- <Subtitle>{'Select an item to craft'}</Subtitle>
95
- <hr className="golden" />
96
- </div>
97
- <Dropdown
98
- options={getDropdownOptions()}
99
- onChange={value => onSelect(value)}
100
- />
101
- <RadioInputScroller>
102
- {craftablesItems?.map((option, index) => (
103
- <RadioOptionsWrapper key={index}>
104
- <SpriteAtlasWrapper>
105
- <SpriteFromAtlas
106
- atlasIMG={atlasIMG}
107
- atlasJSON={atlasJSON}
108
- spriteKey={option.texturePath}
109
- imgScale={3}
110
- grayScale={!option.canCraft}
111
- />
112
- </SpriteAtlasWrapper>
113
- <div>
114
- <input
115
- className="rpgui-radio"
116
- type="radio"
117
- value={option.name}
118
- name="test"
119
- disabled={!option.canCraft}
120
- checked={craftItem === option.key}
121
- onChange={() => handleClick(option.key)}
122
- />
123
- <label
124
- onClick={() => {
125
- handleClick(option.key);
126
- }}
127
- onTouchStart={() => {
128
- setIsShown({ show: true, index: index });
129
- }}
130
- style={{ display: 'flex', alignItems: 'center' }}
131
- onMouseEnter={() => setIsShown({ show: true, index: index })}
132
- onMouseLeave={() => setIsShown({ show: false, index: index })}
133
- >
134
- {modifyString(option.name)}
135
- </label>
136
-
137
- {isShown &&
138
- isShown.index === index &&
139
- option.ingredients.map((option, index) => (
140
- <Recipes key={index}>
141
- <SpriteFromAtlas
142
- atlasIMG={atlasIMG}
143
- atlasJSON={atlasJSON}
144
- spriteKey={option.texturePath}
145
- imgScale={1}
146
- />
147
- <StyledItem>
148
- {modifyString(option.key)} ({option.qty}x)
149
- </StyledItem>
150
- </Recipes>
151
- ))}
152
- </div>
153
- </RadioOptionsWrapper>
154
- ))}
155
- </RadioInputScroller>
156
- <ButtonWrapper>
157
- <Button
158
- buttonType={ButtonTypes.RPGUIButton}
159
- onClick={onClose}
160
- onTouchStart={onClose}
161
- >
162
- Cancel
163
- </Button>
164
- <Button
165
- buttonType={ButtonTypes.RPGUIButton}
166
- onClick={() => onCraftItem(craftItem)}
167
- onTouchStart={() => onCraftItem(craftItem)}
168
- >
169
- Craft
170
- </Button>
171
- </ButtonWrapper>
172
- </DraggableContainer>
173
- );
174
- };
175
-
176
- const StyledItem = styled.div`
177
- margin-left: 10px;
178
- `;
179
-
180
- const Recipes = styled.div`
181
- font-size: 0.6rem;
182
- color: yellow !important;
183
- margin-bottom: 3px;
184
- display: flex;
185
- align-items: center;
186
-
187
- .sprite-from-atlas-img {
188
- top: 0px;
189
- left: 0px;
190
- }
191
- `;
192
-
193
- const Title = styled.h1`
194
- font-size: 0.6rem;
195
- color: yellow !important;
196
- `;
197
- const Subtitle = styled.h1`
198
- font-size: 0.4rem;
199
- color: yellow !important;
200
- `;
201
-
202
- const RadioInputScroller = styled.div`
203
- padding-left: 15px;
204
- padding-top: 10px;
205
- width: 100%;
206
- margin-top: 1rem;
207
- align-items: center;
208
- margin-left: 20px;
209
- align-items: flex-start;
210
- overflow-y: scroll;
211
- height: 360px;
212
- -webkit-overflow-scrolling: touch;
213
- `;
214
-
215
- const SpriteAtlasWrapper = styled.div`
216
- margin-right: 40px;
217
- `;
218
-
219
- const RadioOptionsWrapper = styled.div`
220
- display: flex;
221
- align-items: stretch;
222
- margin-bottom: 40px;
223
- `;
224
-
225
- const ButtonWrapper = styled.div`
226
- display: flex;
227
- justify-content: space-around;
228
- padding-top: 20px;
229
- width: 100%;
230
- `;
@@ -1,46 +0,0 @@
1
- import { ICraftableItem } from '@rpg-engine/shared';
2
-
3
- export const craftableItems: ICraftableItem[] = [
4
- {
5
- key: 'bandana',
6
- name: 'Bandana',
7
- canCraft: true,
8
- texturePath: 'accessories/bandana.png',
9
- ingredients: [
10
- {
11
- key: 'leather',
12
- name: 'leather',
13
- qty: 10,
14
- texturePath: 'crafting-resources/leather.png',
15
- },
16
- ],
17
- },
18
- {
19
- key: 'bandana1',
20
- name: 'Bandana',
21
- canCraft: true,
22
- texturePath: 'accessories/bandana.png',
23
- ingredients: [
24
- {
25
- key: 'leather',
26
- name: 'leather',
27
- qty: 10,
28
- texturePath: 'crafting-resources/leather.png',
29
- },
30
- ],
31
- },
32
- {
33
- key: 'bandana2',
34
- name: 'Bandana',
35
- canCraft: true,
36
- texturePath: 'accessories/bandana.png',
37
- ingredients: [
38
- {
39
- key: 'leather',
40
- name: 'leather',
41
- qty: 10,
42
- texturePath: 'crafting-resources/leather.png',
43
- },
44
- ],
45
- },
46
- ];
@@ -1,42 +0,0 @@
1
- import React from 'react';
2
- import styled from 'styled-components';
3
- import { uiFonts } from '../constants/uiFonts';
4
- import { Dropdown } from './Dropdown';
5
-
6
- interface IDropdownSelectorOption {
7
- id: string;
8
- name: string;
9
- }
10
-
11
- export interface IDropdownSelectorContainer {
12
- onChange: (id: string) => void;
13
- options: IDropdownSelectorOption[];
14
- details?: string;
15
- title: string;
16
- }
17
-
18
- export const DropdownSelectorContainer: React.FC<IDropdownSelectorContainer> = ({
19
- title,
20
- onChange,
21
- options,
22
- details,
23
- }) => {
24
- return (
25
- <div>
26
- <p>{title}</p>
27
- <Dropdown
28
- options={options.map((option, index) => ({
29
- option: option.name,
30
- value: option.id,
31
- id: index,
32
- }))}
33
- onChange={onChange}
34
- />
35
- <Details>{details}</Details>
36
- </div>
37
- );
38
- };
39
-
40
- const Details = styled.p`
41
- font-size: ${uiFonts.size.xsmall} !important;
42
- `;
@@ -1,142 +0,0 @@
1
- import React, { useEffect, useRef, useState } from 'react';
2
- import styled from 'styled-components';
3
- import { Button, ButtonTypes } from '../../Button';
4
- import { Input } from '../../Input';
5
- import { RPGUIContainer, RPGUIContainerTypes } from '../../RPGUIContainer';
6
- import { RangeSlider, RangeSliderType } from '../../RangeSlider';
7
-
8
- export interface IItemQuantitySelectorProps {
9
- quantity: number;
10
- onConfirm: (quantity: number) => void;
11
- onClose: () => void;
12
- }
13
-
14
- export const ItemQuantitySelector: React.FC<IItemQuantitySelectorProps> = ({
15
- quantity,
16
- onConfirm,
17
- onClose,
18
- }) => {
19
- const [value, setValue] = useState(quantity);
20
-
21
- const inputRef = useRef<HTMLInputElement>(null);
22
-
23
- useEffect(() => {
24
- if (inputRef.current) {
25
- inputRef.current.focus();
26
- inputRef.current.select();
27
-
28
- const closeSelector = (e: KeyboardEvent) => {
29
- if (e.key === 'Escape') {
30
- onClose();
31
- }
32
- };
33
-
34
- document.addEventListener('keydown', closeSelector);
35
-
36
- return () => {
37
- document.removeEventListener('keydown', closeSelector);
38
- };
39
- }
40
-
41
- return () => {};
42
- }, []);
43
-
44
- return (
45
- <StyledContainer type={RPGUIContainerTypes.Framed} width="25rem">
46
- <CloseButton
47
- className="container-close"
48
- onClick={onClose}
49
- onTouchStart={onClose}
50
- >
51
- X
52
- </CloseButton>
53
- <h2>Select quantity to move</h2>
54
- <StyledForm
55
- style={{ width: '100%' }}
56
- onSubmit={e => {
57
- e.preventDefault();
58
-
59
- const numberValue = Number(value);
60
-
61
- if (Number.isNaN(numberValue)) {
62
- return;
63
- }
64
-
65
- onConfirm(Math.max(1, Math.min(quantity, numberValue)));
66
- }}
67
- noValidate
68
- >
69
- <StyledInput
70
- innerRef={inputRef}
71
- placeholder="Enter quantity"
72
- type="number"
73
- min={1}
74
- max={quantity}
75
- value={value}
76
- onChange={e => {
77
- if (Number(e.target.value) >= quantity) {
78
- setValue(quantity);
79
- return;
80
- }
81
-
82
- setValue((e.target.value as unknown) as number);
83
- }}
84
- onBlur={e => {
85
- const newValue = Math.max(
86
- 1,
87
- Math.min(quantity, Number(e.target.value))
88
- );
89
-
90
- setValue(newValue);
91
- }}
92
- />
93
- <RangeSlider
94
- type={RangeSliderType.Slider}
95
- valueMin={1}
96
- valueMax={quantity}
97
- width="100%"
98
- onChange={setValue}
99
- value={value}
100
- />
101
- <Button buttonType={ButtonTypes.RPGUIButton} type="submit">
102
- Confirm
103
- </Button>
104
- </StyledForm>
105
- </StyledContainer>
106
- );
107
- };
108
-
109
- const StyledContainer = styled(RPGUIContainer)`
110
- display: flex;
111
- flex-direction: column;
112
- align-items: center;
113
- `;
114
-
115
- const StyledForm = styled.form`
116
- display: flex;
117
- flex-direction: column;
118
- align-items: center;
119
- width: 100%;
120
- `;
121
- const StyledInput = styled(Input)`
122
- text-align: center;
123
-
124
- &::-webkit-outer-spin-button,
125
- &::-webkit-inner-spin-button {
126
- -webkit-appearance: none;
127
- margin: 0;
128
- }
129
-
130
- &[type='number'] {
131
- -moz-appearance: textfield;
132
- }
133
- `;
134
-
135
- const CloseButton = styled.div`
136
- position: absolute;
137
- top: 3px;
138
- right: 0px;
139
- color: white;
140
- z-index: 22;
141
- font-size: 0.8rem;
142
- `;
Binary file
@@ -1,98 +0,0 @@
1
- import { capitalize } from 'lodash';
2
- import React from 'react';
3
- import styled from 'styled-components';
4
- import { uiColors } from '../../constants/uiColors';
5
- import { Ellipsis } from '../shared/Ellipsis';
6
-
7
- export interface IRadioProps {
8
- title:string,
9
- subtitle:string,
10
- instrument:string|null
11
- setInstrument: (value: string) => void;
12
- }
13
-
14
- export const RadioButton: React.FC<IRadioProps> = ({
15
- title,
16
- subtitle,
17
- instrument,
18
- setInstrument,
19
- }) => {
20
- const isRadioSelected=(value:string):boolean=>instrument===value;
21
-
22
- const handleClick = (e:string):void => {
23
- setInstrument(e)
24
- };
25
-
26
- return (
27
- <ItemWrapper onClick={() => handleClick(title)} >
28
- <ItemIconContainer>
29
- <SpriteContainer id='elemento-radio'>
30
- <input
31
- type='radio'
32
- name='react-radio-btn'
33
- className='rpgui-radio'
34
- value={title}
35
- checked={isRadioSelected(title)}
36
- onChange={(e)=>(e)}
37
- />
38
- </SpriteContainer>
39
- </ItemIconContainer>
40
- <ItemNameContainer>
41
- <NameValue onClick={() => handleClick(title)}>
42
- <p>{title}</p>
43
- <p>
44
- <Ellipsis maxLines={1} maxWidth="250px">
45
- {capitalize(subtitle)}
46
- </Ellipsis>
47
- </p>
48
-
49
- </NameValue>
50
- </ItemNameContainer>
51
- </ItemWrapper>
52
- );
53
- };
54
-
55
- const ItemWrapper = styled.div`
56
- width: 100%;
57
- margin: auto;
58
- display: flex;
59
- justify-content: space-between;
60
- margin-bottom: 1rem;
61
-
62
- &:hover {
63
- background-color: ${uiColors.darkGray};
64
- }
65
- padding: 0.5rem;
66
- `;
67
-
68
-
69
- const ItemNameContainer = styled.div`
70
- flex: 80%;
71
- `;
72
-
73
- const ItemIconContainer = styled.div`
74
- display: flex;
75
- justify-content: flex-start;
76
- align-items: center;
77
-
78
- flex: 0 0 58px;
79
- `;
80
-
81
- const SpriteContainer = styled.div`
82
- input {
83
- display:block !important;
84
- &:hover {
85
- cursor: pointer;
86
- }
87
- };
88
- position: relative;
89
- top: -0.5rem;
90
- left: 0.5rem;
91
- `;
92
-
93
- const NameValue = styled.div`
94
- p {
95
- font-size: 0.75rem;
96
- margin: 0;
97
- }
98
- `;
@@ -1,99 +0,0 @@
1
- import React, { useState } from 'react';
2
- import styled from 'styled-components';
3
- import { DraggableContainer } from '../DraggableContainer';
4
- import { RPGUIContainerTypes } from '../RPGUIContainer';
5
- import { Button, ButtonTypes } from '../Button';
6
- import { RadioButton } from './RadioButton';
7
-
8
- export interface IRadioItems {
9
- title: string;
10
- subtitle: string;
11
- }
12
- export interface IRadioInput {
13
- title:string,
14
- subtitle:string,
15
- onSelect:(a:string)=>void,
16
- onCancel:()=>void,
17
- items:IRadioItems[]
18
- }
19
-
20
- export const RadioInput: React.FC<IRadioInput>=({title,subtitle,onSelect,onCancel,items})=>{
21
- const [instrument, setInstrument] = useState('')
22
-
23
- const confirHandler=()=>{
24
- if(instrument){
25
- onSelect(instrument)
26
- }
27
- }
28
-
29
- return (
30
- <DraggableContainer
31
- type={RPGUIContainerTypes.Framed}
32
- onCloseButton={() => {
33
- if (onCancel) onCancel();
34
- }}
35
- width="500px"
36
- cancelDrag=".equipment-container-body .arrow-selector"
37
- >
38
- <>
39
- <div style={{ width: '100%' }}>
40
- <Title>{title}</Title>
41
- <Subtitle>{subtitle}</Subtitle>
42
- <hr className="golden" />
43
- </div>
44
- <RadioInputScroller>{
45
- items.map((item,index)=>(
46
- <RadioButton
47
- key={`${item.title}_${index}`}
48
- title={item.title}
49
- subtitle={item.subtitle}
50
- setInstrument={setInstrument}
51
- instrument={instrument}
52
- />
53
- ))
54
- }
55
- </RadioInputScroller>
56
- <ButtonWrapper>
57
- <Button
58
- buttonType={ButtonTypes.RPGUIButton}
59
- onClick={() => onCancel()}
60
- >
61
- Cancel
62
- </Button>
63
- <Button
64
- buttonType={ButtonTypes.RPGUIButton}
65
- onClick={ confirHandler}
66
- >
67
- Select
68
- </Button>
69
-
70
- </ButtonWrapper>
71
-
72
- </>
73
- </DraggableContainer>
74
- )
75
- }
76
- const RadioInputScroller = styled.div`
77
- overflow-y: scroll;
78
- height: 390px;
79
- width: 100%;
80
- margin-top: 1rem;
81
- `;
82
-
83
- const Title = styled.h1`
84
- z-index: 22;
85
- font-size: 0.6rem;
86
- color: yellow !important;
87
- `;
88
- const Subtitle = styled.h1`
89
- z-index: 22;
90
- font-size: 0.4rem;
91
- color: yellow !important;
92
- `;
93
- const ButtonWrapper = styled.div`
94
- display: flex;
95
- justify-content: flex-end;
96
- padding-top: 20px;
97
- width: 100%;
98
- margin-top: 1rem;
99
- `;
@@ -1,16 +0,0 @@
1
-
2
- export const Itools:{title:string,subtitle:string}[] = [
3
- {
4
- title : 'Ax',
5
- subtitle:'Cut down trees',
6
- }, {
7
- title : 'Sawing',
8
- subtitle:'cut the wood into small pieces',
9
- }, {
10
- title : 'Sickle',
11
- subtitle:'harvesting cereal plants',
12
- }, {
13
- title : 'Bow',
14
- subtitle:'Hunting monsters',
15
- },
16
- ];