point-click-components 0.0.8 → 0.0.10
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 +219 -69
- package/dist/point-click-components.js +6525 -5456
- 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';
|
|
12
|
+
import { GameRuntimeOptions } from 'point-click-lib';
|
|
7
13
|
import { HotspotZone } from 'point-click-lib';
|
|
14
|
+
import { InGameEventReporter } from 'point-click-lib';
|
|
15
|
+
import { LogToDebug } from 'point-click-lib';
|
|
8
16
|
import { Order } 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,78 @@ 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: 'SET-SOUND-DISABLED';
|
|
88
|
+
isSoundDisabled: boolean;
|
|
89
|
+
} | {
|
|
90
|
+
type: 'RESET';
|
|
91
|
+
} | {
|
|
92
|
+
type: 'CLEAR-STORYBOARD';
|
|
93
|
+
} | {
|
|
94
|
+
type: 'HANDLE-LOAD';
|
|
95
|
+
data: GameData;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export declare const GameDataContext: Context< {
|
|
99
|
+
gameState: GameData;
|
|
100
|
+
dispatch: Dispatch<GameAction>;
|
|
101
|
+
gameDesign: GameDesign;
|
|
102
|
+
getImageAsset: GetImageAsset;
|
|
103
|
+
getSoundAsset: GetSoundAsset;
|
|
104
|
+
SoundHandler?: SoundPlayerComponent;
|
|
105
|
+
allowLocalSaves?: boolean;
|
|
106
|
+
}>;
|
|
107
|
+
|
|
108
|
+
export declare const GameRoom: FunctionComponent<Props_2>;
|
|
109
|
+
|
|
110
|
+
export declare const GameRunner: ({ gameDesign, Layout, getImageAsset, getSoundAsset, SoundHandler, initialRoomSize, options }: Props_3) => JSX.Element;
|
|
111
|
+
|
|
112
|
+
declare type GameRunnerOptions = Partial<GameRuntimeOptions> & {
|
|
113
|
+
eventReporter?: InGameEventReporter;
|
|
114
|
+
debugLogger?: LogToDebug;
|
|
115
|
+
allowLocalSaves?: boolean;
|
|
116
|
+
maxCameraMove?: number;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
declare type GetImageAsset = {
|
|
120
|
+
(id: string): ImageAsset | undefined;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export declare const getInitialState: (gameDesign: GameDesign, cellSize?: number, startPaused?: boolean) => GameData;
|
|
124
|
+
|
|
125
|
+
export declare const getIntialUi: (gameDesign: GameDesign, size?: {
|
|
126
|
+
roomWidth?: number;
|
|
127
|
+
roomHeight?: number;
|
|
128
|
+
}) => UiState;
|
|
129
|
+
|
|
56
130
|
export declare function getLayerHeight(parallax: number, roomData: RoomData): number;
|
|
57
131
|
|
|
58
132
|
export declare function getLayerWidth(parallax: number, roomData: RoomData): number;
|
|
59
133
|
|
|
134
|
+
declare type GetSoundAsset = {
|
|
135
|
+
(id: string): SoundAsset | undefined;
|
|
136
|
+
};
|
|
137
|
+
|
|
60
138
|
export declare function getXShift(viewAngleX: number, parallax: number, roomData: RoomData): number;
|
|
61
139
|
|
|
62
140
|
export declare function getYShift(viewAngleY: number, parallax: number, roomData: RoomData): number;
|
|
@@ -69,9 +147,9 @@ declare type HandleHoverFunction = {
|
|
|
69
147
|
(target: CommandTarget, event: 'enter' | 'leave'): void;
|
|
70
148
|
};
|
|
71
149
|
|
|
72
|
-
export declare const HorizontalLine: FunctionComponent<
|
|
150
|
+
export declare const HorizontalLine: FunctionComponent<Props_4>;
|
|
73
151
|
|
|
74
|
-
export declare const Hotspot: FunctionComponent<
|
|
152
|
+
export declare const Hotspot: FunctionComponent<Props_5>;
|
|
75
153
|
|
|
76
154
|
declare type ImageAsset = FileAsset & {
|
|
77
155
|
category: ImageAssetCategory;
|
|
@@ -89,6 +167,10 @@ export declare function locateClickInWorld(clickXPosition: number, clickYpositio
|
|
|
89
167
|
y: number;
|
|
90
168
|
};
|
|
91
169
|
|
|
170
|
+
export declare const makeReducer: (gameDesign: GameDesign, options?: GameRunnerOptions) => Reducer<GameData, GameAction>;
|
|
171
|
+
|
|
172
|
+
export declare const makeUiReducer: () => Reducer<UiState, UiAction>;
|
|
173
|
+
|
|
92
174
|
export declare const Pin: ({ x, y, label, pinHeight, pinTilt }: PinProps) => JSX.Element;
|
|
93
175
|
|
|
94
176
|
declare interface PinProps {
|
|
@@ -100,6 +182,74 @@ declare interface PinProps {
|
|
|
100
182
|
}
|
|
101
183
|
|
|
102
184
|
declare interface Props {
|
|
185
|
+
data: ActorData;
|
|
186
|
+
clickHandler?: HandleClickFunction<ActorData>;
|
|
187
|
+
contextClickHandler?: HandleClickFunction<ActorData>;
|
|
188
|
+
handleHover?: HandleHoverFunction;
|
|
189
|
+
orders?: Order[];
|
|
190
|
+
isPaused: boolean;
|
|
191
|
+
roomScale?: number;
|
|
192
|
+
overrideSpriteData?: SpriteData;
|
|
193
|
+
noSound?: boolean;
|
|
194
|
+
getImageAsset: GetImageAsset;
|
|
195
|
+
getSoundAsset: GetSoundAsset;
|
|
196
|
+
sprites: SpriteData[];
|
|
197
|
+
SoundHandler?: SoundPlayerComponent;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
declare type Props_2 = {
|
|
201
|
+
gameState: GameData;
|
|
202
|
+
handleTargetClick: HandleClickFunction<CommandTarget>;
|
|
203
|
+
handleTargetContextClick?: HandleClickFunction<CommandTarget>;
|
|
204
|
+
placeholder?: ReactElement;
|
|
205
|
+
} & Omit<RoomProps, 'data' | 'viewAngleX' | 'viewAngleY' | 'orderedActors'>;
|
|
206
|
+
|
|
207
|
+
declare interface Props_3 {
|
|
208
|
+
gameDesign: GameDesign;
|
|
209
|
+
Layout: FunctionComponent;
|
|
210
|
+
getImageAsset: GetImageAsset;
|
|
211
|
+
getSoundAsset: GetSoundAsset;
|
|
212
|
+
SoundHandler?: SoundPlayerComponent;
|
|
213
|
+
initialRoomSize?: {
|
|
214
|
+
roomHeight?: number;
|
|
215
|
+
roomWidth?: number;
|
|
216
|
+
};
|
|
217
|
+
options?: GameRunnerOptions;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
declare interface Props_4 {
|
|
221
|
+
y: number;
|
|
222
|
+
color?: string;
|
|
223
|
+
text?: string;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
declare interface Props_5 {
|
|
227
|
+
zone: HotspotZone;
|
|
228
|
+
clickHandler?: HandleClickFunction<HotspotZone>;
|
|
229
|
+
contextClickHandler?: HandleClickFunction<HotspotZone>;
|
|
230
|
+
handleHover?: HandleHoverFunction;
|
|
231
|
+
highlight?: boolean;
|
|
232
|
+
markVertices?: boolean;
|
|
233
|
+
flash?: boolean;
|
|
234
|
+
stopPropogation?: boolean;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
declare interface Props_6 {
|
|
238
|
+
children: ReactNode;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
declare interface Props_7 {
|
|
242
|
+
zone: Zone;
|
|
243
|
+
markVertices: boolean;
|
|
244
|
+
zoneType: 'walkable' | 'obstacle';
|
|
245
|
+
zoneOptions: ZoneOptions;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export declare const putActorsInDisplayOrder: (a: ActorData, b: ActorData) => number;
|
|
249
|
+
|
|
250
|
+
export declare const Room: FunctionComponent<RoomProps>;
|
|
251
|
+
|
|
252
|
+
export declare interface RoomProps {
|
|
103
253
|
data: RoomData;
|
|
104
254
|
maxWidth?: number;
|
|
105
255
|
maxHeight?: number;
|
|
@@ -132,85 +282,85 @@ declare interface Props {
|
|
|
132
282
|
fontFamily?: string;
|
|
133
283
|
parallaxContent?: ReactNode;
|
|
134
284
|
surfaceContent?: ReactNode;
|
|
135
|
-
getImageAsset: {
|
|
136
|
-
(id: string): ImageAsset | undefined;
|
|
137
|
-
};
|
|
138
285
|
orderSpeed?: number;
|
|
139
286
|
sprites: SpriteData[];
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
frameIndex?: number;
|
|
144
|
-
}>;
|
|
287
|
+
getImageAsset: GetImageAsset;
|
|
288
|
+
getSoundAsset: GetSoundAsset;
|
|
289
|
+
SoundHandler?: SoundPlayerComponent;
|
|
145
290
|
}
|
|
146
291
|
|
|
147
|
-
declare
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
flash?: boolean;
|
|
155
|
-
stopPropogation?: boolean;
|
|
156
|
-
}
|
|
292
|
+
export declare const RoomRenderContext: Context< {
|
|
293
|
+
roomData: RoomData;
|
|
294
|
+
viewAngleX: number;
|
|
295
|
+
viewAngleY: number;
|
|
296
|
+
scale: number;
|
|
297
|
+
orderSpeed: number;
|
|
298
|
+
}>;
|
|
157
299
|
|
|
158
|
-
declare
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
zoneType: 'walkable' | 'obstacle';
|
|
162
|
-
zoneOptions: ZoneOptions;
|
|
163
|
-
}
|
|
300
|
+
declare type SoundAsset = FileAsset & {
|
|
301
|
+
category: SoundAssetCategory;
|
|
302
|
+
};
|
|
164
303
|
|
|
165
|
-
declare
|
|
166
|
-
children: ReactNode;
|
|
167
|
-
}
|
|
304
|
+
declare type SoundAssetCategory = 'sfx' | 'music';
|
|
168
305
|
|
|
169
|
-
declare
|
|
170
|
-
|
|
171
|
-
clickHandler?: HandleClickFunction<ActorData>;
|
|
172
|
-
contextClickHandler?: HandleClickFunction<ActorData>;
|
|
173
|
-
handleHover?: HandleHoverFunction;
|
|
174
|
-
orders?: Order[];
|
|
306
|
+
declare type SoundPlayerComponent = FunctionComponent<{
|
|
307
|
+
soundValues: SoundValue[];
|
|
175
308
|
isPaused: boolean;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
getImageAsset: {
|
|
180
|
-
(id: string): ImageAsset | undefined;
|
|
181
|
-
};
|
|
182
|
-
sprites: SpriteData[];
|
|
183
|
-
SoundHandler?: FunctionComponent<{
|
|
184
|
-
soundValues: SoundValue[];
|
|
185
|
-
isPaused: boolean;
|
|
186
|
-
frameIndex?: number;
|
|
187
|
-
}>;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
declare interface Props_6 {
|
|
191
|
-
y: number;
|
|
192
|
-
color?: string;
|
|
193
|
-
text?: string;
|
|
194
|
-
}
|
|
309
|
+
frameIndex?: number;
|
|
310
|
+
getSoundAsset: GetSoundAsset;
|
|
311
|
+
}>;
|
|
195
312
|
|
|
196
|
-
export declare const
|
|
313
|
+
export declare const SurfaceFrame: ({ children }: Props_6) => JSX.Element;
|
|
314
|
+
|
|
315
|
+
export declare type UiAction = {
|
|
316
|
+
type: 'SET_VERB';
|
|
317
|
+
verbId: string;
|
|
318
|
+
} | {
|
|
319
|
+
type: 'SET_ITEM';
|
|
320
|
+
itemId?: string;
|
|
321
|
+
} | {
|
|
322
|
+
type: 'SET_HOVER_TARGET';
|
|
323
|
+
hoverTarget?: CommandTarget;
|
|
324
|
+
} | {
|
|
325
|
+
type: 'SET_SCREEN_SIZE';
|
|
326
|
+
height?: number;
|
|
327
|
+
width?: number;
|
|
328
|
+
};
|
|
197
329
|
|
|
198
|
-
export declare
|
|
330
|
+
export declare type UiState = {
|
|
331
|
+
verbId: string;
|
|
332
|
+
itemId?: string;
|
|
333
|
+
hoverTarget?: CommandTarget;
|
|
334
|
+
roomWidth?: number;
|
|
335
|
+
roomHeight?: number;
|
|
336
|
+
};
|
|
199
337
|
|
|
200
|
-
export declare const
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
viewAngleY: number;
|
|
204
|
-
scale: number;
|
|
205
|
-
orderSpeed: number;
|
|
338
|
+
export declare const UiStateContext: Context< {
|
|
339
|
+
uiState: UiState;
|
|
340
|
+
dispatchUi: Dispatch<UiAction>;
|
|
206
341
|
}>;
|
|
207
342
|
|
|
208
|
-
export declare const
|
|
343
|
+
export declare const useCamera: (maxCameraMove?: number) => {
|
|
344
|
+
cameraPoint: {
|
|
345
|
+
x: number;
|
|
346
|
+
y: number;
|
|
347
|
+
};
|
|
348
|
+
updateCamera: (viewAngleX: number, viewAngleY: number, currentRoomId: string) => void;
|
|
349
|
+
isAtPoint: boolean;
|
|
350
|
+
};
|
|
209
351
|
|
|
210
352
|
export declare const useCameraPoint: () => {
|
|
211
353
|
cameraPoint?: XY;
|
|
212
354
|
};
|
|
213
355
|
|
|
356
|
+
export declare const useLocalSavedGame: () => {
|
|
357
|
+
saveGame: (fileName?: string) => void;
|
|
358
|
+
loadGame: (fileName?: string) => void;
|
|
359
|
+
listSavedGames: () => string[];
|
|
360
|
+
deleteSave: (fileName: string) => void;
|
|
361
|
+
restart: () => void;
|
|
362
|
+
};
|
|
363
|
+
|
|
214
364
|
export declare const useRoomRender: () => {
|
|
215
365
|
roomData: {
|
|
216
366
|
id: string;
|
|
@@ -291,7 +441,7 @@ export declare const useRoomRender: () => {
|
|
|
291
441
|
orderSpeed: number;
|
|
292
442
|
};
|
|
293
443
|
|
|
294
|
-
export declare const WalkableOrObstacle: ({ zone, markVertices, zoneType, zoneOptions }:
|
|
444
|
+
export declare const WalkableOrObstacle: ({ zone, markVertices, zoneType, zoneOptions }: Props_7) => JSX.Element;
|
|
295
445
|
|
|
296
446
|
declare type XY = {
|
|
297
447
|
x: number;
|