@rpg-engine/long-bow 0.1.82 → 0.1.83

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpg-engine/long-bow",
3
- "version": "0.1.82",
3
+ "version": "0.1.83",
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
  );
@@ -68,6 +68,7 @@ export const ItemSlot: React.FC<IProps> = ({
68
68
  if (itemToRender?.texturePath) {
69
69
  element.push(
70
70
  <SpriteFromAtlas
71
+ key={itemToRender._id}
71
72
  atlasIMG={atlasIMG}
72
73
  atlasJSON={atlasJSON}
73
74
  spriteKey={itemToRender.texturePath}
@@ -77,7 +78,10 @@ export const ItemSlot: React.FC<IProps> = ({
77
78
  }
78
79
  if (itemToRender?.isStackable && itemToRender?.stackQty) {
79
80
  element.push(
80
- <ItemQty left={getLeftPositionValue(itemToRender.stackQty)}>
81
+ <ItemQty
82
+ left={getLeftPositionValue(itemToRender.stackQty)}
83
+ key={`qty-${itemToRender._id}`}
84
+ >
81
85
  {' '}
82
86
  {itemToRender.stackQty}{' '}
83
87
  </ItemQty>
@@ -93,6 +97,7 @@ export const ItemSlot: React.FC<IProps> = ({
93
97
  ) {
94
98
  return (
95
99
  <SpriteFromAtlas
100
+ key={Math.random()}
96
101
  atlasIMG={atlasIMG}
97
102
  atlasJSON={atlasJSON}
98
103
  spriteKey={itemToRender.texturePath}
@@ -0,0 +1,147 @@
1
+ import React from 'react';
2
+ import { RPGUIContainerTypes } from '../RPGUIContainer';
3
+ import { DraggableContainer } from '../DraggableContainer';
4
+ import { Column } from '../shared/Column';
5
+ import { Button, ButtonTypes } from '../Button';
6
+ import { uiStore } from '../store/UI.store';
7
+ import styled from 'styled-components';
8
+ import thumbnailDefault from './img/default.png';
9
+
10
+ export interface IQuestInfoProps {
11
+ title: string;
12
+ children: React.ReactNode;
13
+ onClose?: () => void;
14
+ button?: Array<IQuestButtonProps>;
15
+ thumbnail?: string;
16
+ }
17
+
18
+ export interface IQuestButtonProps {
19
+ disabled: boolean;
20
+ title: string;
21
+ onClick: () => void;
22
+ }
23
+
24
+ export const QuestInfo: React.FC<IQuestInfoProps> = ({
25
+ title,
26
+ onClose,
27
+ button,
28
+ thumbnail,
29
+ children,
30
+ }) => {
31
+ return (
32
+ <QuestDraggableContainer
33
+ type={RPGUIContainerTypes.Framed}
34
+ onCloseButton={() => {
35
+ if (onClose) onClose();
36
+ }}
37
+ width="730px"
38
+ cancelDrag=".equipment-container-body"
39
+ onOutsideClick={() => {
40
+ uiStore.clearContextMenu();
41
+ uiStore.clearItemHoverDetail();
42
+ }}
43
+ >
44
+ {title && (
45
+ <TitleContainer className="drag-handler">
46
+ <Title>
47
+ <Thumbnail src={thumbnail || thumbnailDefault} />
48
+ {title}
49
+ </Title>
50
+ <QuestSplitDiv>
51
+ <hr className="golden" />
52
+ </QuestSplitDiv>
53
+ </TitleContainer>
54
+ )}
55
+ <Content>{children}</Content>
56
+ <QuestColumn className="dark-background" justifyContent="flex-end">
57
+ {button &&
58
+ button.map((item, index) => (
59
+ <Button
60
+ key={index}
61
+ onClick={item.onClick}
62
+ disabled={item.disabled}
63
+ buttonType={ButtonTypes.RPGUIButton}
64
+ id={`button-${index}`}
65
+ >
66
+ {item.title}
67
+ </Button>
68
+ ))}
69
+ </QuestColumn>
70
+ </QuestDraggableContainer>
71
+ );
72
+ };
73
+
74
+ const QuestDraggableContainer = styled(DraggableContainer)`
75
+ border: 1px solid black;
76
+ width: 600px;
77
+ height: 500px;
78
+ overflow-y: scroll;
79
+ padding: 0 0 0 0 !important;
80
+ .DraggableContainer__TitleContainer-sc-184mpyl-2 {
81
+ height: auto;
82
+ }
83
+ .container-close {
84
+ position: sticky;
85
+ margin-left: auto;
86
+ top: 10px;
87
+ padding-right: 5px;
88
+ }
89
+ img {
90
+ display: inline-block;
91
+ vertical-align: middle;
92
+ line-height: normal;
93
+ }
94
+ `;
95
+
96
+ const Content = styled.div`
97
+ padding: 18px;
98
+ h1 {
99
+ text-align: left;
100
+ margin: 14px 0px;
101
+ }
102
+ `;
103
+
104
+ const QuestSplitDiv = styled.div`
105
+ width: 100%;
106
+ font-size: 11px;
107
+ margin-bottom: 10px;
108
+ hr {
109
+ margin: 0px;
110
+ padding: 0px;
111
+ }
112
+ p {
113
+ margin-bottom: 0px;
114
+ }
115
+ `;
116
+
117
+ const QuestColumn = styled(Column)`
118
+ background: #4e4a4e;
119
+ padding-top: 5px;
120
+ position: sticky;
121
+ bottom: 0;
122
+ `;
123
+
124
+ const TitleContainer = styled.div`
125
+ background: #4e4a4e;
126
+ position: sticky;
127
+ top: 0;
128
+ width: 100%;
129
+ display: flex;
130
+ flex-wrap: wrap;
131
+ justify-content: flex-start;
132
+ align-items: center;
133
+ `;
134
+
135
+ const Title = styled.h1`
136
+ color: white;
137
+ z-index: 22;
138
+ font-size: 0.6rem;
139
+ `;
140
+
141
+ const Thumbnail = styled.img`
142
+ color: white;
143
+ z-index: 22;
144
+ font-size: 10px;
145
+ width: 64px;
146
+ margin-right: 0.5rem;
147
+ `;
@@ -15,7 +15,12 @@ export const SkillsContainer: React.FC<ISkillContainerProps> = ({
15
15
  skill,
16
16
  }) => {
17
17
  return (
18
- <SkillsDraggableContainer title="Skills" onCloseButton={onCloseButton}>
18
+ <SkillsDraggableContainer title="Skills">
19
+ {onCloseButton && (
20
+ <CloseButton onClick={onCloseButton} onTouchStart={onCloseButton}>
21
+ X
22
+ </CloseButton>
23
+ )}
19
24
  <SkillSplitDiv>
20
25
  <p>Combat Skills</p>
21
26
  <hr className="golden" />
@@ -233,3 +238,12 @@ const SkillSplitDiv = styled.div`
233
238
  margin-bottom: 0px;
234
239
  }
235
240
  `;
241
+
242
+ const CloseButton = styled.div`
243
+ position: absolute;
244
+ top: 2px;
245
+ right: 2px;
246
+ color: white;
247
+ z-index: 22;
248
+ font-size: 0.7rem;
249
+ `;
@@ -132,7 +132,7 @@ export const items: IItem[] = [
132
132
  updatedAt: '2022-06-04T18:16:49.056Z',
133
133
  },
134
134
  {
135
- _id: '629acek4j7c8e8002ff60034',
135
+ _id: '629acek4j7c8e8002fg60034',
136
136
  type: ItemType.Consumable,
137
137
  subType: ItemSubType.Accessory,
138
138
  textureAtlas: 'items',