summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/battlemap/src/View/SubMenu')
-rw-r--r-- | src/battlemap/src/View/SubMenu/Characters.elm | 22 | ||||
-rw-r--r-- | src/battlemap/src/View/SubMenu/Status.elm | 10 | ||||
-rw-r--r-- | src/battlemap/src/View/SubMenu/Status/CharacterInfo.elm | 11 | ||||
-rw-r--r-- | src/battlemap/src/View/SubMenu/Timeline.elm | 41 | ||||
-rw-r--r-- | src/battlemap/src/View/SubMenu/Timeline/Attack.elm | 15 | ||||
-rw-r--r-- | src/battlemap/src/View/SubMenu/Timeline/Movement.elm | 11 | ||||
-rw-r--r-- | src/battlemap/src/View/SubMenu/Timeline/WeaponSwitch.elm | 11 |
7 files changed, 76 insertions, 45 deletions
diff --git a/src/battlemap/src/View/SubMenu/Characters.elm b/src/battlemap/src/View/SubMenu/Characters.elm index 92cf52e..2f24b82 100644 --- a/src/battlemap/src/View/SubMenu/Characters.elm +++ b/src/battlemap/src/View/SubMenu/Characters.elm @@ -1,7 +1,7 @@ module View.SubMenu.Characters exposing (get_html) -- Elm ------------------------------------------------------------------------- -import Dict +import Array import Html import Html.Attributes @@ -18,11 +18,11 @@ import View.Controlled.CharacterCard -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- get_character_element_html : ( - Struct.Model.Type -> + String -> Struct.Character.Type -> (Html.Html Struct.Event.Type) ) -get_character_element_html model char = +get_character_element_html player_id char = (Html.div [ (Html.Attributes.class "battlemap-characters-element"), @@ -34,7 +34,7 @@ get_character_element_html model char = (Html.Attributes.class "") ), (Html.Events.onClick - (Struct.Event.LookingForCharacter (Struct.Character.get_ref char)) + (Struct.Event.LookingForCharacter (Struct.Character.get_index char)) ), ( if (Struct.Character.is_enabled char) @@ -45,22 +45,26 @@ get_character_element_html model char = ) ] [ - (View.Controlled.CharacterCard.get_minimal_html model char) + (View.Controlled.CharacterCard.get_minimal_html player_id char) ] ) -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- -get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type) -get_html model = +get_html : ( + (Array.Array Struct.Character.Type) -> + String -> + (Html.Html Struct.Event.Type) + ) +get_html characters player_id = (Html.div [ (Html.Attributes.class "battlemap-tabmenu-content"), (Html.Attributes.class "battlemap-tabmenu-characters-tab") ] (List.map - (get_character_element_html model) - (Dict.values model.characters) + (get_character_element_html player_id) + (Array.toList characters) ) ) diff --git a/src/battlemap/src/View/SubMenu/Status.elm b/src/battlemap/src/View/SubMenu/Status.elm index 70a7e3c..c64bc2d 100644 --- a/src/battlemap/src/View/SubMenu/Status.elm +++ b/src/battlemap/src/View/SubMenu/Status.elm @@ -1,10 +1,11 @@ module View.SubMenu.Status exposing (get_html) -- Elm ------------------------------------------------------------------------- -import Dict +import Array import Html import Html.Attributes +import Html.Lazy -- Struct.Battlemap ------------------------------------------------------------------- import Struct.Event @@ -37,10 +38,11 @@ get_html model = ) (Just (Struct.UI.SelectedCharacter target_char)) -> - case (Dict.get target_char model.characters) of + case (Array.get target_char model.characters) of (Just char) -> - (View.SubMenu.Status.CharacterInfo.get_html - model + (Html.Lazy.lazy2 + (View.SubMenu.Status.CharacterInfo.get_html) + model.player_id char ) diff --git a/src/battlemap/src/View/SubMenu/Status/CharacterInfo.elm b/src/battlemap/src/View/SubMenu/Status/CharacterInfo.elm index 1713fdd..de27c79 100644 --- a/src/battlemap/src/View/SubMenu/Status/CharacterInfo.elm +++ b/src/battlemap/src/View/SubMenu/Status/CharacterInfo.elm @@ -1,13 +1,14 @@ module View.SubMenu.Status.CharacterInfo exposing (get_html) -- Elm ------------------------------------------------------------------------- +import Debug + import Html import Html.Attributes -- Struct.Battlemap ------------------------------------------------------------------- import Struct.Character import Struct.Event -import Struct.Model import View.Controlled.CharacterCard @@ -19,17 +20,17 @@ import View.Controlled.CharacterCard -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- get_html: ( - Struct.Model.Type -> + String -> Struct.Character.Type -> (Html.Html Struct.Event.Type) ) -get_html model char = +get_html player_id char = (Html.div [ - (Html.Attributes.class "battlemap-tabmenu-character-info") + (Debug.log "Drawing char info" (Html.Attributes.class "battlemap-tabmenu-character-info")) ] [ (Html.text ("Focusing:")), - (View.Controlled.CharacterCard.get_full_html model char) + (View.Controlled.CharacterCard.get_full_html player_id char) ] ) diff --git a/src/battlemap/src/View/SubMenu/Timeline.elm b/src/battlemap/src/View/SubMenu/Timeline.elm index eb67085..70b22bc 100644 --- a/src/battlemap/src/View/SubMenu/Timeline.elm +++ b/src/battlemap/src/View/SubMenu/Timeline.elm @@ -1,6 +1,7 @@ module View.SubMenu.Timeline exposing (get_html) -- Elm ------------------------------------------------------------------------- +import Debug import Array import Html @@ -9,6 +10,7 @@ import Html.Attributes import Html.Lazy -- Battlemap ------------------------------------------------------------------- +import Struct.Character import Struct.Event import Struct.TurnResult import Struct.Model @@ -21,38 +23,52 @@ import View.SubMenu.Timeline.WeaponSwitch -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- get_turn_result_html : ( - Struct.Model.Type -> + (Array.Array Struct.Character.Type) -> + String -> Struct.TurnResult.Type -> (Html.Html Struct.Event.Type) ) -get_turn_result_html model turn_result = +get_turn_result_html characters player_id turn_result = case turn_result of (Struct.TurnResult.Moved movement) -> - (View.SubMenu.Timeline.Movement.get_html model movement) + (View.SubMenu.Timeline.Movement.get_html + characters + player_id + movement + ) (Struct.TurnResult.Attacked attack) -> - (View.SubMenu.Timeline.Attack.get_html model attack) + (View.SubMenu.Timeline.Attack.get_html + characters + player_id + attack + ) (Struct.TurnResult.SwitchedWeapon weapon_switch) -> (View.SubMenu.Timeline.WeaponSwitch.get_html - model + characters + player_id weapon_switch ) true_get_html : ( - Struct.Model.Type -> + (Array.Array Struct.Character.Type) -> + String -> (Array.Array Struct.TurnResult.Type) -> (Html.Html Struct.Event.Type) ) -true_get_html model turn_results = +true_get_html characters player_id turn_results = (Html.div [ - (Html.Attributes.class "battlemap-tabmenu-content"), + (Debug.log + "Drawing timeline" + (Html.Attributes.class "battlemap-tabmenu-content") + ), (Html.Attributes.class "battlemap-tabmenu-timeline-tab") ] (Array.toList (Array.map - (get_turn_result_html model) + (get_turn_result_html characters player_id) turn_results ) ) @@ -63,4 +79,9 @@ true_get_html model turn_results = -------------------------------------------------------------------------------- get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type) get_html model = - (Html.Lazy.lazy (true_get_html model) model.timeline) + (Html.Lazy.lazy3 + (true_get_html) + model.characters + model.player_id + model.timeline + ) diff --git a/src/battlemap/src/View/SubMenu/Timeline/Attack.elm b/src/battlemap/src/View/SubMenu/Timeline/Attack.elm index 3330007..974867e 100644 --- a/src/battlemap/src/View/SubMenu/Timeline/Attack.elm +++ b/src/battlemap/src/View/SubMenu/Timeline/Attack.elm @@ -1,7 +1,7 @@ module View.SubMenu.Timeline.Attack exposing (get_html) -- Elm ------------------------------------------------------------------------- -import Dict +import Array import Html import Html.Attributes @@ -121,15 +121,16 @@ get_attack_html attacker defender attack = -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- get_html : ( - Struct.Model.Type -> + (Array.Array Struct.Character.Type) -> + String -> Struct.TurnResult.Attack -> (Html.Html Struct.Event.Type) ) -get_html model attack = +get_html characters player_id attack = case ( - (Dict.get (toString attack.attacker_index) model.characters), - (Dict.get (toString attack.defender_index) model.characters) + (Array.get attack.attacker_index characters), + (Array.get attack.defender_index characters) ) of ((Just atkchar), (Just defchar)) -> @@ -140,8 +141,8 @@ get_html model attack = ] ( [ - (View.Character.get_portrait_html model.player_id atkchar), - (View.Character.get_portrait_html model.player_id defchar), + (View.Character.get_portrait_html player_id atkchar), + (View.Character.get_portrait_html 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 bba9bc1..afc4055 100644 --- a/src/battlemap/src/View/SubMenu/Timeline/Movement.elm +++ b/src/battlemap/src/View/SubMenu/Timeline/Movement.elm @@ -1,7 +1,7 @@ module View.SubMenu.Timeline.Movement exposing (get_html) -- Elm ------------------------------------------------------------------------- -import Dict +import Array import Html import Html.Attributes @@ -23,12 +23,13 @@ import View.Character -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- get_html : ( - Struct.Model.Type -> + (Array.Array Struct.Character.Type) -> + String -> Struct.TurnResult.Movement -> (Html.Html Struct.Event.Type) ) -get_html model movement = - case (Dict.get (toString movement.character_index) model.characters) of +get_html characters player_id movement = + case (Array.get movement.character_index characters) of (Just char) -> (Html.div [ @@ -36,7 +37,7 @@ get_html model movement = (Html.Attributes.class "battlemap-timeline-movement") ] [ - (View.Character.get_portrait_html model.player_id char), + (View.Character.get_portrait_html 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 53122ad..21d07e6 100644 --- a/src/battlemap/src/View/SubMenu/Timeline/WeaponSwitch.elm +++ b/src/battlemap/src/View/SubMenu/Timeline/WeaponSwitch.elm @@ -1,7 +1,7 @@ module View.SubMenu.Timeline.WeaponSwitch exposing (get_html) -- Elm ------------------------------------------------------------------------- -import Dict +import Array import Html import Html.Attributes @@ -23,12 +23,13 @@ import View.Character -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- get_html : ( - Struct.Model.Type -> + (Array.Array Struct.Character.Type) -> + String -> Struct.TurnResult.WeaponSwitch -> (Html.Html Struct.Event.Type) ) -get_html model weapon_switch = - case (Dict.get (toString weapon_switch.character_index) model.characters) of +get_html characters player_id weapon_switch = + case (Array.get weapon_switch.character_index characters) of (Just char) -> (Html.div [ @@ -36,7 +37,7 @@ get_html model weapon_switch = (Html.Attributes.class "battlemap-timeline-weapon-switch") ] [ - (View.Character.get_portrait_html model.player_id char), + (View.Character.get_portrait_html player_id char), (Html.text ( (Struct.Character.get_name char) |