@rpg-engine/long-bow 0.2.23 → 0.2.24
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/Equipment/EquipmentSet.d.ts +2 -0
- package/dist/components/Item/Inventory/ErrorBoundary.d.ts +14 -0
- package/dist/components/Item/Inventory/ItemContainer.d.ts +2 -0
- package/dist/components/Item/Inventory/ItemSlot.d.ts +2 -0
- package/dist/long-bow.cjs.development.js +824 -699
- 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 +828 -703
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Character/CharacterSelection.tsx +19 -11
- package/src/components/Equipment/EquipmentSet.tsx +6 -0
- package/src/components/Item/Inventory/ErrorBoundary.tsx +43 -0
- package/src/components/Item/Inventory/ItemContainer.tsx +6 -0
- package/src/components/Item/Inventory/ItemSlot.tsx +33 -24
- package/src/components/SkillProgressBar.tsx +11 -8
- package/src/mocks/atlas/items/items.json +169 -121
- package/src/mocks/atlas/items/items.png +0 -0
- package/src/stories/CharacterSelection.stories.tsx +4 -0
- package/src/stories/EquipmentSet.stories.tsx +4 -0
- package/src/stories/ItemContainer.stories.tsx +4 -0
- package/src/components/NPCDialog/.DS_Store +0 -0
- package/src/mocks/.DS_Store +0 -0
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@ import { SpriteFromAtlas } from '../shared/SpriteFromAtlas';
|
|
|
5
5
|
|
|
6
6
|
import entitiesJSON from '../../mocks/atlas/entities/entities.json';
|
|
7
7
|
import entitiesIMG from '../../mocks/atlas/entities/entities.png';
|
|
8
|
+
import { ErrorBoundary } from '../Item/Inventory/ErrorBoundary';
|
|
8
9
|
import PropertySelect, {
|
|
9
10
|
IPropertiesProps,
|
|
10
11
|
} from '../PropertySelect/PropertySelect';
|
|
@@ -56,17 +57,24 @@ export const CharacterSelection: React.FC<ICharacterSelectionProps> = ({
|
|
|
56
57
|
return (
|
|
57
58
|
<Container>
|
|
58
59
|
{selectedSpriteKey && (
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
60
|
+
<ErrorBoundary>
|
|
61
|
+
<SpriteFromAtlas
|
|
62
|
+
spriteKey={selectedSpriteKey}
|
|
63
|
+
atlasIMG={entitiesIMG}
|
|
64
|
+
atlasJSON={entitiesJSON}
|
|
65
|
+
imgScale={4}
|
|
66
|
+
height={80}
|
|
67
|
+
width={64}
|
|
68
|
+
containerStyle={{
|
|
69
|
+
display: 'flex',
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
paddingBottom: '15px',
|
|
72
|
+
}}
|
|
73
|
+
imgStyle={{
|
|
74
|
+
left: '22px',
|
|
75
|
+
}}
|
|
76
|
+
/>
|
|
77
|
+
</ErrorBoundary>
|
|
70
78
|
)}
|
|
71
79
|
<PropertySelect
|
|
72
80
|
availableProperties={propertySelectValues}
|
|
@@ -24,6 +24,8 @@ export interface IEquipmentSetProps {
|
|
|
24
24
|
onSelected?: (optionId: string) => void;
|
|
25
25
|
initialPosition?: { x: number; y: number };
|
|
26
26
|
type: ItemContainerType | null;
|
|
27
|
+
atlasIMG: any;
|
|
28
|
+
atlasJSON: any;
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
export const EquipmentSet: React.FC<IEquipmentSetProps> = ({
|
|
@@ -32,6 +34,8 @@ export const EquipmentSet: React.FC<IEquipmentSetProps> = ({
|
|
|
32
34
|
onMouseOver,
|
|
33
35
|
onSelected,
|
|
34
36
|
onItemClick,
|
|
37
|
+
atlasIMG,
|
|
38
|
+
atlasJSON,
|
|
35
39
|
}) => {
|
|
36
40
|
const {
|
|
37
41
|
neck,
|
|
@@ -98,6 +102,8 @@ export const EquipmentSet: React.FC<IEquipmentSetProps> = ({
|
|
|
98
102
|
onSelected={(optionId: string) => {
|
|
99
103
|
if (onSelected) onSelected(optionId);
|
|
100
104
|
}}
|
|
105
|
+
atlasIMG={atlasIMG}
|
|
106
|
+
atlasJSON={atlasJSON}
|
|
101
107
|
/>
|
|
102
108
|
);
|
|
103
109
|
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, { Component, ErrorInfo, ReactNode } from 'react';
|
|
2
|
+
import atlasJSON from '../../../mocks/atlas/items/items.json';
|
|
3
|
+
import atlasIMG from '../../../mocks/atlas/items/items.png';
|
|
4
|
+
import { SpriteFromAtlas } from '../../shared/SpriteFromAtlas';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface State {
|
|
11
|
+
hasError: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class ErrorBoundary extends Component<Props, State> {
|
|
15
|
+
public state: State = {
|
|
16
|
+
hasError: false,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
public static getDerivedStateFromError(_: Error): State {
|
|
20
|
+
// Update state so the next render will show the fallback UI.
|
|
21
|
+
return { hasError: true };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public componentDidCatch(error: Error, errorInfo: ErrorInfo) {
|
|
25
|
+
console.error('Uncaught error:', error, errorInfo);
|
|
26
|
+
console.log('quelquer cois');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public render() {
|
|
30
|
+
if (this.state.hasError) {
|
|
31
|
+
return (
|
|
32
|
+
<SpriteFromAtlas
|
|
33
|
+
atlasIMG={atlasIMG}
|
|
34
|
+
atlasJSON={atlasJSON}
|
|
35
|
+
spriteKey={'others/no-image.png'}
|
|
36
|
+
imgScale={3}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return this.props.children;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -16,6 +16,8 @@ export interface IItemContainerProps {
|
|
|
16
16
|
onMouseOver?: (e: any, slotIndex: number, item: IItem | null) => void;
|
|
17
17
|
onSelected?: (optionId: string, item: IItem) => void;
|
|
18
18
|
type: ItemContainerType;
|
|
19
|
+
atlasJSON: any;
|
|
20
|
+
atlasIMG: any;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
export const ItemContainer: React.FC<IItemContainerProps> = ({
|
|
@@ -25,6 +27,8 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
|
|
|
25
27
|
onSelected,
|
|
26
28
|
onItemClick,
|
|
27
29
|
type,
|
|
30
|
+
atlasJSON,
|
|
31
|
+
atlasIMG,
|
|
28
32
|
}) => {
|
|
29
33
|
const onRenderSlots = () => {
|
|
30
34
|
const slots = [];
|
|
@@ -45,6 +49,8 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
|
|
|
45
49
|
onSelected={(optionId: string, item: IItem) => {
|
|
46
50
|
if (onSelected) onSelected(optionId, item);
|
|
47
51
|
}}
|
|
52
|
+
atlasIMG={atlasIMG}
|
|
53
|
+
atlasJSON={atlasJSON}
|
|
48
54
|
/>
|
|
49
55
|
);
|
|
50
56
|
}
|
|
@@ -9,11 +9,10 @@ import {
|
|
|
9
9
|
import { observer } from 'mobx-react-lite';
|
|
10
10
|
import React, { useEffect, useState } from 'react';
|
|
11
11
|
import styled from 'styled-components';
|
|
12
|
-
import atlasJSON from '../../../mocks/atlas/items/items.json';
|
|
13
|
-
import atlasIMG from '../../../mocks/atlas/items/items.png';
|
|
14
12
|
import { RelativeListMenu } from '../../RelativeListMenu';
|
|
15
13
|
import { SpriteFromAtlas } from '../../shared/SpriteFromAtlas';
|
|
16
14
|
import { ItemTooltip } from '../Cards/ItemTooltip';
|
|
15
|
+
import { ErrorBoundary } from './ErrorBoundary';
|
|
17
16
|
import { generateContextMenu, IContextMenuItem } from './itemContainerHelper';
|
|
18
17
|
|
|
19
18
|
const EquipmentSlotSpriteByType: any = {
|
|
@@ -49,6 +48,8 @@ interface IProps {
|
|
|
49
48
|
itemContainerType: ItemContainerType | null,
|
|
50
49
|
item: IItem
|
|
51
50
|
) => void;
|
|
51
|
+
atlasJSON: any;
|
|
52
|
+
atlasIMG: any;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
export const ItemSlot: React.FC<IProps> = observer(
|
|
@@ -61,6 +62,8 @@ export const ItemSlot: React.FC<IProps> = observer(
|
|
|
61
62
|
onMouseOut,
|
|
62
63
|
onClick,
|
|
63
64
|
onSelected,
|
|
65
|
+
atlasJSON,
|
|
66
|
+
atlasIMG,
|
|
64
67
|
}) => {
|
|
65
68
|
const [isTooltipVisible, setTooltipVisible] = useState(false);
|
|
66
69
|
|
|
@@ -101,13 +104,15 @@ export const ItemSlot: React.FC<IProps> = observer(
|
|
|
101
104
|
if (itemToRender?.texturePath) {
|
|
102
105
|
console.table(itemToRender);
|
|
103
106
|
element.push(
|
|
104
|
-
<
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
<ErrorBoundary>
|
|
108
|
+
<SpriteFromAtlas
|
|
109
|
+
key={itemToRender._id}
|
|
110
|
+
atlasIMG={atlasIMG}
|
|
111
|
+
atlasJSON={atlasJSON}
|
|
112
|
+
spriteKey={itemToRender.texturePath}
|
|
113
|
+
imgScale={3}
|
|
114
|
+
/>
|
|
115
|
+
</ErrorBoundary>
|
|
111
116
|
);
|
|
112
117
|
}
|
|
113
118
|
const stackInfo = getStackInfo(
|
|
@@ -128,13 +133,15 @@ export const ItemSlot: React.FC<IProps> = observer(
|
|
|
128
133
|
) {
|
|
129
134
|
const element = [];
|
|
130
135
|
element.push(
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
<ErrorBoundary>
|
|
137
|
+
<SpriteFromAtlas
|
|
138
|
+
key={itemToRender._id}
|
|
139
|
+
atlasIMG={atlasIMG}
|
|
140
|
+
atlasJSON={atlasJSON}
|
|
141
|
+
spriteKey={itemToRender.texturePath}
|
|
142
|
+
imgScale={3}
|
|
143
|
+
/>
|
|
144
|
+
</ErrorBoundary>
|
|
138
145
|
);
|
|
139
146
|
const stackInfo = getStackInfo(
|
|
140
147
|
itemToRender?._id ?? '',
|
|
@@ -146,14 +153,16 @@ export const ItemSlot: React.FC<IProps> = observer(
|
|
|
146
153
|
return element;
|
|
147
154
|
} else {
|
|
148
155
|
return (
|
|
149
|
-
<
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
156
|
+
<ErrorBoundary>
|
|
157
|
+
<SpriteFromAtlas
|
|
158
|
+
atlasIMG={atlasIMG}
|
|
159
|
+
atlasJSON={atlasJSON}
|
|
160
|
+
spriteKey={EquipmentSlotSpriteByType[slotSpriteMask!]}
|
|
161
|
+
imgScale={3}
|
|
162
|
+
grayScale={true}
|
|
163
|
+
opacity={0.4}
|
|
164
|
+
/>
|
|
165
|
+
</ErrorBoundary>
|
|
157
166
|
);
|
|
158
167
|
}
|
|
159
168
|
};
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import atlasJSON from '../mocks/atlas/items/items.json';
|
|
5
5
|
import atlasIMG from '../mocks/atlas/items/items.png';
|
|
6
|
+
import { ErrorBoundary } from './Item/Inventory/ErrorBoundary';
|
|
6
7
|
import { SpriteFromAtlas } from './shared/SpriteFromAtlas';
|
|
7
8
|
import { SimpleProgressBar } from './SimpleProgressBar';
|
|
8
9
|
|
|
@@ -38,14 +39,16 @@ export const SkillProgressBar: React.FC<ISkillProgressBarProps> = ({
|
|
|
38
39
|
<ProgressIconContainer>
|
|
39
40
|
{atlasIMG && atlasJSON ? (
|
|
40
41
|
<SpriteContainer>
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
<ErrorBoundary>
|
|
43
|
+
<SpriteFromAtlas
|
|
44
|
+
atlasIMG={atlasIMG}
|
|
45
|
+
atlasJSON={atlasJSON}
|
|
46
|
+
spriteKey={texturePath}
|
|
47
|
+
imgScale={1}
|
|
48
|
+
grayScale
|
|
49
|
+
opacity={0.5}
|
|
50
|
+
/>
|
|
51
|
+
</ErrorBoundary>
|
|
49
52
|
</SpriteContainer>
|
|
50
53
|
) : (
|
|
51
54
|
<></>
|