@rpg-engine/long-bow 0.1.82 → 0.1.85
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/Button.d.ts +1 -0
- package/dist/components/Equipment/EquipmentSet.d.ts +3 -1
- package/dist/components/Item/Cards/ItemTooltip.d.ts +6 -0
- package/dist/components/Item/Inventory/ItemContainer.d.ts +3 -5
- package/dist/components/Item/Inventory/ItemContainerTypes.d.ts +4 -0
- package/dist/components/Item/Inventory/ItemSlot.d.ts +4 -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/components/shared/SpriteIcon.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/long-bow.cjs.development.js +407 -813
- 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 +402 -811
- package/dist/long-bow.esm.js.map +1 -1
- 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 +2 -2
- package/src/components/Button.tsx +3 -2
- package/src/components/Equipment/EquipmentSet.tsx +97 -142
- package/src/components/Item/Cards/ItemTooltip.tsx +32 -0
- package/src/components/Item/Inventory/ItemContainer.tsx +47 -95
- package/src/components/Item/Inventory/ItemContainerTypes.ts +4 -0
- package/src/components/Item/Inventory/ItemSlot.tsx +145 -104
- package/src/components/NPCDialog/QuestionDialog/QuestionDialog.tsx +0 -3
- 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/RelativeListMenu.tsx +83 -0
- package/src/components/SkillsContainer.tsx +15 -1
- package/src/components/shared/SpriteIcon.tsx +4 -2
- package/src/index.tsx +1 -0
- package/src/mocks/atlas/icons/icons.json +494 -62
- package/src/mocks/atlas/icons/icons.png +0 -0
- package/src/mocks/itemContainer.mocks.ts +1 -1
- 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 +50 -0
- package/src/stories/ItemContainer.stories.tsx +50 -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/dist/components/Item/Cards/ItemCard.d.ts +0 -9
- package/dist/components/store/UI.store.d.ts +0 -34
- package/src/components/Item/Cards/ItemCard.tsx +0 -36
- package/src/components/store/UI.store.ts +0 -192
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { IButtonProps } from '../../src/components/Button';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IButtonProps>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IChatMessage } from '@rpg-engine/shared';
|
|
2
|
+
import { Meta } from '@storybook/react';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IChatMessage>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { ICheckProps } from '../../src/components/CheckButton';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, ICheckProps>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { IDraggableContainerProps } from '../../src/components/DraggableContainer';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IDraggableContainerProps>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { IDropdownProps } from '../../src/components/Dropdown';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IDropdownProps>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { IEquipmentSetProps } from '../../src/components/Equipment/EquipmentSet';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IEquipmentSetProps>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { IItemContainerProps } from '../../src/components/Item/Inventory/ItemContainer';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IItemContainerProps>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { IListMenuProps } from '../../src/components/ListMenu';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IListMenuProps>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { ITabsContainer } from '../../src/components/Multitab/TabsContainer';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Brown: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, ITabsContainer>;
|
|
6
|
+
export declare const Gray: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, ITabsContainer>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { INPCDialogProps } from '../../src/components/NPCDialog/NPCDialog';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const TextAndThumbnail: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, INPCDialogProps>;
|
|
6
|
+
export declare const TextOnly: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, INPCDialogProps>;
|
|
7
|
+
export declare const Question: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, INPCDialogProps>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IBarProps } from '../../src/components/ProgressBar';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: React.FC<IBarProps>;
|
|
6
|
+
};
|
|
7
|
+
export default _default;
|
|
8
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IBarProps>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { IPropertySelectProps } from '../components/PropertySelect/PropertySelect';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IPropertySelectProps>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { IQuestInfoProps } from '../../src/components/QuestInfo/QuestInfo';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IQuestInfoProps>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { IRPGUIContainerProps } from '../../src/components/RPGUIContainer';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IRPGUIContainerProps>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { IRadioProps } from '../../src/components/RadioButton';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IRadioProps>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { IRangeSliderProps } from '../../src/components/RangeSlider';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IRangeSliderProps>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { IListMenuProps } from '../../src/components/ScrollList';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IListMenuProps>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { ISimpleProgressBarProps } from '../../src/components/SimpleProgressBar';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, ISimpleProgressBarProps>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { ISkillProgressBarProps } from '../../src/components/SkillProgressBar';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, ISkillProgressBarProps>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { ISkillContainerProps } from '../../src/components/SkillsContainer';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, ISkillContainerProps>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { IInputProps } from '../../src/components/Input';
|
|
3
|
+
import { ITextArea } from '../../src/components/TextArea';
|
|
4
|
+
declare const meta: Meta;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const Input: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IInputProps>;
|
|
7
|
+
export declare const TextArea: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, ITextArea>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpg-engine/long-bow",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.85",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"node": ">=10"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
|
-
"dev": "start-storybook -p 6006",
|
|
22
|
+
"dev": "yarn install && start-storybook -p 6006",
|
|
23
23
|
"start": "tsdx watch",
|
|
24
24
|
"build": "tsdx build",
|
|
25
25
|
"test": "tsdx test --passWithNoTests",
|
|
@@ -7,6 +7,7 @@ export enum ButtonTypes {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export interface IButtonProps {
|
|
10
|
+
disabled?: boolean;
|
|
10
11
|
children: React.ReactNode;
|
|
11
12
|
buttonType: ButtonTypes;
|
|
12
13
|
}
|
|
@@ -15,9 +16,9 @@ export const Button: React.FC<IButtonProps &
|
|
|
15
16
|
React.DetailedHTMLProps<
|
|
16
17
|
React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
17
18
|
HTMLButtonElement
|
|
18
|
-
>> = ({ children, buttonType, ...props }) => {
|
|
19
|
+
>> = ({ disabled = false, children, buttonType, ...props }) => {
|
|
19
20
|
return (
|
|
20
|
-
<ButtonContainer className={`${buttonType}`} {...props}>
|
|
21
|
+
<ButtonContainer className={`${buttonType}`} disabled={disabled} {...props}>
|
|
21
22
|
<p>{children}</p>
|
|
22
23
|
</ButtonContainer>
|
|
23
24
|
);
|
|
@@ -3,165 +3,120 @@ import {
|
|
|
3
3
|
IItem,
|
|
4
4
|
IItemContainer,
|
|
5
5
|
ItemSlotType,
|
|
6
|
-
ItemSocketEvents,
|
|
7
6
|
} from '@rpg-engine/shared';
|
|
8
|
-
import
|
|
9
|
-
import React, { useState } from 'react';
|
|
7
|
+
import React from 'react';
|
|
10
8
|
import styled from 'styled-components';
|
|
11
|
-
import { IPosition } from '../../types/eventTypes';
|
|
12
9
|
import { DraggableContainer } from '../DraggableContainer';
|
|
13
|
-
import {
|
|
14
|
-
import { ItemSlot
|
|
15
|
-
import { ListMenu } from '../ListMenu';
|
|
10
|
+
import { SlotContainerType } from '../Item/Inventory/ItemContainerTypes';
|
|
11
|
+
import { ItemSlot } from '../Item/Inventory/ItemSlot';
|
|
16
12
|
import { RPGUIContainerTypes } from '../RPGUIContainer';
|
|
17
|
-
import { uiStore } from '../store/UI.store';
|
|
18
13
|
|
|
19
14
|
export interface IEquipmentSetProps {
|
|
20
15
|
equipmentSet: IEquipmentSet;
|
|
21
16
|
onClose?: () => void;
|
|
17
|
+
onItemClick?: (
|
|
18
|
+
item: IItem,
|
|
19
|
+
slotContainerType: SlotContainerType | null
|
|
20
|
+
) => void;
|
|
22
21
|
onMouseOver?: (e: any, slotIndex: number, item: IItem | null) => void;
|
|
23
|
-
|
|
22
|
+
onSelected?: (optionId: string) => void;
|
|
24
23
|
initialPosition?: { x: number; y: number };
|
|
25
24
|
}
|
|
26
25
|
|
|
27
|
-
export const EquipmentSet: React.FC<IEquipmentSetProps> =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} = equipmentSet;
|
|
26
|
+
export const EquipmentSet: React.FC<IEquipmentSetProps> = ({
|
|
27
|
+
equipmentSet,
|
|
28
|
+
onClose,
|
|
29
|
+
onMouseOver,
|
|
30
|
+
onSelected,
|
|
31
|
+
onItemClick,
|
|
32
|
+
}) => {
|
|
33
|
+
const {
|
|
34
|
+
neck,
|
|
35
|
+
leftHand,
|
|
36
|
+
ring,
|
|
37
|
+
head,
|
|
38
|
+
armor,
|
|
39
|
+
legs,
|
|
40
|
+
boot,
|
|
41
|
+
inventory,
|
|
42
|
+
rightHand,
|
|
43
|
+
accessory,
|
|
44
|
+
} = equipmentSet;
|
|
47
45
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
46
|
+
const equipmentData = [
|
|
47
|
+
neck,
|
|
48
|
+
leftHand,
|
|
49
|
+
ring,
|
|
50
|
+
head,
|
|
51
|
+
armor,
|
|
52
|
+
legs,
|
|
53
|
+
boot,
|
|
54
|
+
inventory,
|
|
55
|
+
rightHand,
|
|
56
|
+
accessory,
|
|
57
|
+
];
|
|
60
58
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
59
|
+
const equipmentMaskSlots = [
|
|
60
|
+
ItemSlotType.Neck,
|
|
61
|
+
ItemSlotType.LeftHand,
|
|
62
|
+
ItemSlotType.Ring,
|
|
63
|
+
ItemSlotType.Head,
|
|
64
|
+
ItemSlotType.Torso,
|
|
65
|
+
ItemSlotType.Legs,
|
|
66
|
+
ItemSlotType.Feet,
|
|
67
|
+
ItemSlotType.Inventory,
|
|
68
|
+
ItemSlotType.RightHand,
|
|
69
|
+
ItemSlotType.Accessory,
|
|
70
|
+
];
|
|
73
71
|
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
);
|
|
72
|
+
const onRenderEquipmentSlotRange = (start: number, end: number) => {
|
|
73
|
+
const equipmentRange = equipmentData.slice(start, end);
|
|
74
|
+
const slotMaksRange = equipmentMaskSlots.slice(start, end);
|
|
78
75
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
76
|
+
return equipmentRange.map((data, i) => {
|
|
77
|
+
const item = data as IItem;
|
|
78
|
+
const itemContainer =
|
|
79
|
+
(item && (item.itemContainer as IItemContainer)) ?? null;
|
|
80
|
+
return (
|
|
81
|
+
<ItemSlot
|
|
82
|
+
key={i}
|
|
83
|
+
slotIndex={i}
|
|
84
|
+
item={item}
|
|
85
|
+
itemContainer={itemContainer}
|
|
86
|
+
slotContainerType={SlotContainerType.EQUIPMENT_SET}
|
|
87
|
+
slotSpriteMask={slotMaksRange[i]}
|
|
88
|
+
onMouseOver={(event, slotIndex, item) => {
|
|
89
|
+
if (onMouseOver) onMouseOver(event, slotIndex, item);
|
|
90
|
+
}}
|
|
91
|
+
onClick={(item, slotContainerType) => {
|
|
92
|
+
if (onItemClick) onItemClick(item, slotContainerType);
|
|
93
|
+
}}
|
|
94
|
+
onSelected={(optionId: string) => {
|
|
95
|
+
if (onSelected) onSelected(optionId);
|
|
96
|
+
}}
|
|
97
|
+
/>
|
|
98
|
+
);
|
|
99
|
+
});
|
|
100
|
+
};
|
|
88
101
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
slotContainerType={SlotContainerType.EQUIPMENT_SET}
|
|
108
|
-
slotSpriteMask={slotMaksRange[i]}
|
|
109
|
-
onMouseOver={handleOnMouseHover}
|
|
110
|
-
onMouseOut={() => {
|
|
111
|
-
uiStore.clearItemHoverDetail();
|
|
112
|
-
}}
|
|
113
|
-
onClick={uiStore.handleOnItemClick}
|
|
114
|
-
onCancelContextMenu={() => {
|
|
115
|
-
uiStore.clearContextMenu();
|
|
116
|
-
}}
|
|
117
|
-
/>
|
|
118
|
-
);
|
|
119
|
-
});
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
return (
|
|
123
|
-
<DraggableContainer
|
|
124
|
-
title={'Equipments'}
|
|
125
|
-
type={RPGUIContainerTypes.Framed}
|
|
126
|
-
onCloseButton={() => {
|
|
127
|
-
if (onClose) onClose();
|
|
128
|
-
}}
|
|
129
|
-
width="330px"
|
|
130
|
-
cancelDrag=".equipment-container-body"
|
|
131
|
-
onPositionChange={({ x, y }) => {
|
|
132
|
-
setDraggablePosition({ x, y });
|
|
133
|
-
}}
|
|
134
|
-
onOutsideClick={() => {
|
|
135
|
-
uiStore.clearContextMenu();
|
|
136
|
-
uiStore.clearItemHoverDetail();
|
|
137
|
-
}}
|
|
138
|
-
>
|
|
139
|
-
<EquipmentSetContainer className="equipment-container-body">
|
|
140
|
-
<EquipmentColumn>{onRenderEquipmentSlotRange(0, 3)}</EquipmentColumn>
|
|
141
|
-
<EquipmentColumn>{onRenderEquipmentSlotRange(3, 7)}</EquipmentColumn>
|
|
142
|
-
<EquipmentColumn>{onRenderEquipmentSlotRange(7, 10)}</EquipmentColumn>
|
|
143
|
-
</EquipmentSetContainer>
|
|
144
|
-
|
|
145
|
-
{uiStore.contextMenu?.visible ? (
|
|
146
|
-
<ListMenu
|
|
147
|
-
x={uiStore.contextMenu.posX - draggablePosition.x}
|
|
148
|
-
y={uiStore.contextMenu.posY - draggablePosition.y}
|
|
149
|
-
options={uiStore.contextMenu.contextActions}
|
|
150
|
-
onSelected={onSelected}
|
|
151
|
-
/>
|
|
152
|
-
) : null}
|
|
153
|
-
|
|
154
|
-
{uiStore.onHoverDetail?.visible ? (
|
|
155
|
-
<ItemCard
|
|
156
|
-
item={uiStore.onHoverDetail.item}
|
|
157
|
-
x={uiStore.onHoverDetail.posX - draggablePosition.x}
|
|
158
|
-
y={uiStore.onHoverDetail.posY - draggablePosition.y}
|
|
159
|
-
/>
|
|
160
|
-
) : null}
|
|
161
|
-
</DraggableContainer>
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
);
|
|
102
|
+
return (
|
|
103
|
+
<DraggableContainer
|
|
104
|
+
title={'Equipments'}
|
|
105
|
+
type={RPGUIContainerTypes.Framed}
|
|
106
|
+
onCloseButton={() => {
|
|
107
|
+
if (onClose) onClose();
|
|
108
|
+
}}
|
|
109
|
+
width="330px"
|
|
110
|
+
cancelDrag=".equipment-container-body"
|
|
111
|
+
>
|
|
112
|
+
<EquipmentSetContainer className="equipment-container-body">
|
|
113
|
+
<EquipmentColumn>{onRenderEquipmentSlotRange(0, 3)}</EquipmentColumn>
|
|
114
|
+
<EquipmentColumn>{onRenderEquipmentSlotRange(3, 7)}</EquipmentColumn>
|
|
115
|
+
<EquipmentColumn>{onRenderEquipmentSlotRange(7, 10)}</EquipmentColumn>
|
|
116
|
+
</EquipmentSetContainer>
|
|
117
|
+
</DraggableContainer>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
165
120
|
|
|
166
121
|
const EquipmentSetContainer = styled.div`
|
|
167
122
|
width: inherit;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
interface IProps {
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const ItemTooltip: React.FC<IProps> = ({ label }) => {
|
|
9
|
+
return (
|
|
10
|
+
<Container>
|
|
11
|
+
<div>{label}</div>
|
|
12
|
+
</Container>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const Container = styled.div`
|
|
17
|
+
z-index: 2;
|
|
18
|
+
position: absolute;
|
|
19
|
+
top: 1rem;
|
|
20
|
+
left: 4rem;
|
|
21
|
+
|
|
22
|
+
font-size: 0.5rem;
|
|
23
|
+
color: white;
|
|
24
|
+
background-color: black;
|
|
25
|
+
border-radius: 5px;
|
|
26
|
+
padding: 0.5rem;
|
|
27
|
+
min-width: 20px;
|
|
28
|
+
width: 100%;
|
|
29
|
+
text-align: center;
|
|
30
|
+
|
|
31
|
+
opacity: 0.75;
|
|
32
|
+
`;
|
|
@@ -1,109 +1,61 @@
|
|
|
1
|
-
import { IItem, IItemContainer
|
|
2
|
-
import
|
|
3
|
-
import React, { useState } from 'react';
|
|
1
|
+
import { IItem, IItemContainer } from '@rpg-engine/shared';
|
|
2
|
+
import React from 'react';
|
|
4
3
|
import styled from 'styled-components';
|
|
5
|
-
import { IPosition } from '../../../types/eventTypes';
|
|
6
4
|
import { SlotsContainer } from '../../Abstractions/SlotsContainer';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { ItemCard } from '../Cards/ItemCard';
|
|
10
|
-
import { ItemSlot, SlotContainerType } from './ItemSlot';
|
|
5
|
+
import { SlotContainerType } from './ItemContainerTypes';
|
|
6
|
+
import { ItemSlot } from './ItemSlot';
|
|
11
7
|
|
|
12
8
|
export interface IItemContainerProps {
|
|
13
9
|
itemContainer: IItemContainer;
|
|
14
10
|
onClose?: () => void;
|
|
11
|
+
onItemClick?: (
|
|
12
|
+
item: IItem,
|
|
13
|
+
slotContainerType: SlotContainerType | null
|
|
14
|
+
) => void;
|
|
15
15
|
onMouseOver?: (e: any, slotIndex: number, item: IItem | null) => void;
|
|
16
|
-
|
|
17
|
-
initialPosition?: { x: number; y: number };
|
|
16
|
+
onSelected?: (optionId: string) => void;
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
export const ItemContainer: React.FC<IItemContainerProps> =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const [draggablePosition, setDraggablePosition] = useState<IPosition>(
|
|
30
|
-
initialPosition
|
|
31
|
-
);
|
|
19
|
+
export const ItemContainer: React.FC<IItemContainerProps> = ({
|
|
20
|
+
itemContainer,
|
|
21
|
+
onClose,
|
|
22
|
+
onMouseOver,
|
|
23
|
+
onSelected,
|
|
24
|
+
onItemClick,
|
|
25
|
+
}) => {
|
|
26
|
+
const onRenderSlots = () => {
|
|
27
|
+
const slots = [];
|
|
32
28
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
for (let i = 0; i < itemContainer.slotQty; i++) {
|
|
30
|
+
slots.push(
|
|
31
|
+
<ItemSlot
|
|
32
|
+
key={i}
|
|
33
|
+
slotIndex={i}
|
|
34
|
+
item={itemContainer.slots?.[i] || null}
|
|
35
|
+
slotContainerType={SlotContainerType.INVENTORY}
|
|
36
|
+
onMouseOver={(event, slotIndex, item) => {
|
|
37
|
+
if (onMouseOver) onMouseOver(event, slotIndex, item);
|
|
38
|
+
}}
|
|
39
|
+
onClick={(item, slotContainerType) => {
|
|
40
|
+
if (onItemClick) onItemClick(item, slotContainerType);
|
|
41
|
+
}}
|
|
42
|
+
onSelected={(optionId: string) => {
|
|
43
|
+
if (onSelected) onSelected(optionId);
|
|
44
|
+
}}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
return slots;
|
|
49
|
+
};
|
|
42
50
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
slots.push(
|
|
52
|
-
<ItemSlot
|
|
53
|
-
key={i}
|
|
54
|
-
slotIndex={i}
|
|
55
|
-
item={itemContainer.slots?.[i] || null}
|
|
56
|
-
slotContainerType={SlotContainerType.INVENTORY}
|
|
57
|
-
onMouseOver={handleOnMouseHover}
|
|
58
|
-
onClick={uiStore.handleOnItemClick}
|
|
59
|
-
onMouseOut={() => {
|
|
60
|
-
uiStore.clearItemHoverDetail();
|
|
61
|
-
}}
|
|
62
|
-
onCancelContextMenu={() => {
|
|
63
|
-
uiStore.clearContextMenu();
|
|
64
|
-
}}
|
|
65
|
-
/>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
return slots;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
return (
|
|
72
|
-
<SlotsContainer
|
|
73
|
-
title={itemContainer.name || 'Container'}
|
|
74
|
-
onPositionChange={({ x, y }) => {
|
|
75
|
-
setDraggablePosition({ x, y });
|
|
76
|
-
}}
|
|
77
|
-
onOutsideClick={() => {
|
|
78
|
-
uiStore.clearContextMenu();
|
|
79
|
-
uiStore.clearItemHoverDetail();
|
|
80
|
-
}}
|
|
81
|
-
onClose={onClose}
|
|
82
|
-
>
|
|
83
|
-
<ItemsContainer className="item-container-body">
|
|
84
|
-
{onRenderSlots()}
|
|
85
|
-
</ItemsContainer>
|
|
86
|
-
|
|
87
|
-
{uiStore.contextMenu?.visible ? (
|
|
88
|
-
<ListMenu
|
|
89
|
-
x={uiStore.contextMenu.posX - draggablePosition.x}
|
|
90
|
-
y={uiStore.contextMenu.posY - draggablePosition.y}
|
|
91
|
-
options={uiStore.contextMenu.contextActions}
|
|
92
|
-
onSelected={onSelected}
|
|
93
|
-
/>
|
|
94
|
-
) : null}
|
|
95
|
-
|
|
96
|
-
{uiStore.onHoverDetail?.visible ? (
|
|
97
|
-
<ItemCard
|
|
98
|
-
item={uiStore.onHoverDetail.item}
|
|
99
|
-
x={uiStore.onHoverDetail.posX - draggablePosition.x}
|
|
100
|
-
y={uiStore.onHoverDetail.posY - draggablePosition.y}
|
|
101
|
-
/>
|
|
102
|
-
) : null}
|
|
103
|
-
</SlotsContainer>
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
);
|
|
51
|
+
return (
|
|
52
|
+
<SlotsContainer title={itemContainer.name || 'Container'} onClose={onClose}>
|
|
53
|
+
<ItemsContainer className="item-container-body">
|
|
54
|
+
{onRenderSlots()}
|
|
55
|
+
</ItemsContainer>
|
|
56
|
+
</SlotsContainer>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
107
59
|
|
|
108
60
|
const ItemsContainer = styled.div`
|
|
109
61
|
max-width: 280px;
|