| summaryrefslogtreecommitdiff | 
diff options
| author | nsensfel <SpamShield0@noot-noot.org> | 2017-11-30 20:00:42 +0100 | 
|---|---|---|
| committer | nsensfel <SpamShield0@noot-noot.org> | 2017-11-30 20:00:42 +0100 | 
| commit | 4a2976d634040f16fd85262f4fbf7b97e4dec36c (patch) | |
| tree | 76f0548f0b79ee950957120d370481f7aaf52d1a | |
| parent | 2d030cbc89e4bf14fc584a83417d59fc86640202 (diff) | |
Changes how the GUI looks.
18 files changed, 152 insertions, 110 deletions
| diff --git a/src/battlemap/src/Model.elm b/src/battlemap/src/Model.elm index 255190b..5a0b754 100644 --- a/src/battlemap/src/Model.elm +++ b/src/battlemap/src/Model.elm @@ -27,7 +27,6 @@ import Character  --------------------------------------------------------------------------------  type State =     Default -   | ControllingCharacter Character.Ref     | InspectingTile Battlemap.Location.Ref     | InspectingCharacter Character.Ref @@ -38,6 +37,7 @@ type alias Type =        characters: (Dict.Dict Character.Ref Character.Type),        error: (Maybe Error.Type),        controlled_team: Int, +      controlled_character: (Maybe Character.Ref),        player_id: String,        ui: UI.Type     } @@ -70,6 +70,7 @@ reset model characters =        battlemap = (Battlemap.reset model.battlemap),        characters = characters,        error = Nothing, +      controlled_character = Nothing,        ui = (UI.set_previous_action model.ui Nothing)     } diff --git a/src/battlemap/src/Model/EndTurn.elm b/src/battlemap/src/Model/EndTurn.elm index f62c108..f26beba 100644 --- a/src/battlemap/src/Model/EndTurn.elm +++ b/src/battlemap/src/Model/EndTurn.elm @@ -65,8 +65,8 @@ make_it_so model char_ref =  --------------------------------------------------------------------------------  apply_to : Model.Type -> (Model.Type, (Cmd Event.Type))  apply_to model = -   case (Model.get_state model) of -      (Model.ControllingCharacter char_ref) -> +   case model.controlled_character of +      (Just char_ref) ->           (make_it_so model char_ref)        _ -> diff --git a/src/battlemap/src/Model/RequestDirection.elm b/src/battlemap/src/Model/RequestDirection.elm index 30bc54e..4e52897 100644 --- a/src/battlemap/src/Model/RequestDirection.elm +++ b/src/battlemap/src/Model/RequestDirection.elm @@ -57,8 +57,8 @@ make_it_so model char_ref dir =  --------------------------------------------------------------------------------  apply_to : Model.Type -> Battlemap.Direction.Type -> Model.Type  apply_to model dir = -   case (Model.get_state model) of -      (Model.ControllingCharacter char_ref) -> +   case model.controlled_character of +      (Just char_ref) ->           (make_it_so model char_ref dir)        _ -> diff --git a/src/battlemap/src/Model/SelectCharacter.elm b/src/battlemap/src/Model/SelectCharacter.elm index 2f10f1e..a4a077d 100644 --- a/src/battlemap/src/Model/SelectCharacter.elm +++ b/src/battlemap/src/Model/SelectCharacter.elm @@ -49,7 +49,8 @@ select_character model target_char_id target_char =     if ((Character.is_enabled target_char))     then        {model | -         state = (Model.ControllingCharacter target_char_id), +         state = Model.Default, +         controlled_character = (Just target_char_id),           ui = (UI.set_previous_action model.ui Nothing),           battlemap =              (Battlemap.set_navigator @@ -83,8 +84,8 @@ apply_to model target_char_id =     then        case (Dict.get target_char_id model.characters) of           (Just target_char) -> -            case (Model.get_state model) of -               (Model.ControllingCharacter main_char_id) -> +            case model.controlled_character of +               (Just main_char_id) ->                    (attack_character                       model                       main_char_id diff --git a/src/battlemap/src/Model/SelectTile.elm b/src/battlemap/src/Model/SelectTile.elm index 2191d27..5ce3c3c 100644 --- a/src/battlemap/src/Model/SelectTile.elm +++ b/src/battlemap/src/Model/SelectTile.elm @@ -103,8 +103,8 @@ apply_to : (        (Model.Type, (Cmd Event.Type))     )  apply_to model loc_ref = -   case (Model.get_state model) of -      (Model.ControllingCharacter char_ref) -> +   case model.controlled_character of +      (Just char_ref) ->           (go_to_tile model char_ref loc_ref)        _ -> ({model | state = (Model.InspectingTile loc_ref)}, Cmd.none) diff --git a/src/battlemap/src/Send/CharacterTurn.elm b/src/battlemap/src/Send/CharacterTurn.elm index 092f31f..0235122 100644 --- a/src/battlemap/src/Send/CharacterTurn.elm +++ b/src/battlemap/src/Send/CharacterTurn.elm @@ -24,8 +24,8 @@ import Send  --------------------------------------------------------------------------------  try_encoding : Model.Type -> (Maybe Json.Encode.Value)  try_encoding model = -   case (Model.get_state model) of -      (Model.ControllingCharacter char_ref) -> +   case model.controlled_character of +      (Just char_ref) ->           (Just              (Json.Encode.object                 [ diff --git a/src/battlemap/src/Shim/Model.elm b/src/battlemap/src/Shim/Model.elm index 396a8f8..e7bd2c3 100644 --- a/src/battlemap/src/Shim/Model.elm +++ b/src/battlemap/src/Shim/Model.elm @@ -24,6 +24,7 @@ generate =        error = Nothing,        battlemap = (Battlemap.empty),        controlled_team = 0, +      controlled_character = Nothing,        player_id = "0",        characters = (Dict.empty),        ui = (UI.default) diff --git a/src/battlemap/src/UI.elm b/src/battlemap/src/UI.elm index f30a0fc..978ed00 100644 --- a/src/battlemap/src/UI.elm +++ b/src/battlemap/src/UI.elm @@ -17,6 +17,7 @@ module UI exposing        -- Manual Controls        has_manual_controls_enabled,        -- Previous Action +      has_focus,        get_previous_action,        set_previous_action     ) @@ -111,6 +112,9 @@ set_enable_manual_controls : Type -> Bool -> Type  set_enable_manual_controls ui val = {ui | show_manual_controls = val}  -- Previous Action ------------------------------------------------------------- +has_focus : Type -> Bool +has_focus ui = True +  set_previous_action : Type -> (Maybe Action) -> Type  set_previous_action ui act = {ui | previous_action = act} diff --git a/src/battlemap/src/View.elm b/src/battlemap/src/View.elm index b8fae72..9073d93 100644 --- a/src/battlemap/src/View.elm +++ b/src/battlemap/src/View.elm @@ -10,7 +10,7 @@ import Html.Attributes  import UI  import View.Battlemap -import View.Header +import View.SideBar  import View.Footer  import Event @@ -26,19 +26,33 @@ view model =           (Html.Attributes.class "fullscreen-module")        ]        [ -         (View.Header.get_html model),           (Html.div              [ -               (Html.Attributes.class "battlemap-container") +               (Html.Attributes.class "battlemap-left-panel")              ]              [ -               (View.Battlemap.get_html -                  model.battlemap -                  (UI.get_zoom_level model.ui) -                  (Dict.values model.characters) -               ) +               (Html.div +                  [ +                     (Html.Attributes.class "battlemap-container") +                  ] +                  [ +                     (View.Battlemap.get_html +                        model.battlemap +                        (UI.get_zoom_level model.ui) +                        (Dict.values model.characters) +                     ) +                  ] +               ), +               (View.Footer.get_html model)              ]           ), -         (View.Footer.get_html model) +         (Html.div +            [ +               (Html.Attributes.class "battlemap-right-panel") +            ] +            [ +               (View.SideBar.get_html model) +            ] +         )        ]     ) diff --git a/src/battlemap/src/View/Footer.elm b/src/battlemap/src/View/Footer.elm index 3b4d8ef..26a08ef 100644 --- a/src/battlemap/src/View/Footer.elm +++ b/src/battlemap/src/View/Footer.elm @@ -4,7 +4,12 @@ module View.Footer exposing (get_html)  import Html  import Html.Attributes +import Dict +  -- Battlemap ------------------------------------------------------------------- +import Battlemap +import Character +  import Event  import Model @@ -13,26 +18,48 @@ import Util.Html  import UI -import View.Footer.TabMenu -import View.Footer.ManualControls +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_curr_char_info_htmls : ( +      Model.Type -> +      Character.Ref -> +      (List (Html.Html Event.Type)) +   ) +get_curr_char_info_htmls model char_ref = +   case (Dict.get char_ref model.characters) of +      (Just char) -> +         [ +            (Html.text +               ( +                  "Controlling " +                  ++ char.name +                  ++ ": " +                  ++ (toString +                        (Battlemap.get_navigator_remaining_points +                           model.battlemap +                        ) +                     ) +                  ++ "/" +                  ++ (toString (Character.get_movement_points char)) +                  ++ " movement points remaining." +               ) +            ) +         ] + +      Nothing -> +         [(Html.text "Error: Unknown character selected.")]  --------------------------------------------------------------------------------  -- EXPORTED --------------------------------------------------------------------  --------------------------------------------------------------------------------  get_html : Model.Type -> (Html.Html Event.Type)  get_html model = -   (Html.div -      [ -         (Html.Attributes.class "battlemap-footer") -      ] -      [ -         (View.Footer.TabMenu.get_html model), -         ( -            if (UI.has_manual_controls_enabled model.ui) -            then -               (View.Footer.ManualControls.get_html) -            else -               (Util.Html.nothing) +   case model.controlled_character of +      (Just char_id) -> +         (Html.div +            [(Html.Attributes.class "battlemap-footer")] +            (get_curr_char_info_htmls model char_id)           ) -      ] -   ) + +      Nothing -> (Util.Html.nothing) diff --git a/src/battlemap/src/View/Header.elm b/src/battlemap/src/View/SideBar.elm index d2bd2da..050ee29 100644 --- a/src/battlemap/src/View/Header.elm +++ b/src/battlemap/src/View/SideBar.elm @@ -1,4 +1,4 @@ -module View.Header exposing (get_html) +module View.SideBar exposing (get_html)  -- Elm -------------------------------------------------------------------------  import Html @@ -9,6 +9,13 @@ import Event  import Model +import Util.Html + +import UI + +import View.SideBar.TabMenu +import View.SideBar.ManualControls +  --------------------------------------------------------------------------------  -- EXPORTED --------------------------------------------------------------------  -------------------------------------------------------------------------------- @@ -16,9 +23,16 @@ get_html : Model.Type -> (Html.Html Event.Type)  get_html model =     (Html.div        [ -         (Html.Attributes.class "global-ingame-header") +         (Html.Attributes.class "battlemap-side-bar")        ]        [ -         (Html.text "Tacticians Online - Development Branch") +         (View.SideBar.TabMenu.get_html model), +         ( +            if (UI.has_manual_controls_enabled model.ui) +            then +               (View.SideBar.ManualControls.get_html) +            else +               (Util.Html.nothing) +         )        ]     ) diff --git a/src/battlemap/src/View/Footer/ManualControls.elm b/src/battlemap/src/View/SideBar/ManualControls.elm index c56e954..15edd2a 100644 --- a/src/battlemap/src/View/Footer/ManualControls.elm +++ b/src/battlemap/src/View/SideBar/ManualControls.elm @@ -1,4 +1,4 @@ -module View.Footer.ManualControls exposing (get_html) +module View.SideBar.ManualControls exposing (get_html)  -- Elm -------------------------------------------------------------------------  import Html diff --git a/src/battlemap/src/View/Footer/TabMenu.elm b/src/battlemap/src/View/SideBar/TabMenu.elm index 967610a..864618b 100644 --- a/src/battlemap/src/View/Footer/TabMenu.elm +++ b/src/battlemap/src/View/SideBar/TabMenu.elm @@ -1,4 +1,4 @@ -module View.Footer.TabMenu exposing (get_html) +module View.SideBar.TabMenu exposing (get_html)  -- Elm -------------------------------------------------------------------------  import Html @@ -15,9 +15,9 @@ import Model  import UI  import Util.Html -import View.Footer.TabMenu.Characters -import View.Footer.TabMenu.Status -import View.Footer.TabMenu.Settings +import View.SideBar.TabMenu.Characters +import View.SideBar.TabMenu.Status +import View.SideBar.TabMenu.Settings  --------------------------------------------------------------------------------  -- LOCAL ----------------------------------------------------------------------- @@ -94,19 +94,19 @@ get_html model =                    (Just UI.StatusTab) ->                       [                          (get_active_tab_selector_html UI.StatusTab), -                        (View.Footer.TabMenu.Status.get_html model) +                        (View.SideBar.TabMenu.Status.get_html model)                       ]                    (Just UI.CharactersTab) ->                       [                          (get_active_tab_selector_html UI.CharactersTab), -                        (View.Footer.TabMenu.Characters.get_html model) +                        (View.SideBar.TabMenu.Characters.get_html model)                       ]                    (Just UI.SettingsTab) ->                       [                          (get_active_tab_selector_html UI.SettingsTab), -                        (View.Footer.TabMenu.Settings.get_html model) +                        (View.SideBar.TabMenu.Settings.get_html model)                       ]                    Nothing -> [(get_inactive_tab_selector_html)] diff --git a/src/battlemap/src/View/Footer/TabMenu/Characters.elm b/src/battlemap/src/View/SideBar/TabMenu/Characters.elm index 2e15ce1..7768ff2 100644 --- a/src/battlemap/src/View/Footer/TabMenu/Characters.elm +++ b/src/battlemap/src/View/SideBar/TabMenu/Characters.elm @@ -1,4 +1,4 @@ -module View.Footer.TabMenu.Characters exposing (get_html) +module View.SideBar.TabMenu.Characters exposing (get_html)  -- Elm -------------------------------------------------------------------------  import Dict diff --git a/src/battlemap/src/View/Footer/TabMenu/Settings.elm b/src/battlemap/src/View/SideBar/TabMenu/Settings.elm index 3c23a15..d73956a 100644 --- a/src/battlemap/src/View/Footer/TabMenu/Settings.elm +++ b/src/battlemap/src/View/SideBar/TabMenu/Settings.elm @@ -1,4 +1,4 @@ -module View.Footer.TabMenu.Settings exposing (get_html) +module View.SideBar.TabMenu.Settings exposing (get_html)  -- Elm -------------------------------------------------------------------------  import Html diff --git a/src/battlemap/src/View/Footer/TabMenu/Status.elm b/src/battlemap/src/View/SideBar/TabMenu/Status.elm index e3dd19b..a0a66f9 100644 --- a/src/battlemap/src/View/Footer/TabMenu/Status.elm +++ b/src/battlemap/src/View/SideBar/TabMenu/Status.elm @@ -1,4 +1,4 @@ -module View.Footer.TabMenu.Status exposing (get_html) +module View.SideBar.TabMenu.Status exposing (get_html)  -- Elm -------------------------------------------------------------------------  import Dict @@ -24,26 +24,6 @@ import Model  --------------------------------------------------------------------------------  -- LOCAL -----------------------------------------------------------------------  -------------------------------------------------------------------------------- -get_navigator_info_html : Model.Type -> Character.Ref -> (Html.Html Event.Type) -get_navigator_info_html model char_ref = -   case (Dict.get char_ref model.characters) of -      Nothing -> (Html.text "Error: Unknown character selected.") -      (Just char) -> -         (Html.text -            ( -               "Controlling " -               ++ char.name -               ++ ": " -               ++ (toString -                     (Battlemap.get_navigator_remaining_points -                        model.battlemap -                     ) -                  ) -               ++ "/" -               ++ (toString (Character.get_movement_points char)) -               ++ " movement points remaining." -            ) -         )  get_char_info_html : Model.Type -> Character.Ref -> (Html.Html Event.Type)  get_char_info_html model char_ref = @@ -165,32 +145,14 @@ get_html model =           (Html.Attributes.class "battlemap-footer-tabmenu-content-status")        ]        (case model.state of -         Model.Default -> -            [ -               (case (UI.get_previous_action model.ui) of -                  (Just (UI.SelectedLocation loc)) -> -                     (get_tile_info_html -                        model -                        (Battlemap.Location.from_ref loc) -                     ) - -                  (Just (UI.SelectedCharacter target_char)) -> -                     (get_char_info_html model target_char) - -                  _ -> -                     (Html.text "Double-click on a character to control it.") -               ) -            ] -           (Model.InspectingTile tile_loc) ->              [(get_tile_info_html model (Battlemap.Location.from_ref tile_loc))]           (Model.InspectingCharacter char_ref) ->              [(get_char_info_html model char_ref)] -         (Model.ControllingCharacter char_ref) -> +         _ ->              [ -               (get_navigator_info_html model char_ref),                 (case (UI.get_previous_action model.ui) of                    (Just (UI.SelectedLocation loc)) ->                       (get_tile_info_html @@ -201,10 +163,8 @@ get_html model =                    (Just (UI.SelectedCharacter target_char)) ->                       (get_char_info_html model target_char) -                  (Just (UI.AttackedCharacter target_char)) -> -                     (get_char_attack_info_html model target_char) - -                  _ -> (Util.Html.nothing) +                  _ -> +                     (Html.text "Double-click on a character to control it.")                 )              ]        ) diff --git a/src/battlemap/www/style.css b/src/battlemap/www/style.css index b8f60ff..4044e38 100644 --- a/src/battlemap/www/style.css +++ b/src/battlemap/www/style.css @@ -1,15 +1,45 @@ +.battlemap-left-panel +{ +   flex-grow: 1; +   min-width: 70%; +   display: flex; +   flex-direction: column; +} + +.battlemap-right-panel +{ +   height: inherit; +   max-width: 30%; + +   display: flex; +} +  .battlemap-container  { +   flex-grow: 1; +   min-height: 70%; +     overflow: auto;     width: inherit; -   flex: 1; +} + +.battlemap-side-bar +{ +   flex-grow: 1; +   overflow-y: auto; +   width: inherit; +   height: inherit; +   word-wrap: break-word;  }  .battlemap-footer  { -   display: flex; -   flex: 0;     max-height: 30%; + +   overflow-y: auto; +   width: inherit; +   word-wrap: break-word; +   padding-bottom: 1em;  }  .battlemap-actual @@ -121,6 +151,7 @@  .battlemap-tabmenu  {     flex: 1; +   height: inherit;  }  .battlemap-manual-controls diff --git a/src/global/www/style.css b/src/global/www/style.css index 406c60e..f0cfb6a 100644 --- a/src/global/www/style.css +++ b/src/global/www/style.css @@ -10,18 +10,7 @@ html, body, .fullscreen-module     bottom: 0;     right: 0;     left: 0; -} - -.fullscreen-module -{ +   margin: 0; +   padding: 0;     display: flex; -   flex-flow: column; -   align-content: stretch; -   justify-content: stretch; -} - -.global-ingame-header -{ -   text-align: center; -   flex: 0;  } | 


