Disable scoresheet skipping, change multiplayer string and bg
This commit is contained in:
parent
426bc160c6
commit
82963f7912
@ -31,6 +31,7 @@ var assets = {
|
|||||||
"bg_genre_7.png",
|
"bg_genre_7.png",
|
||||||
"bg_score_p1.png",
|
"bg_score_p1.png",
|
||||||
"bg_score_p2.png",
|
"bg_score_p2.png",
|
||||||
|
"bg_settings.png",
|
||||||
"badge_auto.png",
|
"badge_auto.png",
|
||||||
"touch_drum.png",
|
"touch_drum.png",
|
||||||
"touch_pause.png",
|
"touch_pause.png",
|
||||||
|
@ -188,6 +188,11 @@
|
|||||||
|
|
||||||
ctx.restore()
|
ctx.restore()
|
||||||
|
|
||||||
|
if(config.disabled){
|
||||||
|
ctx.fillStyle = "rgba(0, 0, 0, 0.5)"
|
||||||
|
ctx.fillRect(x, y, w, h)
|
||||||
|
}
|
||||||
|
|
||||||
if(config.highlight){
|
if(config.highlight){
|
||||||
this.highlight({
|
this.highlight({
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
|
@ -141,7 +141,7 @@ class Controller{
|
|||||||
}
|
}
|
||||||
displayResults(){
|
displayResults(){
|
||||||
if(this.multiplayer !== 2){
|
if(this.multiplayer !== 2){
|
||||||
this.scoresheet = new Scoresheet(this, this.getGlobalScore(), this.multiplayer)
|
this.scoresheet = new Scoresheet(this, this.getGlobalScore(), this.multiplayer, this.touchEnabled)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
displayScore(score, notPlayed, bigNote){
|
displayScore(score, notPlayed, bigNote){
|
||||||
|
@ -92,7 +92,6 @@ class loadSong{
|
|||||||
}
|
}
|
||||||
}else if(event.type === "gamestart"){
|
}else if(event.type === "gamestart"){
|
||||||
this.clean()
|
this.clean()
|
||||||
p2.clearMessage("scorenext")
|
|
||||||
p2.clearMessage("songsel")
|
p2.clearMessage("songsel")
|
||||||
loader.changePage("game")
|
loader.changePage("game")
|
||||||
var taikoGame1 = new Controller(this.selectedSong, this.songData, false, 1, this.touchEnabled)
|
var taikoGame1 = new Controller(this.selectedSong, this.songData, false, 1, this.touchEnabled)
|
||||||
|
@ -47,6 +47,11 @@ class P2Connection{
|
|||||||
closeEvent(){
|
closeEvent(){
|
||||||
this.removeEventListener(onmessage)
|
this.removeEventListener(onmessage)
|
||||||
this.otherConnected = false
|
this.otherConnected = false
|
||||||
|
this.session = false
|
||||||
|
if(this.hashLock){
|
||||||
|
this.hash("")
|
||||||
|
this.hashLock = false
|
||||||
|
}
|
||||||
if(!this.closed){
|
if(!this.closed){
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if(this.socket.readyState !== this.socket.OPEN){
|
if(this.socket.readyState !== this.socket.OPEN){
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
class Scoresheet{
|
class Scoresheet{
|
||||||
constructor(controller, results, multiplayer){
|
constructor(controller, results, multiplayer, touchEnabled){
|
||||||
this.controller = controller
|
this.controller = controller
|
||||||
this.results = {}
|
this.results = {}
|
||||||
for(var i in results){
|
for(var i in results){
|
||||||
this.results[i] = results[i].toString()
|
this.results[i] = results[i].toString()
|
||||||
}
|
}
|
||||||
this.multiplayer = multiplayer
|
this.multiplayer = multiplayer
|
||||||
|
this.touchEnabled = touchEnabled
|
||||||
|
|
||||||
this.canvas = document.getElementById("canvas")
|
this.canvas = document.getElementById("canvas")
|
||||||
this.ctx = this.canvas.getContext("2d")
|
this.ctx = this.canvas.getContext("2d")
|
||||||
@ -15,7 +16,8 @@ class Scoresheet{
|
|||||||
screen: "fadeIn",
|
screen: "fadeIn",
|
||||||
screenMS: this.getMS(),
|
screenMS: this.getMS(),
|
||||||
startDelay: 3300,
|
startDelay: 3300,
|
||||||
hasPointer: 0
|
hasPointer: 0,
|
||||||
|
scoreNext: false
|
||||||
}
|
}
|
||||||
this.frame = 1000 / 60
|
this.frame = 1000 / 60
|
||||||
this.numbers = "001122334455667788900112233445".split("")
|
this.numbers = "001122334455667788900112233445".split("")
|
||||||
@ -35,17 +37,11 @@ class Scoresheet{
|
|||||||
assets.sounds["bgm_result"].playLoop(3, false, 0, 0.847, 17.689)
|
assets.sounds["bgm_result"].playLoop(3, false, 0, 0.847, 17.689)
|
||||||
|
|
||||||
if(p2.session){
|
if(p2.session){
|
||||||
if(p2.getMessage("scorenext")){
|
|
||||||
this.toScorenext(true)
|
|
||||||
}
|
|
||||||
if(p2.getMessage("songsel")){
|
if(p2.getMessage("songsel")){
|
||||||
this.toSongsel(true)
|
this.toSongsel(true)
|
||||||
}
|
}
|
||||||
pageEvents.add(p2, "message", response => {
|
pageEvents.add(p2, "message", response => {
|
||||||
if(response.type === "scorenext"){
|
if(response.type === "songsel"){
|
||||||
this.toScorenext(true)
|
|
||||||
}else if(response.type === "songsel"){
|
|
||||||
this.state.pointerLocked = true
|
|
||||||
this.toSongsel(true)
|
this.toSongsel(true)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -87,28 +83,26 @@ class Scoresheet{
|
|||||||
toNext(){
|
toNext(){
|
||||||
var elapsed = this.getMS() - this.state.screenMS
|
var elapsed = this.getMS() - this.state.screenMS
|
||||||
if(this.state.screen === "fadeIn" && elapsed >= this.state.startDelay){
|
if(this.state.screen === "fadeIn" && elapsed >= this.state.startDelay){
|
||||||
this.toScorenext()
|
this.toScoresShown()
|
||||||
}else if(this.state.screen === "scoresShown" && elapsed >= 1000){
|
}else if(this.state.screen === "scoresShown" && elapsed >= 1000){
|
||||||
this.toSongsel()
|
this.toSongsel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
toScorenext(fromP2){
|
toScoresShown(){
|
||||||
if(p2.session && !fromP2){
|
if(!p2.session){
|
||||||
p2.send("scorenext")
|
this.state.screen = "scoresShown"
|
||||||
|
this.state.screenMS = this.getMS()
|
||||||
|
assets.sounds["note_don"].play()
|
||||||
}
|
}
|
||||||
this.state.screen = "scoresShown"
|
|
||||||
this.state.screenMS = this.getMS()
|
|
||||||
assets.sounds["note_don"].play()
|
|
||||||
}
|
}
|
||||||
toSongsel(fromP2){
|
toSongsel(fromP2){
|
||||||
if(p2.session && !fromP2){
|
if(!p2.session || fromP2){
|
||||||
this.state.pointerLocked = true
|
|
||||||
p2.send("songsel")
|
|
||||||
}else{
|
|
||||||
snd.musicGain.fadeOut(0.5)
|
snd.musicGain.fadeOut(0.5)
|
||||||
this.state.screen = "fadeOut"
|
this.state.screen = "fadeOut"
|
||||||
this.state.screenMS = this.getMS()
|
this.state.screenMS = this.getMS()
|
||||||
assets.sounds["note_don"].play()
|
if(!fromP2){
|
||||||
|
assets.sounds["note_don"].play()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,7 +256,7 @@ class Scoresheet{
|
|||||||
if(elapsed >= 0){
|
if(elapsed >= 0){
|
||||||
if(this.state.hasPointer === 0){
|
if(this.state.hasPointer === 0){
|
||||||
this.state.hasPointer = 1
|
this.state.hasPointer = 1
|
||||||
if(!this.state.pointerLocked){
|
if(!this.state.pointerLocked && !p2.session){
|
||||||
this.canvas.style.cursor = "pointer"
|
this.canvas.style.cursor = "pointer"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -645,6 +639,11 @@ class Scoresheet{
|
|||||||
ctx.restore()
|
ctx.restore()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(p2.session && !this.state.scoreNext && this.state.screen === "scoresShown" && ms - this.state.screenMS >= 10000){
|
||||||
|
this.state.scoreNext = true
|
||||||
|
p2.send("songsel")
|
||||||
|
}
|
||||||
|
|
||||||
if(this.state.screen === "fadeOut"){
|
if(this.state.screen === "fadeOut"){
|
||||||
ctx.save()
|
ctx.save()
|
||||||
if(this.state.hasPointer === 1){
|
if(this.state.hasPointer === 1){
|
||||||
@ -661,7 +660,7 @@ class Scoresheet{
|
|||||||
|
|
||||||
if(elapsed >= 1000){
|
if(elapsed >= 1000){
|
||||||
this.clean()
|
this.clean()
|
||||||
this.controller.songSelection(true, false, this.state.pointerLocked)
|
this.controller.songSelection(true, false, p2.session ? this.touchEnabled : this.state.pointerLocked)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,8 +182,8 @@ class SongSelect{
|
|||||||
this.difficultyId = ["easy", "normal", "hard", "oni", "ura"]
|
this.difficultyId = ["easy", "normal", "hard", "oni", "ura"]
|
||||||
|
|
||||||
this.sessionText = {
|
this.sessionText = {
|
||||||
"sessionstart": "2人プレイのネットプレイセッションを開始する!",
|
"sessionstart": "オンラインセッションを開始する!",
|
||||||
"sessionend": "ネットプレイを終了する"
|
"sessionend": "オンラインセッションを終了する"
|
||||||
}
|
}
|
||||||
|
|
||||||
this.selectedSong = 0
|
this.selectedSong = 0
|
||||||
@ -201,7 +201,7 @@ class SongSelect{
|
|||||||
this.selectedSong = this.songs.findIndex(song => song.action === fromTutorial)
|
this.selectedSong = this.songs.findIndex(song => song.action === fromTutorial)
|
||||||
this.playBgm(true)
|
this.playBgm(true)
|
||||||
}else{
|
}else{
|
||||||
if(!p2.session && "selectedSong" in localStorage){
|
if((!p2.session || fadeIn) && "selectedSong" in localStorage){
|
||||||
this.selectedSong = Math.min(Math.max(0, localStorage["selectedSong"] |0), this.songs.length)
|
this.selectedSong = Math.min(Math.max(0, localStorage["selectedSong"] |0), this.songs.length)
|
||||||
}
|
}
|
||||||
assets.sounds["song-select"].play()
|
assets.sounds["song-select"].play()
|
||||||
@ -220,7 +220,7 @@ class SongSelect{
|
|||||||
this.previewId = 0
|
this.previewId = 0
|
||||||
var skipStart = fromTutorial || p2.session
|
var skipStart = fromTutorial || p2.session
|
||||||
this.state = {
|
this.state = {
|
||||||
screen: skipStart ? "song" : (fadeIn ? "titleFadeIn" : "title"),
|
screen: fadeIn ? "titleFadeIn" : (skipStart ? "song" : "title"),
|
||||||
screenMS: this.getMS(),
|
screenMS: this.getMS(),
|
||||||
move: 0,
|
move: 0,
|
||||||
moveMS: 0,
|
moveMS: 0,
|
||||||
@ -242,11 +242,12 @@ class SongSelect{
|
|||||||
this.pressedKeys = {}
|
this.pressedKeys = {}
|
||||||
this.gamepad = new Gamepad({
|
this.gamepad = new Gamepad({
|
||||||
"13": ["b", "start", "ls", "rs"],
|
"13": ["b", "start", "ls", "rs"],
|
||||||
"8": ["a"],
|
"27": ["a"],
|
||||||
"37": ["l", "lb", "lt", "lsl"],
|
"37": ["l", "lb", "lt", "lsl"],
|
||||||
"39": ["r", "rb", "rt", "lsr"],
|
"39": ["r", "rb", "rt", "lsr"],
|
||||||
"38": ["u", "lsu"],
|
"38": ["u", "lsu"],
|
||||||
"40": ["d", "lsd"],
|
"40": ["d", "lsd"],
|
||||||
|
"8": ["back"],
|
||||||
"ctrl": ["y"],
|
"ctrl": ["y"],
|
||||||
"shift": ["x"]
|
"shift": ["x"]
|
||||||
})
|
})
|
||||||
@ -293,8 +294,10 @@ class SongSelect{
|
|||||||
var key = {
|
var key = {
|
||||||
confirm: code == 13 || code == 32 || code == 70 || code == 74,
|
confirm: code == 13 || code == 32 || code == 70 || code == 74,
|
||||||
// Enter, Space, F, J
|
// Enter, Space, F, J
|
||||||
cancel: code == 27 || code == 8,
|
cancel: code == 27,
|
||||||
// Esc, Backspace
|
// Esc
|
||||||
|
session: code == 8,
|
||||||
|
// Backspace
|
||||||
left: code == 37 || code == 68,
|
left: code == 37 || code == 68,
|
||||||
// Left, D
|
// Left, D
|
||||||
right: code == 39 || code == 75,
|
right: code == 39 || code == 75,
|
||||||
@ -312,6 +315,8 @@ class SongSelect{
|
|||||||
this.toSelectDifficulty()
|
this.toSelectDifficulty()
|
||||||
}else if(key.cancel){
|
}else if(key.cancel){
|
||||||
this.toTitleScreen()
|
this.toTitleScreen()
|
||||||
|
}else if(key.session){
|
||||||
|
this.toSession()
|
||||||
}else if(key.left){
|
}else if(key.left){
|
||||||
this.moveToSong(-1)
|
this.moveToSong(-1)
|
||||||
}else if(key.right){
|
}else if(key.right){
|
||||||
@ -326,7 +331,7 @@ class SongSelect{
|
|||||||
}else{
|
}else{
|
||||||
this.toLoadSong(this.selectedDiff - this.diffOptions.length, modifiers.shift, modifiers.ctrl)
|
this.toLoadSong(this.selectedDiff - this.diffOptions.length, modifiers.shift, modifiers.ctrl)
|
||||||
}
|
}
|
||||||
}else if(key.cancel){
|
}else if(key.cancel || key.session){
|
||||||
this.toSongSelect()
|
this.toSongSelect()
|
||||||
}else if(key.left){
|
}else if(key.left){
|
||||||
this.moveToDiff(-1)
|
this.moveToDiff(-1)
|
||||||
@ -941,7 +946,8 @@ class SongSelect{
|
|||||||
x: _x,
|
x: _x,
|
||||||
y: songTop,
|
y: songTop,
|
||||||
song: this.songs[index],
|
song: this.songs[index],
|
||||||
highlight: highlight
|
highlight: highlight,
|
||||||
|
disabled: p2.session && this.songs[index].action && this.songs[index].action !== "random"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
for(var i = this.selectedSong + 1; ; i++){
|
for(var i = this.selectedSong + 1; ; i++){
|
||||||
@ -960,7 +966,8 @@ class SongSelect{
|
|||||||
x: _x,
|
x: _x,
|
||||||
y: songTop,
|
y: songTop,
|
||||||
song: this.songs[index],
|
song: this.songs[index],
|
||||||
highlight: highlight
|
highlight: highlight,
|
||||||
|
disabled: p2.session && this.songs[index].action && this.songs[index].action !== "random"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1003,6 +1010,7 @@ class SongSelect{
|
|||||||
animateMS: this.state.moveMS,
|
animateMS: this.state.moveMS,
|
||||||
cached: selectedWidth === this.songAsset.fullWidth ? 3 : (selectedWidth === this.songAsset.selectedWidth ? 2 : (selectedWidth === this.songAsset.width ? 1 : 0)),
|
cached: selectedWidth === this.songAsset.fullWidth ? 3 : (selectedWidth === this.songAsset.selectedWidth ? 2 : (selectedWidth === this.songAsset.width ? 1 : 0)),
|
||||||
frameCache: this.songFrameCache,
|
frameCache: this.songFrameCache,
|
||||||
|
disabled: p2.session && currentSong.action && currentSong.action !== "random",
|
||||||
innerContent: (x, y, w, h) => {
|
innerContent: (x, y, w, h) => {
|
||||||
ctx.strokeStyle = "#000"
|
ctx.strokeStyle = "#000"
|
||||||
if(screen === "title" || screen === "titleFadeIn" || screen === "song"){
|
if(screen === "title" || screen === "titleFadeIn" || screen === "song"){
|
||||||
@ -1388,18 +1396,33 @@ class SongSelect{
|
|||||||
ctx.lineTo(x + w - 4, y + 4)
|
ctx.lineTo(x + w - 4, y + 4)
|
||||||
ctx.fill()
|
ctx.fill()
|
||||||
x = frameLeft + 642
|
x = frameLeft + 642
|
||||||
this.draw.pattern({
|
if(p2.session){
|
||||||
ctx: ctx,
|
this.draw.pattern({
|
||||||
img: assets.image["bg_score_p2"],
|
ctx: ctx,
|
||||||
x: x,
|
img: assets.image["bg_score_p2"],
|
||||||
y: y,
|
x: x,
|
||||||
w: w,
|
y: y,
|
||||||
h: h,
|
w: w,
|
||||||
dx: frameLeft + 15,
|
h: h,
|
||||||
dy: frameTop - 20,
|
dx: frameLeft + 15,
|
||||||
scale: 1.55
|
dy: frameTop - 20,
|
||||||
})
|
scale: 1.55
|
||||||
ctx.fillStyle = "rgba(138, 245, 247, 0.5)"
|
})
|
||||||
|
ctx.fillStyle = "rgba(138, 245, 247, 0.5)"
|
||||||
|
}else{
|
||||||
|
this.draw.pattern({
|
||||||
|
ctx: ctx,
|
||||||
|
img: assets.image["bg_settings"],
|
||||||
|
x: x,
|
||||||
|
y: y,
|
||||||
|
w: w,
|
||||||
|
h: h,
|
||||||
|
dx: frameLeft + 11,
|
||||||
|
dy: frameTop + 45,
|
||||||
|
scale: 3.1
|
||||||
|
})
|
||||||
|
ctx.fillStyle = "rgba(255, 255, 255, 0.5)"
|
||||||
|
}
|
||||||
ctx.beginPath()
|
ctx.beginPath()
|
||||||
ctx.moveTo(x, y + h)
|
ctx.moveTo(x, y + h)
|
||||||
ctx.lineTo(x, y)
|
ctx.lineTo(x, y)
|
||||||
|
@ -169,13 +169,12 @@ async def connection(ws, path):
|
|||||||
if "other_user" in user and "ws" in user["other_user"]:
|
if "other_user" in user and "ws" in user["other_user"]:
|
||||||
if type == "note"\
|
if type == "note"\
|
||||||
or type == "drumroll"\
|
or type == "drumroll"\
|
||||||
or type == "gameresults"\
|
or type == "gameresults":
|
||||||
or type == "scorenext" and user["session"]:
|
|
||||||
await user["other_user"]["ws"].send(msgobj(type, value))
|
await user["other_user"]["ws"].send(msgobj(type, value))
|
||||||
elif type == "songsel" and user["session"]:
|
elif type == "songsel" and user["session"]:
|
||||||
user["action"] = "songsel"
|
user["action"] = "songsel"
|
||||||
user["other_user"]["action"] = "songsel"
|
user["other_user"]["action"] = "songsel"
|
||||||
sent_msg1 = msgobj(type)
|
sent_msg1 = msgobj("songsel")
|
||||||
sent_msg2 = msgobj("users", [])
|
sent_msg2 = msgobj("users", [])
|
||||||
await asyncio.wait([
|
await asyncio.wait([
|
||||||
ws.send(sent_msg1),
|
ws.send(sent_msg1),
|
||||||
|
Loading…
Reference in New Issue
Block a user