@rpg-engine/long-bow 0.8.68 → 0.8.69
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/long-bow.cjs.development.js +20238 -14
- 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 +20238 -14
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Store/CartView.tsx +52 -42
- package/src/components/Store/StoreCharacterSkinRow.tsx +3 -3
- package/src/types/index.d.ts +1 -0
package/package.json
CHANGED
|
@@ -2,10 +2,13 @@ import { IStoreItem, MetadataType } from '@rpg-engine/shared';
|
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
3
|
import { FaInfoCircle, FaShoppingBag, FaTimes, FaTrash } from 'react-icons/fa';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
|
+
import characterAtlasJSON from '../../mocks/atlas/entities/entities.json';
|
|
6
|
+
import characterAtlasIMG from '../../mocks/atlas/entities/entities.png';
|
|
5
7
|
import { CTAButton } from '../shared/CTAButton/CTAButton';
|
|
6
8
|
import { SpriteFromAtlas } from '../shared/SpriteFromAtlas';
|
|
7
9
|
|
|
8
10
|
|
|
11
|
+
|
|
9
12
|
interface ICartViewProps {
|
|
10
13
|
cartItems: {
|
|
11
14
|
item: IStoreItem;
|
|
@@ -31,7 +34,7 @@ const MetadataDisplay: React.FC<{
|
|
|
31
34
|
<FaInfoCircle />
|
|
32
35
|
<span>Skin:</span>
|
|
33
36
|
</MetadataLabel>
|
|
34
|
-
<MetadataValue>{metadata.
|
|
37
|
+
<MetadataValue>{metadata.selectedSkinName || 'Custom skin'}</MetadataValue>
|
|
35
38
|
</MetadataInfo>
|
|
36
39
|
);
|
|
37
40
|
default:
|
|
@@ -87,48 +90,55 @@ export const CartView: React.FC<ICartViewProps> = ({
|
|
|
87
90
|
{cartItems.length === 0 ? (
|
|
88
91
|
<EmptyCart>Your cart is empty</EmptyCart>
|
|
89
92
|
) : (
|
|
90
|
-
cartItems.map(cartItem =>
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
<span>×</span>
|
|
108
|
-
<span>{cartItem.quantity}</span>
|
|
109
|
-
<span>=</span>
|
|
110
|
-
<span>
|
|
111
|
-
${formatPrice(cartItem.item.price * cartItem.quantity)}
|
|
112
|
-
</span>
|
|
113
|
-
</ItemInfo>
|
|
114
|
-
|
|
115
|
-
{cartItem.metadata && cartItem.item.metadataType && (
|
|
116
|
-
<MetadataDisplay
|
|
117
|
-
type={cartItem.item.metadataType}
|
|
118
|
-
metadata={cartItem.metadata}
|
|
93
|
+
cartItems.map(cartItem => {
|
|
94
|
+
console.log('Item metadataType: , texturePath:', cartItem.item.metadataType , cartItem.item.texturePath);
|
|
95
|
+
const getSpriteKey = (textureKey: string) => {
|
|
96
|
+
return textureKey + '/down/standing/0.png';
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<CartItemRow key={cartItem.item.key}>
|
|
101
|
+
<ItemIconContainer>
|
|
102
|
+
<SpriteFromAtlas
|
|
103
|
+
atlasJSON={cartItem.item.metadataType === MetadataType.CharacterSkin ? characterAtlasJSON : atlasJSON}
|
|
104
|
+
atlasIMG={cartItem.item.metadataType === MetadataType.CharacterSkin ? characterAtlasIMG : atlasIMG}
|
|
105
|
+
spriteKey={cartItem.item.metadataType === MetadataType.CharacterSkin && cartItem.metadata?.selectedSkinTextureKey ? getSpriteKey(cartItem.metadata.selectedSkinTextureKey) : cartItem.item.texturePath}
|
|
106
|
+
width={32}
|
|
107
|
+
height={32}
|
|
108
|
+
imgScale={2}
|
|
109
|
+
centered
|
|
119
110
|
/>
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
111
|
+
</ItemIconContainer>
|
|
112
|
+
<ItemDetails>
|
|
113
|
+
<ItemName>{cartItem.item.name}</ItemName>
|
|
114
|
+
<ItemInfo>
|
|
115
|
+
<span>${formatPrice(cartItem.item.price)}</span>
|
|
116
|
+
<span>×</span>
|
|
117
|
+
<span>{cartItem.quantity}</span>
|
|
118
|
+
<span>=</span>
|
|
119
|
+
<span>
|
|
120
|
+
${formatPrice(cartItem.item.price * cartItem.quantity)}
|
|
121
|
+
</span>
|
|
122
|
+
</ItemInfo>
|
|
123
|
+
|
|
124
|
+
{cartItem.metadata && cartItem.item.metadataType && (
|
|
125
|
+
<MetadataDisplay
|
|
126
|
+
type={cartItem.item.metadataType}
|
|
127
|
+
metadata={cartItem.metadata}
|
|
128
|
+
/>
|
|
129
|
+
)}
|
|
130
|
+
</ItemDetails>
|
|
131
|
+
|
|
132
|
+
<CTAButton
|
|
133
|
+
icon={<FaTrash />}
|
|
134
|
+
onClick={e => {
|
|
135
|
+
e.stopPropagation();
|
|
136
|
+
onRemoveFromCart(cartItem.item.key);
|
|
137
|
+
}}
|
|
138
|
+
/>
|
|
139
|
+
</CartItemRow>
|
|
140
|
+
);
|
|
141
|
+
})
|
|
132
142
|
)}
|
|
133
143
|
</CartItems>
|
|
134
144
|
|
|
@@ -78,10 +78,10 @@ export const StoreCharacterSkinRow: React.FC<IStoreCharacterSkinRowProps> = ({
|
|
|
78
78
|
if (!hasRequiredAccount) return;
|
|
79
79
|
|
|
80
80
|
// If we have character skins, add the selected skin to the purchase
|
|
81
|
-
if (availableCharacters.length > 0) {
|
|
82
|
-
const selectedCharacter = availableCharacters[currentIndex];
|
|
81
|
+
if (availableCharacters.length > 0 && currentCharacter) {
|
|
83
82
|
onAddToCart(item, quantity, {
|
|
84
|
-
|
|
83
|
+
selectedSkinName: currentCharacter.name,
|
|
84
|
+
selectedSkinTextureKey: currentCharacter.textureKey
|
|
85
85
|
});
|
|
86
86
|
} else {
|
|
87
87
|
onAddToCart(item, quantity);
|
package/src/types/index.d.ts
CHANGED