summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/battlemap/src/View/SideBar/TabMenu/Timeline.elm129
-rw-r--r--src/battlemap/src/View/SideBar/TabMenu/Timeline/Attack.elm62
-rw-r--r--src/battlemap/src/View/SideBar/TabMenu/Timeline/Movement.elm59
-rw-r--r--src/battlemap/src/View/SideBar/TabMenu/Timeline/WeaponSwitch.elm55
4 files changed, 186 insertions, 119 deletions
diff --git a/src/battlemap/src/View/SideBar/TabMenu/Timeline.elm b/src/battlemap/src/View/SideBar/TabMenu/Timeline.elm
index 8ca1f3d..1073735 100644
--- a/src/battlemap/src/View/SideBar/TabMenu/Timeline.elm
+++ b/src/battlemap/src/View/SideBar/TabMenu/Timeline.elm
@@ -3,8 +3,6 @@ module View.SideBar.TabMenu.Timeline exposing (get_html)
-- Elm -------------------------------------------------------------------------
import Array
-import Dict
-
import Html
import Html.Attributes
--import Html.Events
@@ -13,125 +11,15 @@ import Html.Lazy
-- Battlemap -------------------------------------------------------------------
import Struct.Event
import Struct.TurnResult
-import Struct.Character
import Struct.Model
+import View.SideBar.TabMenu.Timeline.Attack
+import View.SideBar.TabMenu.Timeline.Movement
+import View.SideBar.TabMenu.Timeline.WeaponSwitch
+
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_attack_html : (
- Struct.Model.Type ->
- Struct.TurnResult.Attack ->
- (Html.Html Struct.Event.Type)
- )
-get_attack_html model attack =
- case
- (
- (Dict.get (toString attack.attacker_index) model.characters),
- (Dict.get (toString attack.defender_index) model.characters)
- )
- of
- ((Just atkchar), (Just defchar)) ->
- (Html.div
- [
- (Html.Attributes.class "battlemap-timeline-element"),
- (Html.Attributes.class "battlemap-timeline-attack")
- ]
- [
- (Html.text
- (
- (Struct.Character.get_name atkchar)
- ++ " attacked "
- ++ (Struct.Character.get_name defchar)
- ++ "!"
- )
- )
- ]
- )
-
- _ ->
- (Html.div
- [
- (Html.Attributes.class "battlemap-timeline-element"),
- (Html.Attributes.class "battlemap-timeline-attack")
- ]
- [
- (Html.text "Error: Attack with unknown characters")
- ]
- )
-
-get_movement_html : (
- Struct.Model.Type ->
- Struct.TurnResult.Movement ->
- (Html.Html Struct.Event.Type)
- )
-get_movement_html model movement =
- case (Dict.get (toString movement.character_index) model.characters) of
- (Just char) ->
- (Html.div
- [
- (Html.Attributes.class "battlemap-timeline-element"),
- (Html.Attributes.class "battlemap-timeline-movement")
- ]
- [
- (Html.text
- (
- (Struct.Character.get_name char)
- ++ " moved to ("
- ++ (toString movement.destination.x)
- ++ ", "
- ++ (toString movement.destination.y)
- ++ ")."
- )
- )
- ]
- )
-
- _ ->
- (Html.div
- [
- (Html.Attributes.class "battlemap-timeline-element"),
- (Html.Attributes.class "battlemap-timeline-movement")
- ]
- [
- (Html.text "Error: Moving with unknown character")
- ]
- )
-
-get_weapon_switch_html : (
- Struct.Model.Type ->
- Struct.TurnResult.WeaponSwitch ->
- (Html.Html Struct.Event.Type)
- )
-get_weapon_switch_html model weapon_switch =
- case (Dict.get (toString weapon_switch.character_index) model.characters) of
- (Just char) ->
- (Html.div
- [
- (Html.Attributes.class "battlemap-timeline-element"),
- (Html.Attributes.class "battlemap-timeline-weapon-switch")
- ]
- [
- (Html.text
- (
- (Struct.Character.get_name char)
- ++ " switched weapons."
- )
- )
- ]
- )
-
- _ ->
- (Html.div
- [
- (Html.Attributes.class "battlemap-timeline-element"),
- (Html.Attributes.class "battlemap-timeline-weapon-switch")
- ]
- [
- (Html.text "Error: Unknown character switched weapons")
- ]
- )
-
get_turn_result_html : (
Struct.Model.Type ->
Struct.TurnResult.Type ->
@@ -140,13 +28,16 @@ get_turn_result_html : (
get_turn_result_html model turn_result =
case turn_result of
(Struct.TurnResult.Moved movement) ->
- (get_movement_html model movement)
+ (View.SideBar.TabMenu.Timeline.Movement.get_html model movement)
(Struct.TurnResult.Attacked attack) ->
- (get_attack_html model attack)
+ (View.SideBar.TabMenu.Timeline.Attack.get_html model attack)
(Struct.TurnResult.SwitchedWeapon weapon_switch) ->
- (get_weapon_switch_html model weapon_switch)
+ (View.SideBar.TabMenu.Timeline.WeaponSwitch.get_html
+ model
+ weapon_switch
+ )
true_get_html : (
Struct.Model.Type ->
diff --git a/src/battlemap/src/View/SideBar/TabMenu/Timeline/Attack.elm b/src/battlemap/src/View/SideBar/TabMenu/Timeline/Attack.elm
new file mode 100644
index 0000000..2fa7e0a
--- /dev/null
+++ b/src/battlemap/src/View/SideBar/TabMenu/Timeline/Attack.elm
@@ -0,0 +1,62 @@
+module View.SideBar.TabMenu.Timeline.Attack exposing (get_html)
+
+-- Elm -------------------------------------------------------------------------
+import Dict
+
+import Html
+import Html.Attributes
+--import Html.Events
+
+-- Battlemap -------------------------------------------------------------------
+import Struct.Event
+import Struct.TurnResult
+import Struct.Character
+import Struct.Model
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+get_html : (
+ Struct.Model.Type ->
+ Struct.TurnResult.Attack ->
+ (Html.Html Struct.Event.Type)
+ )
+get_html model attack =
+ case
+ (
+ (Dict.get (toString attack.attacker_index) model.characters),
+ (Dict.get (toString attack.defender_index) model.characters)
+ )
+ of
+ ((Just atkchar), (Just defchar)) ->
+ (Html.div
+ [
+ (Html.Attributes.class "battlemap-timeline-element"),
+ (Html.Attributes.class "battlemap-timeline-attack")
+ ]
+ [
+ (Html.text
+ (
+ (Struct.Character.get_name atkchar)
+ ++ " attacked "
+ ++ (Struct.Character.get_name defchar)
+ ++ "!"
+ )
+ )
+ ]
+ )
+
+ _ ->
+ (Html.div
+ [
+ (Html.Attributes.class "battlemap-timeline-element"),
+ (Html.Attributes.class "battlemap-timeline-attack")
+ ]
+ [
+ (Html.text "Error: Attack with unknown characters")
+ ]
+ )
diff --git a/src/battlemap/src/View/SideBar/TabMenu/Timeline/Movement.elm b/src/battlemap/src/View/SideBar/TabMenu/Timeline/Movement.elm
new file mode 100644
index 0000000..56560b6
--- /dev/null
+++ b/src/battlemap/src/View/SideBar/TabMenu/Timeline/Movement.elm
@@ -0,0 +1,59 @@
+module View.SideBar.TabMenu.Timeline.Movement exposing (get_html)
+
+-- Elm -------------------------------------------------------------------------
+import Dict
+
+import Html
+import Html.Attributes
+--import Html.Events
+
+-- Battlemap -------------------------------------------------------------------
+import Struct.Event
+import Struct.TurnResult
+import Struct.Character
+import Struct.Model
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+get_html : (
+ Struct.Model.Type ->
+ Struct.TurnResult.Movement ->
+ (Html.Html Struct.Event.Type)
+ )
+get_html model movement =
+ case (Dict.get (toString movement.character_index) model.characters) of
+ (Just char) ->
+ (Html.div
+ [
+ (Html.Attributes.class "battlemap-timeline-element"),
+ (Html.Attributes.class "battlemap-timeline-movement")
+ ]
+ [
+ (Html.text
+ (
+ (Struct.Character.get_name char)
+ ++ " moved to ("
+ ++ (toString movement.destination.x)
+ ++ ", "
+ ++ (toString movement.destination.y)
+ ++ ")."
+ )
+ )
+ ]
+ )
+
+ _ ->
+ (Html.div
+ [
+ (Html.Attributes.class "battlemap-timeline-element"),
+ (Html.Attributes.class "battlemap-timeline-movement")
+ ]
+ [
+ (Html.text "Error: Moving with unknown character")
+ ]
+ )
diff --git a/src/battlemap/src/View/SideBar/TabMenu/Timeline/WeaponSwitch.elm b/src/battlemap/src/View/SideBar/TabMenu/Timeline/WeaponSwitch.elm
new file mode 100644
index 0000000..ef7e757
--- /dev/null
+++ b/src/battlemap/src/View/SideBar/TabMenu/Timeline/WeaponSwitch.elm
@@ -0,0 +1,55 @@
+module View.SideBar.TabMenu.Timeline.WeaponSwitch exposing (get_html)
+
+-- Elm -------------------------------------------------------------------------
+import Dict
+
+import Html
+import Html.Attributes
+--import Html.Events
+
+-- Battlemap -------------------------------------------------------------------
+import Struct.Event
+import Struct.TurnResult
+import Struct.Character
+import Struct.Model
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+get_html : (
+ Struct.Model.Type ->
+ Struct.TurnResult.WeaponSwitch ->
+ (Html.Html Struct.Event.Type)
+ )
+get_html model weapon_switch =
+ case (Dict.get (toString weapon_switch.character_index) model.characters) of
+ (Just char) ->
+ (Html.div
+ [
+ (Html.Attributes.class "battlemap-timeline-element"),
+ (Html.Attributes.class "battlemap-timeline-weapon-switch")
+ ]
+ [
+ (Html.text
+ (
+ (Struct.Character.get_name char)
+ ++ " switched weapons."
+ )
+ )
+ ]
+ )
+
+ _ ->
+ (Html.div
+ [
+ (Html.Attributes.class "battlemap-timeline-element"),
+ (Html.Attributes.class "battlemap-timeline-weapon-switch")
+ ]
+ [
+ (Html.text "Error: Unknown character switched weapons")
+ ]
+ )