@rpg-engine/long-bow 0.3.87 → 0.3.89
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/Item/Inventory/ItemSlot.d.ts +1 -0
- package/dist/long-bow.cjs.development.js +30 -12
- 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 +30 -12
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/CircularController/CircularController.tsx +1 -0
- package/src/components/Item/Inventory/ItemContainer.tsx +10 -6
- package/src/components/Item/Inventory/ItemSlot.tsx +14 -0
- package/src/components/Shortcuts/Shortcuts.tsx +1 -0
- package/src/components/Shortcuts/ShortcutsSetter.tsx +8 -1
- package/src/components/TradingMenu/TradingItemRow.tsx +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpg-engine/long-bow",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.89",
|
|
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.7.
|
|
86
|
+
"@rpg-engine/shared": "^0.7.40",
|
|
87
87
|
"dayjs": "^1.11.2",
|
|
88
88
|
"font-awesome": "^4.7.0",
|
|
89
89
|
"fs-extra": "^10.1.0",
|
|
@@ -88,6 +88,12 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
|
|
|
88
88
|
});
|
|
89
89
|
const [settingShortcutIndex, setSettingShortcutIndex] = useState(-1);
|
|
90
90
|
|
|
91
|
+
const handleSetShortcut = (item: IItem, index: number) => {
|
|
92
|
+
if (item.type === ItemType.Consumable || item.type === ItemType.Tool) {
|
|
93
|
+
setItemShortcut?.(item.key, index);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
91
97
|
const onRenderSlots = () => {
|
|
92
98
|
const slots = [];
|
|
93
99
|
|
|
@@ -106,12 +112,7 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
|
|
|
106
112
|
if (settingShortcutIndex !== -1) {
|
|
107
113
|
setSettingShortcutIndex(-1);
|
|
108
114
|
|
|
109
|
-
|
|
110
|
-
itemType === ItemType.Consumable ||
|
|
111
|
-
itemType === ItemType.Tool
|
|
112
|
-
) {
|
|
113
|
-
setItemShortcut?.(item.key, settingShortcutIndex);
|
|
114
|
-
}
|
|
115
|
+
handleSetShortcut(item, settingShortcutIndex);
|
|
115
116
|
} else if (onItemClick) onItemClick(item, itemType, containerType);
|
|
116
117
|
}}
|
|
117
118
|
onSelected={(optionId: string, item: IItem) => {
|
|
@@ -145,6 +146,9 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
|
|
|
145
146
|
atlasJSON={atlasJSON}
|
|
146
147
|
isSelectingShortcut={settingShortcutIndex !== -1}
|
|
147
148
|
equipmentSet={equipmentSet}
|
|
149
|
+
setItemShortcut={
|
|
150
|
+
type === ItemContainerType.Inventory ? handleSetShortcut : undefined
|
|
151
|
+
}
|
|
148
152
|
isDepotSystem={isDepotSystem}
|
|
149
153
|
/>
|
|
150
154
|
);
|
|
@@ -78,6 +78,7 @@ interface IProps {
|
|
|
78
78
|
isContextMenuDisabled?: boolean;
|
|
79
79
|
isSelectingShortcut?: boolean;
|
|
80
80
|
equipmentSet?: IEquipmentSet | null;
|
|
81
|
+
setItemShortcut?: (item: IItem, shortcutIndex: number) => void;
|
|
81
82
|
isDepotSystem?: boolean;
|
|
82
83
|
}
|
|
83
84
|
|
|
@@ -104,6 +105,7 @@ export const ItemSlot: React.FC<IProps> = observer(
|
|
|
104
105
|
dragScale,
|
|
105
106
|
isSelectingShortcut,
|
|
106
107
|
equipmentSet,
|
|
108
|
+
setItemShortcut,
|
|
107
109
|
isDepotSystem,
|
|
108
110
|
}) => {
|
|
109
111
|
const [isTooltipVisible, setTooltipVisible] = useState(false);
|
|
@@ -310,6 +312,18 @@ export const ItemSlot: React.FC<IProps> = observer(
|
|
|
310
312
|
defaultClassName={item ? 'draggable' : 'empty-slot'}
|
|
311
313
|
scale={dragScale}
|
|
312
314
|
onStop={(e, data) => {
|
|
315
|
+
const target = e.target as HTMLElement;
|
|
316
|
+
if (
|
|
317
|
+
target?.id.includes('shortcutSetter') &&
|
|
318
|
+
setItemShortcut &&
|
|
319
|
+
item
|
|
320
|
+
) {
|
|
321
|
+
const index = parseInt(target.id.split('_')[1]);
|
|
322
|
+
if (!isNaN(index)) {
|
|
323
|
+
setItemShortcut(item, index);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
313
327
|
if (wasDragged && item && !isSelectingShortcut) {
|
|
314
328
|
//@ts-ignore
|
|
315
329
|
const classes: string[] = Array.from(e.target?.classList);
|
|
@@ -42,6 +42,7 @@ export const ShortcutsSetter: React.FC<ShortcutsSetterProps> = ({
|
|
|
42
42
|
key: payload.texturePath,
|
|
43
43
|
texturePath: payload.texturePath,
|
|
44
44
|
stackQty: payload.stackQty || 1,
|
|
45
|
+
isStackable: payload.isStackable,
|
|
45
46
|
},
|
|
46
47
|
atlasJSON
|
|
47
48
|
)}
|
|
@@ -66,12 +67,18 @@ export const ShortcutsSetter: React.FC<ShortcutsSetterProps> = ({
|
|
|
66
67
|
<Shortcut
|
|
67
68
|
key={i}
|
|
68
69
|
onPointerDown={() => {
|
|
70
|
+
if (settingShortcutIndex !== -1) setSettingShortcutIndex(-1);
|
|
71
|
+
|
|
69
72
|
removeShortcut(i);
|
|
70
|
-
if (
|
|
73
|
+
if (
|
|
74
|
+
settingShortcutIndex === -1 &&
|
|
75
|
+
(!shortcuts[i] || shortcuts[i].type === ShortcutType.None)
|
|
76
|
+
)
|
|
71
77
|
setSettingShortcutIndex(i);
|
|
72
78
|
}}
|
|
73
79
|
disabled={settingShortcutIndex !== -1 && settingShortcutIndex !== i}
|
|
74
80
|
isBeingSet={settingShortcutIndex === i}
|
|
81
|
+
id={`shortcutSetter_${i}`}
|
|
75
82
|
>
|
|
76
83
|
{getContent(i)}
|
|
77
84
|
</Shortcut>
|