summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/map-editor')
-rw-r--r-- | src/map-editor/elm.json | 6 | ||||
-rw-r--r-- | src/map-editor/src/Struct/TileInstance.elm | 6 | ||||
-rw-r--r-- | src/map-editor/src/View/Map/Tile.elm | 119 | ||||
-rw-r--r-- | src/map-editor/src/View/SubMenu.elm | 8 |
4 files changed, 26 insertions, 113 deletions
diff --git a/src/map-editor/elm.json b/src/map-editor/elm.json index cd41660..55f961b 100644 --- a/src/map-editor/elm.json +++ b/src/map-editor/elm.json @@ -2,7 +2,9 @@ "type": "application", "source-directories": [ "src", - "../shared/elm" + "../shared/elm", + "../shared/battle", + "../shared/battle-map" ], "elm-version": "0.19.0", "dependencies": { @@ -26,4 +28,4 @@ "direct": {}, "indirect": {} } -}
\ No newline at end of file +} diff --git a/src/map-editor/src/Struct/TileInstance.elm b/src/map-editor/src/Struct/TileInstance.elm index 862598b..635dbac 100644 --- a/src/map-editor/src/Struct/TileInstance.elm +++ b/src/map-editor/src/Struct/TileInstance.elm @@ -30,12 +30,14 @@ import Json.Encode import Json.Decode import Json.Decode.Pipeline +-- Battle Map ------------------------------------------------------------------ +import Struct.Tile +import Struct.Location + -- Map Editor ------------------------------------------------------------------ import Constants.UI import Constants.Movement -import Struct.Tile -import Struct.Location -------------------------------------------------------------------------------- -- TYPES ----------------------------------------------------------------------- diff --git a/src/map-editor/src/View/Map/Tile.elm b/src/map-editor/src/View/Map/Tile.elm index 96fdee6..8fe96cf 100644 --- a/src/map-editor/src/View/Map/Tile.elm +++ b/src/map-editor/src/View/Map/Tile.elm @@ -1,112 +1,44 @@ -module View.Map.Tile exposing (get_html, get_content_html) +module View.Map.SelectableTile exposing (get_html) -- Elm ------------------------------------------------------------------------- import Html import Html.Attributes import Html.Events +-- Battle Map ------------------------------------------------------------------ +import Struct.TileInstance +import Struct.Location + +import View.Map.Tile + -- Map Editor ------------------------------------------------------------------ import Constants.UI import Constants.IO import Struct.Event -import Struct.Location -import Struct.TileInstance import Struct.Toolbox -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- -get_layer_html : ( - Int -> - Struct.TileInstance.Border -> - (Html.Html Struct.Event.Type) - ) -get_layer_html index border = - (Html.div - [ - (Html.Attributes.class - ("tile-icon-f-" ++ (String.fromInt index)) - ), - (Html.Attributes.style - "background-image" - ( - "url(" - ++ Constants.IO.tile_assets_url - ++ (Struct.TileInstance.get_border_class_id border) - ++ "-f-" - ++ (Struct.TileInstance.get_border_variant_id border) - ++ ".svg)" - ) - ) - ] - [] - ) -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- -get_content_html : ( - Struct.TileInstance.Type -> - (List (Html.Html Struct.Event.Type)) - ) -get_content_html tile = - ( - (Html.div - [ - (Html.Attributes.class "tile-icon-bg"), - (Html.Attributes.style - "background-image" - ( - "url(" - ++ Constants.IO.tile_assets_url - ++ (Struct.TileInstance.get_class_id tile) - ++ "-bg.svg)" - ) - ) - ] - [] - ) - :: - ( - (Html.div - [ - (Html.Attributes.class "tile-icon-dt"), - (Html.Attributes.style - "background-image" - ( - "url(" - ++ Constants.IO.tile_assets_url - ++ (Struct.TileInstance.get_class_id tile) - ++ "-v-" - ++ (Struct.TileInstance.get_variant_id tile) - ++ ".svg)" - ) - ) - ] - [] - ) - :: - (List.indexedMap - (get_layer_html) - (Struct.TileInstance.get_borders tile) - ) - ) - ) get_html : ( + Bool -> Struct.Toolbox.Type -> Struct.TileInstance.Type -> (Html.Html Struct.Event.Type) ) -get_html tb tile = +get_html display_cost tb tile = let tile_loc = (Struct.TileInstance.get_location tile) in - (Html.div + (View.Map.Tile.get_html_with_extra + display_cost [ - (Html.Attributes.class "tile-icon"), - (Html.Attributes.class "tiled"), ( if (Struct.Toolbox.is_selected tile_loc tb) then (Html.Attributes.class "tile-selected") @@ -116,34 +48,7 @@ get_html tb tile = if (Struct.Toolbox.is_square_corner tile_loc tb) then (Html.Attributes.class "tile-square-corner") else (Html.Attributes.class "") - ), - (Html.Attributes.class - ( - "tile-variant-" - ++ - (String.fromInt - (Struct.TileInstance.get_local_variant_ix tile) - ) - ) - ), - (Html.Attributes.class "clickable"), - (Html.Events.onClick - (Struct.Event.TileSelected (Struct.Location.get_ref tile_loc)) - ), - (Html.Attributes.style - "top" - ( - (String.fromInt (tile_loc.y * Constants.UI.tile_size)) - ++ "px" - ) - ), - (Html.Attributes.style - "left" - ( - (String.fromInt (tile_loc.x * Constants.UI.tile_size)) - ++ "px" - ) ) ] - (get_content_html tile) + tile ) diff --git a/src/map-editor/src/View/SubMenu.elm b/src/map-editor/src/View/SubMenu.elm index 70e66cf..6e62ac5 100644 --- a/src/map-editor/src/View/SubMenu.elm +++ b/src/map-editor/src/View/SubMenu.elm @@ -4,16 +4,17 @@ module View.SubMenu exposing (get_html) import Html import Html.Attributes --- Battlemap ------------------------------------------------------------------- +-- Map Editor ------------------------------------------------------------------ import Struct.Event import Struct.Model import Struct.UI import Util.Html -import View.SubMenu.Tiles +import View.SubMenu.Markers import View.SubMenu.Settings import View.SubMenu.TileStatus +import View.SubMenu.Tiles -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- @@ -28,6 +29,9 @@ get_inner_html model tab = Struct.UI.StatusTab -> (View.SubMenu.TileStatus.get_html model) + Struct.UI.MarkersTab -> + (View.SubMenu.Markers.get_html model) + Struct.UI.TilesTab -> (View.SubMenu.Tiles.get_html model) |