point-click-components 0.0.7 → 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 +215 -64
- package/dist/point-click-components.js +6652 -5622
- package/package.json +2 -2
|
@@ -1,18 +1,43 @@
|
|
|
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';
|
|
7
|
+
import { Direction } from 'point-click-lib';
|
|
8
|
+
import { Dispatch } from 'react';
|
|
5
9
|
import { FunctionComponent } from 'react';
|
|
10
|
+
import { GameData } from 'point-click-lib';
|
|
11
|
+
import { GameDesign } from 'point-click-lib';
|
|
6
12
|
import { HotspotZone } from 'point-click-lib';
|
|
13
|
+
import { InGameEventReporter } from 'point-click-lib';
|
|
14
|
+
import { LogToDebug } from 'point-click-lib';
|
|
7
15
|
import { Order } from 'point-click-lib';
|
|
16
|
+
import { PlaySound } from 'point-click-lib';
|
|
8
17
|
import { Provider } from 'react';
|
|
18
|
+
import { ReactElement } from 'react';
|
|
9
19
|
import { ReactNode } from 'react';
|
|
20
|
+
import { Reducer } from 'react';
|
|
10
21
|
import { RoomData } from 'point-click-lib';
|
|
11
22
|
import { SoundValue } from 'point-click-lib';
|
|
12
23
|
import { SpriteData } from 'point-click-lib';
|
|
13
24
|
import { Zone } from 'point-click-lib';
|
|
14
25
|
|
|
15
|
-
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;
|
|
27
|
+
|
|
28
|
+
export declare const ActorPreview: ({ data, overrideSpriteData, scale, noBaseLine, maxHeight, animation, direction, getImageAsset, sprites }: ActorPreviewProps) => JSX.Element;
|
|
29
|
+
|
|
30
|
+
export declare type ActorPreviewProps = {
|
|
31
|
+
data: ActorData;
|
|
32
|
+
overrideSpriteData?: SpriteData;
|
|
33
|
+
scale?: number;
|
|
34
|
+
noBaseLine?: boolean;
|
|
35
|
+
maxHeight?: number;
|
|
36
|
+
animation?: string;
|
|
37
|
+
direction?: Direction;
|
|
38
|
+
getImageAsset: GetImageAsset;
|
|
39
|
+
sprites: SpriteData[];
|
|
40
|
+
};
|
|
16
41
|
|
|
17
42
|
declare type ActorWithOrdersAndClickHandlers = {
|
|
18
43
|
data: ActorData;
|
|
@@ -21,18 +46,16 @@ declare type ActorWithOrdersAndClickHandlers = {
|
|
|
21
46
|
contextClickHandler?: HandleClickFunction<ActorData>;
|
|
22
47
|
};
|
|
23
48
|
|
|
24
|
-
export declare function calculateScreenX(xPosition: number, viewAngleX: number, roomData: RoomData): number;
|
|
25
|
-
|
|
26
|
-
export declare function calculateScreenY(yPosition: number, viewAngleY: number, roomData: RoomData): number;
|
|
27
|
-
|
|
28
49
|
export declare const cameraPointContext: Context< {
|
|
29
50
|
cameraPoint?: XY;
|
|
30
51
|
}>;
|
|
31
52
|
|
|
32
|
-
export declare const
|
|
53
|
+
export declare const CameraPointProvider: Provider< {
|
|
33
54
|
cameraPoint?: XY;
|
|
34
55
|
}>;
|
|
35
56
|
|
|
57
|
+
export declare const ContextualGameRoom: () => JSX.Element;
|
|
58
|
+
|
|
36
59
|
declare type FileAsset = {
|
|
37
60
|
id: string;
|
|
38
61
|
href: string;
|
|
@@ -40,10 +63,75 @@ declare type FileAsset = {
|
|
|
40
63
|
category?: string;
|
|
41
64
|
};
|
|
42
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
|
+
|
|
43
127
|
export declare function getLayerHeight(parallax: number, roomData: RoomData): number;
|
|
44
128
|
|
|
45
129
|
export declare function getLayerWidth(parallax: number, roomData: RoomData): number;
|
|
46
130
|
|
|
131
|
+
declare type GetSoundAsset = {
|
|
132
|
+
(id: string): SoundAsset | undefined;
|
|
133
|
+
};
|
|
134
|
+
|
|
47
135
|
export declare function getXShift(viewAngleX: number, parallax: number, roomData: RoomData): number;
|
|
48
136
|
|
|
49
137
|
export declare function getYShift(viewAngleY: number, parallax: number, roomData: RoomData): number;
|
|
@@ -56,7 +144,9 @@ declare type HandleHoverFunction = {
|
|
|
56
144
|
(target: CommandTarget, event: 'enter' | 'leave'): void;
|
|
57
145
|
};
|
|
58
146
|
|
|
59
|
-
export declare const
|
|
147
|
+
export declare const HorizontalLine: FunctionComponent<Props_4>;
|
|
148
|
+
|
|
149
|
+
export declare const Hotspot: FunctionComponent<Props_5>;
|
|
60
150
|
|
|
61
151
|
declare type ImageAsset = FileAsset & {
|
|
62
152
|
category: ImageAssetCategory;
|
|
@@ -74,6 +164,10 @@ export declare function locateClickInWorld(clickXPosition: number, clickYpositio
|
|
|
74
164
|
y: number;
|
|
75
165
|
};
|
|
76
166
|
|
|
167
|
+
export declare const makeReducer: (gameDesign: GameDesign, options?: GameRunnerOptions) => Reducer<GameData, GameAction>;
|
|
168
|
+
|
|
169
|
+
export declare const makeUiReducer: () => Reducer<UiState, UiAction>;
|
|
170
|
+
|
|
77
171
|
export declare const Pin: ({ x, y, label, pinHeight, pinTilt }: PinProps) => JSX.Element;
|
|
78
172
|
|
|
79
173
|
declare interface PinProps {
|
|
@@ -85,6 +179,74 @@ declare interface PinProps {
|
|
|
85
179
|
}
|
|
86
180
|
|
|
87
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 {
|
|
88
250
|
data: RoomData;
|
|
89
251
|
maxWidth?: number;
|
|
90
252
|
maxHeight?: number;
|
|
@@ -117,65 +279,13 @@ declare interface Props {
|
|
|
117
279
|
fontFamily?: string;
|
|
118
280
|
parallaxContent?: ReactNode;
|
|
119
281
|
surfaceContent?: ReactNode;
|
|
120
|
-
getImageAsset: {
|
|
121
|
-
(id: string): ImageAsset | undefined;
|
|
122
|
-
};
|
|
123
282
|
orderSpeed?: number;
|
|
124
283
|
sprites: SpriteData[];
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
frameIndex?: number;
|
|
129
|
-
}>;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
declare interface Props_2 {
|
|
133
|
-
zone: HotspotZone;
|
|
134
|
-
clickHandler?: HandleClickFunction<HotspotZone>;
|
|
135
|
-
contextClickHandler?: HandleClickFunction<HotspotZone>;
|
|
136
|
-
handleHover?: HandleHoverFunction;
|
|
137
|
-
highlight?: boolean;
|
|
138
|
-
markVertices?: boolean;
|
|
139
|
-
flash?: boolean;
|
|
140
|
-
stopPropogation?: boolean;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
declare interface Props_3 {
|
|
144
|
-
zone: Zone;
|
|
145
|
-
markVertices: boolean;
|
|
146
|
-
zoneType: 'walkable' | 'obstacle';
|
|
147
|
-
zoneOptions: ZoneOptions;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
declare interface Props_4 {
|
|
151
|
-
children: ReactNode;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
declare interface Props_5 {
|
|
155
|
-
data: ActorData;
|
|
156
|
-
clickHandler?: HandleClickFunction<ActorData>;
|
|
157
|
-
contextClickHandler?: HandleClickFunction<ActorData>;
|
|
158
|
-
handleHover?: HandleHoverFunction;
|
|
159
|
-
orders?: Order[];
|
|
160
|
-
isPaused: boolean;
|
|
161
|
-
roomScale?: number;
|
|
162
|
-
overrideSpriteData?: SpriteData;
|
|
163
|
-
noSound?: boolean;
|
|
164
|
-
getImageAsset: {
|
|
165
|
-
(id: string): ImageAsset | undefined;
|
|
166
|
-
};
|
|
167
|
-
sprites: SpriteData[];
|
|
168
|
-
SoundHandler?: FunctionComponent<{
|
|
169
|
-
soundValues: SoundValue[];
|
|
170
|
-
isPaused: boolean;
|
|
171
|
-
frameIndex?: number;
|
|
172
|
-
}>;
|
|
284
|
+
getImageAsset: GetImageAsset;
|
|
285
|
+
getSoundAsset: GetSoundAsset;
|
|
286
|
+
SoundHandler?: SoundPlayerComponent;
|
|
173
287
|
}
|
|
174
288
|
|
|
175
|
-
export declare const putActorsInDisplayOrder: (a: ActorData, b: ActorData) => number;
|
|
176
|
-
|
|
177
|
-
export declare const Room: FunctionComponent<Props>;
|
|
178
|
-
|
|
179
289
|
export declare const RoomRenderContext: Context< {
|
|
180
290
|
roomData: RoomData;
|
|
181
291
|
viewAngleX: number;
|
|
@@ -184,7 +294,48 @@ scale: number;
|
|
|
184
294
|
orderSpeed: number;
|
|
185
295
|
}>;
|
|
186
296
|
|
|
187
|
-
|
|
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
|
+
}>;
|
|
188
339
|
|
|
189
340
|
export declare const useCameraPoint: () => {
|
|
190
341
|
cameraPoint?: XY;
|
|
@@ -270,7 +421,7 @@ export declare const useRoomRender: () => {
|
|
|
270
421
|
orderSpeed: number;
|
|
271
422
|
};
|
|
272
423
|
|
|
273
|
-
export declare const WalkableOrObstacle: ({ zone, markVertices, zoneType, zoneOptions }:
|
|
424
|
+
export declare const WalkableOrObstacle: ({ zone, markVertices, zoneType, zoneOptions }: Props_7) => JSX.Element;
|
|
274
425
|
|
|
275
426
|
declare type XY = {
|
|
276
427
|
x: number;
|