P2: Add multiplayer session

This commit is contained in:
LoveEevee
2018-11-02 01:05:18 +03:00
parent b85f879ba0
commit 426bc160c6
14 changed files with 635 additions and 61 deletions

View File

@@ -12,6 +12,13 @@ class Titlescreen{
this.onPressed()
}
})
if(p2.session){
pageEvents.add(p2, "message", response => {
if(response.type === "songsel"){
this.goNext(true)
}
})
}
}
keyDown(event, code){
if(!code){
@@ -34,13 +41,20 @@ class Titlescreen{
this.titleScreen.style.cursor = "auto"
this.clean()
assets.sounds["don"].play()
setTimeout(this.goNext.bind(this), 500)
this.goNext()
}
goNext(){
if(this.touched || localStorage.getItem("tutorial") === "true"){
new SongSelect(false, false, this.touched)
goNext(fromP2){
if(p2.session && !fromP2){
p2.send("songsel")
}else if(fromP2 || this.touched || localStorage.getItem("tutorial") === "true"){
pageEvents.remove(p2, "message")
setTimeout(() => {
new SongSelect(false, false, this.touched)
}, 500)
}else{
new Tutorial()
setTimeout(() => {
new Tutorial()
}, 500)
}
}
clean(){