-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ci: an/hack/develop 추가 * ui: theme 설정 및 컬러 적용 * refactor: type UI 모델 재정의 - 색상도 포함하도록 수정 * chore: 타입 데이터 추가 및 파일 위치 변경 * chore: 불필요한 파일 제거 * feat: 타입 결과 반환하는 로직 구현 * feat: 타입 선택 바텀 시트 데이터 및 이벤트 핸들러 연결 * feat: 상성 결과 화면 데이터 연결 및 이벤트 처리 * refresh, 눌렀을 때 바텀시트 dismiss * ktlintformat --------- Co-authored-by: murjune <[email protected]>
- Loading branch information
1 parent
0739658
commit 50001e8
Showing
58 changed files
with
1,266 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
38 changes: 38 additions & 0 deletions
38
android/app/src/main/java/poke/rogue/helper/data/datasource/LocalTypeDataSource.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package poke.rogue.helper.data.datasource | ||
|
||
import poke.rogue.helper.data.model.TypeMatchedResult | ||
import poke.rogue.helper.local.DummyTypeData | ||
|
||
class LocalTypeDataSource(private val typeData: DummyTypeData = DummyTypeData) { | ||
fun findAllTypesAgainstAttackingType(attackingTypeId: Int): List<TypeMatchedResult> { | ||
val allResult = typeData.typeMatchedTable[attackingTypeId] | ||
val resultMap = allResult.withIndex().groupBy({ it.value }, { typeData.allTypes[it.index] }) | ||
val result = | ||
resultMap.entries.map { | ||
(matchedResult, types) -> | ||
TypeMatchedResult(matchedResult, types) | ||
} | ||
return result | ||
} | ||
|
||
fun findAllTypesAgainstDefendingType(defendingTypeId: Int): List<TypeMatchedResult> { | ||
val allResult = typeData.typeMatchedTable.map { it[defendingTypeId] } | ||
val resultMap = allResult.withIndex().groupBy({ it.value }, { typeData.allTypes[it.index] }) | ||
val result = | ||
resultMap.entries.map { | ||
(matchedResult, types) -> | ||
TypeMatchedResult(matchedResult, types) | ||
} | ||
return result | ||
} | ||
|
||
fun findMatchedTypeResult( | ||
attackingTypeId: Int, | ||
defendingTypeId: Int, | ||
): TypeMatchedResult { | ||
return TypeMatchedResult( | ||
typeData.typeMatchedTable[attackingTypeId][defendingTypeId], | ||
listOf(typeData.allTypes.get(defendingTypeId)), | ||
) | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
android/app/src/main/java/poke/rogue/helper/data/model/TypeMatchedResult.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package poke.rogue.helper.data.model | ||
|
||
data class TypeMatchedResult(val matchedResult: MatchedResult, val types: List<TypeInfo>) |
Empty file.
26 changes: 26 additions & 0 deletions
26
android/app/src/main/java/poke/rogue/helper/data/repository/TypeRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package poke.rogue.helper.data.repository | ||
|
||
import poke.rogue.helper.data.datasource.LocalTypeDataSource | ||
import poke.rogue.helper.data.model.MatchedResult | ||
import poke.rogue.helper.data.model.TypeMatchedResult | ||
|
||
class TypeRepository(private val localTypeDataSource: LocalTypeDataSource) { | ||
fun findResultAgainstMyType(myTypeId: Int): List<TypeMatchedResult> { | ||
return localTypeDataSource.findAllTypesAgainstAttackingType(myTypeId) | ||
.filter { it.matchedResult != MatchedResult.NORMAL } | ||
} | ||
|
||
fun findResultAgainstOpponent(opponentTypeId: Int): List<TypeMatchedResult> { | ||
return localTypeDataSource.findAllTypesAgainstDefendingType(opponentTypeId) | ||
.filter { it.matchedResult != MatchedResult.NORMAL } | ||
} | ||
|
||
fun findMatchedResult( | ||
myTypeId: Int, | ||
opponentTypeIds: List<Int>, | ||
): List<TypeMatchedResult> { | ||
return opponentTypeIds.map { | ||
localTypeDataSource.findMatchedTypeResult(myTypeId, it) | ||
}.filter { it.matchedResult != MatchedResult.NORMAL } | ||
} | ||
} |
Oops, something went wrong.