Skip to content

Commit

Permalink
refactor(style): slight old season cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
xeruf committed Jul 9, 2024
1 parent b6f06af commit d830bc0
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 43 deletions.
63 changes: 32 additions & 31 deletions src/main/kotlin/sc/gui/AppStyle.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ class AppStyle: Stylesheet() {
val statusLabel by cssclass()
val plainLabel by cssclass()

val gridHover by csspseudoclass()
val gridLock by csspseudoclass()

fun background() =
StackPane(
Region().apply {
Expand Down Expand Up @@ -164,33 +161,6 @@ class AppStyle: Stylesheet() {
}
}

fun ostseeschachStyles() {
val colorBackground = c("#36d2ff")

Team.values().forEach { team ->
".${team.color}" {
val color = team.color
backgroundColor += c(color, 0.6).desaturate()
and(gridHover) {
backgroundColor += c(color, 0.6)
}
and(gridLock) {
backgroundColor += c(color, 0.8)
}
}
}

CssRule.c("grid").theme {
borderStyle += BorderStrokeStyle.DOTTED
borderColor += box(if(it.isDark) colorBackground.brighter() else colorBackground.darker())
}

background {
opacity = 0.7
backgroundColor += colorBackground
}
}

fun mqStyles() {
background {
opacity = 0.7
Expand Down Expand Up @@ -258,4 +228,35 @@ class AppStyle: Stylesheet() {
select(CssRule.c("coal$it")) { image = resources.url("/mq/boats/coal/coal_$it.png").toURI() }
}
}
}

val gridHover by csspseudoclass()
val gridLock by csspseudoclass()

fun ostseeschachStyles() {
val colorBackground = c("#36d2ff")

Team.values().forEach { team ->
".${team.color}" {
val color = team.color
backgroundColor += c(color, 0.6).desaturate()
and(gridHover) {
backgroundColor += c(color, 0.6)
}
and(gridLock) {
backgroundColor += c(color, 0.8)
}
}
}

CssRule.c("grid").theme {
borderStyle += BorderStrokeStyle.DOTTED
borderColor += box(if(it.isDark) colorBackground.brighter() else colorBackground.darker())
}

background {
opacity = 0.7
backgroundColor += colorBackground
}
}

}
8 changes: 0 additions & 8 deletions src/main/kotlin/sc/gui/penguins/PenguinsStyle.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package sc.gui.penguins
import javafx.geometry.Side
import javafx.scene.layout.BackgroundPosition
import javafx.scene.layout.BackgroundSize
import sc.gui.AppStyle
import sc.gui.AppStyle.Companion.background
import tornadofx.*

Expand All @@ -21,13 +20,6 @@ class PenguinsStyle: Stylesheet() {
}

// Game
AppStyle.gridHover {
backgroundColor += c("#222", 0.3)
and(hover) {
backgroundColor += c("#222", 0.5)
}
}

arrayOf("fish", "ice").forEach {
select(CssRule.c(it)) { image = resources.url("/penguins/$it.png").toURI() }
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/kotlin/sc/gui/view/ControlView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import sc.gui.AppStyle
import sc.gui.GamePausedEvent
import sc.gui.GameReadyEvent
import sc.gui.events.*
import sc.gui.model.AppModel
import sc.gui.model.GameModel
import sc.gui.util.binding
import sc.gui.util.booleanBinding
Expand Down Expand Up @@ -131,7 +130,7 @@ class ControlView: View() {
// TODO unfocus on normal character typed
prefWidthProperty().bind(fontSize.multiply(6))
}
checkbox("Animationen", AppModel.animate)
// TODO depend on game: checkbox("Animationen", AppModel.animate)
}

init {
Expand Down
2 changes: 0 additions & 2 deletions src/main/kotlin/sc/gui/view/PenguinsBoard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,10 @@ class PenguinBoard: View() {
}

private fun Node.removeHover() {
//removeClass(AppStyle.gridHover, AppStyle.gridLock)
effect = null
}

private fun Node.addHover(lock: Boolean = false, team: Team? = null): Node {
//addClass(if(lock) AppStyle.gridLock else AppStyle.gridHover)
effect =
if(team == null) Glow(if(lock) 0.7 else 0.4)
else ColorAdjust(team.colorAdjust, -0.6, 0.0, 0.0)
Expand Down

0 comments on commit d830bc0

Please sign in to comment.