Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AN-HACKATON] 해커톤 작업한거 develop 에 머지 #27

Merged
merged 4 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

<application
android:name=".PokeRogueHelperApp"
Expand All @@ -12,10 +12,13 @@
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:roundIcon="@mipmap/ic_poke_icon"
android:supportsRtl="true"
android:theme="@style/Theme.PokeRogueHelper"
tools:targetApi="31">
<activity
android:name=".presentation.poketmon2.PokemonActivity"
android:exported="true" />
<activity
android:name=".presentation.home.HomeActivity"
android:exported="true">
Expand All @@ -28,6 +31,14 @@
<activity
android:name=".presentation.type.TypeActivity"
android:exported="false" />

<activity
android:name=".presentation.ability.AbilityActivity"
android:exported="false" />

<activity
android:name=".presentation.ability.detail.AbilityDetailActivity"
android:exported="false" />
</application>

</manifest>
Binary file added android/app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
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)),
)
}
}
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.
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 }
}
}
Loading
Loading