summaryrefslogtreecommitdiff |
diff options
author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2019-02-26 21:34:35 +0100 |
---|---|---|
committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2019-02-26 21:34:35 +0100 |
commit | b055ce4b1e9f9b056f38739506157432a9a82875 (patch) | |
tree | 4f6bfc923be0ed7fa0312a76b7154deb7ca8adf9 /src/battle/src/View | |
parent | 3d945fe5726bf8da486973328a5e8f58f15d3663 (diff) |
Splits Tile & TileInstance (Battle).
Diffstat (limited to 'src/battle/src/View')
-rw-r--r-- | src/battle/src/View/Map/Tile.elm | 30 | ||||
-rw-r--r-- | src/battle/src/View/SubMenu/Status/TileInfo.elm | 30 |
2 files changed, 35 insertions, 25 deletions
diff --git a/src/battle/src/View/Map/Tile.elm b/src/battle/src/View/Map/Tile.elm index 172ca59..abadea1 100644 --- a/src/battle/src/View/Map/Tile.elm +++ b/src/battle/src/View/Map/Tile.elm @@ -11,14 +11,14 @@ import Constants.IO import Struct.Event import Struct.Location -import Struct.Tile +import Struct.TileInstance -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- get_layer_html : ( Int -> - Struct.Tile.Border -> + Struct.TileInstance.Border -> (Html.Html Struct.Event.Type) ) get_layer_html index border = @@ -30,9 +30,9 @@ get_layer_html index border = ( "url(" ++ Constants.IO.tile_assets_url - ++ (Struct.Tile.get_border_type_id border) + ++ (Struct.TileInstance.get_border_class_id border) ++ "-f-" - ++ (Struct.Tile.get_border_variant_id border) + ++ (Struct.TileInstance.get_border_variant_id border) ++ ".svg)" ) ) @@ -43,7 +43,10 @@ get_layer_html index border = -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- -get_content_html : Struct.Tile.Instance -> (List (Html.Html Struct.Event.Type)) +get_content_html : ( + Struct.TileInstance.Type -> + (List (Html.Html Struct.Event.Type)) + ) get_content_html tile = ( (Html.div @@ -54,7 +57,7 @@ get_content_html tile = ( "url(" ++ Constants.IO.tile_assets_url - ++ (Struct.Tile.get_type_id tile) + ++ (Struct.TileInstance.get_class_id tile) ++ "-bg.svg)" ) ) @@ -71,9 +74,9 @@ get_content_html tile = ( "url(" ++ Constants.IO.tile_assets_url - ++ (Struct.Tile.get_type_id tile) + ++ (Struct.TileInstance.get_class_id tile) ++ "-v-" - ++ (Struct.Tile.get_variant_id tile) + ++ (Struct.TileInstance.get_variant_id tile) ++ ".svg)" ) ) @@ -83,14 +86,14 @@ get_content_html tile = :: (List.indexedMap (get_layer_html) - (Struct.Tile.get_borders tile) + (Struct.TileInstance.get_borders tile) ) ) ) -get_html : Struct.Tile.Instance -> (Html.Html Struct.Event.Type) +get_html : Struct.TileInstance.Type -> (Html.Html Struct.Event.Type) get_html tile = - let tile_loc = (Struct.Tile.get_location tile) in + let tile_loc = (Struct.TileInstance.get_location tile) in (Html.div [ (Html.Attributes.class "tile-icon"), @@ -98,7 +101,10 @@ get_html tile = (Html.Attributes.class ( "tile-variant-" - ++ (String.fromInt (Struct.Tile.get_local_variant_ix tile)) + ++ + (String.fromInt + (Struct.TileInstance.get_local_variant_ix tile) + ) ) ), (Html.Attributes.class "clickable"), diff --git a/src/battle/src/View/SubMenu/Status/TileInfo.elm b/src/battle/src/View/SubMenu/Status/TileInfo.elm index bc382fc..44f7293 100644 --- a/src/battle/src/View/SubMenu/Status/TileInfo.elm +++ b/src/battle/src/View/SubMenu/Status/TileInfo.elm @@ -15,6 +15,7 @@ import Struct.Location import Struct.Omnimods import Struct.Model import Struct.Tile +import Struct.TileInstance import Util.Html @@ -23,7 +24,7 @@ import View.Map.Tile -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- -get_icon : (Struct.Tile.Instance -> (Html.Html Struct.Event.Type)) +get_icon : (Struct.TileInstance.Type -> (Html.Html Struct.Event.Type)) get_icon tile = (Html.div [ @@ -32,7 +33,10 @@ get_icon tile = (Html.Attributes.class ( "tile-variant-" - ++ (String.fromInt (Struct.Tile.get_local_variant_ix tile)) + ++ + (String.fromInt + (Struct.TileInstance.get_local_variant_ix tile) + ) ) ) ] @@ -41,13 +45,13 @@ get_icon tile = get_name : ( Struct.Model.Type -> - Struct.Tile.Instance -> + Struct.TileInstance.Type -> (Html.Html Struct.Event.Type) ) -get_name model tile = - case (Dict.get (Struct.Tile.get_type_id tile) model.tiles) of +get_name model tile_inst = + case (Dict.get (Struct.TileInstance.get_class_id tile_inst) model.tiles) of Nothing -> (Util.Html.nothing) - (Just tile_type) -> + (Just tile) -> (Html.div [ (Html.Attributes.class "info-card-name"), @@ -55,14 +59,14 @@ get_name model tile = (Html.Attributes.class "tile-card-name") ] [ - (Html.text (Struct.Tile.get_name tile_type)) + (Html.text (Struct.Tile.get_name tile)) ] ) -get_cost : Struct.Tile.Instance -> (Html.Html Struct.Event.Type) -get_cost tile = +get_cost : Struct.TileInstance.Type -> (Html.Html Struct.Event.Type) +get_cost tile_inst = let - cost = (Struct.Tile.get_instance_cost tile) + cost = (Struct.TileInstance.get_cost tile_inst) text = if (cost > Constants.Movement.max_points) then @@ -80,10 +84,10 @@ get_cost tile = ] ) -get_location : Struct.Tile.Instance -> (Html.Html Struct.Event.Type) -get_location tile = +get_location : Struct.TileInstance.Type -> (Html.Html Struct.Event.Type) +get_location tile_inst = let - tile_location = (Struct.Tile.get_location tile) + tile_location = (Struct.TileInstance.get_location tile_inst) in (Html.div [ |