Skip to content

Commit 17914c8

Browse files
authored
Merge pull request #334 from alyssaruth/more-theme-tweaks
More theme tweaks
2 parents f2748d7 + b46316e commit 17914c8

18 files changed

Lines changed: 35 additions & 3 deletions

File tree

‎src/main/kotlin/dartzee/screen/animation/IAnimationTrigger.kt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ data class DartScoreTrigger(val gameType: GameType, val total: Int) : IAnimation
1111
object BadLuckTrigger : IAnimationTrigger
1212

1313
object BruceyBonusTrigger : IAnimationTrigger
14+
15+
object PlayerVictory : IAnimationTrigger

‎src/main/kotlin/dartzee/screen/game/DartsGamePanel.kt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import dartzee.`object`.SegmentType
2626
import dartzee.preferences.Preferences
2727
import dartzee.screen.GameplayDartboard
2828
import dartzee.screen.animation.DartScoreTrigger
29+
import dartzee.screen.animation.PlayerVictory
2930
import dartzee.screen.game.dartzee.DartzeeRuleCarousel
3031
import dartzee.screen.game.dartzee.DartzeeRuleSummaryPanel
3132
import dartzee.screen.game.dartzee.GamePanelDartzee
@@ -406,6 +407,10 @@ abstract class DartsGamePanel<
406407
protected fun handlePlayerFinish(): Int {
407408
val state = getCurrentPlayerState()
408409
val finishingPosition = getFinishingPositionFromPlayersRemaining()
410+
if (finishingPosition == 1) {
411+
dartboard.doDodgy(PlayerVictory)
412+
}
413+
409414
val numberOfDarts = state.getScoreSoFar()
410415
state.participantFinished(finishingPosition, numberOfDarts)
411416

‎src/main/kotlin/dartzee/screen/game/GamePanelFixedLength.kt‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package dartzee.screen.game
22

3+
import dartzee.core.util.doDodgy
34
import dartzee.db.GameEntity
45
import dartzee.game.state.AbstractPlayerState
6+
import dartzee.screen.animation.PlayerVictory
57
import dartzee.screen.game.scorer.AbstractDartsScorer
6-
import dartzee.utils.doesHighestWin
78
import dartzee.utils.setFinishingPositions
89

910
abstract class GamePanelFixedLength<
@@ -12,7 +13,6 @@ abstract class GamePanelFixedLength<
1213
>(parent: AbstractDartsGameScreen, game: GameEntity, totalPlayers: Int) :
1314
DartsGamePanel<S, PlayerState>(parent, game, totalPlayers) {
1415
abstract val totalRounds: Int
15-
val highestWins = doesHighestWin(game.gameType)
1616

1717
fun finishRound() {
1818
if (currentRoundNumber == totalRounds) {
@@ -35,6 +35,8 @@ abstract class GamePanelFixedLength<
3535
// Get the participants sorted by score so we can assign finishing positions
3636
setFinishingPositions(getParticipants().map { it.participant }, gameEntity)
3737

38+
dartboard.doDodgy(PlayerVictory)
39+
3840
getPlayerStates().forEach { updateWinAchievement(it.wrappedParticipant) }
3941

4042
allPlayersFinished()

‎src/main/kotlin/dartzee/theme/ThemeUtils.kt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fun autoApplyTheme() {
1717

1818
fun pickThemeForDate(now: LocalDate): Theme? {
1919
if (DartsClient.devMode) {
20-
return Themes.OKTOBERFEST
20+
return Themes.EASTER
2121
}
2222

2323
val easterSunday = findEasterSunday(now.year)

‎src/main/kotlin/dartzee/theme/Themes.kt‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ package dartzee.theme
33
import dartzee.game.GameType
44
import dartzee.`object`.ColourWrapper
55
import dartzee.screen.animation.Animation
6+
import dartzee.screen.animation.CompositeAnimation
67
import dartzee.screen.animation.DartScoreTrigger
78
import dartzee.screen.animation.IAnimation
89
import dartzee.screen.animation.IAnimationTrigger
10+
import dartzee.screen.animation.PlayerVictory
911
import java.awt.Color
1012

1113
private val lightOrange = Color.decode("#ff8200")
@@ -65,6 +67,17 @@ object Themes {
6567
dartboardColours = halloweenDartboardColours,
6668
)
6769

70+
private val easterAnimations: List<Pair<IAnimationTrigger, IAnimation>> =
71+
listOf(
72+
PlayerVictory to Animation("thats-all-folks", "/theme/easter/horrific/bugs-bunny.png")
73+
) +
74+
GameType.values().flatMap { gameType ->
75+
listOf(
76+
DartScoreTrigger(gameType, 0) to
77+
Animation("egg-crack", "/theme/easter/horrific/egg-crack.png")
78+
)
79+
}
80+
6881
val EASTER =
6982
Theme(
7083
"easter",
@@ -76,6 +89,15 @@ object Themes {
7689
fontColor = Color.DARK_GRAY,
7790
dartboardColours = easterDartboardColours,
7891
menuFontSize = 20f,
92+
animations = easterAnimations.toMap(),
93+
)
94+
95+
private val beerSmashAnimation =
96+
CompositeAnimation(
97+
(1..3).map { Animation("smash$it", "/theme/oktoberfest/horrific/dropped-beer.png") } +
98+
(1..3).map {
99+
Animation("smash$it", "/theme/oktoberfest/horrific/dropped-beer-2.png")
100+
}
79101
)
80102

81103
private val oktoberfestAnimations: List<Pair<IAnimationTrigger, IAnimation>> =
@@ -87,6 +109,7 @@ object Themes {
87109
Animation("blimey", "/theme/oktoberfest/horrific/blimey.png"),
88110
DartScoreTrigger(gameType, 18) to
89111
Animation("eighteen-pints", "/theme/oktoberfest/horrific/pints-of-lager.png"),
112+
DartScoreTrigger(gameType, 0) to beerSmashAnimation,
90113
)
91114
}
92115

67.7 KB
Loading
113 KB
Loading
909 Bytes
Loading
9.27 KB
Loading
9.3 KB
Loading

0 commit comments

Comments
 (0)