summaryrefslogtreecommitdiff |
diff options
author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2018-05-30 21:17:58 +0200 |
---|---|---|
committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2018-05-30 21:17:58 +0200 |
commit | 15c75eedb3cd68ab5020f6f0745a7bee24fe1565 (patch) | |
tree | 0c718a0a4f66c7b415191d563408077391cb6e2a | |
parent | 994519db688853605d00f75ddcf70f883ef1025a (diff) |
Mov pts + smooth :hovers + go button.
-rw-r--r-- | src/battlemap/src/View/Controlled.elm | 13 | ||||
-rw-r--r-- | src/battlemap/src/View/Controlled/CharacterCard.elm | 71 | ||||
-rw-r--r-- | src/battlemap/src/View/Controlled/ManualControls.elm | 15 | ||||
-rw-r--r-- | src/battlemap/www/style.css | 25 | ||||
-rw-r--r-- | src/global/www/style.css | 2 |
5 files changed, 115 insertions, 11 deletions
diff --git a/src/battlemap/src/View/Controlled.elm b/src/battlemap/src/View/Controlled.elm index a0046e6..8449741 100644 --- a/src/battlemap/src/View/Controlled.elm +++ b/src/battlemap/src/View/Controlled.elm @@ -113,7 +113,18 @@ get_html model = (Struct.Character.get_weapons char) ) ), - (View.Controlled.ManualControls.get_html), + ( + if + ( + (Struct.CharacterTurn.get_state model.char_turn) + == + Struct.CharacterTurn.SelectedCharacter + ) + then + (View.Controlled.ManualControls.get_html) + else + (Util.Html.nothing) + ), (Html.div [(Html.Attributes.class "battlemap-controlled-actions")] (get_available_actions model) diff --git a/src/battlemap/src/View/Controlled/CharacterCard.elm b/src/battlemap/src/View/Controlled/CharacterCard.elm index a48a311..9f00aa3 100644 --- a/src/battlemap/src/View/Controlled/CharacterCard.elm +++ b/src/battlemap/src/View/Controlled/CharacterCard.elm @@ -6,8 +6,10 @@ import Html.Attributes -- Battlemap ------------------------------------------------------------------- import Struct.Character +import Struct.CharacterTurn import Struct.Event import Struct.Model +import Struct.Navigator import Struct.Statistics import Struct.Weapon @@ -51,17 +53,24 @@ get_health_bar char = [] ) -get_movement_bar : ( +get_active_movement_bar : ( + (Maybe Struct.Navigator.Type) -> Struct.Character.Type -> (Html.Html Struct.Event.Type) ) -get_movement_bar char = +get_active_movement_bar maybe_navigator char = let - current = (Struct.Character.get_current_health char) max = - (Struct.Statistics.get_max_health + (Struct.Statistics.get_movement_points (Struct.Character.get_statistics char) ) + current = + case maybe_navigator of + (Just navigator) -> + (Struct.Navigator.get_remaining_points navigator) + + Nothing -> + max in (View.Gauge.get_html ("MP: " ++ (toString current) ++ "/" ++ (toString max)) @@ -71,6 +80,58 @@ get_movement_bar char = [] ) +get_inactive_movement_bar : ( + Struct.Character.Type -> + (Html.Html Struct.Event.Type) + ) +get_inactive_movement_bar char = + let + max = + (Struct.Statistics.get_movement_points + (Struct.Character.get_statistics char) + ) + in + (View.Gauge.get_html + ( + "MP: " + ++ + (toString + (Struct.Statistics.get_movement_points + (Struct.Character.get_statistics char) + ) + ) + ) + 100.0 + [(Html.Attributes.class "battlemap-character-card-movement")] + [] + [] + ) + +get_movement_bar : ( + Struct.Model.Type -> + Struct.Character.Type -> + (Html.Html Struct.Event.Type) + ) +get_movement_bar model char = + case (Struct.CharacterTurn.try_getting_active_character model.char_turn) of + (Just active_char) -> + if + ( + (Struct.Character.get_ref active_char) + == + (Struct.Character.get_ref char) + ) + then + (get_active_movement_bar + (Struct.CharacterTurn.try_getting_navigator model.char_turn) + active_char + ) + else + (get_inactive_movement_bar char) + + Nothing -> + (get_inactive_movement_bar char) + get_weapon_details : ( Struct.Model.Type -> Struct.Statistics.Type -> @@ -212,7 +273,7 @@ get_html model char weapon = [ (View.Character.get_portrait_html model.player_id char), (get_health_bar char), - (get_movement_bar char) + (get_movement_bar model char) ] ), (get_weapon_details diff --git a/src/battlemap/src/View/Controlled/ManualControls.elm b/src/battlemap/src/View/Controlled/ManualControls.elm index 9f1685d..4e41e27 100644 --- a/src/battlemap/src/View/Controlled/ManualControls.elm +++ b/src/battlemap/src/View/Controlled/ManualControls.elm @@ -29,6 +29,18 @@ direction_button dir label = [] ) +go_button : (Html.Html Struct.Event.Type) +go_button = + (Html.button + [ + (Html.Attributes.class "battlemap-manual-controls-go"), + (Html.Events.onClick Struct.Event.AttackWithoutMovingRequest) + ] + [ + (Html.text "Go") + ] + ) + -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- @@ -42,6 +54,7 @@ get_html = (direction_button Struct.Direction.Left "left"), (direction_button Struct.Direction.Down "down"), (direction_button Struct.Direction.Up "up"), - (direction_button Struct.Direction.Right "right") + (direction_button Struct.Direction.Right "right"), + (go_button) ] ) diff --git a/src/battlemap/www/style.css b/src/battlemap/www/style.css index 46bab81..ee74f23 100644 --- a/src/battlemap/www/style.css +++ b/src/battlemap/www/style.css @@ -113,17 +113,33 @@ display: grid; grid-template: '. top .' - 'left . right' + 'left go right' '. bottom .'; margin: auto; } -.battlemap-manual-controls > * +.battlemap-manual-controls > div { - background-image: url(/asset/svg/arrowhead.svg); - background-size: 100%; width: 32px; height: 32px; + background-image: url(/asset/svg/arrowhead.svg); + background-size: 100%; + transition: opacity 0.3s ease-out; + opacity: 0.5; +} + +.battlemap-manual-controls > div:hover +{ + opacity: 1; +} + +.battlemap-manual-controls-go +{ + margin: auto; + width: 28px; + height: 28px; + border-radius: 100em; + grid-area: go; } .battlemap-manual-controls-up @@ -473,6 +489,7 @@ { background-color: #FFF; opacity: 0.3; + transition: opacity 0.3s ease-out; } .battlemap-can-go-to-marker:hover diff --git a/src/global/www/style.css b/src/global/www/style.css index a345650..7782f05 100644 --- a/src/global/www/style.css +++ b/src/global/www/style.css @@ -25,10 +25,12 @@ html color: #FFEEAA; margin: 0.1em; padding: 0.2em; + transition: background-color 0.3s ease-out; } * button:hover { + cursor: pointer; background-color: #AC9D93; } |