point-click-components 0.0.8 → 0.0.9
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/point-click-components.d.ts +200 -70
- package/dist/point-click-components.js +6423 -5475
- package/package.json +2 -2
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
import { ActorData } from 'point-click-lib';
|
|
2
2
|
import { CellMatrix } from 'point-click-lib';
|
|
3
|
+
import { Command } from 'point-click-lib';
|
|
3
4
|
import { CommandTarget } from 'point-click-lib';
|
|
4
5
|
import { Context } from 'react';
|
|
6
|
+
import { ConversationChoice } from 'point-click-lib';
|
|
5
7
|
import { Direction } from 'point-click-lib';
|
|
8
|
+
import { Dispatch } from 'react';
|
|
6
9
|
import { FunctionComponent } from 'react';
|
|
10
|
+
import { GameData } from 'point-click-lib';
|
|
11
|
+
import { GameDesign } from 'point-click-lib';
|
|
7
12
|
import { HotspotZone } from 'point-click-lib';
|
|
13
|
+
import { InGameEventReporter } from 'point-click-lib';
|
|
14
|
+
import { LogToDebug } from 'point-click-lib';
|
|
8
15
|
import { Order } from 'point-click-lib';
|
|
16
|
+
import { PlaySound } from 'point-click-lib';
|
|
9
17
|
import { Provider } from 'react';
|
|
18
|
+
import { ReactElement } from 'react';
|
|
10
19
|
import { ReactNode } from 'react';
|
|
20
|
+
import { Reducer } from 'react';
|
|
11
21
|
import { RoomData } from 'point-click-lib';
|
|
12
22
|
import { SoundValue } from 'point-click-lib';
|
|
13
23
|
import { SpriteData } from 'point-click-lib';
|
|
14
24
|
import { Zone } from 'point-click-lib';
|
|
15
25
|
|
|
16
|
-
export declare const ActorFigure: ({ data, isPaused, clickHandler, handleHover, contextClickHandler, orders, overrideSpriteData, noSound, getImageAsset, sprites, SoundHandler, }:
|
|
26
|
+
export declare const ActorFigure: ({ data, isPaused, clickHandler, handleHover, contextClickHandler, orders, overrideSpriteData, noSound, getImageAsset, getSoundAsset, sprites, SoundHandler, }: Props) => JSX.Element;
|
|
17
27
|
|
|
18
|
-
export declare const ActorPreview: ({ data, overrideSpriteData, scale, noBaseLine, maxHeight, animation, direction, getImageAsset, sprites
|
|
28
|
+
export declare const ActorPreview: ({ data, overrideSpriteData, scale, noBaseLine, maxHeight, animation, direction, getImageAsset, sprites }: ActorPreviewProps) => JSX.Element;
|
|
19
29
|
|
|
20
30
|
export declare type ActorPreviewProps = {
|
|
21
31
|
data: ActorData;
|
|
@@ -25,9 +35,7 @@ export declare type ActorPreviewProps = {
|
|
|
25
35
|
maxHeight?: number;
|
|
26
36
|
animation?: string;
|
|
27
37
|
direction?: Direction;
|
|
28
|
-
getImageAsset:
|
|
29
|
-
(id: string): ImageAsset | undefined;
|
|
30
|
-
};
|
|
38
|
+
getImageAsset: GetImageAsset;
|
|
31
39
|
sprites: SpriteData[];
|
|
32
40
|
};
|
|
33
41
|
|
|
@@ -46,6 +54,8 @@ export declare const CameraPointProvider: Provider< {
|
|
|
46
54
|
cameraPoint?: XY;
|
|
47
55
|
}>;
|
|
48
56
|
|
|
57
|
+
export declare const ContextualGameRoom: () => JSX.Element;
|
|
58
|
+
|
|
49
59
|
declare type FileAsset = {
|
|
50
60
|
id: string;
|
|
51
61
|
href: string;
|
|
@@ -53,10 +63,75 @@ declare type FileAsset = {
|
|
|
53
63
|
category?: string;
|
|
54
64
|
};
|
|
55
65
|
|
|
66
|
+
export declare type GameAction = {
|
|
67
|
+
type: 'TICK';
|
|
68
|
+
} | {
|
|
69
|
+
type: 'ROOM-CLICK';
|
|
70
|
+
x: number;
|
|
71
|
+
y: number;
|
|
72
|
+
} | {
|
|
73
|
+
type: 'TARGET-CLICK';
|
|
74
|
+
target: CommandTarget;
|
|
75
|
+
verbId?: string;
|
|
76
|
+
itemId?: string;
|
|
77
|
+
} | {
|
|
78
|
+
type: 'SEND-COMMAND';
|
|
79
|
+
command: Command;
|
|
80
|
+
} | {
|
|
81
|
+
type: 'CONVERSATION-CHOICE';
|
|
82
|
+
choice: ConversationChoice;
|
|
83
|
+
} | {
|
|
84
|
+
type: 'SET-PAUSED';
|
|
85
|
+
isPaused: boolean;
|
|
86
|
+
} | {
|
|
87
|
+
type: 'RESET';
|
|
88
|
+
} | {
|
|
89
|
+
type: 'CLEAR-STORYBOARD';
|
|
90
|
+
} | {
|
|
91
|
+
type: 'HANDLE-LOAD';
|
|
92
|
+
data: GameData;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export declare const GameDataContext: Context< {
|
|
96
|
+
gameState: GameData;
|
|
97
|
+
dispatch: Dispatch<GameAction>;
|
|
98
|
+
gameDesign: GameDesign;
|
|
99
|
+
getImageAsset: GetImageAsset;
|
|
100
|
+
getSoundAsset: GetSoundAsset;
|
|
101
|
+
SoundHandler?: SoundPlayerComponent;
|
|
102
|
+
}>;
|
|
103
|
+
|
|
104
|
+
export declare const GameRoom: FunctionComponent<Props_2>;
|
|
105
|
+
|
|
106
|
+
export declare const GameRunner: ({ gameDesign, Layout, getImageAsset, getSoundAsset, SoundHandler, initialRoomSize, options }: Props_3) => JSX.Element;
|
|
107
|
+
|
|
108
|
+
declare type GameRunnerOptions = {
|
|
109
|
+
eventReporter?: InGameEventReporter;
|
|
110
|
+
debugLogger?: LogToDebug;
|
|
111
|
+
playSound?: PlaySound;
|
|
112
|
+
defaultTalkTime?: number;
|
|
113
|
+
cellSize?: number;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
declare type GetImageAsset = {
|
|
117
|
+
(id: string): ImageAsset | undefined;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export declare const getInitialState: (gameDesign: GameDesign, cellSize?: number, startPaused?: boolean) => GameData;
|
|
121
|
+
|
|
122
|
+
export declare const getIntialUi: (gameDesign: GameDesign, size?: {
|
|
123
|
+
roomWidth?: number;
|
|
124
|
+
roomHeight?: number;
|
|
125
|
+
}) => UiState;
|
|
126
|
+
|
|
56
127
|
export declare function getLayerHeight(parallax: number, roomData: RoomData): number;
|
|
57
128
|
|
|
58
129
|
export declare function getLayerWidth(parallax: number, roomData: RoomData): number;
|
|
59
130
|
|
|
131
|
+
declare type GetSoundAsset = {
|
|
132
|
+
(id: string): SoundAsset | undefined;
|
|
133
|
+
};
|
|
134
|
+
|
|
60
135
|
export declare function getXShift(viewAngleX: number, parallax: number, roomData: RoomData): number;
|
|
61
136
|
|
|
62
137
|
export declare function getYShift(viewAngleY: number, parallax: number, roomData: RoomData): number;
|
|
@@ -69,9 +144,9 @@ declare type HandleHoverFunction = {
|
|
|
69
144
|
(target: CommandTarget, event: 'enter' | 'leave'): void;
|
|
70
145
|
};
|
|
71
146
|
|
|
72
|
-
export declare const HorizontalLine: FunctionComponent<
|
|
147
|
+
export declare const HorizontalLine: FunctionComponent<Props_4>;
|
|
73
148
|
|
|
74
|
-
export declare const Hotspot: FunctionComponent<
|
|
149
|
+
export declare const Hotspot: FunctionComponent<Props_5>;
|
|
75
150
|
|
|
76
151
|
declare type ImageAsset = FileAsset & {
|
|
77
152
|
category: ImageAssetCategory;
|
|
@@ -89,6 +164,10 @@ export declare function locateClickInWorld(clickXPosition: number, clickYpositio
|
|
|
89
164
|
y: number;
|
|
90
165
|
};
|
|
91
166
|
|
|
167
|
+
export declare const makeReducer: (gameDesign: GameDesign, options?: GameRunnerOptions) => Reducer<GameData, GameAction>;
|
|
168
|
+
|
|
169
|
+
export declare const makeUiReducer: () => Reducer<UiState, UiAction>;
|
|
170
|
+
|
|
92
171
|
export declare const Pin: ({ x, y, label, pinHeight, pinTilt }: PinProps) => JSX.Element;
|
|
93
172
|
|
|
94
173
|
declare interface PinProps {
|
|
@@ -100,6 +179,74 @@ declare interface PinProps {
|
|
|
100
179
|
}
|
|
101
180
|
|
|
102
181
|
declare interface Props {
|
|
182
|
+
data: ActorData;
|
|
183
|
+
clickHandler?: HandleClickFunction<ActorData>;
|
|
184
|
+
contextClickHandler?: HandleClickFunction<ActorData>;
|
|
185
|
+
handleHover?: HandleHoverFunction;
|
|
186
|
+
orders?: Order[];
|
|
187
|
+
isPaused: boolean;
|
|
188
|
+
roomScale?: number;
|
|
189
|
+
overrideSpriteData?: SpriteData;
|
|
190
|
+
noSound?: boolean;
|
|
191
|
+
getImageAsset: GetImageAsset;
|
|
192
|
+
getSoundAsset: GetSoundAsset;
|
|
193
|
+
sprites: SpriteData[];
|
|
194
|
+
SoundHandler?: SoundPlayerComponent;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
declare type Props_2 = {
|
|
198
|
+
gameState: GameData;
|
|
199
|
+
handleTargetClick: HandleClickFunction<CommandTarget>;
|
|
200
|
+
handleTargetContextClick?: HandleClickFunction<CommandTarget>;
|
|
201
|
+
placeholder?: ReactElement;
|
|
202
|
+
} & Omit<RoomProps, 'data' | 'viewAngleX' | 'viewAngleY' | 'orderedActors'>;
|
|
203
|
+
|
|
204
|
+
declare interface Props_3 {
|
|
205
|
+
gameDesign: GameDesign;
|
|
206
|
+
Layout: FunctionComponent;
|
|
207
|
+
getImageAsset: GetImageAsset;
|
|
208
|
+
getSoundAsset: GetSoundAsset;
|
|
209
|
+
SoundHandler?: SoundPlayerComponent;
|
|
210
|
+
initialRoomSize?: {
|
|
211
|
+
roomHeight?: number;
|
|
212
|
+
roomWidth?: number;
|
|
213
|
+
};
|
|
214
|
+
options?: GameRunnerOptions;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
declare interface Props_4 {
|
|
218
|
+
y: number;
|
|
219
|
+
color?: string;
|
|
220
|
+
text?: string;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
declare interface Props_5 {
|
|
224
|
+
zone: HotspotZone;
|
|
225
|
+
clickHandler?: HandleClickFunction<HotspotZone>;
|
|
226
|
+
contextClickHandler?: HandleClickFunction<HotspotZone>;
|
|
227
|
+
handleHover?: HandleHoverFunction;
|
|
228
|
+
highlight?: boolean;
|
|
229
|
+
markVertices?: boolean;
|
|
230
|
+
flash?: boolean;
|
|
231
|
+
stopPropogation?: boolean;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
declare interface Props_6 {
|
|
235
|
+
children: ReactNode;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
declare interface Props_7 {
|
|
239
|
+
zone: Zone;
|
|
240
|
+
markVertices: boolean;
|
|
241
|
+
zoneType: 'walkable' | 'obstacle';
|
|
242
|
+
zoneOptions: ZoneOptions;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export declare const putActorsInDisplayOrder: (a: ActorData, b: ActorData) => number;
|
|
246
|
+
|
|
247
|
+
export declare const Room: FunctionComponent<RoomProps>;
|
|
248
|
+
|
|
249
|
+
export declare interface RoomProps {
|
|
103
250
|
data: RoomData;
|
|
104
251
|
maxWidth?: number;
|
|
105
252
|
maxHeight?: number;
|
|
@@ -132,71 +279,13 @@ declare interface Props {
|
|
|
132
279
|
fontFamily?: string;
|
|
133
280
|
parallaxContent?: ReactNode;
|
|
134
281
|
surfaceContent?: ReactNode;
|
|
135
|
-
getImageAsset: {
|
|
136
|
-
(id: string): ImageAsset | undefined;
|
|
137
|
-
};
|
|
138
282
|
orderSpeed?: number;
|
|
139
283
|
sprites: SpriteData[];
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
frameIndex?: number;
|
|
144
|
-
}>;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
declare interface Props_2 {
|
|
148
|
-
zone: HotspotZone;
|
|
149
|
-
clickHandler?: HandleClickFunction<HotspotZone>;
|
|
150
|
-
contextClickHandler?: HandleClickFunction<HotspotZone>;
|
|
151
|
-
handleHover?: HandleHoverFunction;
|
|
152
|
-
highlight?: boolean;
|
|
153
|
-
markVertices?: boolean;
|
|
154
|
-
flash?: boolean;
|
|
155
|
-
stopPropogation?: boolean;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
declare interface Props_3 {
|
|
159
|
-
zone: Zone;
|
|
160
|
-
markVertices: boolean;
|
|
161
|
-
zoneType: 'walkable' | 'obstacle';
|
|
162
|
-
zoneOptions: ZoneOptions;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
declare interface Props_4 {
|
|
166
|
-
children: ReactNode;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
declare interface Props_5 {
|
|
170
|
-
data: ActorData;
|
|
171
|
-
clickHandler?: HandleClickFunction<ActorData>;
|
|
172
|
-
contextClickHandler?: HandleClickFunction<ActorData>;
|
|
173
|
-
handleHover?: HandleHoverFunction;
|
|
174
|
-
orders?: Order[];
|
|
175
|
-
isPaused: boolean;
|
|
176
|
-
roomScale?: number;
|
|
177
|
-
overrideSpriteData?: SpriteData;
|
|
178
|
-
noSound?: boolean;
|
|
179
|
-
getImageAsset: {
|
|
180
|
-
(id: string): ImageAsset | undefined;
|
|
181
|
-
};
|
|
182
|
-
sprites: SpriteData[];
|
|
183
|
-
SoundHandler?: FunctionComponent<{
|
|
184
|
-
soundValues: SoundValue[];
|
|
185
|
-
isPaused: boolean;
|
|
186
|
-
frameIndex?: number;
|
|
187
|
-
}>;
|
|
284
|
+
getImageAsset: GetImageAsset;
|
|
285
|
+
getSoundAsset: GetSoundAsset;
|
|
286
|
+
SoundHandler?: SoundPlayerComponent;
|
|
188
287
|
}
|
|
189
288
|
|
|
190
|
-
declare interface Props_6 {
|
|
191
|
-
y: number;
|
|
192
|
-
color?: string;
|
|
193
|
-
text?: string;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
export declare const putActorsInDisplayOrder: (a: ActorData, b: ActorData) => number;
|
|
197
|
-
|
|
198
|
-
export declare const Room: FunctionComponent<Props>;
|
|
199
|
-
|
|
200
289
|
export declare const RoomRenderContext: Context< {
|
|
201
290
|
roomData: RoomData;
|
|
202
291
|
viewAngleX: number;
|
|
@@ -205,7 +294,48 @@ scale: number;
|
|
|
205
294
|
orderSpeed: number;
|
|
206
295
|
}>;
|
|
207
296
|
|
|
208
|
-
|
|
297
|
+
declare type SoundAsset = FileAsset & {
|
|
298
|
+
category: SoundAssetCategory;
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
declare type SoundAssetCategory = 'sfx' | 'music';
|
|
302
|
+
|
|
303
|
+
declare type SoundPlayerComponent = FunctionComponent<{
|
|
304
|
+
soundValues: SoundValue[];
|
|
305
|
+
isPaused: boolean;
|
|
306
|
+
frameIndex?: number;
|
|
307
|
+
getSoundAsset: GetSoundAsset;
|
|
308
|
+
}>;
|
|
309
|
+
|
|
310
|
+
export declare const SurfaceFrame: ({ children }: Props_6) => JSX.Element;
|
|
311
|
+
|
|
312
|
+
export declare type UiAction = {
|
|
313
|
+
type: 'SET_VERB';
|
|
314
|
+
verbId: string;
|
|
315
|
+
} | {
|
|
316
|
+
type: 'SET_ITEM';
|
|
317
|
+
itemId?: string;
|
|
318
|
+
} | {
|
|
319
|
+
type: 'SET_HOVER_TARGET';
|
|
320
|
+
hoverTarget?: CommandTarget;
|
|
321
|
+
} | {
|
|
322
|
+
type: 'SET_SCREEN_SIZE';
|
|
323
|
+
height?: number;
|
|
324
|
+
width?: number;
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
export declare type UiState = {
|
|
328
|
+
verbId: string;
|
|
329
|
+
itemId?: string;
|
|
330
|
+
hoverTarget?: CommandTarget;
|
|
331
|
+
roomWidth?: number;
|
|
332
|
+
roomHeight?: number;
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
export declare const UiStateContext: Context< {
|
|
336
|
+
uiState: UiState;
|
|
337
|
+
dispatchUi: Dispatch<UiAction>;
|
|
338
|
+
}>;
|
|
209
339
|
|
|
210
340
|
export declare const useCameraPoint: () => {
|
|
211
341
|
cameraPoint?: XY;
|
|
@@ -291,7 +421,7 @@ export declare const useRoomRender: () => {
|
|
|
291
421
|
orderSpeed: number;
|
|
292
422
|
};
|
|
293
423
|
|
|
294
|
-
export declare const WalkableOrObstacle: ({ zone, markVertices, zoneType, zoneOptions }:
|
|
424
|
+
export declare const WalkableOrObstacle: ({ zone, markVertices, zoneType, zoneOptions }: Props_7) => JSX.Element;
|
|
295
425
|
|
|
296
426
|
declare type XY = {
|
|
297
427
|
x: number;
|