Disable scoresheet skipping, change multiplayer string and bg

This commit is contained in:
LoveEevee
2018-11-02 13:26:46 +03:00
parent 426bc160c6
commit 82963f7912
8 changed files with 81 additions and 50 deletions

View File

@@ -31,6 +31,7 @@ var assets = {
"bg_genre_7.png",
"bg_score_p1.png",
"bg_score_p2.png",
"bg_settings.png",
"badge_auto.png",
"touch_drum.png",
"touch_pause.png",

View File

@@ -188,6 +188,11 @@
ctx.restore()
if(config.disabled){
ctx.fillStyle = "rgba(0, 0, 0, 0.5)"
ctx.fillRect(x, y, w, h)
}
if(config.highlight){
this.highlight({
ctx: ctx,

View File

@@ -141,7 +141,7 @@ class Controller{
}
displayResults(){
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){

View File

@@ -92,7 +92,6 @@ class loadSong{
}
}else if(event.type === "gamestart"){
this.clean()
p2.clearMessage("scorenext")
p2.clearMessage("songsel")
loader.changePage("game")
var taikoGame1 = new Controller(this.selectedSong, this.songData, false, 1, this.touchEnabled)

View File

@@ -47,6 +47,11 @@ class P2Connection{
closeEvent(){
this.removeEventListener(onmessage)
this.otherConnected = false
this.session = false
if(this.hashLock){
this.hash("")
this.hashLock = false
}
if(!this.closed){
setTimeout(() => {
if(this.socket.readyState !== this.socket.OPEN){

View File

@@ -1,11 +1,12 @@
class Scoresheet{
constructor(controller, results, multiplayer){
constructor(controller, results, multiplayer, touchEnabled){
this.controller = controller
this.results = {}
for(var i in results){
this.results[i] = results[i].toString()
}
this.multiplayer = multiplayer
this.touchEnabled = touchEnabled
this.canvas = document.getElementById("canvas")
this.ctx = this.canvas.getContext("2d")
@@ -15,7 +16,8 @@ class Scoresheet{
screen: "fadeIn",
screenMS: this.getMS(),
startDelay: 3300,
hasPointer: 0
hasPointer: 0,
scoreNext: false
}
this.frame = 1000 / 60
this.numbers = "001122334455667788900112233445".split("")
@@ -35,17 +37,11 @@ class Scoresheet{
assets.sounds["bgm_result"].playLoop(3, false, 0, 0.847, 17.689)
if(p2.session){
if(p2.getMessage("scorenext")){
this.toScorenext(true)
}
if(p2.getMessage("songsel")){
this.toSongsel(true)
}
pageEvents.add(p2, "message", response => {
if(response.type === "scorenext"){
this.toScorenext(true)
}else if(response.type === "songsel"){
this.state.pointerLocked = true
if(response.type === "songsel"){
this.toSongsel(true)
}
})
@@ -87,28 +83,26 @@ class Scoresheet{
toNext(){
var elapsed = this.getMS() - this.state.screenMS
if(this.state.screen === "fadeIn" && elapsed >= this.state.startDelay){
this.toScorenext()
this.toScoresShown()
}else if(this.state.screen === "scoresShown" && elapsed >= 1000){
this.toSongsel()
}
}
toScorenext(fromP2){
if(p2.session && !fromP2){
p2.send("scorenext")
toScoresShown(){
if(!p2.session){
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){
if(p2.session && !fromP2){
this.state.pointerLocked = true
p2.send("songsel")
}else{
if(!p2.session || fromP2){
snd.musicGain.fadeOut(0.5)
this.state.screen = "fadeOut"
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(this.state.hasPointer === 0){
this.state.hasPointer = 1
if(!this.state.pointerLocked){
if(!this.state.pointerLocked && !p2.session){
this.canvas.style.cursor = "pointer"
}
}
@@ -645,6 +639,11 @@ class Scoresheet{
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"){
ctx.save()
if(this.state.hasPointer === 1){
@@ -661,7 +660,7 @@ class Scoresheet{
if(elapsed >= 1000){
this.clean()
this.controller.songSelection(true, false, this.state.pointerLocked)
this.controller.songSelection(true, false, p2.session ? this.touchEnabled : this.state.pointerLocked)
}
}

View File

@@ -182,8 +182,8 @@ class SongSelect{
this.difficultyId = ["easy", "normal", "hard", "oni", "ura"]
this.sessionText = {
"sessionstart": "2人プレイのネットプレイセッションを開始する!",
"sessionend": "ネットプレイを終了する"
"sessionstart": "オンラインセッションを開始する!",
"sessionend": "オンラインセッションを終了する"
}
this.selectedSong = 0
@@ -201,7 +201,7 @@ class SongSelect{
this.selectedSong = this.songs.findIndex(song => song.action === fromTutorial)
this.playBgm(true)
}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)
}
assets.sounds["song-select"].play()
@@ -220,7 +220,7 @@ class SongSelect{
this.previewId = 0
var skipStart = fromTutorial || p2.session
this.state = {
screen: skipStart ? "song" : (fadeIn ? "titleFadeIn" : "title"),
screen: fadeIn ? "titleFadeIn" : (skipStart ? "song" : "title"),
screenMS: this.getMS(),
move: 0,
moveMS: 0,
@@ -242,11 +242,12 @@ class SongSelect{
this.pressedKeys = {}
this.gamepad = new Gamepad({
"13": ["b", "start", "ls", "rs"],
"8": ["a"],
"27": ["a"],
"37": ["l", "lb", "lt", "lsl"],
"39": ["r", "rb", "rt", "lsr"],
"38": ["u", "lsu"],
"40": ["d", "lsd"],
"8": ["back"],
"ctrl": ["y"],
"shift": ["x"]
})
@@ -293,8 +294,10 @@ class SongSelect{
var key = {
confirm: code == 13 || code == 32 || code == 70 || code == 74,
// Enter, Space, F, J
cancel: code == 27 || code == 8,
// Esc, Backspace
cancel: code == 27,
// Esc
session: code == 8,
// Backspace
left: code == 37 || code == 68,
// Left, D
right: code == 39 || code == 75,
@@ -312,6 +315,8 @@ class SongSelect{
this.toSelectDifficulty()
}else if(key.cancel){
this.toTitleScreen()
}else if(key.session){
this.toSession()
}else if(key.left){
this.moveToSong(-1)
}else if(key.right){
@@ -326,7 +331,7 @@ class SongSelect{
}else{
this.toLoadSong(this.selectedDiff - this.diffOptions.length, modifiers.shift, modifiers.ctrl)
}
}else if(key.cancel){
}else if(key.cancel || key.session){
this.toSongSelect()
}else if(key.left){
this.moveToDiff(-1)
@@ -941,7 +946,8 @@ class SongSelect{
x: _x,
y: songTop,
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++){
@@ -960,7 +966,8 @@ class SongSelect{
x: _x,
y: songTop,
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,
cached: selectedWidth === this.songAsset.fullWidth ? 3 : (selectedWidth === this.songAsset.selectedWidth ? 2 : (selectedWidth === this.songAsset.width ? 1 : 0)),
frameCache: this.songFrameCache,
disabled: p2.session && currentSong.action && currentSong.action !== "random",
innerContent: (x, y, w, h) => {
ctx.strokeStyle = "#000"
if(screen === "title" || screen === "titleFadeIn" || screen === "song"){
@@ -1388,18 +1396,33 @@ class SongSelect{
ctx.lineTo(x + w - 4, y + 4)
ctx.fill()
x = frameLeft + 642
this.draw.pattern({
ctx: ctx,
img: assets.image["bg_score_p2"],
x: x,
y: y,
w: w,
h: h,
dx: frameLeft + 15,
dy: frameTop - 20,
scale: 1.55
})
ctx.fillStyle = "rgba(138, 245, 247, 0.5)"
if(p2.session){
this.draw.pattern({
ctx: ctx,
img: assets.image["bg_score_p2"],
x: x,
y: y,
w: w,
h: h,
dx: frameLeft + 15,
dy: frameTop - 20,
scale: 1.55
})
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.moveTo(x, y + h)
ctx.lineTo(x, y)