diff --git a/app/src/main/java/com/kyhsgeekcode/dereinfo/model/DereDatabaseHelper.kt b/app/src/main/java/com/kyhsgeekcode/dereinfo/model/DereDatabaseHelper.kt index 80a44de..fcd3f53 100644 --- a/app/src/main/java/com/kyhsgeekcode/dereinfo/model/DereDatabaseHelper.kt +++ b/app/src/main/java/com/kyhsgeekcode/dereinfo/model/DereDatabaseHelper.kt @@ -521,7 +521,73 @@ class DereDatabaseHelper(context: Context) { } private fun parseDereFumenWitch(fumenStr: String, info: MusicInfo): List { - return parseDereFumen(fumenStr, info) + val parsedFumen = csvReader().readAllWithHeader(fumenStr) +// Log.d(TAG, "parsing Fumen; size ${parsedFumen.size}, fumenStr $fumenStr") + + val prevIDs = HashMap() + val longnoteIDs = HashMap() + val IDToNotes = HashMap() + val notes = ArrayList() + var prevID = 0 + var idd = 0 + for (row in parsedFumen) { + prevID = 0 + val gid = row["groupId"]!!.toInt() + val mode = row["type"]!!.toInt() + val visible = row["visible"]?.toIntOrNull() ?: 100 + if (visible < 0) + continue + if (mode > 3 && mode != 8) + continue + idd++ + var twMode = getTWMode(mode) + val endpos = row["finishPos"]!!.toFloat() + val flick = + getTW5Flick(row["status"]!!.toInt()) + if (gid == 0) { + //... + } else { + if (prevIDs.containsKey(gid)) { + prevID = prevIDs[gid]!! + } else { + //... + } + prevIDs[gid] = idd + } + if (longnoteIDs.containsKey(endpos)) { + //롱노트 중이었다면 해제한다. 자신의 prev를 그 롱노트로 설정한다. + prevID = longnoteIDs[endpos]!! + twMode = TWMode.Hold + longnoteIDs.remove(endpos) + } else if (mode == 2) { + //롱노트 중이 아니었고 자신이 롱노트라면 등록한다. + prevID = 0 + longnoteIDs[endpos] = idd + } + //롱노트 중도 아니었고 자신도 롱노트가 아니다 + else if ((mode == 1) and (IDToNotes[prevID]?.isFlick() == false) /*and (flick == FlickMode.None)*/) { + prevID = 0 + } + val theNote = Note( + idd, + 0, + getColor(info.circleType), + twMode, + flick, + row["sec"]!!.toFloat(), + 1.0f, + row["startPos"]!!.toFloat(), + endpos, + arrayOf(prevID), + row["sync"]?.toInt() == 1 + ) + IDToNotes[idd] = theNote + for (id in theNote.previds) { + IDToNotes[id]?.addNext(theNote) + } + notes.add(theNote) + } + return notes } private fun parseDereFumen( @@ -541,7 +607,7 @@ class DereDatabaseHelper(context: Context) { prevID = 0 var gid = row["groupId"]!!.toInt() var mode = row["type"]!!.toInt() - if (mode > 3) + if (mode > 3 && mode != 8) continue idd++ var twMode = getTWMode(mode) @@ -611,7 +677,7 @@ class DereDatabaseHelper(context: Context) { prevID = 0 var gid = row["groupId"]!!.toInt() var mode = row["type"]!!.toInt() - if (mode > 7) + if (mode > 8) continue idd++ val twModePair = getTWModeGrand(mode) diff --git a/app/src/main/java/com/kyhsgeekcode/dereinfo/model/DereToTW.kt b/app/src/main/java/com/kyhsgeekcode/dereinfo/model/DereToTW.kt index f4ba662..9bf9005 100644 --- a/app/src/main/java/com/kyhsgeekcode/dereinfo/model/DereToTW.kt +++ b/app/src/main/java/com/kyhsgeekcode/dereinfo/model/DereToTW.kt @@ -19,6 +19,7 @@ fun getTWMode(mode: Int): TWMode { 1 -> TWMode.Tap 2 -> TWMode.Hold 3 -> TWMode.Slide + 8 -> TWMode.Damage else -> TWMode.Tap } } diff --git a/app/src/main/java/com/kyhsgeekcode/dereinfo/model/FumenStatistics.kt b/app/src/main/java/com/kyhsgeekcode/dereinfo/model/FumenStatistics.kt index 4e4d9b3..fb0571a 100644 --- a/app/src/main/java/com/kyhsgeekcode/dereinfo/model/FumenStatistics.kt +++ b/app/src/main/java/com/kyhsgeekcode/dereinfo/model/FumenStatistics.kt @@ -9,6 +9,7 @@ enum class StatisticIndex { Long, Flick, Slide, + Damage, Total7, Total9, @@ -28,7 +29,11 @@ enum class StatisticIndex { Slide7, Slide9, - Slide11; + Slide11, + + Damage7, + Damage9, + Damage11; companion object { fun makeIndex(type: String, time: Int = 0): StatisticIndex { @@ -46,6 +51,7 @@ enum class StatisticIndex { TWMode.Tap -> Normal TWMode.Hold -> Long TWMode.Slide -> Slide + TWMode.Damage -> Damage else -> throw IllegalArgumentException() } else Flick