summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2019-09-06 20:12:37 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2019-09-06 20:12:37 +0200
commit8ef8145f77d6a4d82378b6abd03f62b74dc45118 (patch)
tree367f58d5ce7709243459e895e05e164e94e6f99c /src
parent2d859e80c3e034b9f312df2cd9b2e70cd8766655 (diff)
Working on the UI...
Diffstat (limited to 'src')
-rw-r--r--src/roster-editor/src/Update/SwitchWeapons.elm5
-rw-r--r--src/roster-editor/src/View/CharacterCard.elm223
-rw-r--r--src/roster-editor/src/View/Controlled.elm4
-rw-r--r--src/shared/battle/Battle/View/Attribute.elm20
4 files changed, 139 insertions, 113 deletions
diff --git a/src/roster-editor/src/Update/SwitchWeapons.elm b/src/roster-editor/src/Update/SwitchWeapons.elm
index 40cc7ac..3bc8e71 100644
--- a/src/roster-editor/src/Update/SwitchWeapons.elm
+++ b/src/roster-editor/src/Update/SwitchWeapons.elm
@@ -37,6 +37,11 @@ apply_to model =
)
char
)
+ ),
+ ui =
+ (Struct.UI.set_displayed_tab
+ Struct.UI.WeaponSelectionTab
+ model.ui
)
}
diff --git a/src/roster-editor/src/View/CharacterCard.elm b/src/roster-editor/src/View/CharacterCard.elm
index 4fca090..ca300b7 100644
--- a/src/roster-editor/src/View/CharacterCard.elm
+++ b/src/roster-editor/src/View/CharacterCard.elm
@@ -11,6 +11,9 @@ import Html
import Html.Attributes
import Html.Events
+-- Shared ----------------------------------------------------------------------
+import Util.Html
+
-- Battle ----------------------------------------------------------------------
import Battle.Struct.Omnimods
import Battle.Struct.Attributes
@@ -135,16 +138,29 @@ get_movement_bar char_atts =
)
get_weapon_field_header : (
- Float ->
+ Bool ->
BattleCharacters.Struct.Weapon.Type ->
(Html.Html Struct.Event.Type)
)
-get_weapon_field_header damage_multiplier weapon =
+get_weapon_field_header is_active_wp weapon =
(Html.div
[
(Html.Attributes.class "character-card-header")
]
[
+ (
+ if (is_active_wp)
+ then
+ (Html.div
+ [
+ (Html.Attributes.class "character-card-active-weapon")
+ ]
+ [
+ (Html.text "(Equipped)")
+ ]
+ )
+ else (Util.Html.nothing)
+ ),
(Html.div
[
]
@@ -159,28 +175,6 @@ get_weapon_field_header damage_multiplier weapon =
(Html.div
[
(Html.Attributes.class "omnimod-icon"),
- (Html.Attributes.class "omnimod-icon-dmg")
- ]
- [
- ]
- ),
- (Html.text
- (String.fromInt
- (ceiling
- (
- (toFloat
- (BattleCharacters.Struct.Weapon.get_damage_sum
- weapon
- )
- )
- * damage_multiplier
- )
- )
- )
- ),
- (Html.div
- [
- (Html.Attributes.class "omnimod-icon"),
(Html.Attributes.class "omnimod-icon-range")
]
[
@@ -229,77 +223,44 @@ get_mod_html mod =
]
)
-get_multiplied_mod_html : (
- Float ->
- (String, Int) ->
- (Html.Html Struct.Event.Type)
- )
-get_multiplied_mod_html multiplier mod =
- let
- (category, value) = mod
- in
- (Html.div
- [
- (Html.Attributes.class "character-card-mod")
- ]
- [
- (Html.div
- [
- (Html.Attributes.class "omnimod-icon"),
- (Html.Attributes.class ("omnimod-icon-" ++ category))
- ]
- [
- ]
- ),
- (Html.text
- (String.fromInt (ceiling ((toFloat value) * multiplier)))
- )
- ]
- )
-
get_weapon_details : (
- Float ->
- BattleCharacters.Struct.Weapon.Type ->
+ Struct.UI.Tab ->
Bool ->
+ BattleCharacters.Struct.Weapon.Type ->
(Html.Html Struct.Event.Type)
)
-get_weapon_details damage_multiplier weapon is_active_wp =
- if (is_active_wp)
- then
- (Html.div
- [
- (Html.Attributes.class "character-card-weapon"),
- (Html.Attributes.class "clickable"),
- (Html.Events.onClick
- (Struct.Event.TabSelected Struct.UI.WeaponSelectionTab)
- )
- ]
- [
- (get_weapon_field_header damage_multiplier weapon),
- (Battle.View.Omnimods.get_html_with_modifier
- damage_multiplier
- (BattleCharacters.Struct.Weapon.get_omnimods weapon)
+get_weapon_details current_tab is_active_wp weapon =
+ (Html.div
+ [
+ (Html.Attributes.class "character-card-weapon"),
+ (Html.Attributes.class "clickable"),
+ (Html.Events.onClick
+ (
+ if (is_active_wp)
+ then (Struct.Event.TabSelected Struct.UI.WeaponSelectionTab)
+ else (Struct.Event.SwitchWeapons)
)
- ]
- )
- else
- (Html.div
- [
- (Html.Attributes.class "character-card-weapon-summary"),
- (Html.Attributes.class "clickable"),
- (Html.Events.onClick (Struct.Event.SwitchWeapons))
- ]
- [
- (get_weapon_field_header damage_multiplier weapon)
- ]
- )
+ )
+ ]
+ [
+ (get_weapon_field_header is_active_wp weapon),
+ (
+ if (is_active_wp && (current_tab == Struct.UI.WeaponSelectionTab))
+ then
+ (Battle.View.Omnimods.get_html
+ (BattleCharacters.Struct.Weapon.get_omnimods weapon)
+ )
+ else (Util.Html.nothing)
+ )
+ ]
+ )
get_armor_details : (
- Float ->
+ Struct.UI.Tab ->
BattleCharacters.Struct.Armor.Type ->
(Html.Html Struct.Event.Type)
)
-get_armor_details damage_multiplier armor =
+get_armor_details current_tab armor =
(Html.div
[
(Html.Attributes.class "character-card-armor"),
@@ -317,19 +278,22 @@ get_armor_details damage_multiplier armor =
(Html.text (BattleCharacters.Struct.Armor.get_name armor))
]
),
- (Battle.View.Omnimods.get_html_with_modifier
- damage_multiplier
- (BattleCharacters.Struct.Armor.get_omnimods armor)
+ (
+ if (current_tab == Struct.UI.ArmorSelectionTab)
+ then
+ (Battle.View.Omnimods.get_html
+ (BattleCharacters.Struct.Armor.get_omnimods armor)
+ )
+ else (Util.Html.nothing)
)
]
)
get_glyph_board_details : (
- Float ->
BattleCharacters.Struct.GlyphBoard.Type ->
(Html.Html Struct.Event.Type)
)
-get_glyph_board_details damage_multiplier board =
+get_glyph_board_details board =
(Html.div
[
(Html.Attributes.class "character-card-glyph-board")
@@ -362,16 +326,52 @@ get_glyph_board_details damage_multiplier board =
)
get_relevant_atts : (
+ Battle.Struct.Omnimods.Type ->
Battle.Struct.Attributes.Type ->
(Html.Html Struct.Event.Type)
)
-get_relevant_atts atts =
+get_relevant_atts omnimods atts =
(Html.div
[
- (Html.Attributes.class "character-card-atts"),
- (Html.Attributes.class "clickable")
+ (Html.Attributes.class "character-card-atts")
]
- (Battle.View.Attribute.get_all_but_gauges_html atts)
+ (
+ [
+ (
+ let
+ damage_multiplier =
+ (Battle.Struct.Attributes.get_damage_multiplier atts)
+ in
+ (Html.div
+ [
+ (Html.Attributes.class "omnimod-attack-mods")
+ ]
+ (List.map
+ (
+ \(s, i) ->
+ (get_mod_html
+ (
+ s,
+ (ceiling ((toFloat i) * damage_multiplier))
+ )
+ )
+ )
+ (Battle.Struct.Omnimods.get_attack_mods omnimods)
+ )
+ )
+ ),
+ (Html.div
+ [
+ (Html.Attributes.class "omnimod-defense-mods")
+ ]
+ (List.map
+ (get_mod_html)
+ (Battle.Struct.Omnimods.get_defense_mods omnimods)
+ )
+ )
+ ]
+ ++ (Battle.View.Attribute.get_all_but_gauges_html atts)
+ )
)
--------------------------------------------------------------------------------
@@ -420,16 +420,16 @@ get_minimal_html char =
]
)
-get_full_html : Struct.Character.Type -> (Html.Html Struct.Event.Type)
-get_full_html char =
+get_full_html : (
+ Struct.UI.Tab ->
+ Struct.Character.Type ->
+ (Html.Html Struct.Event.Type)
+ )
+get_full_html current_tab char =
let
base_char = (Struct.Character.get_base_character char)
char_attributes =
(BattleCharacters.Struct.Character.get_attributes base_char)
- damage_multiplier =
- (Battle.Struct.Attributes.get_damage_multiplier
- char_attributes
- )
omnimods = (BattleCharacters.Struct.Character.get_omnimods base_char)
equipment = (BattleCharacters.Struct.Character.get_equipment base_char)
is_using_secondary =
@@ -468,25 +468,24 @@ get_full_html char =
]
),
(get_weapon_details
- damage_multiplier
- (BattleCharacters.Struct.Equipment.get_primary_weapon equipment)
+ current_tab
(not is_using_secondary)
+ (BattleCharacters.Struct.Equipment.get_primary_weapon equipment)
+ ),
+ (get_weapon_details
+ current_tab
+ is_using_secondary
+ (BattleCharacters.Struct.Equipment.get_secondary_weapon
+ equipment
+ )
),
(get_armor_details
- damage_multiplier
+ current_tab
(BattleCharacters.Struct.Equipment.get_armor equipment)
),
(get_glyph_board_details
- damage_multiplier
(BattleCharacters.Struct.Equipment.get_glyph_board equipment)
),
- (get_relevant_atts char_attributes),
- (get_weapon_details
- damage_multiplier
- (BattleCharacters.Struct.Equipment.get_secondary_weapon
- equipment
- )
- is_using_secondary
- )
+ (get_relevant_atts omnimods char_attributes)
]
)
diff --git a/src/roster-editor/src/View/Controlled.elm b/src/roster-editor/src/View/Controlled.elm
index 138add9..702c05f 100644
--- a/src/roster-editor/src/View/Controlled.elm
+++ b/src/roster-editor/src/View/Controlled.elm
@@ -11,6 +11,7 @@ import Util.Html
-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.Model
+import Struct.UI
import View.CharacterCard
@@ -29,8 +30,9 @@ get_html model =
(Html.div
[(Html.Attributes.class "controlled")]
[
- (Html.Lazy.lazy
+ (Html.Lazy.lazy2
(View.CharacterCard.get_full_html)
+ (Struct.UI.get_displayed_tab model.ui)
char
)
]
diff --git a/src/shared/battle/Battle/View/Attribute.elm b/src/shared/battle/Battle/View/Attribute.elm
index ae2edf3..49fe7a8 100644
--- a/src/shared/battle/Battle/View/Attribute.elm
+++ b/src/shared/battle/Battle/View/Attribute.elm
@@ -163,6 +163,10 @@ get_all_html atts =
(get_html
Battle.Struct.Attributes.MovementPoints
(Battle.Struct.Attributes.get_movement_points atts)
+ ),
+ (get_html
+ Battle.Struct.Attributes.DamageModifier
+ (Battle.Struct.Attributes.get_damage_modifier atts)
)
]
@@ -199,6 +203,10 @@ get_all_signed_html atts =
(get_signed_html
Battle.Struct.Attributes.MovementPoints
(Battle.Struct.Attributes.get_movement_points atts)
+ ),
+ (get_signed_html
+ Battle.Struct.Attributes.DamageModifier
+ (Battle.Struct.Attributes.get_damage_modifier atts)
)
]
@@ -227,6 +235,14 @@ get_all_but_gauges_html atts =
(get_html
Battle.Struct.Attributes.CriticalHits
(Battle.Struct.Attributes.get_critical_hits atts)
+ ),
+ (get_html
+ Battle.Struct.Attributes.CriticalHits
+ (Battle.Struct.Attributes.get_critical_hits atts)
+ ),
+ (get_html
+ Battle.Struct.Attributes.DamageModifier
+ (Battle.Struct.Attributes.get_damage_modifier atts)
)
]
@@ -255,5 +271,9 @@ get_all_but_gauges_signed_html atts =
(get_signed_html
Battle.Struct.Attributes.CriticalHits
(Battle.Struct.Attributes.get_critical_hits atts)
+ ),
+ (get_signed_html
+ Battle.Struct.Attributes.DamageModifier
+ (Battle.Struct.Attributes.get_damage_modifier atts)
)
]