-
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.
Browse files
Browse the repository at this point in the history
* Moved views to views package * Added InputSidebar, need to move stuff from GameView there * Added new sidebar (empty for now) and moved left sidebar into its own class * moved mouse pos fragment to right sidebar * rudimentary mouse handling in InfoSidebar * Moved logArea to the top to see how it feels * Created lockable fragment to display information about a tile * updated codestyle (accidentially...?) * created new module and basic interface * Created default implementation of FrontendString * FrontendStrings can be added ("bindPlusWith"), extended tests * removed comments in CoordinateAtMousePosition * Moved strings module one level up, started building CoordinateFrontendString * Renamed module strings to ui-strings * fixed packaging of ui pom * Changed how "transform" works, renamed Length * Created test for CoordinateFrontendString * Fixed NPE in DefaultFrontendString * Fixed DefaultFrontendStringTest * fixed typo * Renamed ObjectFormatter to Format * Minor improvements * Fixed errors after merge * Created TerrainFrontendString (including test) * Fixed test: sidebar width is less now * Removed old frontendstring stuff * Fixed DefaultTransformationTest because the sidebar width changed * Fixed compile error * transformations for terrain * Created test for terrain transformations to not accidentally have erroneous ones * coordinate fragment is also lockable * Toggle locked state of info sidebar with right click * Beginning of the element info fragment * Added icon to TerrainDetailsFragment * Added simple element info * Improved sidebar layout, added docs * Small cleanups * removed initial text from terrainDesciption because withFrontendString() updates on bind * Added dummy MarkersFragment * "fixed" mapOffset bug * simplified update of absolutePosition * git ignores logs * use world of model not ui * use data binding instead of overridden method * use CallSign.name for display * place logArea code first * GameView connects InputSidebar to GameComponent * GameView connects InfoSidebar to GameComponent * updated screenshot * Improved logback.xml * better short names for water * Better panel borders, improved time display * Improved documentation in InfoSidebar * You can now pause the game! Whoohoo! with space or P * Show element icon in sidebar * Opt in to ExperimentalTime * added TODO in ElementInfoFragment * Better highlight when game is paused * Deleted unused fragments * Unified look and feel of the sidebar * Updated map screenshot Co-authored-by: Loomie <[email protected]>
- Loading branch information
Showing
37 changed files
with
962 additions
and
242 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
target/ | ||
logs/ | ||
|
||
# IntelliJ | ||
.DS_Store | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
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
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
69 changes: 69 additions & 0 deletions
69
game/ui-strings/src/main/kotlin/de/gleex/pltcmd/game/ui/strings/transformations/Terrain.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,69 @@ | ||
package de.gleex.pltcmd.game.ui.strings.transformations | ||
|
||
import de.gleex.pltcmd.game.ui.strings.Format | ||
import de.gleex.pltcmd.game.ui.strings.Transformation | ||
import de.gleex.pltcmd.model.world.terrain.Terrain | ||
import de.gleex.pltcmd.model.world.terrain.TerrainHeight | ||
import de.gleex.pltcmd.model.world.terrain.TerrainType | ||
import org.hexworks.zircon.api.graphics.Symbols | ||
|
||
internal val terrainTransformation: Transformation<Terrain> = { format -> | ||
when(format) { | ||
Format.ICON -> type.terrainTypeTransformation(format) | ||
Format.SHORT3 -> "${height.terrainHeightTransformation(Format.ICON)},${type.terrainTypeTransformation(Format.ICON)}" | ||
Format.SHORT5 -> "${height.terrainHeightTransformation(Format.ICON)},${type.terrainTypeTransformation(Format.SHORT3)}" | ||
Format.SIDEBAR -> "${"%3s".format(height.terrainHeightTransformation(Format.SHORT3))}, ${type.terrainTypeTransformation(Format.SIDEBAR)}" | ||
Format.FULL -> "Terrain height: ${height.terrainHeightTransformation(format)}, type: ${type.terrainTypeTransformation(format)}" | ||
} | ||
} | ||
|
||
internal val terrainTypeTransformation: Transformation<TerrainType> = { format -> | ||
when(format) { | ||
Format.ICON -> when (this) { | ||
TerrainType.GRASSLAND -> "G" | ||
TerrainType.FOREST -> "F" | ||
TerrainType.MOUNTAIN -> "M" | ||
TerrainType.HILL -> "H" | ||
TerrainType.WATER_DEEP -> "W" | ||
TerrainType.WATER_SHALLOW -> "S" | ||
} | ||
Format.SHORT3 -> when (this) { | ||
TerrainType.GRASSLAND -> "Grs" | ||
TerrainType.FOREST -> "Frs" | ||
TerrainType.MOUNTAIN -> "Mnt" | ||
TerrainType.HILL -> "Hil" | ||
TerrainType.WATER_DEEP -> "Wdp" | ||
TerrainType.WATER_SHALLOW -> "Wsh" | ||
} | ||
Format.SHORT5 -> when (this) { | ||
TerrainType.GRASSLAND -> "Grass" | ||
TerrainType.FOREST -> "Fores" | ||
TerrainType.MOUNTAIN -> "Mount" | ||
TerrainType.HILL -> "Hills" | ||
TerrainType.WATER_DEEP -> "WtrDp" | ||
TerrainType.WATER_SHALLOW -> "WtrSh" | ||
} | ||
Format.SIDEBAR, Format.FULL -> when (this) { | ||
TerrainType.GRASSLAND, | ||
TerrainType.FOREST, | ||
TerrainType.MOUNTAIN -> name.toLowerCase().capitalize() | ||
TerrainType.HILL -> "Hills" | ||
TerrainType.WATER_DEEP -> "Deep water" | ||
TerrainType.WATER_SHALLOW -> "Shallow water" | ||
} | ||
} | ||
} | ||
|
||
internal val terrainHeightTransformation: Transformation<TerrainHeight> = { format -> | ||
when(format) { | ||
Format.ICON -> when { | ||
value < 1 -> Symbols.ARROW_DOWN.toString() | ||
value > 9 -> Symbols.ARROW_UP.toString() | ||
else -> "$value" | ||
} | ||
Format.SHORT3 -> "$value" | ||
Format.SHORT5 -> "H: $value" | ||
Format.SIDEBAR -> "Height: $value" | ||
Format.FULL -> "Terrain height: $value" | ||
} | ||
} |
Oops, something went wrong.