aboutsummaryrefslogtreecommitdiff
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
parentc1066323a777d14de4070b0bb8de2c248711285f (diff)
downloadtacticians-client-376929d6cd7c237faae1c9746733366e8d6f455a.zip
tacticians-client-376929d6cd7c237faae1c9746733366e8d6f455a.tar.bz2
Remaining: time/delay, list encoding, http
-rw-r--r--src/battle/src/Comm/AddChar.elm2
-rw-r--r--src/battle/src/Comm/SetMap.elm4
-rw-r--r--src/battle/src/Update/HandleServerReply.elm18
-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
9 files changed, 164 insertions, 214 deletions
diff --git a/src/battle/src/Comm/AddChar.elm b/src/battle/src/Comm/AddChar.elm
index 9c7662e..9b36f69 100644
--- a/src/battle/src/Comm/AddChar.elm
+++ b/src/battle/src/Comm/AddChar.elm
@@ -18,7 +18,7 @@ import Struct.ServerReply
--------------------------------------------------------------------------------
internal_decoder : (
- Struct.Character.TypeAndEquipementRef ->
+ Struct.Character.TypeAndEquipmentRef ->
Struct.ServerReply.Type
)
internal_decoder char_and_refs = (Struct.ServerReply.AddCharacter char_and_refs)
diff --git a/src/battle/src/Comm/SetMap.elm b/src/battle/src/Comm/SetMap.elm
index 81a4a73..44a6136 100644
--- a/src/battle/src/Comm/SetMap.elm
+++ b/src/battle/src/Comm/SetMap.elm
@@ -45,7 +45,7 @@ deserialize_tile_instance map_width index t =
(a :: (b :: c)) ->
(Struct.Tile.new_instance
{
- x = (index % map_width),
+ x = (modBy map_width index),
y = (index // map_width)
}
a
@@ -57,7 +57,7 @@ deserialize_tile_instance map_width index t =
_ ->
(Struct.Tile.new_instance
{
- x = (index % map_width),
+ x = (modBy map_width index),
y = (index // map_width)
}
"0"
diff --git a/src/battle/src/Update/HandleServerReply.elm b/src/battle/src/Update/HandleServerReply.elm
index b64b285..d3c44f8 100644
--- a/src/battle/src/Update/HandleServerReply.elm
+++ b/src/battle/src/Update/HandleServerReply.elm
@@ -16,7 +16,7 @@ import Action.Ports
import Struct.Flags
-import Util.Html
+import Util.Http
-- Battle ----------------------------------------------------------------------
import Constants.IO
@@ -108,22 +108,16 @@ add_weapon wp current_state =
((Struct.Model.add_weapon wp model), cmds)
add_character : (
- (
- Struct.Character.Type,
- Struct.Weapon.Ref,
- Struct.Weapon.Ref,
- Struct.Armor.Ref
- ) ->
+ Struct.Character.TypeAndEquipmentRef ->
(Struct.Model.Type, (List (Cmd Struct.Event.Type))) ->
(Struct.Model.Type, (List (Cmd Struct.Event.Type)))
)
add_character char_and_refs current_state =
let
(model, cmds) = current_state
- (char, awp_ref, swp_ref, ar_ref) = char_and_refs
- awp = (weapon_getter model awp_ref)
- swp = (weapon_getter model swp_ref)
- ar = (armor_getter model ar_ref)
+ awp = (weapon_getter model char_and_refs.main_weapon_ref)
+ swp = (weapon_getter model char_and_refs.secondary_weapon_ref)
+ ar = (armor_getter model char_and_refs.armor_ref)
in
(
(Struct.Model.add_character
@@ -132,7 +126,7 @@ add_character char_and_refs current_state =
awp
swp
ar
- char
+ char_and_refs.char
)
model
),
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)