From a23387b5b7c1f87242ed66e08268dfb4a9c0a376 Mon Sep 17 00:00:00 2001 From: nsensfel Date: Fri, 22 Jun 2018 18:37:27 +0200 Subject: ... --- src/battlemap/src/Struct/Model.elm | 13 +++++++++++-- src/battlemap/src/Update/HandleAnimationEnded.elm | 14 +++++--------- src/battlemap/src/View/Battlemap/Character.elm | 7 +++++++ src/battlemap/src/View/Controlled.elm | 5 ++++- src/battlemap/www/style.css | 21 +++++++++++++++++++-- 5 files changed, 46 insertions(+), 14 deletions(-) diff --git a/src/battlemap/src/Struct/Model.elm b/src/battlemap/src/Struct/Model.elm index 9a3b054..ecb3a70 100644 --- a/src/battlemap/src/Struct/Model.elm +++ b/src/battlemap/src/Struct/Model.elm @@ -11,6 +11,7 @@ module Struct.Model exposing invalidate, initialize_animator, apply_animator_step, + move_animator_to_next_step, reset, full_debug_reset, clear_error @@ -166,14 +167,22 @@ initialize_animator model = ) } +move_animator_to_next_step : Type -> Type +move_animator_to_next_step model = + case model.animator of + Nothing -> model + (Just animator) -> + {model | + animator = + (Struct.TurnResultAnimator.maybe_trigger_next_step animator) + } + apply_animator_step : Type -> Type apply_animator_step model = case model.animator of Nothing -> model (Just animator) -> {model | - animator = - (Struct.TurnResultAnimator.maybe_trigger_next_step animator), characters = case (Struct.TurnResultAnimator.get_current_animation animator) diff --git a/src/battlemap/src/Update/HandleAnimationEnded.elm b/src/battlemap/src/Update/HandleAnimationEnded.elm index 60011ac..6cedb43 100644 --- a/src/battlemap/src/Update/HandleAnimationEnded.elm +++ b/src/battlemap/src/Update/HandleAnimationEnded.elm @@ -17,7 +17,6 @@ import Struct.Event import Struct.Model import Struct.TurnResult import Struct.TurnResultAnimator -import Struct.UI -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- @@ -34,13 +33,7 @@ handle_char_focus model animator char_index = if (Struct.TurnResultAnimator.waits_for_focus animator) then ( - {model | - ui = - (Struct.UI.set_previous_action - (Just (Struct.UI.SelectedCharacter char_index)) - model.ui - ) - }, + model, (Cmd.batch [ (Task.attempt @@ -123,7 +116,10 @@ apply_to : ( ) apply_to model = let - new_model = (Struct.Model.apply_animator_step model) + new_model = + (Struct.Model.apply_animator_step + (Struct.Model.move_animator_to_next_step model) + ) in case new_model.animator of Nothing -> (new_model, Cmd.none) diff --git a/src/battlemap/src/View/Battlemap/Character.elm b/src/battlemap/src/View/Battlemap/Character.elm index 4ff6c73..0c84a94 100644 --- a/src/battlemap/src/View/Battlemap/Character.elm +++ b/src/battlemap/src/View/Battlemap/Character.elm @@ -31,6 +31,13 @@ get_animation_class model char = Nothing -> (Html.Attributes.class "") (Just animator) -> case (Struct.TurnResultAnimator.get_current_animation animator) of + (Struct.TurnResultAnimator.Focus char_index) -> + if ((Struct.Character.get_index char) /= char_index) + then + (Html.Attributes.class "") + else + (Html.Attributes.class "battlemap-character-selected") + (Struct.TurnResultAnimator.TurnResult current_action) -> if ( diff --git a/src/battlemap/src/View/Controlled.elm b/src/battlemap/src/View/Controlled.elm index c7c4c49..6116970 100644 --- a/src/battlemap/src/View/Controlled.elm +++ b/src/battlemap/src/View/Controlled.elm @@ -50,7 +50,10 @@ abort_button = end_turn_button : String -> (Html.Html Struct.Event.Type) end_turn_button suffix = (Html.button - [ (Html.Events.onClick Struct.Event.TurnEnded) ] + [ + (Html.Events.onClick Struct.Event.TurnEnded), + (Html.Attributes.class "battlemap-end-turn-button") + ] [ (Html.text ("End Turn" ++ suffix)) ] ) diff --git a/src/battlemap/www/style.css b/src/battlemap/www/style.css index 532ab88..7d4ba53 100644 --- a/src/battlemap/www/style.css +++ b/src/battlemap/www/style.css @@ -47,9 +47,13 @@ display: flex; flex-flow: row; - justify-content: space-evenly; + justify-content: space-between; } +.battlemap-help .battlemap-character-card +{ + width: 30%; +} .battlemap-container { @@ -270,7 +274,7 @@ border-radius: 5px; z-index: 0; top: -100%; - transition: width 0.3s ease-out; + transition: width 1s ease-out; } .battlemap-character-card-health, @@ -384,6 +388,13 @@ animation-iteration-count: infinite; } +.battlemap-end-turn-button +{ + animation-name: reverse-brown-alarm-bg; + animation-duration: 2s; + animation-iteration-count: infinite; +} + .battlemap-character-portrait:hover { cursor: pointer; @@ -771,6 +782,12 @@ 100% {background-color: #917C6F;} } +@keyframes reverse-brown-alarm-bg { + 0% {background-color: #917C6F;} + 50% {background-color: #502D16;} + 100% {background-color: #917C6F;} +} + @keyframes blue-alarm-bg { 0% {background-color: rgba(0,0,255,0.2);} 25% {background-color: rgba(0,0,255,0.8);} -- cgit v1.2.3-70-g09d2