summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/battlemap/src/View/Character.elm7
-rw-r--r--src/battlemap/src/View/Controlled.elm2
-rw-r--r--src/battlemap/src/View/Controlled/CharacterCard.elm70
-rw-r--r--src/battlemap/src/View/SubMenu.elm2
-rw-r--r--src/battlemap/src/View/SubMenu/Characters.elm49
-rw-r--r--src/battlemap/www/style.css23
6 files changed, 102 insertions, 51 deletions
diff --git a/src/battlemap/src/View/Character.elm b/src/battlemap/src/View/Character.elm
index 0edb5e0..ec9d661 100644
--- a/src/battlemap/src/View/Character.elm
+++ b/src/battlemap/src/View/Character.elm
@@ -200,6 +200,13 @@ get_portrait_html viewer_id char =
)
),
(Html.Attributes.class "battlemap-character-portrait"),
+ (Html.Attributes.class
+ (
+ "battlemap-character-portrait-team-"
+ ++
+ (Struct.Character.get_player_id char)
+ )
+ ),
(Html.Events.onClick
(Struct.Event.LookingForCharacter (Struct.Character.get_ref char))
)
diff --git a/src/battlemap/src/View/Controlled.elm b/src/battlemap/src/View/Controlled.elm
index 8449741..9b78b57 100644
--- a/src/battlemap/src/View/Controlled.elm
+++ b/src/battlemap/src/View/Controlled.elm
@@ -106,7 +106,7 @@ get_html model =
(Html.div
[(Html.Attributes.class "battlemap-controlled")]
[
- (View.Controlled.CharacterCard.get_html
+ (View.Controlled.CharacterCard.get_summary_html
model
char
(Struct.WeaponSet.get_active_weapon
diff --git a/src/battlemap/src/View/Controlled/CharacterCard.elm b/src/battlemap/src/View/Controlled/CharacterCard.elm
index 913aaa0..dab163a 100644
--- a/src/battlemap/src/View/Controlled/CharacterCard.elm
+++ b/src/battlemap/src/View/Controlled/CharacterCard.elm
@@ -1,4 +1,9 @@
-module View.Controlled.CharacterCard exposing (get_html)
+module View.Controlled.CharacterCard exposing
+ (
+ get_minimal_html,
+ get_summary_html,
+ get_full_html
+ )
-- Elm -------------------------------------------------------------------------
import Html
@@ -297,13 +302,72 @@ get_relevant_stats model char weapon =
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_html : (
+get_minimal_html : (
+ Struct.Model.Type ->
+ Struct.Character.Type ->
+ (Html.Html Struct.Event.Type)
+ )
+get_minimal_html model char =
+ (Html.div
+ [
+ (Html.Attributes.class "battlemap-character-card"),
+ (Html.Attributes.class "battlemap-character-card-minimal")
+ ]
+ [
+ (get_name char),
+ (Html.div
+ [
+ (Html.Attributes.class "battlemap-character-card-top")
+ ]
+ [
+ (View.Character.get_portrait_html model.player_id char),
+ (get_health_bar char),
+ (get_movement_bar model char)
+ ]
+ )
+ ]
+ )
+
+get_summary_html : (
+ Struct.Model.Type ->
+ Struct.Character.Type ->
+ Struct.Weapon.Type ->
+ (Html.Html Struct.Event.Type)
+ )
+get_summary_html model char weapon =
+ (Html.div
+ [
+ (Html.Attributes.class "battlemap-character-card")
+ ]
+ [
+ (get_name char),
+ (Html.div
+ [
+ (Html.Attributes.class "battlemap-character-card-top")
+ ]
+ [
+ (View.Character.get_portrait_html model.player_id char),
+ (get_health_bar char),
+ (get_movement_bar model char)
+ ]
+ ),
+ (get_weapon_details
+ model
+ (Struct.Character.get_statistics char)
+ weapon
+ ),
+ (get_armor_details (Struct.Character.get_armor char)),
+ (get_relevant_stats model char weapon)
+ ]
+ )
+
+get_full_html : (
Struct.Model.Type ->
Struct.Character.Type ->
Struct.Weapon.Type ->
(Html.Html Struct.Event.Type)
)
-get_html model char weapon =
+get_full_html model char weapon =
(Html.div
[
(Html.Attributes.class "battlemap-character-card")
diff --git a/src/battlemap/src/View/SubMenu.elm b/src/battlemap/src/View/SubMenu.elm
index f582329..b23273e 100644
--- a/src/battlemap/src/View/SubMenu.elm
+++ b/src/battlemap/src/View/SubMenu.elm
@@ -66,7 +66,7 @@ get_html model =
[(Html.Attributes.class "battlemap-sub-menu")]
[
(Html.text "Targeting:"),
- (View.Controlled.CharacterCard.get_html
+ (View.Controlled.CharacterCard.get_summary_html
model
char
(Struct.WeaponSet.get_active_weapon
diff --git a/src/battlemap/src/View/SubMenu/Characters.elm b/src/battlemap/src/View/SubMenu/Characters.elm
index a4ed10e..6e19619 100644
--- a/src/battlemap/src/View/SubMenu/Characters.elm
+++ b/src/battlemap/src/View/SubMenu/Characters.elm
@@ -12,54 +12,24 @@ import Struct.Character
import Struct.Event
import Struct.Model
-import View.Character
+import View.Controlled.CharacterCard
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_character_text_html : Struct.Character.Type -> (Html.Html Struct.Event.Type)
-get_character_text_html char =
- (Html.div
- [
- (Html.Attributes.class "clickable"),
- (Html.Events.onClick
- (Struct.Event.CharacterInfoRequested
- (Struct.Character.get_ref char)
- )
- )
- ]
- [
- (Html.text
- (
- (Struct.Character.get_name char)
- ++ ": "
- ++ (toString (Struct.Character.get_current_health char))
- ++ " HP, "
- ++
- (
- if (Struct.Character.is_enabled char)
- then
- "active"
- else
- "inactive"
- )
- ++ " (Player "
- ++ (Struct.Character.get_player_id char)
- ++ ")."
- )
- )
- ]
- )
-
get_character_element_html : (
- String ->
+ Struct.Model.Type ->
Struct.Character.Type ->
(Html.Html Struct.Event.Type)
)
-get_character_element_html viewer_id char =
+get_character_element_html model char =
(Html.div
[
(Html.Attributes.class "battlemap-characters-element"),
+ (Html.Attributes.class "clickable"),
+ (Html.Events.onClick
+ (Struct.Event.LookingForCharacter (Struct.Character.get_ref char))
+ ),
(
if (Struct.Character.is_enabled char)
then
@@ -69,8 +39,7 @@ get_character_element_html viewer_id char =
)
]
[
- (View.Character.get_portrait_html viewer_id char),
- (get_character_text_html char)
+ (View.Controlled.CharacterCard.get_minimal_html model char)
]
)
@@ -85,7 +54,7 @@ get_html model =
(Html.Attributes.class "battlemap-tabmenu-characters-tab")
]
(List.map
- (get_character_element_html model.player_id)
+ (get_character_element_html model)
(Dict.values model.characters)
)
)
diff --git a/src/battlemap/www/style.css b/src/battlemap/www/style.css
index 356358d..5a80563 100644
--- a/src/battlemap/www/style.css
+++ b/src/battlemap/www/style.css
@@ -181,8 +181,6 @@
{
display: flex;
flex-flow: column;
- margin-left: 0.2em;
- margin-right: 0.2em;
}
.battlemap-character-card-top
@@ -190,6 +188,7 @@
display: grid;
grid-template-columns: [col] auto [col] 1fr;
grid-template-rows: [row] 1em [row] 1fr [row] 1em [row] 1fr [row] 1em;
+ grid-column-gap: 0.5em;
align-items: center;
justify-content: left;
@@ -200,8 +199,23 @@
grid-column: col 1;
grid-row: row 1 / span 6;
margin: 0;
+ box-sizing: border-box;
+ box-shadow:
+ 1px 0px 2px #333,
+ -1px 0px 2px #333,
+ 0px 1px 2px #333,
+ 0px -1px 2px #333;
}
+.battlemap-character-portrait-team-0 { background-color: #396AB1; }
+.battlemap-character-portrait-team-1 { background-color: #CC2529; }
+.battlemap-character-portrait-team-2 { background-color: #3E9651; }
+.battlemap-character-portrait-team-3 { background-color: #DA7C30; }
+.battlemap-character-portrait-team-4 { background-color: #535154; }
+.battlemap-character-portrait-team-5 { background-color: #6B4C9A; }
+.battlemap-character-portrait-team-6 { background-color: #7FA7A9; }
+.battlemap-character-portrait-team-7 { background-color: #E7A7A9; }
+
.battlemap-character-card-name
{
text-align: center;
@@ -244,7 +258,6 @@
{
grid-column: col 2;
grid-row: row 2;
- width: 100%;
height: 100%;
}
@@ -257,7 +270,6 @@
{
grid-column: col 2;
grid-row: row 4;
- width: 100%;
height: 100%;
}
@@ -347,7 +359,6 @@
.battlemap-character-portrait
{
- margin: 0.5em;
box-sizing: border-box;
border-radius: 5px;
background-size: 100% 100%;
@@ -385,7 +396,7 @@
border-radius: 5px;
border: 1px solid #502D16;
border-bottom-width: 2px;
- padding: 0.05em;
+ padding: 0.5em;
}
.battlemap-tabmenu-characters-tab .battlemap-character-portrait