@rpg-engine/long-bow 0.1.91 → 0.1.94
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/ItemContainer.d.ts +1 -1
- package/dist/components/Item/Inventory/ItemSlot.d.ts +1 -1
- package/dist/long-bow.cjs.development.js +22 -8
- 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 +22 -8
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Item/Inventory/ItemContainer.tsx +3 -3
- package/src/components/Item/Inventory/ItemSlot.tsx +6 -7
- package/src/components/Item/Inventory/itemContainerHelper.ts +3 -3
- package/src/stories/ItemContainer.stories.tsx +2 -2
|
@@ -6,6 +6,6 @@ export interface IItemContainerProps {
|
|
|
6
6
|
onClose?: () => void;
|
|
7
7
|
onItemClick?: (item: IItem, slotContainerType: SlotContainerType | null) => void;
|
|
8
8
|
onMouseOver?: (e: any, slotIndex: number, item: IItem | null) => void;
|
|
9
|
-
onSelected?: (optionId: string) => void;
|
|
9
|
+
onSelected?: (optionId: string, item: IItem) => void;
|
|
10
10
|
}
|
|
11
11
|
export declare const ItemContainer: React.FC<IItemContainerProps>;
|
|
@@ -7,7 +7,7 @@ interface IProps {
|
|
|
7
7
|
itemContainer?: IItemContainer | null;
|
|
8
8
|
slotContainerType: SlotContainerType | null;
|
|
9
9
|
slotSpriteMask?: ItemSlotType | null;
|
|
10
|
-
onSelected: (
|
|
10
|
+
onSelected: (selectedOption: string, item: IItem) => void;
|
|
11
11
|
onMouseOver: (event: any, slotIndex: number, item: IItem | null, x: number, y: number) => void;
|
|
12
12
|
onMouseOut?: () => void;
|
|
13
13
|
onClick: (item: IItem, slotContainerType: SlotContainerType | null) => void;
|
|
@@ -5827,7 +5827,8 @@ var generateContextList = function generateContextList(actionsByTypeList) {
|
|
|
5827
5827
|
});
|
|
5828
5828
|
return contextMenu;
|
|
5829
5829
|
};
|
|
5830
|
-
|
|
5830
|
+
|
|
5831
|
+
var handleContextMenuList = function handleContextMenuList(itemType) {
|
|
5831
5832
|
var contextActionMenu = [];
|
|
5832
5833
|
|
|
5833
5834
|
switch (itemType) {
|
|
@@ -5836,15 +5837,26 @@ var handleEquipmentContextMenuList = function handleEquipmentContextMenuList(ite
|
|
|
5836
5837
|
case shared.ItemType.Accessory:
|
|
5837
5838
|
case shared.ItemType.Jewelry:
|
|
5838
5839
|
case shared.ItemType.Tool:
|
|
5839
|
-
contextActionMenu = generateContextList(shared.ActionsByItemType.
|
|
5840
|
+
contextActionMenu = generateContextList(shared.ActionsByItemType.Equipment);
|
|
5841
|
+
break;
|
|
5842
|
+
|
|
5843
|
+
case shared.ItemType.Consumable:
|
|
5844
|
+
contextActionMenu = generateContextList(shared.ActionsByItemType.Consumable);
|
|
5845
|
+
break;
|
|
5846
|
+
|
|
5847
|
+
case shared.ItemType.CraftMaterial:
|
|
5848
|
+
contextActionMenu = generateContextList(shared.ActionsByItemType.CraftMaterial);
|
|
5840
5849
|
break;
|
|
5841
5850
|
|
|
5851
|
+
case shared.ItemType.Other:
|
|
5852
|
+
case shared.ItemType.Information:
|
|
5853
|
+
case shared.ItemType.Quest:
|
|
5842
5854
|
case shared.ItemType.Container:
|
|
5843
|
-
contextActionMenu = generateContextList(shared.ActionsByItemType.
|
|
5855
|
+
contextActionMenu = generateContextList(shared.ActionsByItemType.Other);
|
|
5844
5856
|
break;
|
|
5845
5857
|
|
|
5846
5858
|
default:
|
|
5847
|
-
contextActionMenu = generateContextList(shared.ActionsByItemType.
|
|
5859
|
+
contextActionMenu = generateContextList(shared.ActionsByItemType.Other);
|
|
5848
5860
|
break;
|
|
5849
5861
|
}
|
|
5850
5862
|
|
|
@@ -5887,7 +5899,7 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
5887
5899
|
|
|
5888
5900
|
React.useEffect(function () {
|
|
5889
5901
|
if (item) {
|
|
5890
|
-
setContextActions(
|
|
5902
|
+
setContextActions(handleContextMenuList(item.type));
|
|
5891
5903
|
}
|
|
5892
5904
|
}, [item]);
|
|
5893
5905
|
|
|
@@ -5975,7 +5987,9 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
5975
5987
|
onSelected: function onSelected(optionId) {
|
|
5976
5988
|
setIsContextMenuVisible(false);
|
|
5977
5989
|
|
|
5978
|
-
|
|
5990
|
+
if (item) {
|
|
5991
|
+
_onSelected(optionId, item);
|
|
5992
|
+
}
|
|
5979
5993
|
},
|
|
5980
5994
|
onOutsideClick: function onOutsideClick() {
|
|
5981
5995
|
setIsContextMenuVisible(false);
|
|
@@ -6118,8 +6132,8 @@ var ItemContainer = function ItemContainer(_ref) {
|
|
|
6118
6132
|
onClick: function onClick(item, slotContainerType) {
|
|
6119
6133
|
if (onItemClick) onItemClick(item, slotContainerType);
|
|
6120
6134
|
},
|
|
6121
|
-
onSelected: function onSelected(optionId) {
|
|
6122
|
-
if (_onSelected) _onSelected(optionId);
|
|
6135
|
+
onSelected: function onSelected(optionId, item) {
|
|
6136
|
+
if (_onSelected) _onSelected(optionId, item);
|
|
6123
6137
|
}
|
|
6124
6138
|
}));
|
|
6125
6139
|
}
|