summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2018-05-23 16:03:22 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2018-05-23 16:03:22 +0200
commitf52e0f4ee19c21eb05c4f46f35178af49579f49b (patch)
tree4132d8536ef5e5fe71072136847a013b01d20b22 /src/battlemap/src/View/SubMenu/Timeline
parentd9f9a7e1e67eb53d22488dbfb9264e2e05ec1f7a (diff)
Centralizes Character HTML generation.
Diffstat (limited to 'src/battlemap/src/View/SubMenu/Timeline')
-rw-r--r--src/battlemap/src/View/SubMenu/Timeline/Attack.elm35
-rw-r--r--src/battlemap/src/View/SubMenu/Timeline/Movement.elm32
-rw-r--r--src/battlemap/src/View/SubMenu/Timeline/WeaponSwitch.elm32
3 files changed, 10 insertions, 89 deletions
diff --git a/src/battlemap/src/View/SubMenu/Timeline/Attack.elm b/src/battlemap/src/View/SubMenu/Timeline/Attack.elm
index 6dab423..3330007 100644
--- a/src/battlemap/src/View/SubMenu/Timeline/Attack.elm
+++ b/src/battlemap/src/View/SubMenu/Timeline/Attack.elm
@@ -14,6 +14,8 @@ import Struct.TurnResult
import Struct.Character
import Struct.Model
+import View.Character
+
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
@@ -39,35 +41,6 @@ get_title_html attacker defender =
]
)
-get_portrait_html : (
- String ->
- Struct.Character.Type ->
- (Html.Html Struct.Event.Type)
- )
-get_portrait_html viewer_id char =
- (Html.div
- [
- (Html.Attributes.class "battlemap-timeline-portrait"),
- (Html.Attributes.class
- (
- if ((Struct.Character.get_player_id char) == viewer_id)
- then
- "battlemap-character-ally"
- else
- "battlemap-character-enemy"
- )
- ),
- (Html.Attributes.class
- (
- "asset-character-portrait-"
- ++ (Struct.Character.get_portrait_id char)
- )
- )
- ]
- [
- ]
- )
-
get_effect_text : Struct.Attack.Type -> String
get_effect_text attack =
(
@@ -167,8 +140,8 @@ get_html model attack =
]
(
[
- (get_portrait_html model.player_id atkchar),
- (get_portrait_html model.player_id defchar),
+ (View.Character.get_portrait_html model.player_id atkchar),
+ (View.Character.get_portrait_html model.player_id defchar),
(get_title_html atkchar defchar)
]
++
diff --git a/src/battlemap/src/View/SubMenu/Timeline/Movement.elm b/src/battlemap/src/View/SubMenu/Timeline/Movement.elm
index f561d6c..bba9bc1 100644
--- a/src/battlemap/src/View/SubMenu/Timeline/Movement.elm
+++ b/src/battlemap/src/View/SubMenu/Timeline/Movement.elm
@@ -13,37 +13,11 @@ import Struct.TurnResult
import Struct.Character
import Struct.Model
+import View.Character
+
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_portrait_html : (
- String ->
- Struct.Character.Type ->
- (Html.Html Struct.Event.Type)
- )
-get_portrait_html viewer_id char =
- (Html.div
- [
- (Html.Attributes.class "battlemap-timeline-portrait"),
- (Html.Attributes.class
- (
- if ((Struct.Character.get_player_id char) == viewer_id)
- then
- "battlemap-character-ally"
- else
- "battlemap-character-enemy"
- )
- ),
- (Html.Attributes.class
- (
- "asset-character-portrait-"
- ++ (Struct.Character.get_portrait_id char)
- )
- )
- ]
- [
- ]
- )
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
@@ -62,7 +36,7 @@ get_html model movement =
(Html.Attributes.class "battlemap-timeline-movement")
]
[
- (get_portrait_html model.player_id char),
+ (View.Character.get_portrait_html model.player_id char),
(Html.text
(
(Struct.Character.get_name char)
diff --git a/src/battlemap/src/View/SubMenu/Timeline/WeaponSwitch.elm b/src/battlemap/src/View/SubMenu/Timeline/WeaponSwitch.elm
index 91191c4..53122ad 100644
--- a/src/battlemap/src/View/SubMenu/Timeline/WeaponSwitch.elm
+++ b/src/battlemap/src/View/SubMenu/Timeline/WeaponSwitch.elm
@@ -13,37 +13,11 @@ import Struct.TurnResult
import Struct.Character
import Struct.Model
+import View.Character
+
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_portrait_html : (
- String ->
- Struct.Character.Type ->
- (Html.Html Struct.Event.Type)
- )
-get_portrait_html viewer_id char =
- (Html.div
- [
- (Html.Attributes.class "battlemap-timeline-portrait"),
- (Html.Attributes.class
- (
- if ((Struct.Character.get_player_id char) == viewer_id)
- then
- "battlemap-character-ally"
- else
- "battlemap-character-enemy"
- )
- ),
- (Html.Attributes.class
- (
- "asset-character-portrait-"
- ++ (Struct.Character.get_portrait_id char)
- )
- )
- ]
- [
- ]
- )
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
@@ -62,7 +36,7 @@ get_html model weapon_switch =
(Html.Attributes.class "battlemap-timeline-weapon-switch")
]
[
- (get_portrait_html model.player_id char),
+ (View.Character.get_portrait_html model.player_id char),
(Html.text
(
(Struct.Character.get_name char)