@battle-racing/br-common-lib 6.2.0-rc.0 → 6.2.0-rc.2
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/__deprecated__/constants/hardware/screen-view.d.ts +1 -0
- package/dist/__deprecated__/constants/hardware/screen-view.js +1 -0
- package/dist/data/all-tutorial-steps.d.ts +2 -0
- package/dist/data/all-tutorial-steps.js +379 -0
- package/dist/data/index.d.ts +1 -0
- package/dist/data/index.js +1 -0
- package/dist/domains/hardware/ModuleStatus.schema.d.ts +1 -0
- package/dist/domains/hardware/screen/Screen.const.d.ts +1 -0
- package/dist/domains/hardware/screen/Screen.const.js +1 -0
- package/dist/domains/hardware/screen/Screen.schema.d.ts +2 -0
- package/dist/domains/socket/clientToServer/SocketKartClientToServerEventsParams.d.ts +3 -0
- package/dist/domains/socket/serverToClient/SocketKartServerToClientEventsParams.d.ts +3 -0
- package/dist/domains/tutorial/Tutorial.const.d.ts +30 -0
- package/dist/domains/tutorial/Tutorial.const.js +31 -1
- package/dist/domains/tutorial/Tutorial.schema.d.ts +139 -0
- package/dist/domains/tutorial/Tutorial.schema.js +56 -1
- package/dist/domains/tutorial/Tutorial.types.d.ts +10 -1
- package/dist/domains/tutorial/TutorialConfig.schema.d.ts +2781 -0
- package/dist/domains/tutorial/TutorialConfig.schema.js +43 -0
- package/dist/domains/tutorial/TutorialConfig.types.d.ts +9 -0
- package/dist/domains/tutorial/TutorialConfig.types.js +2 -0
- package/dist/domains/tutorial/index.d.ts +2 -0
- package/dist/domains/tutorial/index.js +2 -0
- package/package.json +1 -1
- package/src/__deprecated__/constants/hardware/screen-view.ts +1 -0
- package/src/data/all-tutorial-steps.ts +388 -0
- package/src/data/index.ts +1 -1
- package/src/domains/hardware/screen/Screen.const.ts +1 -0
- package/src/domains/socket/clientToServer/SocketKartClientToServerEventsParams.ts +3 -0
- package/src/domains/socket/serverToClient/SocketKartServerToClientEventsParams.ts +3 -0
- package/src/domains/tutorial/Tutorial.const.ts +36 -0
- package/src/domains/tutorial/Tutorial.schema.ts +74 -1
- package/src/domains/tutorial/Tutorial.types.ts +21 -1
- package/src/domains/tutorial/TutorialConfig.schema.ts +52 -0
- package/src/domains/tutorial/TutorialConfig.types.ts +18 -0
- package/src/domains/tutorial/index.ts +2 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tutorialMasterConfigSchema = exports.tutorialPhaseConfigSchema = exports.tutorialStepConfigSchema = exports.tutorialListenEventSchema = exports.tutorialCheckpointListenEventSchema = exports.tutorialWheelButtonListenEventSchema = exports.tutorialTimeoutListenEventSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const Command_schema_1 = require("../command/Command.schema");
|
|
6
|
+
const Tutorial_const_1 = require("./Tutorial.const");
|
|
7
|
+
const Tutorial_schema_1 = require("./Tutorial.schema");
|
|
8
|
+
exports.tutorialTimeoutListenEventSchema = zod_1.z.object({
|
|
9
|
+
on: zod_1.z.literal(Tutorial_const_1.TUTORIAL_LISTEN_EVENT_ON.TIMEOUT),
|
|
10
|
+
durationMs: zod_1.z.number().int().positive(),
|
|
11
|
+
});
|
|
12
|
+
exports.tutorialWheelButtonListenEventSchema = zod_1.z.object({
|
|
13
|
+
on: zod_1.z.literal(Tutorial_const_1.TUTORIAL_LISTEN_EVENT_ON.WHEEL_BUTTON),
|
|
14
|
+
button: Tutorial_schema_1.tutorialSteeringWheelButtonSchema,
|
|
15
|
+
});
|
|
16
|
+
exports.tutorialCheckpointListenEventSchema = zod_1.z.object({
|
|
17
|
+
on: zod_1.z.literal(Tutorial_const_1.TUTORIAL_LISTEN_EVENT_ON.CHECKPOINT),
|
|
18
|
+
checkpoint: Tutorial_schema_1.tutorialLogicalCheckpointSchema,
|
|
19
|
+
});
|
|
20
|
+
exports.tutorialListenEventSchema = zod_1.z.discriminatedUnion('on', [
|
|
21
|
+
exports.tutorialTimeoutListenEventSchema,
|
|
22
|
+
exports.tutorialWheelButtonListenEventSchema,
|
|
23
|
+
exports.tutorialCheckpointListenEventSchema,
|
|
24
|
+
]);
|
|
25
|
+
exports.tutorialStepConfigSchema = zod_1.z.object({
|
|
26
|
+
id: zod_1.z.string().min(1),
|
|
27
|
+
index: zod_1.z.number().int().nonnegative(),
|
|
28
|
+
name: zod_1.z.string().min(1),
|
|
29
|
+
screenStep: Tutorial_schema_1.tutorialScreenStepSchema,
|
|
30
|
+
listenEvent: exports.tutorialListenEventSchema,
|
|
31
|
+
triggerCommands: zod_1.z.array(Command_schema_1.allCommandsConfigSchema),
|
|
32
|
+
});
|
|
33
|
+
exports.tutorialPhaseConfigSchema = zod_1.z.object({
|
|
34
|
+
id: Tutorial_schema_1.tutorialPhaseIdSchema,
|
|
35
|
+
name: zod_1.z.string().min(1),
|
|
36
|
+
index: zod_1.z.number().int().nonnegative(),
|
|
37
|
+
steps: zod_1.z.array(exports.tutorialStepConfigSchema).min(1),
|
|
38
|
+
});
|
|
39
|
+
exports.tutorialMasterConfigSchema = zod_1.z.object({
|
|
40
|
+
id: zod_1.z.string().min(1),
|
|
41
|
+
name: zod_1.z.string().min(1),
|
|
42
|
+
phases: zod_1.z.array(exports.tutorialPhaseConfigSchema).min(1),
|
|
43
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { tutorialCheckpointListenEventSchema, tutorialListenEventSchema, tutorialMasterConfigSchema, tutorialPhaseConfigSchema, tutorialStepConfigSchema, tutorialTimeoutListenEventSchema, tutorialWheelButtonListenEventSchema } from './TutorialConfig.schema';
|
|
3
|
+
export type TutorialTimeoutListenEvent = z.infer<typeof tutorialTimeoutListenEventSchema>;
|
|
4
|
+
export type TutorialWheelButtonListenEvent = z.infer<typeof tutorialWheelButtonListenEventSchema>;
|
|
5
|
+
export type TutorialCheckpointListenEvent = z.infer<typeof tutorialCheckpointListenEventSchema>;
|
|
6
|
+
export type TutorialListenEvent = z.infer<typeof tutorialListenEventSchema>;
|
|
7
|
+
export type TutorialStepConfig = z.infer<typeof tutorialStepConfigSchema>;
|
|
8
|
+
export type TutorialPhaseConfig = z.infer<typeof tutorialPhaseConfigSchema>;
|
|
9
|
+
export type TutorialMasterConfig = z.infer<typeof tutorialMasterConfigSchema>;
|
|
@@ -17,3 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./Tutorial.const"), exports);
|
|
18
18
|
__exportStar(require("./Tutorial.schema"), exports);
|
|
19
19
|
__exportStar(require("./Tutorial.types"), exports);
|
|
20
|
+
__exportStar(require("./TutorialConfig.schema"), exports);
|
|
21
|
+
__exportStar(require("./TutorialConfig.types"), exports);
|
package/package.json
CHANGED
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import {
|
|
2
|
+
POWER_UP_NAME,
|
|
3
|
+
ScreenTutorialHud,
|
|
4
|
+
TUTORIAL_LISTEN_EVENT_ON,
|
|
5
|
+
TUTORIAL_LOGICAL_CHECKPOINT,
|
|
6
|
+
TUTORIAL_PHASE_ID,
|
|
7
|
+
TUTORIAL_SCREEN_STEP,
|
|
8
|
+
TUTORIAL_STEERING_WHEEL_BUTTON,
|
|
9
|
+
TutorialMasterConfig,
|
|
10
|
+
} from '../domains';
|
|
11
|
+
|
|
12
|
+
const defaultTutorialHud: ScreenTutorialHud = {
|
|
13
|
+
position: { current: 1, total: 6 },
|
|
14
|
+
coins: 0,
|
|
15
|
+
gameTimeLeft: { minutes: 3, seconds: 0 },
|
|
16
|
+
laps: { current: 1, total: 1 },
|
|
17
|
+
powerUp: null,
|
|
18
|
+
powerUpAnimationTimeSeconds: null,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const nitroTutorialHud: ScreenTutorialHud = {
|
|
22
|
+
...defaultTutorialHud,
|
|
23
|
+
powerUp: POWER_UP_NAME.BATTLE_NITRO,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const allTutorialConfig: TutorialMasterConfig = {
|
|
27
|
+
id: 'tutorial-master-v1',
|
|
28
|
+
name: 'Standard Circuit Induction Tutorial',
|
|
29
|
+
phases: [
|
|
30
|
+
{
|
|
31
|
+
id: TUTORIAL_PHASE_ID.STARTING_POINT,
|
|
32
|
+
name: 'Starting Point',
|
|
33
|
+
index: 0,
|
|
34
|
+
steps: [
|
|
35
|
+
{
|
|
36
|
+
id: 'step_welcome',
|
|
37
|
+
index: 0,
|
|
38
|
+
name: 'Welcome Screen',
|
|
39
|
+
screenStep: TUTORIAL_SCREEN_STEP.WELCOME,
|
|
40
|
+
listenEvent: {
|
|
41
|
+
on: TUTORIAL_LISTEN_EVENT_ON.TIMEOUT,
|
|
42
|
+
durationMs: 5000,
|
|
43
|
+
},
|
|
44
|
+
triggerCommands: [
|
|
45
|
+
{
|
|
46
|
+
module: 'screen',
|
|
47
|
+
action: 'showTutorialView',
|
|
48
|
+
params: {
|
|
49
|
+
step: TUTORIAL_SCREEN_STEP.WELCOME,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 'step_personal_items',
|
|
56
|
+
index: 1,
|
|
57
|
+
name: 'Personal Items Safety',
|
|
58
|
+
screenStep: TUTORIAL_SCREEN_STEP.PERSONAL_ITEMS,
|
|
59
|
+
listenEvent: {
|
|
60
|
+
on: TUTORIAL_LISTEN_EVENT_ON.TIMEOUT,
|
|
61
|
+
durationMs: 5000,
|
|
62
|
+
},
|
|
63
|
+
triggerCommands: [
|
|
64
|
+
{
|
|
65
|
+
module: 'screen',
|
|
66
|
+
action: 'showTutorialView',
|
|
67
|
+
params: {
|
|
68
|
+
step: TUTORIAL_SCREEN_STEP.PERSONAL_ITEMS,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: 'step_seat_belt',
|
|
75
|
+
index: 2,
|
|
76
|
+
name: 'Seat Belt Fastening',
|
|
77
|
+
screenStep: TUTORIAL_SCREEN_STEP.SEAT_BELT,
|
|
78
|
+
listenEvent: {
|
|
79
|
+
on: TUTORIAL_LISTEN_EVENT_ON.TIMEOUT,
|
|
80
|
+
durationMs: 5000,
|
|
81
|
+
},
|
|
82
|
+
triggerCommands: [
|
|
83
|
+
{
|
|
84
|
+
module: 'screen',
|
|
85
|
+
action: 'showTutorialView',
|
|
86
|
+
params: {
|
|
87
|
+
step: TUTORIAL_SCREEN_STEP.SEAT_BELT,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: 'step_pedal',
|
|
94
|
+
index: 3,
|
|
95
|
+
name: 'Pedal Acceleration Check',
|
|
96
|
+
screenStep: TUTORIAL_SCREEN_STEP.PEDAL,
|
|
97
|
+
listenEvent: {
|
|
98
|
+
on: TUTORIAL_LISTEN_EVENT_ON.CHECKPOINT,
|
|
99
|
+
checkpoint: TUTORIAL_LOGICAL_CHECKPOINT.CHECKPOINT_1,
|
|
100
|
+
},
|
|
101
|
+
triggerCommands: [
|
|
102
|
+
{
|
|
103
|
+
module: 'screen',
|
|
104
|
+
action: 'showTutorialView',
|
|
105
|
+
params: {
|
|
106
|
+
step: TUTORIAL_SCREEN_STEP.PEDAL,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: TUTORIAL_PHASE_ID.CHECKPOINT_1,
|
|
115
|
+
name: 'Checkpoint 1 - Controls and HUD',
|
|
116
|
+
index: 1,
|
|
117
|
+
steps: [
|
|
118
|
+
{
|
|
119
|
+
id: 'step_wheel_0_of_2',
|
|
120
|
+
index: 0,
|
|
121
|
+
name: 'Wheel Button Right Check',
|
|
122
|
+
screenStep: TUTORIAL_SCREEN_STEP.WHEEL_CONTROLS_0_OF_2,
|
|
123
|
+
listenEvent: {
|
|
124
|
+
on: TUTORIAL_LISTEN_EVENT_ON.WHEEL_BUTTON,
|
|
125
|
+
button: TUTORIAL_STEERING_WHEEL_BUTTON.RIGHT,
|
|
126
|
+
},
|
|
127
|
+
triggerCommands: [
|
|
128
|
+
{
|
|
129
|
+
module: 'screen',
|
|
130
|
+
action: 'showTutorialView',
|
|
131
|
+
params: {
|
|
132
|
+
step: TUTORIAL_SCREEN_STEP.WHEEL_CONTROLS_0_OF_2,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
id: 'step_wheel_1_of_2',
|
|
139
|
+
index: 1,
|
|
140
|
+
name: 'Wheel Button Left Check',
|
|
141
|
+
screenStep: TUTORIAL_SCREEN_STEP.WHEEL_CONTROLS_1_OF_2,
|
|
142
|
+
listenEvent: {
|
|
143
|
+
on: TUTORIAL_LISTEN_EVENT_ON.WHEEL_BUTTON,
|
|
144
|
+
button: TUTORIAL_STEERING_WHEEL_BUTTON.LEFT,
|
|
145
|
+
},
|
|
146
|
+
triggerCommands: [
|
|
147
|
+
{
|
|
148
|
+
module: 'screen',
|
|
149
|
+
action: 'showTutorialView',
|
|
150
|
+
params: {
|
|
151
|
+
step: TUTORIAL_SCREEN_STEP.WHEEL_CONTROLS_1_OF_2,
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
id: 'step_wheel_completed',
|
|
158
|
+
index: 2,
|
|
159
|
+
name: 'Wheel Controls Success',
|
|
160
|
+
screenStep: TUTORIAL_SCREEN_STEP.WHEEL_CONTROLS_COMPLETED,
|
|
161
|
+
listenEvent: {
|
|
162
|
+
on: TUTORIAL_LISTEN_EVENT_ON.TIMEOUT,
|
|
163
|
+
durationMs: 5000,
|
|
164
|
+
},
|
|
165
|
+
triggerCommands: [
|
|
166
|
+
{
|
|
167
|
+
module: 'screen',
|
|
168
|
+
action: 'showTutorialView',
|
|
169
|
+
params: {
|
|
170
|
+
step: TUTORIAL_SCREEN_STEP.WHEEL_CONTROLS_COMPLETED,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
id: 'step_hud_overview',
|
|
177
|
+
index: 3,
|
|
178
|
+
name: 'HUD Overview Explanation',
|
|
179
|
+
screenStep: TUTORIAL_SCREEN_STEP.HUD_OVERVIEW,
|
|
180
|
+
listenEvent: {
|
|
181
|
+
on: TUTORIAL_LISTEN_EVENT_ON.WHEEL_BUTTON,
|
|
182
|
+
button: TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
|
|
183
|
+
},
|
|
184
|
+
triggerCommands: [
|
|
185
|
+
{
|
|
186
|
+
module: 'screen',
|
|
187
|
+
action: 'showTutorialView',
|
|
188
|
+
params: {
|
|
189
|
+
step: TUTORIAL_SCREEN_STEP.HUD_OVERVIEW,
|
|
190
|
+
hud: defaultTutorialHud,
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
],
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
id: 'step_hud_position',
|
|
197
|
+
index: 4,
|
|
198
|
+
name: 'HUD Position Indicator',
|
|
199
|
+
screenStep: TUTORIAL_SCREEN_STEP.HUD_POSITION,
|
|
200
|
+
listenEvent: {
|
|
201
|
+
on: TUTORIAL_LISTEN_EVENT_ON.WHEEL_BUTTON,
|
|
202
|
+
button: TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
|
|
203
|
+
},
|
|
204
|
+
triggerCommands: [
|
|
205
|
+
{
|
|
206
|
+
module: 'screen',
|
|
207
|
+
action: 'showTutorialView',
|
|
208
|
+
params: {
|
|
209
|
+
step: TUTORIAL_SCREEN_STEP.HUD_POSITION,
|
|
210
|
+
hud: defaultTutorialHud,
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
],
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
id: 'step_hud_laps',
|
|
217
|
+
index: 5,
|
|
218
|
+
name: 'HUD Lap Counter',
|
|
219
|
+
screenStep: TUTORIAL_SCREEN_STEP.HUD_LAPS,
|
|
220
|
+
listenEvent: {
|
|
221
|
+
on: TUTORIAL_LISTEN_EVENT_ON.WHEEL_BUTTON,
|
|
222
|
+
button: TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
|
|
223
|
+
},
|
|
224
|
+
triggerCommands: [
|
|
225
|
+
{
|
|
226
|
+
module: 'screen',
|
|
227
|
+
action: 'showTutorialView',
|
|
228
|
+
params: {
|
|
229
|
+
step: TUTORIAL_SCREEN_STEP.HUD_LAPS,
|
|
230
|
+
hud: defaultTutorialHud,
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
],
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
id: 'step_hud_time_left',
|
|
237
|
+
index: 6,
|
|
238
|
+
name: 'HUD Time Left',
|
|
239
|
+
screenStep: TUTORIAL_SCREEN_STEP.HUD_TIME_LEFT,
|
|
240
|
+
listenEvent: {
|
|
241
|
+
on: TUTORIAL_LISTEN_EVENT_ON.WHEEL_BUTTON,
|
|
242
|
+
button: TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
|
|
243
|
+
},
|
|
244
|
+
triggerCommands: [
|
|
245
|
+
{
|
|
246
|
+
module: 'screen',
|
|
247
|
+
action: 'showTutorialView',
|
|
248
|
+
params: {
|
|
249
|
+
step: TUTORIAL_SCREEN_STEP.HUD_TIME_LEFT,
|
|
250
|
+
hud: defaultTutorialHud,
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
],
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
id: 'step_hud_coins',
|
|
257
|
+
index: 7,
|
|
258
|
+
name: 'HUD Coins and Checkpoint 2 Target',
|
|
259
|
+
screenStep: TUTORIAL_SCREEN_STEP.HUD_COINS,
|
|
260
|
+
listenEvent: {
|
|
261
|
+
on: TUTORIAL_LISTEN_EVENT_ON.CHECKPOINT,
|
|
262
|
+
checkpoint: TUTORIAL_LOGICAL_CHECKPOINT.CHECKPOINT_2,
|
|
263
|
+
},
|
|
264
|
+
triggerCommands: [
|
|
265
|
+
{
|
|
266
|
+
module: 'screen',
|
|
267
|
+
action: 'showTutorialView',
|
|
268
|
+
params: {
|
|
269
|
+
step: TUTORIAL_SCREEN_STEP.HUD_COINS,
|
|
270
|
+
hud: defaultTutorialHud,
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
],
|
|
274
|
+
},
|
|
275
|
+
],
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
id: TUTORIAL_PHASE_ID.CHECKPOINT_2,
|
|
279
|
+
name: 'Checkpoint 2 - Power Up Preview',
|
|
280
|
+
index: 2,
|
|
281
|
+
steps: [
|
|
282
|
+
{
|
|
283
|
+
id: 'step_power_up_waiting',
|
|
284
|
+
index: 0,
|
|
285
|
+
name: 'Power Up Allocation Trigger',
|
|
286
|
+
screenStep: TUTORIAL_SCREEN_STEP.POWER_UP_WAITING,
|
|
287
|
+
listenEvent: {
|
|
288
|
+
on: TUTORIAL_LISTEN_EVENT_ON.TIMEOUT,
|
|
289
|
+
durationMs: 1000,
|
|
290
|
+
},
|
|
291
|
+
triggerCommands: [
|
|
292
|
+
{
|
|
293
|
+
module: 'screen',
|
|
294
|
+
action: 'showTutorialView',
|
|
295
|
+
params: {
|
|
296
|
+
step: TUTORIAL_SCREEN_STEP.POWER_UP_WAITING,
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
],
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
id: 'step_power_up_roulette',
|
|
303
|
+
index: 1,
|
|
304
|
+
name: 'Power Up Roulette Animation',
|
|
305
|
+
screenStep: TUTORIAL_SCREEN_STEP.POWER_UP_ROULETTE,
|
|
306
|
+
listenEvent: {
|
|
307
|
+
on: TUTORIAL_LISTEN_EVENT_ON.TIMEOUT,
|
|
308
|
+
durationMs: 3000,
|
|
309
|
+
},
|
|
310
|
+
triggerCommands: [
|
|
311
|
+
{
|
|
312
|
+
module: 'screen',
|
|
313
|
+
action: 'showTutorialView',
|
|
314
|
+
params: {
|
|
315
|
+
step: TUTORIAL_SCREEN_STEP.POWER_UP_ROULETTE,
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
],
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
id: 'step_power_up_nitro_ready',
|
|
322
|
+
index: 2,
|
|
323
|
+
name: 'Power Up Nitro Ready To Fire',
|
|
324
|
+
screenStep: TUTORIAL_SCREEN_STEP.POWER_UP_NITRO_READY,
|
|
325
|
+
listenEvent: {
|
|
326
|
+
on: TUTORIAL_LISTEN_EVENT_ON.WHEEL_BUTTON,
|
|
327
|
+
button: TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
|
|
328
|
+
},
|
|
329
|
+
triggerCommands: [
|
|
330
|
+
{
|
|
331
|
+
module: 'screen',
|
|
332
|
+
action: 'showTutorialView',
|
|
333
|
+
params: {
|
|
334
|
+
step: TUTORIAL_SCREEN_STEP.POWER_UP_NITRO_READY,
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
],
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
id: 'step_power_up_return_to_hud',
|
|
341
|
+
index: 3,
|
|
342
|
+
name: 'Nitro Fired - Return to HUD',
|
|
343
|
+
screenStep: TUTORIAL_SCREEN_STEP.POWER_UP_RETURN_TO_HUD,
|
|
344
|
+
listenEvent: {
|
|
345
|
+
on: TUTORIAL_LISTEN_EVENT_ON.CHECKPOINT,
|
|
346
|
+
checkpoint: TUTORIAL_LOGICAL_CHECKPOINT.CHECKPOINT_3_FINISH,
|
|
347
|
+
},
|
|
348
|
+
triggerCommands: [
|
|
349
|
+
{
|
|
350
|
+
module: 'screen',
|
|
351
|
+
action: 'showTutorialView',
|
|
352
|
+
params: {
|
|
353
|
+
step: TUTORIAL_SCREEN_STEP.POWER_UP_RETURN_TO_HUD,
|
|
354
|
+
hud: nitroTutorialHud,
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
],
|
|
358
|
+
},
|
|
359
|
+
],
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
id: TUTORIAL_PHASE_ID.LAP_COMPLETION,
|
|
363
|
+
name: 'Lap Completion',
|
|
364
|
+
index: 3,
|
|
365
|
+
steps: [
|
|
366
|
+
{
|
|
367
|
+
id: 'step_tutorial_completed',
|
|
368
|
+
index: 0,
|
|
369
|
+
name: 'Tutorial Completed Screen',
|
|
370
|
+
screenStep: TUTORIAL_SCREEN_STEP.TUTORIAL_COMPLETED,
|
|
371
|
+
listenEvent: {
|
|
372
|
+
on: TUTORIAL_LISTEN_EVENT_ON.TIMEOUT,
|
|
373
|
+
durationMs: 5000,
|
|
374
|
+
},
|
|
375
|
+
triggerCommands: [
|
|
376
|
+
{
|
|
377
|
+
module: 'screen',
|
|
378
|
+
action: 'showTutorialView',
|
|
379
|
+
params: {
|
|
380
|
+
step: TUTORIAL_SCREEN_STEP.TUTORIAL_COMPLETED,
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
],
|
|
384
|
+
},
|
|
385
|
+
],
|
|
386
|
+
},
|
|
387
|
+
],
|
|
388
|
+
};
|
package/src/data/index.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { DamageEffectName } from '../../damage';
|
|
2
2
|
import type { Kart } from '../../kart';
|
|
3
|
+
import type { TutorialInputSignal } from '../../tutorial';
|
|
3
4
|
import type { SocketInitKartInput, SocketRegisterKartCheckpointInput } from '../inputs';
|
|
4
5
|
|
|
5
6
|
export interface SocketKartClientToServerEventsParams {
|
|
6
7
|
'kart:init': SocketInitKartInput;
|
|
7
8
|
'kart:checkpoint': SocketRegisterKartCheckpointInput;
|
|
9
|
+
/** Report tutorial input signal from Kart (e.g. steering wheel button) */
|
|
10
|
+
'kart:tutorial:input': TutorialInputSignal;
|
|
8
11
|
/** Activate the damage of a powerUp */
|
|
9
12
|
'kart:damage:sent': { damageName: DamageEffectName };
|
|
10
13
|
/** The Kart received damage */
|
|
@@ -3,6 +3,7 @@ import type { GameTrack, GameTrackKartConfig, GameTrackKartsConfig } from '../..
|
|
|
3
3
|
import type { Kart, KartStatus } from '../../kart';
|
|
4
4
|
import type { Response } from '../../response';
|
|
5
5
|
import type { SocketPowerUpEventsParams } from '../SocketPowerUpEventsParams';
|
|
6
|
+
import type { TutorialKartSnapshot } from '../../tutorial';
|
|
6
7
|
|
|
7
8
|
interface BaseGameEventParams {
|
|
8
9
|
gameId: Game['id'];
|
|
@@ -25,6 +26,8 @@ export interface SocketKartEventsParams {
|
|
|
25
26
|
'kart:gameTrack:emergency:stopped': undefined;
|
|
26
27
|
/** Force kart to change status */
|
|
27
28
|
'kart:status:change': { status: KartStatus };
|
|
29
|
+
/** Synchronize authoritative tutorial state snapshot to Kart */
|
|
30
|
+
'kart:tutorial:sync': TutorialKartSnapshot;
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
export interface SocketGameEventParams {
|
|
@@ -21,3 +21,39 @@ export const TUTORIAL_SCREEN_STEP = {
|
|
|
21
21
|
|
|
22
22
|
TUTORIAL_COMPLETED: 'TutorialCompleted',
|
|
23
23
|
} as const;
|
|
24
|
+
|
|
25
|
+
export const TUTORIAL_STATUS = {
|
|
26
|
+
PENDING: 'PENDING',
|
|
27
|
+
IN_PROGRESS: 'IN_PROGRESS',
|
|
28
|
+
COMPLETED: 'COMPLETED',
|
|
29
|
+
SKIPPED: 'SKIPPED',
|
|
30
|
+
} as const;
|
|
31
|
+
|
|
32
|
+
export const TUTORIAL_PHASE_ID = {
|
|
33
|
+
STARTING_POINT: 'starting_point',
|
|
34
|
+
CHECKPOINT_1: 'checkpoint_1',
|
|
35
|
+
CHECKPOINT_2: 'checkpoint_2',
|
|
36
|
+
LAP_COMPLETION: 'lap_completion',
|
|
37
|
+
} as const;
|
|
38
|
+
|
|
39
|
+
export const TUTORIAL_LISTEN_EVENT_ON = {
|
|
40
|
+
TIMEOUT: 'timeout',
|
|
41
|
+
WHEEL_BUTTON: 'wheelButton',
|
|
42
|
+
CHECKPOINT: 'checkpoint',
|
|
43
|
+
} as const;
|
|
44
|
+
|
|
45
|
+
export const TUTORIAL_STEERING_WHEEL_BUTTON = {
|
|
46
|
+
RIGHT: 'right',
|
|
47
|
+
LEFT: 'left',
|
|
48
|
+
ANY: 'any',
|
|
49
|
+
} as const;
|
|
50
|
+
|
|
51
|
+
export const TUTORIAL_LOGICAL_CHECKPOINT = {
|
|
52
|
+
CHECKPOINT_1: 'checkpoint_1',
|
|
53
|
+
CHECKPOINT_2: 'checkpoint_2',
|
|
54
|
+
CHECKPOINT_3_FINISH: 'checkpoint_3_finish',
|
|
55
|
+
} as const;
|
|
56
|
+
|
|
57
|
+
export const TUTORIAL_INPUT_SIGNAL_TYPE = {
|
|
58
|
+
STEERING_WHEEL_BUTTON_PRESSED: 'SteeringWheelButtonPressed',
|
|
59
|
+
} as const;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { screenTutorialHudSchema } from '../hardware/screen/ScreenTutorial.schema';
|
|
3
|
+
import {
|
|
4
|
+
TUTORIAL_INPUT_SIGNAL_TYPE,
|
|
5
|
+
TUTORIAL_LISTEN_EVENT_ON,
|
|
6
|
+
TUTORIAL_LOGICAL_CHECKPOINT,
|
|
7
|
+
TUTORIAL_PHASE_ID,
|
|
8
|
+
TUTORIAL_SCREEN_STEP,
|
|
9
|
+
TUTORIAL_STATUS,
|
|
10
|
+
TUTORIAL_STEERING_WHEEL_BUTTON,
|
|
11
|
+
} from './Tutorial.const';
|
|
3
12
|
|
|
4
13
|
export const tutorialScreenStepSchema = z.enum([
|
|
5
14
|
TUTORIAL_SCREEN_STEP.WELCOME,
|
|
@@ -20,3 +29,67 @@ export const tutorialScreenStepSchema = z.enum([
|
|
|
20
29
|
TUTORIAL_SCREEN_STEP.POWER_UP_RETURN_TO_HUD,
|
|
21
30
|
TUTORIAL_SCREEN_STEP.TUTORIAL_COMPLETED,
|
|
22
31
|
]);
|
|
32
|
+
|
|
33
|
+
export const tutorialStatusSchema = z.enum([
|
|
34
|
+
TUTORIAL_STATUS.PENDING,
|
|
35
|
+
TUTORIAL_STATUS.IN_PROGRESS,
|
|
36
|
+
TUTORIAL_STATUS.COMPLETED,
|
|
37
|
+
TUTORIAL_STATUS.SKIPPED,
|
|
38
|
+
]);
|
|
39
|
+
|
|
40
|
+
export const tutorialPhaseIdSchema = z.enum([
|
|
41
|
+
TUTORIAL_PHASE_ID.STARTING_POINT,
|
|
42
|
+
TUTORIAL_PHASE_ID.CHECKPOINT_1,
|
|
43
|
+
TUTORIAL_PHASE_ID.CHECKPOINT_2,
|
|
44
|
+
TUTORIAL_PHASE_ID.LAP_COMPLETION,
|
|
45
|
+
]);
|
|
46
|
+
|
|
47
|
+
export const tutorialListenEventOnSchema = z.enum([
|
|
48
|
+
TUTORIAL_LISTEN_EVENT_ON.TIMEOUT,
|
|
49
|
+
TUTORIAL_LISTEN_EVENT_ON.WHEEL_BUTTON,
|
|
50
|
+
TUTORIAL_LISTEN_EVENT_ON.CHECKPOINT,
|
|
51
|
+
]);
|
|
52
|
+
|
|
53
|
+
export const tutorialSteeringWheelButtonSchema = z.enum([
|
|
54
|
+
TUTORIAL_STEERING_WHEEL_BUTTON.RIGHT,
|
|
55
|
+
TUTORIAL_STEERING_WHEEL_BUTTON.LEFT,
|
|
56
|
+
TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
|
|
57
|
+
]);
|
|
58
|
+
|
|
59
|
+
export const tutorialLogicalCheckpointSchema = z.enum([
|
|
60
|
+
TUTORIAL_LOGICAL_CHECKPOINT.CHECKPOINT_1,
|
|
61
|
+
TUTORIAL_LOGICAL_CHECKPOINT.CHECKPOINT_2,
|
|
62
|
+
TUTORIAL_LOGICAL_CHECKPOINT.CHECKPOINT_3_FINISH,
|
|
63
|
+
]);
|
|
64
|
+
|
|
65
|
+
export const tutorialKartSnapshotSchema = z.object({
|
|
66
|
+
tutorialSessionId: z.string().min(1),
|
|
67
|
+
deviceId: z.string().min(1),
|
|
68
|
+
playerId: z.string().min(1).optional(),
|
|
69
|
+
status: tutorialStatusSchema,
|
|
70
|
+
currentPhaseId: tutorialPhaseIdSchema,
|
|
71
|
+
currentStep: tutorialScreenStepSchema,
|
|
72
|
+
revision: z.number().int().nonnegative(),
|
|
73
|
+
presentationRevision: z.number().int().nonnegative(),
|
|
74
|
+
hud: screenTutorialHudSchema.optional(),
|
|
75
|
+
awaitingCheckpoint: tutorialLogicalCheckpointSchema.nullable().optional(),
|
|
76
|
+
completedCheckpoints: z.array(tutorialLogicalCheckpointSchema).optional(),
|
|
77
|
+
updatedAtISO: z.string().datetime(),
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
export const tutorialInputSignalTypeSchema = z.enum([TUTORIAL_INPUT_SIGNAL_TYPE.STEERING_WHEEL_BUTTON_PRESSED]);
|
|
81
|
+
|
|
82
|
+
export const tutorialKartEventBaseSchema = z.object({
|
|
83
|
+
tutorialSessionId: z.string().min(1),
|
|
84
|
+
deviceId: z.string().min(1),
|
|
85
|
+
revision: z.number().int().nonnegative(),
|
|
86
|
+
sequence: z.number().int().nonnegative(),
|
|
87
|
+
originTimestampISO: z.string().datetime(),
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
export const tutorialSteeringWheelButtonPressedSchema = tutorialKartEventBaseSchema.extend({
|
|
91
|
+
type: z.literal(TUTORIAL_INPUT_SIGNAL_TYPE.STEERING_WHEEL_BUTTON_PRESSED),
|
|
92
|
+
button: tutorialSteeringWheelButtonSchema,
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
export const tutorialInputSignalSchema = z.discriminatedUnion('type', [tutorialSteeringWheelButtonPressedSchema]);
|
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
tutorialInputSignalSchema,
|
|
4
|
+
tutorialInputSignalTypeSchema,
|
|
5
|
+
tutorialKartSnapshotSchema,
|
|
6
|
+
tutorialListenEventOnSchema,
|
|
7
|
+
tutorialLogicalCheckpointSchema,
|
|
8
|
+
tutorialPhaseIdSchema,
|
|
9
|
+
tutorialScreenStepSchema,
|
|
10
|
+
tutorialStatusSchema,
|
|
11
|
+
tutorialSteeringWheelButtonPressedSchema,
|
|
12
|
+
tutorialSteeringWheelButtonSchema,
|
|
13
|
+
} from './Tutorial.schema';
|
|
3
14
|
|
|
4
15
|
export type TutorialScreenStep = z.infer<typeof tutorialScreenStepSchema>;
|
|
16
|
+
export type TutorialStatus = z.infer<typeof tutorialStatusSchema>;
|
|
17
|
+
export type TutorialPhaseId = z.infer<typeof tutorialPhaseIdSchema>;
|
|
18
|
+
export type TutorialListenEventOn = z.infer<typeof tutorialListenEventOnSchema>;
|
|
19
|
+
export type TutorialSteeringWheelButton = z.infer<typeof tutorialSteeringWheelButtonSchema>;
|
|
20
|
+
export type TutorialLogicalCheckpoint = z.infer<typeof tutorialLogicalCheckpointSchema>;
|
|
21
|
+
export type TutorialKartSnapshot = z.infer<typeof tutorialKartSnapshotSchema>;
|
|
22
|
+
export type TutorialInputSignalType = z.infer<typeof tutorialInputSignalTypeSchema>;
|
|
23
|
+
export type TutorialSteeringWheelButtonPressed = z.infer<typeof tutorialSteeringWheelButtonPressedSchema>;
|
|
24
|
+
export type TutorialInputSignal = z.infer<typeof tutorialInputSignalSchema>;
|