summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2019-01-17 16:11:59 +0100
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2019-01-17 16:11:59 +0100
commit376929d6cd7c237faae1c9746733366e8d6f455a (patch)
tree7cd5efe0322b91b3d8ef2989d69b5ed6be648e2d /src/battle/src/View
parentc1066323a777d14de4070b0bb8de2c248711285f (diff)
Remaining: time/delay, list encoding, http
Diffstat (limited to 'src/battle/src/View')
-rw-r--r--src/battle/src/View/Character.elm52
-rw-r--r--src/battle/src/View/Gauge.elm5
-rw-r--r--src/battle/src/View/Map.elm70
-rw-r--r--src/battle/src/View/Map/Character.elm55
-rw-r--r--src/battle/src/View/Map/Navigator.elm82
-rw-r--r--src/battle/src/View/Map/Tile.elm90
6 files changed, 155 insertions, 199 deletions
diff --git a/src/battle/src/View/Character.elm b/src/battle/src/View/Character.elm
index a22ca8a..9916723 100644
--- a/src/battle/src/View/Character.elm
+++ b/src/battle/src/View/Character.elm
@@ -49,22 +49,20 @@ get_alliance_class model char =
get_position_style : (
Struct.Character.Type ->
- (Html.Attribute Struct.Event.Type)
+ (List (Html.Attribute Struct.Event.Type))
)
get_position_style char =
let char_loc = (Struct.Character.get_location char) in
- (Html.Attributes.style
- [
- (
- "top",
- ((String.fromInt (char_loc.y * Constants.UI.tile_size)) ++ "px")
- ),
- (
- "left",
- ((String.fromInt (char_loc.x * Constants.UI.tile_size)) ++ "px")
- )
- ]
- )
+ [
+ (Html.Attributes.style
+ "top"
+ ((String.fromInt (char_loc.y * Constants.UI.tile_size)) ++ "px")
+ ),
+ (Html.Attributes.style
+ "left"
+ ((String.fromInt (char_loc.x * Constants.UI.tile_size)) ++ "px")
+ )
+ ]
get_focus_class : (
Struct.Model.Type ->
@@ -128,18 +126,22 @@ get_icon_actual_html : (
)
get_icon_actual_html model char =
(Html.div
- [
- (Html.Attributes.class "tiled"),
- (Html.Attributes.class "character-icon"),
- (get_activation_level_class char),
- (get_alliance_class model char),
- (get_position_style char),
- (get_focus_class model char),
- (Html.Attributes.class "clickable"),
- (Html.Events.onClick
- (Struct.Event.CharacterSelected (Struct.Character.get_index char))
- )
- ]
+ (
+ [
+ (Html.Attributes.class "tiled"),
+ (Html.Attributes.class "character-icon"),
+ (get_activation_level_class char),
+ (get_alliance_class model char),
+ (get_focus_class model char),
+ (Html.Attributes.class "clickable"),
+ (Html.Events.onClick
+ (Struct.Event.CharacterSelected
+ (Struct.Character.get_index char)
+ )
+ )
+ ]
+ ++ (get_position_style char)
+ )
[
(get_icon_body_html char),
(get_icon_head_html char)
diff --git a/src/battle/src/View/Gauge.elm b/src/battle/src/View/Gauge.elm
index a6bf09f..d7ea8b1 100644
--- a/src/battle/src/View/Gauge.elm
+++ b/src/battle/src/View/Gauge.elm
@@ -36,9 +36,8 @@ get_bar_div percent extra_bar_attr =
(
[
(Html.Attributes.style
- [
- ("width", ((String.fromFloat percent) ++ "%"))
- ]
+ "width"
+ ((String.fromFloat percent) ++ "%")
),
(Html.Attributes.class
"gauge-bar"
diff --git a/src/battle/src/View/Map.elm b/src/battle/src/View/Map.elm
index 0e9a7fa..6ae3e01 100644
--- a/src/battle/src/View/Map.elm
+++ b/src/battle/src/View/Map.elm
@@ -34,32 +34,28 @@ get_tiles_html map =
[
(Html.Attributes.class "tiles-layer"),
(Html.Attributes.style
- [
- (
- "width",
+ "width"
+ (
+ (String.fromInt
(
- (String.fromInt
- (
- (Struct.Map.get_width map)
- * Constants.UI.tile_size
- )
- )
- ++ "px"
+ (Struct.Map.get_width map)
+ * Constants.UI.tile_size
)
- ),
- (
- "height",
+ )
+ ++ "px"
+ )
+ ),
+ (Html.Attributes.style
+ "height"
+ (
+ (String.fromInt
(
- (String.fromInt
- (
- (Struct.Map.get_height map)
- * Constants.UI.tile_size
- )
- )
- ++ "px"
+ (Struct.Map.get_height map)
+ * Constants.UI.tile_size
)
)
- ]
+ ++ "px"
+ )
)
]
(List.map
@@ -124,25 +120,21 @@ get_html model =
(Html.div
[
(Html.Attributes.class "actual"),
- (Html.Attributes.style
- (
- if ((Struct.UI.get_zoom_level model.ui) == 1)
- then []
- else
- [
- (
- "transform",
- (
- "scale("
- ++
- (String.fromFloat
- (Struct.UI.get_zoom_level model.ui)
- )
- ++ ")"
- )
+ (
+ if ((Struct.UI.get_zoom_level model.ui) == 1)
+ then (Html.Attributes.style "" "")
+ else
+ (Html.Attributes.style
+ "transform"
+ (
+ "scale("
+ ++
+ (String.fromFloat
+ (Struct.UI.get_zoom_level model.ui)
)
- ]
- )
+ ++ ")"
+ )
+ )
)
]
[
diff --git a/src/battle/src/View/Map/Character.elm b/src/battle/src/View/Map/Character.elm
index 6ced9f0..d7934d3 100644
--- a/src/battle/src/View/Map/Character.elm
+++ b/src/battle/src/View/Map/Character.elm
@@ -82,22 +82,20 @@ get_alliance_class model char =
get_position_style : (
Struct.Character.Type ->
- (Html.Attribute Struct.Event.Type)
+ (List (Html.Attribute Struct.Event.Type))
)
get_position_style char =
let char_loc = (Struct.Character.get_location char) in
- (Html.Attributes.style
- [
- (
- "top",
- ((String.fromInt (char_loc.y * Constants.UI.tile_size)) ++ "px")
- ),
- (
- "left",
- ((String.fromInt (char_loc.x * Constants.UI.tile_size)) ++ "px")
- )
- ]
- )
+ [
+ (Html.Attributes.style
+ "top"
+ ((String.fromInt (char_loc.y * Constants.UI.tile_size)) ++ "px")
+ ),
+ (Html.Attributes.style
+ "left"
+ ((String.fromInt (char_loc.x * Constants.UI.tile_size)) ++ "px")
+ )
+ ]
get_focus_class : (
Struct.Model.Type ->
@@ -186,21 +184,24 @@ get_actual_html : (
)
get_actual_html model char =
(Html.div
- [
- (Html.Attributes.class "tiled"),
- (Html.Attributes.class "character-icon"),
- (get_animation_class model char),
- (get_activation_level_class char),
- (get_alliance_class model char),
- (get_position_style char),
- (get_focus_class model char),
- (Html.Attributes.class "clickable"),
- (Html.Events.onClick
- (Struct.Event.CharacterSelected
- (Struct.Character.get_index char)
+ (
+ [
+ (Html.Attributes.class "tiled"),
+ (Html.Attributes.class "character-icon"),
+ (get_animation_class model char),
+ (get_activation_level_class char),
+ (get_alliance_class model char),
+ (get_focus_class model char),
+ (Html.Attributes.class "clickable"),
+ (Html.Events.onClick
+ (Struct.Event.CharacterSelected
+ (Struct.Character.get_index char)
+ )
)
- )
- ]
+ ]
+ ++
+ (get_position_style char)
+ )
[
(get_body_html char),
(get_head_html char),
diff --git a/src/battle/src/View/Map/Navigator.elm b/src/battle/src/View/Map/Navigator.elm
index 79dd3b0..0cfce61 100644
--- a/src/battle/src/View/Map/Navigator.elm
+++ b/src/battle/src/View/Map/Navigator.elm
@@ -25,6 +25,7 @@ marker_get_html : (
(Html.Html Struct.Event.Type)
)
marker_get_html is_interactive (loc_ref, marker) =
+ let loc = (Struct.Location.from_ref loc_ref) in
(Html.div
(
[
@@ -49,27 +50,12 @@ marker_get_html is_interactive (loc_ref, marker) =
)
),
(Html.Attributes.style
- (
- let
- loc = (Struct.Location.from_ref loc_ref)
- in
- [
- (
- "top",
- (
- (String.fromInt (loc.y * Constants.UI.tile_size))
- ++ "px"
- )
- ),
- (
- "left",
- (
- (String.fromInt (loc.x * Constants.UI.tile_size))
- ++ "px"
- )
- )
- ]
- )
+ "top"
+ ((String.fromInt (loc.y * Constants.UI.tile_size)) ++ "px")
+ ),
+ (Html.Attributes.style
+ "left"
+ ((String.fromInt (loc.x * Constants.UI.tile_size)) ++ "px")
)
]
++
@@ -153,28 +139,24 @@ path_node_get_html is_below_markers next_dir (curr_loc, curr_dir, curr_nodes) =
)
),
(Html.Attributes.style
- [
- (
- "top",
- (
- (String.fromInt
- (curr_loc.y * Constants.UI.tile_size)
- )
- ++
- "px"
- )
- ),
- (
- "left",
- (
- (String.fromInt
- (curr_loc.x * Constants.UI.tile_size)
- )
- ++
- "px"
- )
+ "top"
+ (
+ (String.fromInt
+ (curr_loc.y * Constants.UI.tile_size)
)
- ]
+ ++
+ "px"
+ )
+ ),
+ (Html.Attributes.style
+ "left"
+ (
+ (String.fromInt
+ (curr_loc.x * Constants.UI.tile_size)
+ )
+ ++
+ "px"
+ )
)
]
[
@@ -207,16 +189,12 @@ mark_the_spot loc origin_dir =
(Struct.Event.CharacterOrTileSelected (Struct.Location.get_ref loc))
),
(Html.Attributes.style
- [
- (
- "top",
- ((String.fromInt (loc.y * Constants.UI.tile_size)) ++ "px")
- ),
- (
- "left",
- ((String.fromInt (loc.x * Constants.UI.tile_size)) ++ "px")
- )
- ]
+ "top"
+ ((String.fromInt (loc.y * Constants.UI.tile_size)) ++ "px")
+ ),
+ (Html.Attributes.style
+ "left"
+ ((String.fromInt (loc.x * Constants.UI.tile_size)) ++ "px")
)
]
[
diff --git a/src/battle/src/View/Map/Tile.elm b/src/battle/src/View/Map/Tile.elm
index f2f3003..172ca59 100644
--- a/src/battle/src/View/Map/Tile.elm
+++ b/src/battle/src/View/Map/Tile.elm
@@ -26,19 +26,15 @@ get_layer_html index border =
[
(Html.Attributes.class ("tile-icon-f-" ++ (String.fromInt index))),
(Html.Attributes.style
- [
- (
- "background-image",
- (
- "url("
- ++ Constants.IO.tile_assets_url
- ++ (Struct.Tile.get_border_type_id border)
- ++ "-f-"
- ++ (Struct.Tile.get_border_variant_id border)
- ++ ".svg)"
- )
- )
- ]
+ "background-image"
+ (
+ "url("
+ ++ Constants.IO.tile_assets_url
+ ++ (Struct.Tile.get_border_type_id border)
+ ++ "-f-"
+ ++ (Struct.Tile.get_border_variant_id border)
+ ++ ".svg)"
+ )
)
]
[]
@@ -54,17 +50,13 @@ get_content_html tile =
[
(Html.Attributes.class "tile-icon-bg"),
(Html.Attributes.style
- [
- (
- "background-image",
- (
- "url("
- ++ Constants.IO.tile_assets_url
- ++ (Struct.Tile.get_type_id tile)
- ++ "-bg.svg)"
- )
- )
- ]
+ "background-image"
+ (
+ "url("
+ ++ Constants.IO.tile_assets_url
+ ++ (Struct.Tile.get_type_id tile)
+ ++ "-bg.svg)"
+ )
)
]
[]
@@ -75,19 +67,15 @@ get_content_html tile =
[
(Html.Attributes.class "tile-icon-dt"),
(Html.Attributes.style
- [
- (
- "background-image",
- (
- "url("
- ++ Constants.IO.tile_assets_url
- ++ (Struct.Tile.get_type_id tile)
- ++ "-v-"
- ++ (Struct.Tile.get_variant_id tile)
- ++ ".svg)"
- )
- )
- ]
+ "background-image"
+ (
+ "url("
+ ++ Constants.IO.tile_assets_url
+ ++ (Struct.Tile.get_type_id tile)
+ ++ "-v-"
+ ++ (Struct.Tile.get_variant_id tile)
+ ++ ".svg)"
+ )
)
]
[]
@@ -118,22 +106,18 @@ get_html tile =
(Struct.Event.TileSelected (Struct.Location.get_ref tile_loc))
),
(Html.Attributes.style
- [
- (
- "top",
- (
- (String.fromInt (tile_loc.y * Constants.UI.tile_size))
- ++ "px"
- )
- ),
- (
- "left",
- (
- (String.fromInt (tile_loc.x * Constants.UI.tile_size))
- ++ "px"
- )
- )
- ]
+ "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)