aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-04-17 20:01:18 +0200
committernsensfel <SpamShield0@noot-noot.org>2018-04-17 20:01:18 +0200
commit6a1fd777ae92f5ee1fffb1ffd1c7b72b9b4edd79 (patch)
treebba630e18a2bc9c38c243565e9a4e1d2eaa250db
parent0bbcb6c8429bb9a25aafe5595129470f1c30ced9 (diff)
downloadtacticians-client-6a1fd777ae92f5ee1fffb1ffd1c7b72b9b4edd79.zip
tacticians-client-6a1fd777ae92f5ee1fffb1ffd1c7b72b9b4edd79.tar.bz2
Seems better now.
-rw-r--r--src/battlemap/src/ElmModule/View.elm6
-rw-r--r--src/battlemap/src/Struct/UI.elm2
-rw-r--r--src/battlemap/src/Update/SelectTab.elm15
-rw-r--r--src/battlemap/src/View/Controlled.elm56
-rw-r--r--src/battlemap/src/View/Help.elm124
-rw-r--r--src/battlemap/src/View/MainMenu.elm19
-rw-r--r--src/battlemap/src/View/SideBar.elm47
-rw-r--r--src/battlemap/src/View/SubMenu.elm40
-rw-r--r--src/battlemap/src/View/SubMenu/ManualControls.elm (renamed from src/battlemap/src/View/SideBar/ManualControls.elm)0
-rw-r--r--src/battlemap/src/View/SubMenu/TabMenu/Characters.elm (renamed from src/battlemap/src/View/SideBar/TabMenu/Characters.elm)0
-rw-r--r--src/battlemap/src/View/SubMenu/TabMenu/Settings.elm (renamed from src/battlemap/src/View/SideBar/TabMenu/Settings.elm)0
-rw-r--r--src/battlemap/src/View/SubMenu/TabMenu/Status.elm (renamed from src/battlemap/src/View/SideBar/TabMenu/Status.elm)0
-rw-r--r--src/battlemap/src/View/SubMenu/TabMenu/Status/CharacterInfo.elm (renamed from src/battlemap/src/View/SideBar/TabMenu/Status/CharacterInfo.elm)0
-rw-r--r--src/battlemap/src/View/SubMenu/TabMenu/Timeline.elm (renamed from src/battlemap/src/View/SideBar/TabMenu/Timeline.elm)0
-rw-r--r--src/battlemap/src/View/SubMenu/TabMenu/Timeline/Attack.elm (renamed from src/battlemap/src/View/SideBar/TabMenu/Timeline/Attack.elm)0
-rw-r--r--src/battlemap/src/View/SubMenu/TabMenu/Timeline/Movement.elm (renamed from src/battlemap/src/View/SideBar/TabMenu/Timeline/Movement.elm)0
-rw-r--r--src/battlemap/src/View/SubMenu/TabMenu/Timeline/WeaponSwitch.elm (renamed from src/battlemap/src/View/SideBar/TabMenu/Timeline/WeaponSwitch.elm)0
-rw-r--r--src/battlemap/src/View/SubMenu/Targets.elm (renamed from src/battlemap/src/View/SideBar/Targets.elm)0
-rw-r--r--src/battlemap/www/style.css11
19 files changed, 106 insertions, 214 deletions
diff --git a/src/battlemap/src/ElmModule/View.elm b/src/battlemap/src/ElmModule/View.elm
index aa3929c..b46548c 100644
--- a/src/battlemap/src/ElmModule/View.elm
+++ b/src/battlemap/src/ElmModule/View.elm
@@ -9,8 +9,10 @@ import Struct.Event
import Struct.Model
import View.Battlemap
-import View.SideBar
-import View.Footer
+import View.Controlled
+import View.Help
+import View.MainMenu
+import View.SubMenu
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
diff --git a/src/battlemap/src/Struct/UI.elm b/src/battlemap/src/Struct/UI.elm
index 3343565..3ae462c 100644
--- a/src/battlemap/src/Struct/UI.elm
+++ b/src/battlemap/src/Struct/UI.elm
@@ -62,7 +62,7 @@ default =
{
zoom_level = 1.0,
show_manual_controls = True,
- displayed_tab = (Just StatusTab),
+ displayed_tab = Nothing,
previous_action = Nothing
}
diff --git a/src/battlemap/src/Update/SelectTab.elm b/src/battlemap/src/Update/SelectTab.elm
index c48b0fc..8a5291e 100644
--- a/src/battlemap/src/Update/SelectTab.elm
+++ b/src/battlemap/src/Update/SelectTab.elm
@@ -19,7 +19,14 @@ apply_to : (
(Struct.Model.Type, (Cmd Struct.Event.Type))
)
apply_to model tab =
- (
- {model | ui = (Struct.UI.set_displayed_tab model.ui tab)},
- Cmd.none
- )
+ if ((Struct.UI.try_getting_displayed_tab model.ui) == (Just tab))
+ then
+ (
+ {model | ui = (Struct.UI.reset_displayed_tab model.ui)},
+ Cmd.none
+ )
+ else
+ (
+ {model | ui = (Struct.UI.set_displayed_tab model.ui tab)},
+ Cmd.none
+ )
diff --git a/src/battlemap/src/View/Controlled.elm b/src/battlemap/src/View/Controlled.elm
index 890b59a..6f1e10d 100644
--- a/src/battlemap/src/View/Controlled.elm
+++ b/src/battlemap/src/View/Controlled.elm
@@ -1,4 +1,4 @@
-module View.Footer exposing (get_html)
+module View.Controlled exposing (get_html)
-- Elm -------------------------------------------------------------------------
import Html
@@ -39,31 +39,6 @@ inventory_button =
[ (Html.text "Switch Weapon") ]
)
-get_navigator_info : (
- Struct.Model.Type ->
- Struct.Character.Type ->
- String
- )
-get_navigator_info model char =
- case
- (Struct.CharacterTurn.try_getting_navigator model.char_turn)
- of
- (Just nav) ->
- (
- (toString (Struct.Navigator.get_remaining_points nav))
- ++ "/"
- ++
- (toString
- (Struct.Statistics.get_movement_points
- (Struct.Character.get_statistics char)
- )
- )
- ++ " movement points remaining"
- )
-
- _ ->
- "[Error: Character selected yet navigator undefined.]"
-
get_curr_char_info_htmls : (
Struct.Model.Type ->
Struct.Character.Type ->
@@ -75,43 +50,18 @@ get_curr_char_info_htmls model char =
of
Struct.CharacterTurn.SelectedCharacter ->
[
- (Html.text
- (
- "Controlling "
- ++ char.name
- ++ ". Move ("
- ++ (get_navigator_info model char)
- ++ "), "
- )
- ),
(attack_button),
- (Html.text ", or "),
(inventory_button)
]
Struct.CharacterTurn.MovedCharacter ->
[
- (Html.text
- (
- "Controlling "
- ++ char.name
- ++ ". Moved. Select a target, or "
- )
- ),
(end_turn_button)
]
Struct.CharacterTurn.ChoseTarget ->
[
- (Html.text
- (
- "Controlling "
- ++ char.name
- ++ ". Moved. Chose a target. Click on "
- )
- ),
- (end_turn_button),
- (Html.text "to end turn.")
+ (end_turn_button)
]
_ ->
@@ -135,7 +85,7 @@ get_html model =
of
(Just char) ->
(Html.div
- [(Html.Attributes.class "battlemap-footer")]
+ [(Html.Attributes.class "battlemap-controlled")]
(get_curr_char_info_htmls model char)
)
diff --git a/src/battlemap/src/View/Help.elm b/src/battlemap/src/View/Help.elm
index 6a95aa9..7b89008 100644
--- a/src/battlemap/src/View/Help.elm
+++ b/src/battlemap/src/View/Help.elm
@@ -1,4 +1,4 @@
-module View.Footer exposing (get_html)
+module View.Help exposing (get_html)
-- Elm -------------------------------------------------------------------------
import Html
@@ -6,122 +6,63 @@ import Html.Attributes
import Html.Events
-- Struct.Battlemap -------------------------------------------------------------------
-import Struct.Character
import Struct.CharacterTurn
+import Struct.Error
import Struct.Event
import Struct.Model
-import Struct.Navigator
-import Struct.Statistics
import Util.Html
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-attack_button : (Html.Html Struct.Event.Type)
-attack_button =
- (Html.button
- [ (Html.Events.onClick Struct.Event.AttackWithoutMovingRequest) ]
- [ (Html.text "Attack Without Moving") ]
- )
-
-end_turn_button : (Html.Html Struct.Event.Type)
-end_turn_button =
- (Html.button
- [ (Html.Events.onClick Struct.Event.TurnEnded) ]
- [ (Html.text "End Turn") ]
- )
-
-inventory_button : (Html.Html Struct.Event.Type)
-inventory_button =
- (Html.button
- [ (Html.Events.onClick Struct.Event.WeaponSwitchRequest) ]
- [ (Html.text "Switch Weapon") ]
- )
-
-get_navigator_info : (
- Struct.Model.Type ->
- Struct.Character.Type ->
- String
- )
-get_navigator_info model char =
- case
- (Struct.CharacterTurn.try_getting_navigator model.char_turn)
- of
- (Just nav) ->
- (
- (toString (Struct.Navigator.get_remaining_points nav))
- ++ "/"
- ++
- (toString
- (Struct.Statistics.get_movement_points
- (Struct.Character.get_statistics char)
- )
- )
- ++ " movement points remaining"
- )
-
- _ ->
- "[Error: Character selected yet navigator undefined.]"
-
-get_curr_char_info_htmls : (
+get_error_message : (
Struct.Model.Type ->
- Struct.Character.Type ->
+ Struct.Error.Type ->
(List (Html.Html Struct.Event.Type))
)
-get_curr_char_info_htmls model char =
- case
- (Struct.CharacterTurn.get_state model.char_turn)
- of
+get_error_message model error =
+ [(Html.text (Struct.Error.to_string error))]
+
+get_help_message : Struct.Model.Type -> (List (Html.Html Struct.Event.Type))
+get_help_message model =
+ case (Struct.CharacterTurn.get_state model.char_turn) of
Struct.CharacterTurn.SelectedCharacter ->
[
(Html.text
(
- "Controlling "
- ++ char.name
- ++ ". Move ("
- ++ (get_navigator_info model char)
- ++ "), "
+ "Click on a target tile to select a path or use the manual"
+ ++ " controls to make your own. Click on the destination tile"
+ ++ " again to confirm."
)
- ),
- (attack_button),
- (Html.text ", or "),
- (inventory_button)
+ )
]
Struct.CharacterTurn.MovedCharacter ->
[
(Html.text
(
- "Controlling "
- ++ char.name
- ++ ". Moved. Select a target, or "
+ "You can now choose a target in range. Dashed tiles indicate"
+ ++ " where your character will not be able to defend against"
+ ++ " counter attacks."
)
- ),
- (end_turn_button)
+ )
]
Struct.CharacterTurn.ChoseTarget ->
[
(Html.text
(
- "Controlling "
- ++ char.name
- ++ ". Moved. Chose a target. Click on "
+ "If you are satisfied with your choices, end the turn to"
+ ++ " confirm them."
)
- ),
- (end_turn_button),
- (Html.text "to end turn.")
+ )
]
_ ->
[
(Html.text
- (
- "Error: CharacterTurn structure in an inconsistent state:"
- ++ " Has an active character yet the 'state' is not any of"
- ++ " those expected in such cases."
- )
+ "Double click on an active character to play their turn."
)
]
@@ -130,13 +71,20 @@ get_curr_char_info_htmls model char =
--------------------------------------------------------------------------------
get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)
get_html model =
- case
- (Struct.CharacterTurn.try_getting_active_character model.char_turn)
- of
- (Just char) ->
+ case (model.error) of
+ (Just error) ->
(Html.div
- [(Html.Attributes.class "battlemap-footer")]
- (get_curr_char_info_htmls model char)
+ [
+ (Html.Attributes.class "battlemap-help"),
+ (Html.Attributes.class "battlemap-error")
+ ]
+ (get_error_message model error)
)
- Nothing -> (Util.Html.nothing)
+ Nothing ->
+ (Html.div
+ [
+ (Html.Attributes.class "battlemap-help")
+ ]
+ (get_help_message model)
+ )
diff --git a/src/battlemap/src/View/MainMenu.elm b/src/battlemap/src/View/MainMenu.elm
index c5c4eee..b666195 100644
--- a/src/battlemap/src/View/MainMenu.elm
+++ b/src/battlemap/src/View/MainMenu.elm
@@ -6,18 +6,11 @@ import Html.Attributes
import Html.Events
-- Battlemap -------------------------------------------------------------------
-import Struct.Error
import Struct.Event
import Struct.Model
import Struct.UI
import Util.Html
-
-import View.SubMenu.Characters
-import View.SubMenu.Settings
-import View.SubMenu.Status
-import View.SubMenu.Timeline
-
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
@@ -28,13 +21,13 @@ get_menu_button_html : (
)
get_menu_button_html selected_tab tab =
(Html.button
- (
- if ((Just tab) == selected_tab)
- then
- [ (Html.Attributes.disabled True) ]
- else
+-- (
+-- if ((Just tab) == selected_tab)
+-- then
+-- [ (Html.Attributes.disabled True) ]
+-- else
[ (Html.Events.onClick (Struct.Event.TabSelected tab)) ]
- )
+-- )
[ (Html.text (Struct.UI.to_string tab)) ]
)
diff --git a/src/battlemap/src/View/SideBar.elm b/src/battlemap/src/View/SideBar.elm
deleted file mode 100644
index 206a4a6..0000000
--- a/src/battlemap/src/View/SideBar.elm
+++ /dev/null
@@ -1,47 +0,0 @@
-module View.SideBar exposing (get_html)
-
--- Elm -------------------------------------------------------------------------
-import Html
-import Html.Attributes
-
--- Battlemap -------------------------------------------------------------------
-import Struct.CharacterTurn
-import Struct.Event
-import Struct.Model
-import Struct.UI
-
-import Util.Html
-
-
-import View.SideBar.TabMenu
-import View.SideBar.Targets
-import View.SideBar.ManualControls
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)
-get_html model =
- (Html.div
- [
- (Html.Attributes.class "battlemap-side-bar")
- ]
- [
- (View.SideBar.TabMenu.get_html model),
- (
- case (Struct.CharacterTurn.get_target model.char_turn) of
- (Just target_ref) ->
- (View.SideBar.Targets.get_html model target_ref)
-
- _ ->
- (Util.Html.nothing)
- ),
- (
- if (Struct.UI.has_manual_controls_enabled model.ui)
- then
- (View.SideBar.ManualControls.get_html)
- else
- (Util.Html.nothing)
- )
- ]
- )
diff --git a/src/battlemap/src/View/SubMenu.elm b/src/battlemap/src/View/SubMenu.elm
new file mode 100644
index 0000000..694c826
--- /dev/null
+++ b/src/battlemap/src/View/SubMenu.elm
@@ -0,0 +1,40 @@
+module View.SubMenu exposing (get_html)
+
+-- Elm -------------------------------------------------------------------------
+import Html
+import Html.Attributes
+
+-- Battlemap -------------------------------------------------------------------
+import Struct.Event
+import Struct.Model
+import Struct.UI
+
+import Util.Html
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+get_inner_html : (
+ Struct.Model.Type ->
+ Struct.UI.Tab ->
+ (List (Html.Html Struct.Event.Type))
+ )
+get_inner_html model tab =
+ [(Html.text "Not available")]
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)
+get_html model =
+ case (Struct.UI.try_getting_displayed_tab model.ui) of
+ (Just tab) ->
+ (Html.div
+ [
+ (Html.Attributes.class "battlemap-sub-menu")
+ ]
+ (get_inner_html model tab)
+ )
+
+ Nothing ->
+ (Util.Html.nothing)
diff --git a/src/battlemap/src/View/SideBar/ManualControls.elm b/src/battlemap/src/View/SubMenu/ManualControls.elm
index f2e900c..f2e900c 100644
--- a/src/battlemap/src/View/SideBar/ManualControls.elm
+++ b/src/battlemap/src/View/SubMenu/ManualControls.elm
diff --git a/src/battlemap/src/View/SideBar/TabMenu/Characters.elm b/src/battlemap/src/View/SubMenu/TabMenu/Characters.elm
index 2eaca27..2eaca27 100644
--- a/src/battlemap/src/View/SideBar/TabMenu/Characters.elm
+++ b/src/battlemap/src/View/SubMenu/TabMenu/Characters.elm
diff --git a/src/battlemap/src/View/SideBar/TabMenu/Settings.elm b/src/battlemap/src/View/SubMenu/TabMenu/Settings.elm
index 3f42739..3f42739 100644
--- a/src/battlemap/src/View/SideBar/TabMenu/Settings.elm
+++ b/src/battlemap/src/View/SubMenu/TabMenu/Settings.elm
diff --git a/src/battlemap/src/View/SideBar/TabMenu/Status.elm b/src/battlemap/src/View/SubMenu/TabMenu/Status.elm
index 1eb3e5e..1eb3e5e 100644
--- a/src/battlemap/src/View/SideBar/TabMenu/Status.elm
+++ b/src/battlemap/src/View/SubMenu/TabMenu/Status.elm
diff --git a/src/battlemap/src/View/SideBar/TabMenu/Status/CharacterInfo.elm b/src/battlemap/src/View/SubMenu/TabMenu/Status/CharacterInfo.elm
index 033426a..033426a 100644
--- a/src/battlemap/src/View/SideBar/TabMenu/Status/CharacterInfo.elm
+++ b/src/battlemap/src/View/SubMenu/TabMenu/Status/CharacterInfo.elm
diff --git a/src/battlemap/src/View/SideBar/TabMenu/Timeline.elm b/src/battlemap/src/View/SubMenu/TabMenu/Timeline.elm
index 1073735..1073735 100644
--- a/src/battlemap/src/View/SideBar/TabMenu/Timeline.elm
+++ b/src/battlemap/src/View/SubMenu/TabMenu/Timeline.elm
diff --git a/src/battlemap/src/View/SideBar/TabMenu/Timeline/Attack.elm b/src/battlemap/src/View/SubMenu/TabMenu/Timeline/Attack.elm
index 0bd59b8..0bd59b8 100644
--- a/src/battlemap/src/View/SideBar/TabMenu/Timeline/Attack.elm
+++ b/src/battlemap/src/View/SubMenu/TabMenu/Timeline/Attack.elm
diff --git a/src/battlemap/src/View/SideBar/TabMenu/Timeline/Movement.elm b/src/battlemap/src/View/SubMenu/TabMenu/Timeline/Movement.elm
index 4e5579a..4e5579a 100644
--- a/src/battlemap/src/View/SideBar/TabMenu/Timeline/Movement.elm
+++ b/src/battlemap/src/View/SubMenu/TabMenu/Timeline/Movement.elm
diff --git a/src/battlemap/src/View/SideBar/TabMenu/Timeline/WeaponSwitch.elm b/src/battlemap/src/View/SubMenu/TabMenu/Timeline/WeaponSwitch.elm
index b64a293..b64a293 100644
--- a/src/battlemap/src/View/SideBar/TabMenu/Timeline/WeaponSwitch.elm
+++ b/src/battlemap/src/View/SubMenu/TabMenu/Timeline/WeaponSwitch.elm
diff --git a/src/battlemap/src/View/SideBar/Targets.elm b/src/battlemap/src/View/SubMenu/Targets.elm
index 7bb4c36..7bb4c36 100644
--- a/src/battlemap/src/View/SideBar/Targets.elm
+++ b/src/battlemap/src/View/SubMenu/Targets.elm
diff --git a/src/battlemap/www/style.css b/src/battlemap/www/style.css
index b3a9e46..ecf5f70 100644
--- a/src/battlemap/www/style.css
+++ b/src/battlemap/www/style.css
@@ -6,13 +6,13 @@
{
display: grid;
- grid-template-columns: 1fr;
+ grid-template-columns: 100%;
grid-template-rows: 2em calc(100% - 4em) 2em;
}
.battlemap-main-menu
{
- grid-row: 1
+ grid-row: 1;
display: flex;
@@ -30,8 +30,7 @@
.battlemap-help
{
- grid-row: 3
-
+ grid-row: 3;
}
/** Main Content **************************************************************/
@@ -90,7 +89,7 @@
}
/** Tab Menu Specifics ********************************************************/
-.battlemap-tabmenu-selector
+.battlemap-main-menu
{
display: flex;
flex-direction: row;
@@ -98,7 +97,7 @@
justify-content: space-between;
}
-.battlemap-tabmenu-selector button
+.battlemap-main-menu button
{
flex: 1;