Created
February 6, 2020 00:10
-
-
Save tivac/586c027806579abb7f97645051b1e508 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const machine = Machine({ | |
id: "menu", | |
initial: "initialize", | |
states: { | |
initialize: { | |
on: { | |
CONNECTION: [{ | |
cond: (ctx, { lan } = false) => lan, | |
actions: assign({ | |
lan: true, | |
}), | |
target: "offline", | |
}, { | |
target: "booting" | |
}] | |
} | |
}, | |
booting: { | |
initial: "booting", | |
on: { | |
LOBBY: "online", | |
}, | |
states: { | |
booting: { | |
on: { | |
BOOTED: [{ | |
cond: (ctx, { ftue } = false) => ftue, | |
target: "ftue" | |
}, { | |
cond: (ctx, { banned } = false) => banned, | |
target: "banned", | |
}, { | |
target: "continue", | |
}] | |
} | |
}, | |
ftue: {}, | |
banned: {}, | |
continue: { | |
on: { | |
CLICK: { | |
actions: send("LOBBY"), | |
}, | |
}, | |
}, | |
}, | |
}, | |
offline: { | |
initial : "lobby", | |
states : { | |
lobby : { | |
on: { | |
LOADOUT: "loadout", | |
READY: "connecting", | |
}, | |
}, | |
loadout : { | |
on : { | |
CANCEL : "lobby", | |
CONFIRM : "lobby", | |
}, | |
}, | |
connecting : {}, | |
}, | |
}, | |
online : { | |
initial : "lobby", | |
states : { | |
lobby : { | |
on : { | |
COLLECTIONS : "collections", | |
BATTLEPASS : "battlepass", | |
STORE : "store", | |
}, | |
}, | |
battlepass : {}, | |
collections : {}, | |
store : {}, | |
matchmaking: {}, | |
loadout : { | |
on : { | |
CANCEL : "lobby", | |
CONFIRM : "lobby", | |
}, | |
}, | |
connecting: {}, | |
} | |
}, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment