Add autoplay toggle, fix notes not being skipped on autoplay
This commit is contained in:
parent
925e6b44bd
commit
0e1283c537
@ -3,7 +3,6 @@
|
|||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 260px;
|
width: 260px;
|
||||||
height: 240px;
|
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border: 1px solid #333;
|
border: 1px solid #333;
|
||||||
color: #000;
|
color: #000;
|
||||||
@ -111,3 +110,7 @@
|
|||||||
#debug .exit-btn{
|
#debug .exit-btn{
|
||||||
margin-left: 3px;
|
margin-left: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#debug .autoplay-label{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
@ -13,6 +13,8 @@ class Debug{
|
|||||||
this.offsetDiv = this.debugDiv.getElementsByClassName("offset")[0]
|
this.offsetDiv = this.debugDiv.getElementsByClassName("offset")[0]
|
||||||
this.measureNumDiv = this.debugDiv.getElementsByClassName("measure-num")[0]
|
this.measureNumDiv = this.debugDiv.getElementsByClassName("measure-num")[0]
|
||||||
this.restartCheckbox = this.debugDiv.getElementsByClassName("change-restart")[0]
|
this.restartCheckbox = this.debugDiv.getElementsByClassName("change-restart")[0]
|
||||||
|
this.autoplayLabel = this.debugDiv.getElementsByClassName("autoplay-label")[0]
|
||||||
|
this.autoplayCheckbox = this.debugDiv.getElementsByClassName("autoplay")[0]
|
||||||
this.restartBtn = this.debugDiv.getElementsByClassName("restart-btn")[0]
|
this.restartBtn = this.debugDiv.getElementsByClassName("restart-btn")[0]
|
||||||
this.exitBtn = this.debugDiv.getElementsByClassName("exit-btn")[0]
|
this.exitBtn = this.debugDiv.getElementsByClassName("exit-btn")[0]
|
||||||
|
|
||||||
@ -23,6 +25,7 @@ class Debug{
|
|||||||
pageEvents.add(this.minimiseDiv, "click", this.minimise.bind(this))
|
pageEvents.add(this.minimiseDiv, "click", this.minimise.bind(this))
|
||||||
pageEvents.add(this.restartBtn, "click", this.restartSong.bind(this))
|
pageEvents.add(this.restartBtn, "click", this.restartSong.bind(this))
|
||||||
pageEvents.add(this.exitBtn, "click", this.clean.bind(this))
|
pageEvents.add(this.exitBtn, "click", this.clean.bind(this))
|
||||||
|
pageEvents.add(this.autoplayCheckbox, "change", this.toggleAutoplay.bind(this))
|
||||||
|
|
||||||
this.offsetSlider = new InputSlider(this.offsetDiv, -60, 60, 3)
|
this.offsetSlider = new InputSlider(this.offsetDiv, -60, 60, 3)
|
||||||
this.offsetSlider.onchange(this.offsetChange.bind(this))
|
this.offsetSlider.onchange(this.offsetChange.bind(this))
|
||||||
@ -85,6 +88,7 @@ class Debug{
|
|||||||
updateStatus(){
|
updateStatus(){
|
||||||
if(debugObj.controller && !this.controller){
|
if(debugObj.controller && !this.controller){
|
||||||
this.restartBtn.style.display = "block"
|
this.restartBtn.style.display = "block"
|
||||||
|
this.autoplayLabel.style.display = "block"
|
||||||
|
|
||||||
this.controller = debugObj.controller
|
this.controller = debugObj.controller
|
||||||
var selectedSong = this.controller.selectedSong
|
var selectedSong = this.controller.selectedSong
|
||||||
@ -109,16 +113,16 @@ class Debug{
|
|||||||
var circles = game.songData.circles
|
var circles = game.songData.circles
|
||||||
for(var i in circles){
|
for(var i in circles){
|
||||||
game.currentCircle = i
|
game.currentCircle = i
|
||||||
if(circles[i].ms < measureMS){
|
if(circles[i].endTime >= measureMS){
|
||||||
game.currentCircle = i
|
|
||||||
}else{
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.autoplayCheckbox.checked = this.controller.autoPlayEnabled
|
||||||
}
|
}
|
||||||
if(this.controller && !debugObj.controller){
|
if(this.controller && !debugObj.controller){
|
||||||
this.restartBtn.style.display = ""
|
this.restartBtn.style.display = ""
|
||||||
|
this.autoplayLabel.style.display = ""
|
||||||
this.controller = null
|
this.controller = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -149,14 +153,38 @@ class Debug{
|
|||||||
this.controller.restartSong()
|
this.controller.restartSong()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
toggleAutoplay(){
|
||||||
|
if(this.controller){
|
||||||
|
this.controller.autoPlayEnabled = this.autoplayCheckbox.checked
|
||||||
|
if(!this.controller.autoPlayEnabled){
|
||||||
|
var keyboard = debugObj.controller.keyboard
|
||||||
|
var kbd = keyboard.getBindings()
|
||||||
|
keyboard.setKey(kbd.don_l, false)
|
||||||
|
keyboard.setKey(kbd.don_r, false)
|
||||||
|
keyboard.setKey(kbd.ka_l, false)
|
||||||
|
keyboard.setKey(kbd.ka_r, false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
clean(){
|
clean(){
|
||||||
this.offsetSlider.clean()
|
this.offsetSlider.clean()
|
||||||
|
|
||||||
pageEvents.remove(window, ["mousedown", "mouseup", "mousemove", "blur"])
|
pageEvents.remove(window, ["mousedown", "mouseup", "mousemove", "blur"])
|
||||||
pageEvents.remove(this.title, "mousedown")
|
pageEvents.remove(this.title, "mousedown")
|
||||||
|
pageEvents.remove(this.minimiseDiv, "click")
|
||||||
|
pageEvents.remove(this.restartBtn, "click")
|
||||||
|
pageEvents.remove(this.exitBtn, "click")
|
||||||
|
pageEvents.remove(this.autoplayCheckbox, "change")
|
||||||
|
|
||||||
delete this.titleDiv
|
delete this.titleDiv
|
||||||
delete this.minimiseDiv
|
delete this.minimiseDiv
|
||||||
|
delete this.offsetDiv
|
||||||
|
delete this.measureNumDiv
|
||||||
|
delete this.restartCheckbox
|
||||||
|
delete this.autoplayLabel
|
||||||
|
delete this.autoplayCheckbox
|
||||||
|
delete this.restartBtn
|
||||||
|
delete this.exitBtn
|
||||||
delete this.controller
|
delete this.controller
|
||||||
|
|
||||||
debugObj.state = "closed"
|
debugObj.state = "closed"
|
||||||
|
@ -71,7 +71,7 @@ class Game{
|
|||||||
var endTime = circle.getEndTime() + (drumrollNotes ? 0 : this.rules.bad)
|
var endTime = circle.getEndTime() + (drumrollNotes ? 0 : this.rules.bad)
|
||||||
|
|
||||||
if(ms >= circle.getMS()){
|
if(ms >= circle.getMS()){
|
||||||
if(drumrollNotes && !circle.rendaPlayed){
|
if(drumrollNotes && !circle.rendaPlayed && ms < endTime){
|
||||||
circle.rendaPlayed = true
|
circle.rendaPlayed = true
|
||||||
if(this.rules.difficulty === "easy"){
|
if(this.rules.difficulty === "easy"){
|
||||||
assets.sounds["renda" + this.controller.snd].stop()
|
assets.sounds["renda" + this.controller.snd].stop()
|
||||||
@ -84,10 +84,6 @@ class Game{
|
|||||||
}
|
}
|
||||||
circle.beatMSCopied = true
|
circle.beatMSCopied = true
|
||||||
}
|
}
|
||||||
if(!nextSet){
|
|
||||||
nextSet = true
|
|
||||||
this.currentCircle = i
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(ms > endTime){
|
if(ms > endTime){
|
||||||
if(!this.controller.autoPlayEnabled){
|
if(!this.controller.autoPlayEnabled){
|
||||||
@ -113,6 +109,9 @@ class Game{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else if(!this.controller.autoPlayEnabled && !nextSet){
|
||||||
|
nextSet = true
|
||||||
|
this.currentCircle = i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
<span class="reset">x</span><input type="text" value="" readonly><span class="minus">-</span><span class="plus">+</span>
|
<span class="reset">x</span><input type="text" value="" readonly><span class="minus">-</span><span class="plus">+</span>
|
||||||
</div>
|
</div>
|
||||||
<label><input class="change-restart" type="checkbox">Restart on change</label>
|
<label><input class="change-restart" type="checkbox">Restart on change</label>
|
||||||
|
<label class="autoplay-label"><input class="autoplay" type="checkbox">Auto play</label>
|
||||||
<div class="bottom-btns">
|
<div class="bottom-btns">
|
||||||
<div class="restart-btn">Restart song</div>
|
<div class="restart-btn">Restart song</div>
|
||||||
<div class="exit-btn">Exit debug</div>
|
<div class="exit-btn">Exit debug</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user