@rpg-engine/long-bow 0.2.22 → 0.2.23

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.2.22",
3
+ "version": "0.2.23",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useEffect, useState } from 'react';
2
2
  import styled from 'styled-components';
3
3
  import { NPCDialog, NPCDialogType } from './NPCDialog/NPCDialog';
4
4
  import { NPCMultiDialog, NPCMultiDialogType } from './NPCDialog/NPCMultiDialog';
@@ -9,7 +9,7 @@ import {
9
9
  } from './NPCDialog/QuestionDialog/QuestionDialog';
10
10
 
11
11
  export interface IHistoryDialogProps {
12
- backgroundImgPath: string;
12
+ backgroundImgPath: string[];
13
13
  fullCoverBackground: boolean;
14
14
  questions?: IQuestionDialog[];
15
15
  answers?: IQuestionDialogAnswer[];
@@ -29,9 +29,26 @@ export const HistoryDialog: React.FC<IHistoryDialogProps> = ({
29
29
  textAndTypeArray,
30
30
  onClose,
31
31
  }) => {
32
+ const [img, setImage] = useState<number>(0);
33
+ const onHandleSpacePress = (event: KeyboardEvent) => {
34
+ if (event.code === 'Space') {
35
+ if (img < backgroundImgPath?.length - 1) {
36
+ setImage(prev => prev + 1);
37
+ } else {
38
+ // if there's no more text chunks, close the dialog
39
+ onClose();
40
+ }
41
+ }
42
+ };
43
+
44
+ useEffect(() => {
45
+ document.addEventListener('keydown', onHandleSpacePress);
46
+
47
+ return () => document.removeEventListener('keydown', onHandleSpacePress);
48
+ }, [backgroundImgPath]);
32
49
  return (
33
50
  <BackgroundContainer
34
- imgPath={backgroundImgPath}
51
+ imgPath={backgroundImgPath[img]}
35
52
  fullImg={fullCoverBackground}
36
53
  >
37
54
  <DialogContainer>
Binary file
@@ -36,7 +36,9 @@ export const QuestList: React.FC<IQuestListProps> = ({ quests, onClose }) => {
36
36
  </div>
37
37
  ))
38
38
  ) : (
39
- <div></div>
39
+ <NoQuestContainer>
40
+ <p>There are no ongoing quests</p>
41
+ </NoQuestContainer>
40
42
  )}
41
43
  </QuestListContainer>
42
44
  </div>
@@ -113,4 +115,14 @@ const QuestListContainer = styled.div`
113
115
  .quest-detail__description {
114
116
  margin-top: 5px;
115
117
  }
118
+ .Noquest-detail__description {
119
+ margin-top: 5px;
120
+ margin: auto;
121
+ }
122
+ `;
123
+ const NoQuestContainer = styled.div`
124
+ text-align: center;
125
+ p {
126
+ margin-top: 5px;
127
+ }
116
128
  `;
Binary file
@@ -2,7 +2,9 @@ import { Meta, Story } from '@storybook/react';
2
2
  import React from 'react';
3
3
  import { RPGUIRoot } from '../components/RPGUIRoot';
4
4
  import aliceDefaultThumbnail from '../components/NPCDialog/img/npcDialog/npcThumbnails/alice.png';
5
- import ImgBackground from '../components/NPCDialog/img/background.png';
5
+ import ImgBackground01 from '../components/NPCDialog/img/background01.png';
6
+ import ImgBackground02 from '../components/NPCDialog/img/background02.png';
7
+ import ImgBackground03 from '../components/NPCDialog/img/background03.png';
6
8
  import {
7
9
  HistoryDialog,
8
10
  IHistoryDialogProps,
@@ -55,5 +57,5 @@ const textAndTypeArray: NPCMultiDialogType[] = [
55
57
  HistoryDialogStore.args = {
56
58
  textAndTypeArray,
57
59
  fullCoverBackground: true,
58
- backgroundImgPath: ImgBackground,
60
+ backgroundImgPath: [ImgBackground01, ImgBackground02, ImgBackground03],
59
61
  };