package net.taehui.twilight.note import net.taehui.twilight.awilight.Component import net.taehui.twilight.awilight.DefaultCompute abstract class BaseNote(val logicalY: Double, val wait: Double) : Comparable<BaseNote> { var noteID = 0 private var y = 0.0 var isFailed = false var longWait = 0.0 var longHeight = 0.0 var judged = Component.Judged.NOT var input = 0 abstract val logicalLayer: Int abstract val layer: Int open fun hasStand(): Boolean { return false } open fun isFailedAsTooLate(wait: Double, judgmentStage: Double): Boolean { return false } open fun isTooLong(wait: Double, judgmentStage: Double): Boolean { return false } override fun compareTo(other: BaseNote): Int { if (wait > other.wait) { return 1 } else if (wait < other.wait) { return -1 } if (logicalLayer > other.logicalLayer) { return 1 } else if (logicalLayer < other.logicalLayer) { return -1 } if (input > other.input) { return 1 } else if (input < other.input) { return -1 } return 0 } fun getY(multiplier: Double): Double { return (y - Component.STANDARD_HEIGHT) * multiplier + Component.STANDARD_HEIGHT } fun doMove(distance: Double) { y += distance } fun isClose(wait: Double, logicalY: Double): Boolean { return if (this.wait - wait <= Component.LEVYING_WAIT) { y = this.logicalY - logicalY true } else { false } } abstract fun judge(input: Int, wait: Double, judgmentStage: Double, isAutoLongNote: Boolean): JudgedNoteData? abstract fun autoJudge(wait: Double): JudgedNoteData? abstract fun paint(defaultComputer: DefaultCompute) }