@rpg-engine/long-bow 0.2.44 → 0.2.45
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/DayNightPeriod/DayNightPeriod.d.ts +11 -0
- package/dist/components/StaticBook/StaticBook.d.ts +10 -0
- package/dist/stories/DayNightPeriod.stories.d.ts +5 -0
- package/dist/stories/StaticBook.stories.d.ts +5 -0
- package/package.json +1 -1
- package/src/components/DayNightPeriod/DayNightPeriod.tsx +36 -0
- package/src/components/DayNightPeriod/Gif/Afternoon.gif +0 -0
- package/src/components/DayNightPeriod/Gif/Morning.gif +0 -0
- package/src/components/DayNightPeriod/Gif/Night.gif +0 -0
- package/src/components/StaticBook/StaticBook.tsx +96 -0
- package/src/components/StaticBook/img/0.png +0 -0
- package/src/stories/DayNightPeriod.stories.tsx +20 -0
- package/src/stories/StaticBook.stories.tsx +39 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare enum IPeriodOfDay {
|
|
3
|
+
Morning = "static/media/src/components/DayNightPeriod/Gif/Morning.gif",
|
|
4
|
+
Afternoon = "static/media/src/components/DayNightPeriod/Gif/Afternoon.gif",
|
|
5
|
+
Night = "static/media/src/components/DayNightPeriod/Gif/Night.gif"
|
|
6
|
+
}
|
|
7
|
+
export interface PeriodOfDayProps {
|
|
8
|
+
periodOfDay: IPeriodOfDay;
|
|
9
|
+
}
|
|
10
|
+
export declare const PeriodOfDay: React.FC<PeriodOfDayProps>;
|
|
11
|
+
export default PeriodOfDay;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface StaticBookProps {
|
|
3
|
+
availableBook: Array<staticProps>;
|
|
4
|
+
onChange: (selectedBook: staticProps) => void;
|
|
5
|
+
}
|
|
6
|
+
export interface staticProps {
|
|
7
|
+
text: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const StaticBook: React.FC<StaticBookProps>;
|
|
10
|
+
export default StaticBook;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { PeriodOfDayProps } from '../components/DayNightPeriod/DayNightPeriod';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, PeriodOfDayProps>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { StaticBookProps } from '../components/StaticBook/StaticBook';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, StaticBookProps>;
|
package/package.json
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export enum IPeriodOfDay {
|
|
6
|
+
Morning = "static/media/src/components/DayNightPeriod/Gif/Morning.gif",
|
|
7
|
+
Afternoon = "static/media/src/components/DayNightPeriod/Gif/Afternoon.gif",
|
|
8
|
+
Night = "static/media/src/components/DayNightPeriod/Gif/Night.gif",
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface PeriodOfDayProps {
|
|
12
|
+
periodOfDay: IPeriodOfDay;
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const PeriodOfDay: React.FC<PeriodOfDayProps> = ({ periodOfDay }) => {
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<GifContainer >
|
|
21
|
+
|
|
22
|
+
<img src={periodOfDay} />
|
|
23
|
+
|
|
24
|
+
</GifContainer>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
interface IPeriodOfDayProps {
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const GifContainer = styled.span<IPeriodOfDayProps>`
|
|
33
|
+
width: 100%;
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
export default PeriodOfDay;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import SelectArrow from '../Arrow/SelectArrow';
|
|
4
|
+
import Book from './img/0.png';
|
|
5
|
+
|
|
6
|
+
export interface StaticBookProps {
|
|
7
|
+
availableBook: Array<staticProps>;
|
|
8
|
+
onChange: (selectedBook: staticProps) => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface staticProps {
|
|
12
|
+
text: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const StaticBook: React.FC<StaticBookProps> = ({
|
|
16
|
+
availableBook,
|
|
17
|
+
onChange,
|
|
18
|
+
}) => {
|
|
19
|
+
const [currentIndex, setCurrentIndex] = useState(0);
|
|
20
|
+
const bookLength = availableBook.length - 1;
|
|
21
|
+
|
|
22
|
+
const onLeftClick = () => {
|
|
23
|
+
if (currentIndex === 0) setCurrentIndex(bookLength);
|
|
24
|
+
else setCurrentIndex(index => index - 1);
|
|
25
|
+
};
|
|
26
|
+
const onRightClick = () => {
|
|
27
|
+
if (currentIndex === bookLength) setCurrentIndex(0);
|
|
28
|
+
else setCurrentIndex(index => index + 1);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
onChange(availableBook[currentIndex]);
|
|
33
|
+
}, [currentIndex]);
|
|
34
|
+
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
setCurrentIndex(0);
|
|
37
|
+
}, [JSON.stringify(availableBook)]);
|
|
38
|
+
|
|
39
|
+
const getCurrentSelectionName = () => {
|
|
40
|
+
const item = availableBook[currentIndex];
|
|
41
|
+
if (item) {
|
|
42
|
+
return item.text.slice(0, 600);
|
|
43
|
+
}
|
|
44
|
+
return '';
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Container>
|
|
49
|
+
<Textbook><Colunbook>{getCurrentSelectionName()}</Colunbook></Textbook>
|
|
50
|
+
<ArrowContainer>
|
|
51
|
+
<SelectArrow
|
|
52
|
+
direction="left"
|
|
53
|
+
onClick={onLeftClick}
|
|
54
|
+
onTouchStart={onLeftClick}
|
|
55
|
+
></SelectArrow>
|
|
56
|
+
<SelectArrow
|
|
57
|
+
direction="right"
|
|
58
|
+
onClick={onRightClick}
|
|
59
|
+
onTouchStart={onRightClick}
|
|
60
|
+
></SelectArrow>
|
|
61
|
+
</ArrowContainer>
|
|
62
|
+
</Container>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
const Container = styled.div`
|
|
68
|
+
background-image: url(${Book});
|
|
69
|
+
background-repeat:no-repeat;
|
|
70
|
+
position: relative;
|
|
71
|
+
width: 778px;
|
|
72
|
+
height: 538px;
|
|
73
|
+
|
|
74
|
+
`;
|
|
75
|
+
const Textbook = styled.span`
|
|
76
|
+
position: absolute;
|
|
77
|
+
padding-left: 6em;
|
|
78
|
+
display: flex;
|
|
79
|
+
|
|
80
|
+
`;
|
|
81
|
+
const Colunbook = styled.span`
|
|
82
|
+
padding-left: 3px;
|
|
83
|
+
padding-top: 70px;
|
|
84
|
+
width: 86%;
|
|
85
|
+
column-count:2;
|
|
86
|
+
grid-gap: 50px;
|
|
87
|
+
|
|
88
|
+
`;
|
|
89
|
+
const ArrowContainer = styled.span`
|
|
90
|
+
display: flex;
|
|
91
|
+
height:100% ;
|
|
92
|
+
align-items: center;
|
|
93
|
+
|
|
94
|
+
`;
|
|
95
|
+
|
|
96
|
+
export default StaticBook;
|
|
Binary file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Meta, Story } from '@storybook/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import DayNightPeriod, { IPeriodOfDay, PeriodOfDay, PeriodOfDayProps } from '../components/DayNightPeriod/DayNightPeriod';
|
|
4
|
+
import { RPGUIRoot } from '../components/RPGUIRoot';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
const meta: Meta = {
|
|
8
|
+
title: 'Day and Night Period',
|
|
9
|
+
component: DayNightPeriod,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
|
|
14
|
+
const Template: Story<PeriodOfDayProps> = () => (
|
|
15
|
+
<RPGUIRoot>
|
|
16
|
+
<PeriodOfDay periodOfDay={IPeriodOfDay.Afternoon} />
|
|
17
|
+
</RPGUIRoot>
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export const Default = Template.bind({});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Meta, Story } from '@storybook/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { RPGUIRoot } from '..';
|
|
4
|
+
|
|
5
|
+
import StaticBook, { StaticBookProps } from '../components/StaticBook/StaticBook';
|
|
6
|
+
|
|
7
|
+
const meta: Meta = {
|
|
8
|
+
title: 'Static Book',
|
|
9
|
+
component: StaticBook,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
|
|
14
|
+
const Template: Story<StaticBookProps> = args => (
|
|
15
|
+
<RPGUIRoot>
|
|
16
|
+
<StaticBook {...args} />
|
|
17
|
+
</RPGUIRoot>
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export const Default = Template.bind({});
|
|
21
|
+
|
|
22
|
+
const bookMock = [
|
|
23
|
+
{
|
|
24
|
+
text: '1 ... Computers and RPGs have always gone hand-in-hand. Even when the bes and Oubliette. A few, such as Oubliette, had simple graphics, though most started out as just text or used ASCII’s standard set of text-mode graphics The most successful dungeon crawler of all time is, of course, Blizzard’s Diablo. But Rogue’s longest-lived descendent is arguably a much more interesting game—1987’s Nethack. Technically, it was based on a Rogue clone called, yes, Hack, but let’s not quibble. Nethack takes the basic dungeon crawling concept and adds several decades worth of development.',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
text: '2 ... The original PC RPGs—such as MUDs, or multi-user dungeons—appeared in the mid-70s. These weren’t for home computers, but mainframes, typically found in universities. They tended to be based on either Dungeons & Dragons, which itself launched in 1974, or be variously disguised takes on Tolkien. These included Dungeon, DND, Orthanc, and Oubliette. A few, such as Oubliette, had simple graphics, though most started out as just text or used ASCII’s standard set of text-mode graphics The most successful dungeon crawler of all time is, of course, Blizzard’s Diablo. But Rogue’s longest-lived descendent is arguably a much more interesting game—1987’s Nethack. Technically, it was based on a Rogue clone called, yes, Hack, but let’s not quibble. Nethack takes the basic dungeon crawling concept and adds several decades worth of development. ',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
text: '3 ... Despite the primitive technology, these games often offered surprising depth. Don Daglow’s Dungeon for instance, a 1975 D&D pastiche, offered control of an entire multiplayer party, mapping, NPCs with AI, line-of-sight-based combat, and both melee and ranged attacks. Moria, from the same year, served up wireframe graphics for its characters, and even featured rudimentary 3D views of its corridors. Small ones, with no detail, but let’s not forget that even Space Invaders wasn’t out yet! Ever wondered if throwing a custard pie in a basilisk’s face will stop its petrifying stare? Nethack not only answers that question (it will), but also implements blindness if you get hit by a pie yourself, causes you to break your code if a vegan character eats one (seriously), and ensures the attack doesn’t count if you’re on a pacifist run (it does no damage, no matter your combat bonus). This level of detail lead to the saying “The Dev Team Thinks Of Everything”. Many versions are now available, from the original ASCII-based game to graphical overhauls like Vulture’s Eye. All are free, as a condition of the distribution licence. ',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
text: '4 ... Despite the primitive technology, these games often offered surprising depth. Don Daglow’s Dungeon for instance, a 1975 D&D pastiche, offered control of an entire multiplayer party, mapping, NPCs with AI, line-of-sight-based combat, and both melee and ranged attacks. Moria, from the same year, served up wireframe graphics for its characters, and even featured rudimentary 3D views of its corridors. Small ones, with no detail, but let’s not forget that even Space Invaders wasn’t out yet! Ever wondered if throwing a custard pie in a basilisk’s face will stop its petrifying stare? Nethack not only answers that question (it will), but also implements blindness if you get hit by a pie yourself, causes you to break your code if a vegan character eats one (seriously), and ensures the attack doesn’t count if you’re on a pacifist run (it does no damage, no matter your combat bonus). This level of detail lead to the saying “The Dev Team Thinks Of Everything”. Many versions are now available, from the original ASCII-based game to graphical overhauls like Vulture’s Eye. All are free, as a condition of the distribution licence. ',
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
Default.args = {
|
|
38
|
+
availableBook: bookMock,
|
|
39
|
+
};
|