Skip to content

Commit

Permalink
✨ Damage note
Browse files Browse the repository at this point in the history
  • Loading branch information
yhs0602 committed Dec 30, 2020
1 parent aa60d10 commit 4cb3bf4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,10 @@ class DereDatabaseHelper(context: Context) {
//Log.d(TAG, "Skip file")
continue
}
var fumenDB: SQLiteDatabase? = null
try {
//Log.d(TAG, "Oh file")
val fumenDB =
fumenDB =
SQLiteDatabase.openDatabase(file!!.path, null, SQLiteDatabase.OPEN_READONLY)
cursorFumens = fumenDB.query("blobs", arrayOf("name"), null, null, null, null, null)
while (cursorFumens.moveToNext()) {
Expand All @@ -192,11 +193,11 @@ class DereDatabaseHelper(context: Context) {
musicNumberToFumenFile[musicIndex] = file
break
}
fumenDB.close()
} catch (e: SQLException) {
Log.e(TAG, "indexFumen", e)
continue
} finally {
fumenDB?.close()
cursorFumens?.close()
}
}
Expand Down Expand Up @@ -465,6 +466,7 @@ class DereDatabaseHelper(context: Context) {
5 -> Pair(TWMode.Slide, FlickMode.None)
6 -> Pair(TWMode.Tap, FlickMode.Left)
7 -> Pair(TWMode.Tap, FlickMode.Right)
8 -> Pair(TWMode.Damage, FlickMode.None)
else -> Pair(TWMode.fromType(type), FlickMode.fromStatus(status))
}

Expand Down Expand Up @@ -508,6 +510,8 @@ class DereDatabaseHelper(context: Context) {
val notes: List<Note>
if (twDifficulty == TW5Difficulty.Piano || twDifficulty == TW5Difficulty.Forte)
notes = parseDereFumenGrand(fumenStr, info)
else if (twDifficulty == TW5Difficulty.Witch)
notes = parseDereFumenWitch(fumenStr, info)
else
notes = parseDereFumen(fumenStr, info)
difficulties[twDifficulty] = OneDifficulty(twDifficulty, notes)
Expand All @@ -516,6 +520,10 @@ class DereDatabaseHelper(context: Context) {
return OneMusic(difficulties, info)
}

private fun parseDereFumenWitch(fumenStr: String, info: MusicInfo): List<Note> {
return parseDereFumen(fumenStr, info)
}

private fun parseDereFumen(
fumenStr: String,
musicInfo: MusicInfo
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/com/kyhsgeekcode/dereinfo/model/Note.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Note(
fun isFlick(): Boolean = flick != FlickMode.None
fun isLong(): Boolean = twMode == TWMode.Hold
fun isSlide(): Boolean = twMode == TWMode.Slide
fun isDamage(): Boolean = twMode == TWMode.Damage
fun chaos(): Float = abs(startline - endline)
fun getBitmap(): String {
if (isFlick()) {
Expand All @@ -32,6 +33,9 @@ class Note(
if (isLong()) {
return "Longnote"
}
if (isDamage()) {
return "Damagenote"
}
return "Normalnote"
}

Expand Down
Binary file added app/src/main/res/drawable/damagenote.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4cb3bf4

Please sign in to comment.