summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2018-08-24 17:36:33 +0200 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2018-08-24 17:36:33 +0200 |
commit | b3fd9613c298e1af44f025d9d95021eec8c72a59 (patch) | |
tree | 4e00b8d3c2f3a56747a3520a3ec260c5e3302861 /src/character/src/View/SubMenu/Status | |
parent | 3713d6089adccd96385b0d079bb72587d2122848 (diff) |
Starting to work on the character editor.
Diffstat (limited to 'src/character/src/View/SubMenu/Status')
-rw-r--r-- | src/character/src/View/SubMenu/Status/CharacterInfo.elm | 34 | ||||
-rw-r--r-- | src/character/src/View/SubMenu/Status/TileInfo.elm | 137 |
2 files changed, 171 insertions, 0 deletions
diff --git a/src/character/src/View/SubMenu/Status/CharacterInfo.elm b/src/character/src/View/SubMenu/Status/CharacterInfo.elm new file mode 100644 index 0000000..814ce5f --- /dev/null +++ b/src/character/src/View/SubMenu/Status/CharacterInfo.elm @@ -0,0 +1,34 @@ +module View.SubMenu.Status.CharacterInfo exposing (get_html) + +-- Elm ------------------------------------------------------------------------- +import Html +import Html.Attributes + +-- Struct.Map ------------------------------------------------------------------- +import Struct.Character +import Struct.Event + +import View.Controlled.CharacterCard + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_html : ( + Int -> + Struct.Character.Type -> + (Html.Html Struct.Event.Type) + ) +get_html player_ix char = + (Html.div + [ + (Html.Attributes.class "battle-tabmenu-character-info") + ] + [ + (Html.text ("Focusing:")), + (View.Controlled.CharacterCard.get_full_html player_ix char) + ] + ) diff --git a/src/character/src/View/SubMenu/Status/TileInfo.elm b/src/character/src/View/SubMenu/Status/TileInfo.elm new file mode 100644 index 0000000..920b5ce --- /dev/null +++ b/src/character/src/View/SubMenu/Status/TileInfo.elm @@ -0,0 +1,137 @@ +module View.SubMenu.Status.TileInfo exposing (get_html) + +-- Elm ------------------------------------------------------------------------- +import Dict + +import Html +import Html.Attributes + +-- Struct.Map ------------------------------------------------------------------- +import Constants.Movement + +import Struct.Map +import Struct.Event +import Struct.Location +import Struct.Model +import Struct.Tile + +import Util.Html + +import View.Map.Tile + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_icon : (Struct.Tile.Instance -> (Html.Html Struct.Event.Type)) +get_icon tile = + (Html.div + [ + (Html.Attributes.class "battle-tile-card-icon"), + (Html.Attributes.class "battle-info-card-picture"), + (Html.Attributes.class + ( + "battle-tile-variant-" + ++ (toString (Struct.Tile.get_local_variant_ix tile)) + ) + ) + ] + (View.Map.Tile.get_content_html tile) + ) + +get_name : ( + Struct.Model.Type -> + Struct.Tile.Instance -> + (Html.Html Struct.Event.Type) + ) +get_name model tile = + case (Dict.get (Struct.Tile.get_type_id tile) model.tiles) of + Nothing -> (Util.Html.nothing) + (Just tile_type) -> + (Html.div + [ + (Html.Attributes.class "battle-info-card-name"), + (Html.Attributes.class "battle-info-card-text-field"), + (Html.Attributes.class "battle-tile-card-name") + ] + [ + (Html.text (Struct.Tile.get_name tile_type)) + ] + ) + +get_cost : (Struct.Tile.Instance -> (Html.Html Struct.Event.Type)) +get_cost tile = + let + cost = (Struct.Tile.get_instance_cost tile) + text = + if (cost > Constants.Movement.max_points) + then + "Obstructed" + else + ("Cost: " ++ (toString cost)) + in + (Html.div + [ + (Html.Attributes.class "battle-info-card-text-field"), + (Html.Attributes.class "battle-tile-card-cost") + ] + [ + (Html.text text) + ] + ) + +get_location : (Struct.Tile.Instance -> (Html.Html Struct.Event.Type)) +get_location tile = + let + tile_location = (Struct.Tile.get_location tile) + in + (Html.div + [ + (Html.Attributes.class "battle-info-card-text-field"), + (Html.Attributes.class "battle-tile-card-location") + ] + [ + (Html.text + ( + "{x: " + ++ (toString tile_location.x) + ++ "; y: " + ++ (toString tile_location.y) + ++ "}" + ) + ) + ] + ) + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_html : ( + Struct.Model.Type -> + Struct.Location.Type -> + (Html.Html Struct.Event.Type) + ) +get_html model loc = + case (Struct.Map.try_getting_tile_at loc model.map) of + (Just tile) -> + (Html.div + [ + (Html.Attributes.class "battle-info-card"), + (Html.Attributes.class "battle-tile-card") + ] + [ + (get_name model tile), + (Html.div + [ + (Html.Attributes.class "battle-info-card-top"), + (Html.Attributes.class "battle-tile-card-top") + ] + [ + (get_icon tile), + (get_location tile), + (get_cost tile) + ] + ) + ] + ) + + Nothing -> (Html.text "Error: Unknown tile location selected.") |