Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcf4095f

Browse files
committed
setup step/level/tutorial complete tracking
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent468e897 commitcf4095f

File tree

4 files changed

+58
-4
lines changed

4 files changed

+58
-4
lines changed

‎src/channel.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,15 @@ class Channel implements Channel {
8181
case'EDITOR_RUN_RESET_POSITION':
8282
actions.onRunReset({type:'POSITION',position:action.payload.position},this.context)
8383
return
84+
case'EDITOR_STEP_COMPLETE':
85+
hooks.onStepComplete(action.payload)
86+
return
87+
case'EDITOR_LEVEL_COMPLETE':
88+
hooks.onLevelComplete(action.payload)
89+
return
90+
case'EDITOR_TUTORIAL_COMPLETE':
91+
hooks.onTutorialComplete(action.payload)
92+
return
8493
default:
8594
logger(`No match for action type:${actionType}`)
8695
return

‎src/services/hooks/index.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import*asTfrom'typings'
12
import*asTTfrom'typings/tutorial'
23
import*asgitfrom'../git'
34
importloadCommitsfrom'./utils/loadCommits'
@@ -39,3 +40,18 @@ export const onSolutionEnter = async (actions: TT.StepActions): Promise<void> =>
3940
exportconstonError=async(error:Error):Promise<void>=>{
4041
telemetryOnError(error)
4142
}
43+
44+
exportconstonStepComplete=async({ position}:{position:T.Position}):Promise<void>=>{
45+
/* TODO */
46+
console.log(`ON STEP COMPLETE:${JSON.stringify(position)}`)
47+
}
48+
49+
exportconstonLevelComplete=async({ position}:{position:T.Position}):Promise<void>=>{
50+
/* TODO */
51+
console.log(`ON LEVEL COMPLETE:${JSON.stringify(position)}`)
52+
}
53+
54+
exportconstonTutorialComplete=async({ position}:{position:T.Position}):Promise<void>=>{
55+
/* TODO */
56+
console.log(`ON LEVEL COMPLETE:${JSON.stringify(position)}`)
57+
}

‎web-app/src/services/state/actions/editor.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,28 @@ export default (editorSend: any) => ({
133133
},
134134
})
135135
},
136+
onStepComplete(context:T.MachineContext):void{
137+
editorSend({
138+
type:'EDITOR_STEP_COMPLETE',
139+
payload:{
140+
position:context.position,
141+
},
142+
})
143+
},
144+
onLevelComplete(context:T.MachineContext):void{
145+
editorSend({
146+
type:'EDITOR_LEVEL_COMPLETE',
147+
payload:{
148+
position:context.position,
149+
},
150+
})
151+
},
152+
onTutorialComplete(context:T.MachineContext):void{
153+
editorSend({
154+
type:'EDITOR_TUTORIAL_COMPLETE',
155+
payload:{
156+
position:context.position,
157+
},
158+
})
159+
},
136160
})

‎web-app/src/services/state/machine.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,12 @@ export const createMachine = (options: any) => {
198198
on:{
199199
LOAD_NEXT_STEP:{
200200
target:'Normal',
201-
actions:['loadStep','updateStepPosition'],
201+
actions:['onStepComplete','loadStep','updateStepPosition'],
202+
},
203+
LEVEL_COMPLETE:{
204+
target:'LevelComplete',
205+
actions:['onLevelComplete'],
202206
},
203-
LEVEL_COMPLETE:'LevelComplete',
204207
},
205208
},
206209
LevelComplete:{
@@ -223,14 +226,16 @@ export const createMachine = (options: any) => {
223226
target:'Load',
224227
actions:['updatePosition'],
225228
},
226-
COMPLETED:'#completed-tutorial',
229+
COMPLETED:{
230+
target:'#completed-tutorial',
231+
actions:['onTutorialComplete'],
232+
},
227233
},
228234
},
229235
},
230236
},
231237
Completed:{
232238
id:'completed-tutorial',
233-
onEntry:['userTutorialComplete'],// unusued
234239
on:{
235240
SELECT_TUTORIAL:{
236241
target:'#select-new-tutorial',

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp