Commit 65e26a2b authored by nanahira's avatar nanahira

add badge for mods

parent 613ae0d5
...@@ -76,6 +76,12 @@ var assets = { ...@@ -76,6 +76,12 @@ var assets = {
"bg_settings.png", "bg_settings.png",
"bg_pause.png", "bg_pause.png",
"badge_auto.png", "badge_auto.png",
"badge_x2.png",
"badge_x3.png",
"badge_x4.png",
"badge_s1.png",
"badge_s0.25.png",
"badge_s0.5.png",
"touch_pause.png", "touch_pause.png",
"touch_fullscreen.png", "touch_fullscreen.png",
"mimizu.png", "mimizu.png",
......
...@@ -3,6 +3,7 @@ class Controller{ ...@@ -3,6 +3,7 @@ class Controller{
this.selectedSong = selectedSong this.selectedSong = selectedSong
this.songData = songData this.songData = songData
this.autoPlayEnabled = autoPlayEnabled this.autoPlayEnabled = autoPlayEnabled
this.mods = selectedSong.mods;
this.multiplayer = multiplayer this.multiplayer = multiplayer
this.touchEnabled = touchEnabled this.touchEnabled = touchEnabled
this.snd = this.multiplayer ? "_p" + this.multiplayer : "" this.snd = this.multiplayer ? "_p" + this.multiplayer : ""
...@@ -291,4 +292,15 @@ class Controller{ ...@@ -291,4 +292,15 @@ class Controller{
} }
} }
} }
getModBadge() {
if (!this.mods) {
return null;
}
if (this.mods.speed > 1) {
return "badge_x" + this.mods.speed.toString();
} else if (this.mods.shuffle > 0) {
return "badge_s" + this.mods.shuffle.toString();
}
return null;
}
} }
...@@ -439,8 +439,12 @@ class Scoresheet{ ...@@ -439,8 +439,12 @@ class Scoresheet{
ctx.fillText(text, 395, 308) ctx.fillText(text, 395, 308)
ctx.miterLimit = 10 ctx.miterLimit = 10
let badge_name = this.controller.getModBadge();
if(this.controller.autoPlayEnabled) {
badge_name = "badge_auto";
}
if(this.controller.autoPlayEnabled){ if(this.controller.autoPlayEnabled){
ctx.drawImage(assets.image["badge_auto"], ctx.drawImage(assets.image[badge_name],
431, 311, 34, 34 431, 311, 34, 34
) )
} }
......
...@@ -468,8 +468,12 @@ ...@@ -468,8 +468,12 @@
} }
// Badges // Badges
let badge_name = this.controller.getModBadge();
if(this.controller.autoPlayEnabled && !this.controller.multiplayer){ if(this.controller.autoPlayEnabled && !this.controller.multiplayer){
this.ctx.drawImage(assets.image["badge_auto"], badge_name = "badge_auto";
}
if (badge_name) {
this.ctx.drawImage(assets.image[badge_name],
183, 183,
this.multiplayer === 2 ? 490 : 265, this.multiplayer === 2 ? 490 : 265,
23, 23,
...@@ -631,8 +635,12 @@ ...@@ -631,8 +635,12 @@
} }
// Badges // Badges
let badge_name = this.controller.getModBadge();
if(this.controller.autoPlayEnabled && !this.controller.multiplayer){ if(this.controller.autoPlayEnabled && !this.controller.multiplayer){
this.ctx.drawImage(assets.image["badge_auto"], badge_name = "badge_auto";
}
if(badge_name) {
this.ctx.drawImage(assets.image[badge_name],
125, 235, 34, 34 125, 235, 34, 34
) )
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment