2018-09-15 22:34:53 +08:00
|
|
|
class Circle{
|
2018-09-20 07:20:26 +08:00
|
|
|
constructor(config){
|
|
|
|
// id, ms, type, text, speed, endTime, requiredHits
|
|
|
|
this.id = config.id
|
|
|
|
this.ms = config.start
|
2018-10-15 02:08:05 +08:00
|
|
|
this.originalMS = this.ms
|
2018-09-20 07:20:26 +08:00
|
|
|
this.type = config.type
|
|
|
|
this.text = config.txt
|
|
|
|
this.speed = config.speed
|
2018-09-22 04:31:35 +08:00
|
|
|
this.endTime = config.endTime || this.ms
|
2018-10-15 02:08:05 +08:00
|
|
|
this.originalEndTime = this.endTime
|
2018-09-19 01:33:18 +08:00
|
|
|
this.isPlayed = 0
|
2018-09-15 22:34:53 +08:00
|
|
|
this.animating = false
|
|
|
|
this.animT = 0
|
|
|
|
this.score = 0
|
2018-09-20 07:20:26 +08:00
|
|
|
this.lastFrame = this.ms + 100
|
2018-09-15 22:34:53 +08:00
|
|
|
this.animationEnded = false
|
|
|
|
this.timesHit = 0
|
2018-11-13 12:36:15 +08:00
|
|
|
this.timesKa = 0
|
2018-09-20 07:20:26 +08:00
|
|
|
this.requiredHits = config.requiredHits || 0
|
2018-09-19 01:33:18 +08:00
|
|
|
this.rendaPlayed = false
|
2018-09-20 07:20:26 +08:00
|
|
|
this.gogoTime = config.gogoTime
|
|
|
|
this.gogoChecked = false
|
2018-10-12 04:24:18 +08:00
|
|
|
this.beatMS = config.beatMS
|
2019-01-27 02:29:13 +08:00
|
|
|
this.fixedPos = config.fixedPos
|
2018-09-15 22:34:53 +08:00
|
|
|
}
|
|
|
|
getMS(){
|
|
|
|
return this.ms
|
|
|
|
}
|
|
|
|
getEndTime(){
|
|
|
|
return this.endTime
|
|
|
|
}
|
|
|
|
getType(){
|
|
|
|
return this.type
|
|
|
|
}
|
|
|
|
getLastFrame(){
|
|
|
|
return this.lastFrame
|
|
|
|
}
|
2018-10-08 02:58:42 +08:00
|
|
|
animate(ms){
|
2018-09-15 22:34:53 +08:00
|
|
|
this.animating = true
|
2018-10-08 02:58:42 +08:00
|
|
|
this.animT = ms
|
2018-09-15 22:34:53 +08:00
|
|
|
}
|
|
|
|
isAnimated(){
|
|
|
|
return this.animating
|
|
|
|
}
|
|
|
|
getAnimT(){
|
|
|
|
return this.animT
|
|
|
|
}
|
|
|
|
getPlayed(){
|
|
|
|
return this.isPlayed
|
|
|
|
}
|
|
|
|
isAnimationFinished(){
|
|
|
|
return this.animationEnded
|
|
|
|
}
|
|
|
|
endAnimation(){
|
|
|
|
this.animationEnded = true
|
|
|
|
}
|
2018-09-19 01:33:18 +08:00
|
|
|
played(score, big){
|
2018-09-15 22:34:53 +08:00
|
|
|
this.score = score
|
2018-09-22 04:31:35 +08:00
|
|
|
this.isPlayed = score <= 0 ? score - 1 : (big ? 2 : 1)
|
2018-09-15 22:34:53 +08:00
|
|
|
}
|
2018-11-13 12:36:15 +08:00
|
|
|
hit(keysKa){
|
2018-09-15 22:34:53 +08:00
|
|
|
this.timesHit++
|
2018-11-13 12:36:15 +08:00
|
|
|
if(keysKa){
|
|
|
|
this.timesKa++
|
|
|
|
}
|
2018-09-15 22:34:53 +08:00
|
|
|
}
|
|
|
|
getScore(){
|
|
|
|
return this.score
|
|
|
|
}
|
|
|
|
getID(){
|
|
|
|
return this.id
|
|
|
|
}
|
|
|
|
getText(){
|
|
|
|
return this.text
|
|
|
|
}
|
|
|
|
getSpeed(){
|
|
|
|
return this.speed
|
|
|
|
}
|
2015-07-17 16:22:46 +08:00
|
|
|
}
|