summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map-editor/src/Comm/Send.elm1
-rw-r--r--src/map-editor/src/Comm/SetMap.elm6
-rw-r--r--src/map-editor/src/Constants/IO.elm.m42
-rw-r--r--src/map-editor/src/ElmModule/View.elm6
-rw-r--r--src/map-editor/src/Struct/HelpRequest.elm1
-rw-r--r--src/map-editor/src/Struct/Map.elm8
-rw-r--r--src/map-editor/src/Struct/Model.elm21
-rw-r--r--src/map-editor/src/Struct/Tile.elm4
-rw-r--r--src/map-editor/src/Struct/Toolbox.elm181
-rw-r--r--src/map-editor/src/Struct/UI.elm4
-rw-r--r--src/map-editor/src/Update/HandleServerReply.elm8
-rw-r--r--src/map-editor/src/Update/SelectTile.elm12
-rw-r--r--src/map-editor/src/View/MainMenu.elm2
-rw-r--r--src/map-editor/src/View/Map.elm88
-rw-r--r--src/map-editor/src/View/Map/Character.elm218
-rw-r--r--src/map-editor/src/View/Map/Navigator.elm245
-rw-r--r--src/map-editor/src/View/Map/Tile.elm8
-rw-r--r--src/map-editor/src/View/MessageBoard.elm10
-rw-r--r--src/map-editor/src/View/MessageBoard/Animator.elm57
-rw-r--r--src/map-editor/src/View/MessageBoard/Animator/Attack.elm297
-rw-r--r--src/map-editor/src/View/MessageBoard/Error.elm4
-rw-r--r--src/map-editor/src/View/MessageBoard/Help.elm8
-rw-r--r--src/map-editor/src/View/MessageBoard/Help/Guide.elm56
-rw-r--r--src/map-editor/src/View/MessageBoard/Help/Rank.elm97
-rw-r--r--src/map-editor/src/View/SubMenu.elm42
-rw-r--r--src/map-editor/src/View/SubMenu/Characters.elm69
-rw-r--r--src/map-editor/src/View/SubMenu/Settings.elm24
-rw-r--r--src/map-editor/src/View/SubMenu/Status.elm16
-rw-r--r--src/map-editor/src/View/SubMenu/Status/CharacterInfo.elm2
-rw-r--r--src/map-editor/src/View/SubMenu/Status/TileInfo.elm20
-rw-r--r--src/map-editor/src/View/SubMenu/Tiles.elm27
-rw-r--r--src/map-editor/src/View/ToolBox.elm133
-rw-r--r--src/map-editor/src/View/Toolbox.elm27
33 files changed, 319 insertions, 1385 deletions
diff --git a/src/map-editor/src/Comm/Send.elm b/src/map-editor/src/Comm/Send.elm
index cbb6a28..2b9c4aa 100644
--- a/src/map-editor/src/Comm/Send.elm
+++ b/src/map-editor/src/Comm/Send.elm
@@ -8,6 +8,7 @@ import Json.Encode
-- Battlemap -------------------------------------------------------------------
import Comm.AddTile
+import Comm.Okay
import Comm.SetMap
import Struct.Event
diff --git a/src/map-editor/src/Comm/SetMap.elm b/src/map-editor/src/Comm/SetMap.elm
index dc499cf..754c82b 100644
--- a/src/map-editor/src/Comm/SetMap.elm
+++ b/src/map-editor/src/Comm/SetMap.elm
@@ -3,8 +3,8 @@ module Comm.SetMap exposing (decode)
-- Elm -------------------------------------------------------------------------
import Json.Decode
--- Battlemap -------------------------------------------------------------------
-import Struct.Battlemap
+-- Map -------------------------------------------------------------------------
+import Struct.Map
import Struct.ServerReply
import Struct.Tile
@@ -34,7 +34,7 @@ deserialize_tile_instance map_width index id =
internal_decoder : MapData -> Struct.ServerReply.Type
internal_decoder map_data =
(Struct.ServerReply.SetMap
- (Struct.Battlemap.new
+ (Struct.Map.new
map_data.w
map_data.h
(List.indexedMap
diff --git a/src/map-editor/src/Constants/IO.elm.m4 b/src/map-editor/src/Constants/IO.elm.m4
index 645ad14..07043dc 100644
--- a/src/map-editor/src/Constants/IO.elm.m4
+++ b/src/map-editor/src/Constants/IO.elm.m4
@@ -10,7 +10,7 @@ map_update_handler : String
map_update_handler = (map_editor_handler_url ++ "/me_update")
map_loading_handler : String
-map_loading_handler = (map_edit_handler_url ++ "/me_load_state")
+map_loading_handler = (map_editor_handler_url ++ "/me_load_state")
tile_assets_url : String
tile_assets_url = (base_url ++ "/asset/svg/tile/")
diff --git a/src/map-editor/src/ElmModule/View.elm b/src/map-editor/src/ElmModule/View.elm
index de86372..40ec9b0 100644
--- a/src/map-editor/src/ElmModule/View.elm
+++ b/src/map-editor/src/ElmModule/View.elm
@@ -12,7 +12,7 @@ import Struct.Event
import Struct.Model
import View.Map
-import View.Controlled
+import View.Toolbox
import View.MessageBoard
import View.MainMenu
import View.SubMenu
@@ -32,8 +32,8 @@ view model =
]
[
(View.MainMenu.get_html),
- (Html.Lazy.lazy2
- (View.ToolBox.get_html)
+ (Html.Lazy.lazy
+ (View.Toolbox.get_html)
model.toolbox
),
(Html.div
diff --git a/src/map-editor/src/Struct/HelpRequest.elm b/src/map-editor/src/Struct/HelpRequest.elm
index 92d80eb..774ecdc 100644
--- a/src/map-editor/src/Struct/HelpRequest.elm
+++ b/src/map-editor/src/Struct/HelpRequest.elm
@@ -10,4 +10,3 @@ import Struct.Toolbox
--------------------------------------------------------------------------------
type Type =
None
- | HelpOnTool Struct.Toolbox.Tool
diff --git a/src/map-editor/src/Struct/Map.elm b/src/map-editor/src/Struct/Map.elm
index b5ee795..d6a9cea 100644
--- a/src/map-editor/src/Struct/Map.elm
+++ b/src/map-editor/src/Struct/Map.elm
@@ -6,7 +6,7 @@ module Struct.Map exposing
get_width,
get_height,
get_tiles,
- get_movement_cost_function,
+ set_tile_to,
solve_tiles,
try_getting_tile_at
)
@@ -56,6 +56,12 @@ get_height map = map.height
get_tiles : Type -> (Array.Array Struct.Tile.Instance)
get_tiles map = map.content
+set_tile_to : Struct.Location.Type -> Struct.Tile.Instance -> Type -> Type
+set_tile_to loc tile_inst map =
+ {map |
+ content = (Array.set (location_to_index loc map) tile_inst map.content)
+ }
+
empty : Type
empty =
{
diff --git a/src/map-editor/src/Struct/Model.elm b/src/map-editor/src/Struct/Model.elm
index 4f089ec..634867e 100644
--- a/src/map-editor/src/Struct/Model.elm
+++ b/src/map-editor/src/Struct/Model.elm
@@ -14,11 +14,12 @@ import Array
import Dict
-- Map -------------------------------------------------------------------
-import Struct.Map
import Struct.Error
import Struct.Flags
import Struct.HelpRequest
+import Struct.Map
import Struct.Tile
+import Struct.Toolbox
import Struct.UI
import Util.Array
@@ -28,12 +29,13 @@ import Util.Array
--------------------------------------------------------------------------------
type alias Type =
{
+ toolbox: Struct.Toolbox.Type,
help_request: Struct.HelpRequest.Type,
map: Struct.Map.Type,
tiles: (Dict.Dict Struct.Tile.Ref Struct.Tile.Type),
error: (Maybe Struct.Error.Type),
player_id: String,
- map_id: String,
+ map_ix: String,
session_token: String,
ui: Struct.UI.Type
}
@@ -48,14 +50,15 @@ type alias Type =
new : Struct.Flags.Type -> Type
new flags =
let
- maybe_map_id = (Struct.Flags.maybe_get_param "id" flags)
+ maybe_map_ix = (Struct.Flags.maybe_get_param "id" flags)
model =
{
+ toolbox = (Struct.Toolbox.default),
help_request = Struct.HelpRequest.None,
map = (Struct.Map.empty),
tiles = (Dict.empty),
error = Nothing,
- map_id = "",
+ map_ix = "",
player_id =
(
if (flags.user_id == "")
@@ -66,7 +69,7 @@ new flags =
ui = (Struct.UI.default)
}
in
- case maybe_map_id of
+ case maybe_map_ix of
Nothing ->
(invalidate
(Struct.Error.new
@@ -76,7 +79,7 @@ new flags =
model
)
- (Just id) -> {model | map_id = id}
+ (Just id) -> {model | map_ix = id}
add_tile : Struct.Tile.Type -> Type -> Type
add_tile tl model =
@@ -92,12 +95,10 @@ add_tile tl model =
reset : Type -> Type
reset model =
{model |
+ toolbox = (Struct.Toolbox.default),
help_request = Struct.HelpRequest.None,
error = Nothing,
- ui =
- (Struct.UI.reset_displayed_nav
- (Struct.UI.set_previous_action Nothing model.ui)
- )
+ ui = (Struct.UI.set_previous_action Nothing model.ui)
}
invalidate : Struct.Error.Type -> Type -> Type
diff --git a/src/map-editor/src/Struct/Tile.elm b/src/map-editor/src/Struct/Tile.elm
index a683be3..d1ba4cf 100644
--- a/src/map-editor/src/Struct/Tile.elm
+++ b/src/map-editor/src/Struct/Tile.elm
@@ -4,6 +4,7 @@ module Struct.Tile exposing
Type,
Instance,
new,
+ clone_instance,
new_instance,
error_tile_instance,
get_id,
@@ -112,6 +113,9 @@ new id name crossing_cost range_minimum range_maximum =
range_maximum = range_maximum
}
+clone_instance : Struct.Location.Type -> Instance -> Instance
+clone_instance loc inst = {inst | location = loc}
+
new_instance : Int -> Int -> Int -> Int -> Int -> Instance
new_instance x y icon_id crossing_cost type_id =
{
diff --git a/src/map-editor/src/Struct/Toolbox.elm b/src/map-editor/src/Struct/Toolbox.elm
index 81f7c2a..9b95948 100644
--- a/src/map-editor/src/Struct/Toolbox.elm
+++ b/src/map-editor/src/Struct/Toolbox.elm
@@ -1,15 +1,188 @@
-module Struct.Toolbox exposing (Tool(..))
+module Struct.Toolbox exposing
+ (
+ Type,
+ Mode(..),
+ Shape(..),
+ apply_to,
+ is_selected,
+ clear_selection,
+ set_template,
+ set_mode,
+ set_shape,
+ get_template,
+ get_mode,
+ get_shape,
+ get_selection,
+ default
+ )
-- Elm -------------------------------------------------------------------------
-- Battlemap -------------------------------------------------------------------
-import Struct.Toolbox
+import Struct.Location
+import Struct.Map
+import Struct.Tile
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-type Tool =
+type alias Type =
+ {
+ template : Struct.Tile.Instance,
+ mode : Mode,
+ shape : Shape,
+ selection : (List Struct.Location.Type),
+ square_corner : (Maybe Struct.Location.Type)
+ }
+
+type Mode =
+ Draw
+ | RemoveSelection
+ | AddSelection
+
+type Shape =
Simple
- | Select
| Fill
| Square
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+apply_mode_to : (
+ Struct.Location.Type ->
+ (Type, Struct.Map.Type) ->
+ (Type, Struct.Map.Type)
+ )
+apply_mode_to loc (tb, map) =
+ case tb.mode of
+ Draw ->
+ (
+ tb,
+ (Struct.Map.set_tile_to
+ loc
+ (Struct.Tile.clone_instance loc tb.template)
+ map
+ )
+ )
+
+ RemoveSelection ->
+ (
+ {tb |
+ selection = (List.filter (\e -> (e /= loc)) tb.selection)
+ },
+ map
+ )
+
+ AddSelection ->
+ (
+ (
+ if (List.member loc tb.selection)
+ then tb
+ else
+ {tb |
+ selection = (loc :: tb.selection)
+ }
+ ),
+ map
+ )
+
+get_filled_tiles : (
+ Struct.Location.Type ->
+ Struct.Map.Type ->
+ (List Struct.Location.Type)
+ )
+get_filled_tiles loc map =
+ -- TODO: unimplemented
+ []
+
+get_square_tiles : (
+ Struct.Location.Type ->
+ Struct.Location.Type ->
+ Struct.Map.Type ->
+ (List Struct.Location.Type)
+ )
+get_square_tiles new_loc corner map =
+ -- TODO: unimplemented
+ []
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+default : Type
+default =
+ {
+ template = (Struct.Tile.error_tile_instance 0 0),
+ mode = Draw,
+ shape = Simple,
+ selection = [],
+ square_corner = Nothing
+ }
+
+get_template : Type -> Struct.Tile.Instance
+get_template tb = tb.template
+
+get_mode : Type -> Mode
+get_mode tb = tb.mode
+
+get_shape : Type -> Shape
+get_shape tb = tb.shape
+
+get_selection : Type -> (List Struct.Location.Type)
+get_selection tb = tb.selection
+
+set_template : Struct.Tile.Instance -> Type -> Type
+set_template template tb =
+ {tb |
+ template = template
+ }
+
+set_mode : Mode -> Type -> Type
+set_mode mode tb =
+ {tb |
+ mode = mode,
+ square_corner = Nothing
+ }
+
+set_shape : Shape -> Type -> Type
+set_shape shape tb =
+ {tb |
+ shape = shape,
+ square_corner = Nothing
+ }
+
+clear_selection : Type -> Type
+clear_selection tb =
+ {tb |
+ selection = [],
+ square_corner = Nothing
+ }
+
+is_selected : Type -> Struct.Location.Type -> Bool
+is_selected tb loc =
+ (List.member loc tb.selection)
+
+apply_to : (
+ Struct.Location.Type ->
+ Type ->
+ Struct.Map.Type ->
+ (Type, Struct.Map.Type)
+ )
+apply_to loc tb map =
+ case tb.shape of
+ Simple -> (apply_mode_to loc (tb, map))
+ Fill ->
+ (List.foldl
+ (apply_mode_to)
+ (tb, map)
+ (get_filled_tiles loc map)
+ )
+
+ Square ->
+ case tb.square_corner of
+ Nothing -> ({tb | square_corner = (Just loc)}, map)
+ (Just corner) ->
+ (List.foldl
+ (apply_mode_to)
+ (tb, map)
+ (get_square_tiles loc corner map)
+ )
diff --git a/src/map-editor/src/Struct/UI.elm b/src/map-editor/src/Struct/UI.elm
index aa83bd6..fe7b700 100644
--- a/src/map-editor/src/Struct/UI.elm
+++ b/src/map-editor/src/Struct/UI.elm
@@ -14,10 +14,6 @@ module Struct.UI exposing
reset_displayed_tab,
to_string,
get_all_tabs,
- -- Navigator
- try_getting_displayed_nav,
- set_displayed_nav,
- reset_displayed_nav,
-- Previous Action
get_previous_action,
set_previous_action
diff --git a/src/map-editor/src/Update/HandleServerReply.elm b/src/map-editor/src/Update/HandleServerReply.elm
index 8d5f07d..2622cf2 100644
--- a/src/map-editor/src/Update/HandleServerReply.elm
+++ b/src/map-editor/src/Update/HandleServerReply.elm
@@ -89,5 +89,9 @@ apply_to model query_result =
(Result.Ok commands) ->
case (List.foldl (apply_command) (model, Nothing) commands) of
- (updated_model, Nothing) -> updated_model
- (_, (Just error)) -> (Struct.Model.invalidate error model)
+ (updated_model, Nothing) -> (updated_model, Cmd.none)
+ (_, (Just error)) ->
+ (
+ (Struct.Model.invalidate error model),
+ Cmd.none
+ )
diff --git a/src/map-editor/src/Update/SelectTile.elm b/src/map-editor/src/Update/SelectTile.elm
index e6bb9fd..f1c0e07 100644
--- a/src/map-editor/src/Update/SelectTile.elm
+++ b/src/map-editor/src/Update/SelectTile.elm
@@ -25,13 +25,11 @@ apply_to model loc_ref =
(
{model |
ui =
- (Struct.UI.reset_displayed_nav
- (Struct.UI.set_displayed_tab
- Struct.UI.StatusTab
- (Struct.UI.set_previous_action
- (Just (Struct.UI.SelectedLocation loc_ref))
- model.ui
- )
+ (Struct.UI.set_displayed_tab
+ Struct.UI.StatusTab
+ (Struct.UI.set_previous_action
+ (Just (Struct.UI.SelectedLocation loc_ref))
+ model.ui
)
)
},
diff --git a/src/map-editor/src/View/MainMenu.elm b/src/map-editor/src/View/MainMenu.elm
index f301ea6..b9a8922 100644
--- a/src/map-editor/src/View/MainMenu.elm
+++ b/src/map-editor/src/View/MainMenu.elm
@@ -29,7 +29,7 @@ get_html : (Html.Html Struct.Event.Type)
get_html =
(Html.div
[
- (Html.Attributes.class "battlemap-main-menu")
+ (Html.Attributes.class "map-main-menu")
]
(List.map
(get_menu_button_html)
diff --git a/src/map-editor/src/View/Map.elm b/src/map-editor/src/View/Map.elm
index c185486..f3caa95 100644
--- a/src/map-editor/src/View/Map.elm
+++ b/src/map-editor/src/View/Map.elm
@@ -1,4 +1,4 @@
-module View.Battlemap exposing (get_html)
+module View.Map exposing (get_html)
-- Elm -------------------------------------------------------------------------
import Array
@@ -9,30 +9,26 @@ import Html.Lazy
import List
--- Battlemap -------------------------------------------------------------------
+-- Map -------------------------------------------------------------------------
import Constants.UI
-import Struct.Battlemap
-import Struct.Character
+import Struct.Map
import Struct.Event
import Struct.Model
-import Struct.Navigator
import Struct.UI
import Util.Html
-import View.Battlemap.Character
-import View.Battlemap.Navigator
-import View.Battlemap.Tile
+import View.Map.Tile
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_tiles_html : Struct.Battlemap.Type -> (Html.Html Struct.Event.Type)
-get_tiles_html battlemap =
+get_tiles_html : Struct.Map.Type -> (Html.Html Struct.Event.Type)
+get_tiles_html map =
(Html.div
[
- (Html.Attributes.class "battlemap-tiles-layer"),
+ (Html.Attributes.class "map-tiles-layer"),
(Html.Attributes.style
[
(
@@ -40,7 +36,7 @@ get_tiles_html battlemap =
(
(toString
(
- (Struct.Battlemap.get_width battlemap)
+ (Struct.Map.get_width map)
* Constants.UI.tile_size
)
)
@@ -52,7 +48,7 @@ get_tiles_html battlemap =
(
(toString
(
- (Struct.Battlemap.get_height battlemap)
+ (Struct.Map.get_height map)
* Constants.UI.tile_size
)
)
@@ -63,53 +59,8 @@ get_tiles_html battlemap =
)
]
(List.map
- (View.Battlemap.Tile.get_html)
- (Array.toList (Struct.Battlemap.get_tiles battlemap))
- )
- )
-
-maybe_print_navigator : (
- Bool ->
- (Maybe Struct.Navigator.Type) ->
- (Html.Html Struct.Event.Type)
- )
-maybe_print_navigator interactive maybe_nav =
- let
- name_suffix =
- if (interactive)
- then
- "interactive"
- else
- "non-interactive"
- in
- case maybe_nav of
- (Just nav) ->
- (Html.div
- [
- (Html.Attributes.class ("battlemap-navigator" ++ name_suffix))
- ]
- (View.Battlemap.Navigator.get_html
- (Struct.Navigator.get_summary nav)
- interactive
- )
- )
-
- Nothing ->
- (Util.Html.nothing)
-
-get_characters_html : (
- Struct.Model.Type ->
- (Array.Array Struct.Character.Type) ->
- (Html.Html Struct.Event.Type)
- )
-get_characters_html model characters =
- (Html.div
- [
- (Html.Attributes.class "battlemap-characters")
- ]
- (List.map
- (View.Battlemap.Character.get_html model)
- (Array.toList model.characters)
+ (View.Map.Tile.get_html)
+ (Array.toList (Struct.Map.get_tiles map))
)
)
@@ -123,7 +74,7 @@ get_html : (
get_html model =
(Html.div
[
- (Html.Attributes.class "battlemap-actual"),
+ (Html.Attributes.class "map-actual"),
(Html.Attributes.style
(
if ((Struct.UI.get_zoom_level model.ui) == 1)
@@ -144,19 +95,6 @@ get_html model =
)
]
[
- (Html.Lazy.lazy (get_tiles_html) model.battlemap),
- -- Not in lazy mode, because I can't easily get rid of that 'model'
- -- parameter.
- (get_characters_html model model.characters),
- (Html.Lazy.lazy2
- (maybe_print_navigator)
- True
- model.char_turn.navigator
- ),
- (Html.Lazy.lazy2
- (maybe_print_navigator)
- False
- (Struct.UI.try_getting_displayed_nav model.ui)
- )
+ (Html.Lazy.lazy (get_tiles_html) model.map)
]
)
diff --git a/src/map-editor/src/View/Map/Character.elm b/src/map-editor/src/View/Map/Character.elm
deleted file mode 100644
index fa1bdc1..0000000
--- a/src/map-editor/src/View/Map/Character.elm
+++ /dev/null
@@ -1,218 +0,0 @@
-module View.Battlemap.Character exposing (get_html)
-
--- Elm -------------------------------------------------------------------------
-import Html
-import Html.Attributes
-import Html.Events
-
--- Battlemap ------------------------------------------------------------------
-import Constants.UI
-
-import Util.Html
-
-import Struct.Character
-import Struct.CharacterTurn
-import Struct.Event
-import Struct.Model
-import Struct.TurnResult
-import Struct.TurnResultAnimator
-import Struct.UI
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_animation_class : (
- Struct.Model.Type ->
- Struct.Character.Type ->
- (Html.Attribute Struct.Event.Type)
- )
-get_animation_class model char =
- case model.animator of
- 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
- (
- (Struct.TurnResult.get_actor_index current_action)
- /=
- (Struct.Character.get_index char)
- )
- then
- (Html.Attributes.class "")
- else
- case current_action of
- (Struct.TurnResult.Moved _) ->
- (Html.Attributes.class
- "battlemap-animated-character-icon"
- )
-
- _ -> (Html.Attributes.class "")
- _ -> (Html.Attributes.class "")
-
-get_activation_level_class : (
- Struct.Character.Type ->
- (Html.Attribute Struct.Event.Type)
- )
-get_activation_level_class char =
- if (Struct.Character.is_enabled char)
- then
- (Html.Attributes.class "battlemap-character-icon-enabled")
- else
- (Html.Attributes.class "battlemap-character-icon-disabled")
-
-get_alliance_class : (
- Struct.Model.Type ->
- Struct.Character.Type ->
- (Html.Attribute Struct.Event.Type)
- )
-get_alliance_class model char =
- if ((Struct.Character.get_player_ix char) == model.player_ix)
- then
- (Html.Attributes.class "battlemap-character-ally")
- else
- (Html.Attributes.class "battlemap-character-enemy")
-
-get_position_style : (
- Struct.Character.Type ->
- (Html.Attribute Struct.Event.Type)
- )
-get_position_style char =
- let char_loc = (Struct.Character.get_location char) in
- (Html.Attributes.style
- [
- ("top", ((toString (char_loc.y * Constants.UI.tile_size)) ++ "px")),
- ("left", ((toString (char_loc.x * Constants.UI.tile_size)) ++ "px"))
- ]
- )
-
-get_focus_class : (
- Struct.Model.Type ->
- Struct.Character.Type ->
- (Html.Attribute Struct.Event.Type)
- )
-get_focus_class model char =
- if
- (
- (Struct.UI.get_previous_action model.ui)
- ==
- (Just (Struct.UI.SelectedCharacter (Struct.Character.get_index char)))
- )
- then
- (Html.Attributes.class "battlemap-character-selected")
- else
- if
- (
- (Struct.CharacterTurn.try_getting_target model.char_turn)
- ==
- (Just (Struct.Character.get_index char))
- )
- then
- (Html.Attributes.class "battlemap-character-targeted")
- else
- (Html.Attributes.class "")
-
-get_body_html : Struct.Character.Type -> (Html.Html Struct.Event.Type)
-get_body_html char =
- (Html.div
- [
- (Html.Attributes.class "battlemap-character-icon-body"),
- (Html.Attributes.class
- (
- "asset-character-team-body-"
- ++ (toString (Struct.Character.get_player_ix char))
- )
- )
- ]
- [
- ]
- )
-
-get_head_html : Struct.Character.Type -> (Html.Html Struct.Event.Type)
-get_head_html char =
- (Html.div
- [
- (Html.Attributes.class "battlemap-character-icon-head"),
- (Html.Attributes.class
- ("asset-character-icon-" ++ (Struct.Character.get_icon_id char))
- )
- ]
- [
- ]
- )
-
-get_banner_html : Struct.Character.Type -> (Html.Html Struct.Event.Type)
-get_banner_html char =
- case (Struct.Character.get_rank char) of
- Struct.Character.Commander ->
- (Html.div
- [
- (Html.Attributes.class "battlemap-character-icon-banner"),
- (Html.Attributes.class "asset-character-icon-commander-banner")
- ]
- [
- ]
- )
-
- Struct.Character.Target ->
- (Html.div
- [
- (Html.Attributes.class "battlemap-character-icon-banner"),
- (Html.Attributes.class "asset-character-icon-target-banner")
- ]
- [
- ]
- )
-
- _ -> (Util.Html.nothing)
-
-get_actual_html : (
- Struct.Model.Type ->
- Struct.Character.Type ->
- (Html.Html Struct.Event.Type)
- )
-get_actual_html model char =
- (Html.div
- [
- (Html.Attributes.class "battlemap-tiled"),
- (Html.Attributes.class "battlemap-character-icon"),
- (get_animation_class model char),
- (get_activation_level_class char),
- (get_alliance_class model char),
- (get_position_style char),
- (get_focus_class model char),
- (Html.Attributes.class "clickable"),
- (Html.Events.onClick
- (Struct.Event.CharacterSelected
- (Struct.Character.get_index char)
- )
- )
- ]
- [
- (get_body_html char),
- (get_head_html char),
- (get_banner_html char)
- ]
- )
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_html : (
- Struct.Model.Type ->
- Struct.Character.Type ->
- (Html.Html Struct.Event.Type)
- )
-get_html model char =
- if (Struct.Character.is_alive char)
- then
- (get_actual_html model char)
- else
- (Util.Html.nothing)
diff --git a/src/map-editor/src/View/Map/Navigator.elm b/src/map-editor/src/View/Map/Navigator.elm
deleted file mode 100644
index a03e7d0..0000000
--- a/src/map-editor/src/View/Map/Navigator.elm
+++ /dev/null
@@ -1,245 +0,0 @@
-module View.Battlemap.Navigator exposing (get_html)
-
--- Elm -------------------------------------------------------------------------
-import Html
-import Html.Attributes
-import Html.Events
-
-import List
-
--- Battlemap -------------------------------------------------------------------
-import Constants.UI
-
-import Struct.Direction
-import Struct.Event
-import Struct.Location
-import Struct.Marker
-import Struct.Navigator
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-marker_get_html : (
- Bool ->
- (Struct.Location.Ref, Struct.Marker.Type) ->
- (Html.Html Struct.Event.Type)
- )
-marker_get_html is_interactive (loc_ref, marker) =
- (Html.div
- (
- [
- (Html.Attributes.class "battlemap-marker-icon"),
- (Html.Attributes.class "battlemap-tiled"),
- (Html.Attributes.class
- (
- "battlemap-"
- ++
- (
- case marker of
- Struct.Marker.CanGoToCanDefend -> "can-go-to-can-defend"
- Struct.Marker.CanGoToCantDefend ->
- "can-go-to-cant-defend"
-
- Struct.Marker.CanAttackCanDefend ->
- "can-attack-can-defend"
-
- Struct.Marker.CanAttackCantDefend ->
- "can-attack-cant-defend"
- )
- ++
- "-marker"
- )
- ),
- (Html.Attributes.style
- (
- let
- loc = (Struct.Location.from_ref loc_ref)
- in
- [
- (
- "top",
- ((toString (loc.y * Constants.UI.tile_size)) ++ "px")
- ),
- (
- "left",
- ((toString (loc.x * Constants.UI.tile_size)) ++ "px")
- )
- ]
- )
- )
- ]
- ++
- (
- if (is_interactive)
- then
- if
- (
- (marker == Struct.Marker.CanGoToCanDefend)
- || (marker == Struct.Marker.CanGoToCantDefend)
- )
- then
- [
- (Html.Attributes.class "battlemap-navigator-interactive"),
- (Html.Attributes.class "clickable"),
- (Html.Events.onClick
- (Struct.Event.CharacterOrTileSelected loc_ref)
- )
- ]
- else
- [
- (Html.Attributes.class "battlemap-navigator-interactive")
- ]
- else
- [
- (Html.Attributes.class "battlemap-navigator-non-interactive"),
- (Html.Events.onClick
- (Struct.Event.CharacterOrTileSelected loc_ref)
- )
- ]
- )
- )
- [
- ]
- )
-
-path_node_get_html : (
- Bool ->
- Struct.Direction.Type ->
- (
- Struct.Location.Type,
- Struct.Direction.Type,
- (List (Html.Html Struct.Event.Type))
- ) ->
- (
- Struct.Location.Type,
- Struct.Direction.Type,
- (List (Html.Html Struct.Event.Type))
- )
- )
-path_node_get_html is_below_markers next_dir (curr_loc, curr_dir, curr_nodes) =
- (
- (Struct.Location.neighbor next_dir curr_loc),
- next_dir,
- (
- (Html.div
- [
- (Html.Attributes.class "battlemap-path-icon"),
- (Html.Attributes.class
- (
- if (is_below_markers)
- then
- "battlemap-path-icon-below-markers"
- else
- "battlemap-path-icon-above-markers"
- )
- ),
- (Html.Attributes.class "battlemap-tiled"),
- (Html.Attributes.class
- (
- "battlemap-path-icon-"
- ++
- (Struct.Direction.to_string curr_dir)
- ++
- (Struct.Direction.to_string next_dir)
- )
- ),
- (Html.Events.onClick
- (Struct.Event.CharacterOrTileSelected
- (Struct.Location.get_ref curr_loc)
- )
- ),
- (Html.Attributes.style
- [
- (
- "top",
- (
- (toString (curr_loc.y * Constants.UI.tile_size))
- ++
- "px"
- )
- ),
- (
- "left",
- (
- (toString (curr_loc.x * Constants.UI.tile_size))
- ++
- "px"
- )
- )
- ]
- )
- ]
- [
- ]
- )
- ::
- curr_nodes
- )
- )
-
-mark_the_spot : (
- Struct.Location.Type ->
- Struct.Direction.Type ->
- (Html.Html Struct.Event.Type)
- )
-mark_the_spot loc origin_dir =
- (Html.div
- [
- (Html.Attributes.class "battlemap-path-icon"),
- (Html.Attributes.class "battlemap-path-icon-above-markers"),
- (Html.Attributes.class "battlemap-tiled"),
- (Html.Attributes.class
- (
- "battlemap-path-icon-mark"
- ++
- (Struct.Direction.to_string origin_dir)
- )
- ),
- (Html.Events.onClick
- (Struct.Event.CharacterOrTileSelected (Struct.Location.get_ref loc))
- ),
- (Html.Attributes.style
- [
- (
- "top",
- ((toString (loc.y * Constants.UI.tile_size)) ++ "px")
- ),
- (
- "left",
- ((toString (loc.x * Constants.UI.tile_size)) ++ "px")
- )
- ]
- )
- ]
- [
- ]
- )
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_html : (
- Struct.Navigator.Summary ->
- Bool ->
- (List (Html.Html Struct.Event.Type))
- )
-get_html nav_summary is_interactive =
- if (is_interactive)
- then
- (
- (List.map (marker_get_html True) nav_summary.markers)
- ++
- (
- let
- (final_loc, final_dir, path_node_htmls) =
- (List.foldr
- (path_node_get_html nav_summary.locked_path)
- (nav_summary.starting_location, Struct.Direction.None, [])
- nav_summary.path
- )
- in
- ((mark_the_spot final_loc final_dir) :: path_node_htmls)
- )
- )
- else
- (List.map (marker_get_html False) nav_summary.markers)
diff --git a/src/map-editor/src/View/Map/Tile.elm b/src/map-editor/src/View/Map/Tile.elm
index a049acf..9aa8411 100644
--- a/src/map-editor/src/View/Map/Tile.elm
+++ b/src/map-editor/src/View/Map/Tile.elm
@@ -1,4 +1,4 @@
-module View.Battlemap.Tile exposing (get_html)
+module View.Map.Tile exposing (get_html)
-- Elm -------------------------------------------------------------------------
import Html
@@ -30,11 +30,11 @@ get_html tile =
in
(Html.div
[
- (Html.Attributes.class "battlemap-tile-icon"),
- (Html.Attributes.class "battlemap-tiled"),
+ (Html.Attributes.class "map-tile-icon"),
+ (Html.Attributes.class "map-tiled"),
(Html.Attributes.class
(
- "battlemap-tile-variant-"
+ "map-tile-variant-"
++ (toString (Struct.Tile.get_variant_id tile))
)
),
diff --git a/src/map-editor/src/View/MessageBoard.elm b/src/map-editor/src/View/MessageBoard.elm
index 5de6e8d..f1a2e9b 100644
--- a/src/map-editor/src/View/MessageBoard.elm
+++ b/src/map-editor/src/View/MessageBoard.elm
@@ -3,11 +3,10 @@ module View.MessageBoard exposing (get_html)
-- Elm -------------------------------------------------------------------------
import Html
--- Struct.Battlemap -------------------------------------------------------------------
+-- Battlemap -------------------------------------------------------------------
import Struct.Event
import Struct.Model
-import View.MessageBoard.Animator
import View.MessageBoard.Error
import View.MessageBoard.Help
@@ -22,9 +21,4 @@ get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)
get_html model =
case (model.error) of
(Just error) -> (View.MessageBoard.Error.get_html model error)
- Nothing ->
- case model.animator of
- (Just animator) ->
- (View.MessageBoard.Animator.get_html model animator)
-
- Nothing -> (View.MessageBoard.Help.get_html model)
+ Nothing -> (View.MessageBoard.Help.get_html model)
diff --git a/src/map-editor/src/View/MessageBoard/Animator.elm b/src/map-editor/src/View/MessageBoard/Animator.elm
deleted file mode 100644
index 5c8938b..0000000
--- a/src/map-editor/src/View/MessageBoard/Animator.elm
+++ /dev/null
@@ -1,57 +0,0 @@
-module View.MessageBoard.Animator exposing (get_html)
-
--- Elm -------------------------------------------------------------------------
-import Html
-
--- Battlemap -------------------------------------------------------------------
-import Struct.Event
-import Struct.Model
-import Struct.TurnResult
-import Struct.TurnResultAnimator
-
-import Util.Html
-
-import View.MessageBoard.Animator.Attack
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_turn_result_html : (
- Struct.Model.Type ->
- Struct.TurnResult.Type ->
- (Html.Html Struct.Event.Type)
- )
-get_turn_result_html model turn_result =
- case turn_result of
- (Struct.TurnResult.Attacked attack) ->
- (View.MessageBoard.Animator.Attack.get_html
- model
- (Struct.TurnResult.get_actor_index turn_result)
- (Struct.TurnResult.get_attack_defender_index attack)
- (Struct.TurnResult.maybe_get_attack_next_step attack)
- )
-
- _ -> (Util.Html.nothing)
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_html : (
- Struct.Model.Type ->
- Struct.TurnResultAnimator.Type ->
- (Html.Html Struct.Event.Type)
- )
-get_html model animator =
- case (Struct.TurnResultAnimator.get_current_animation animator) of
- (Struct.TurnResultAnimator.TurnResult turn_result) ->
- (get_turn_result_html model turn_result)
-
- (Struct.TurnResultAnimator.AttackSetup (attacker_id, defender_id)) ->
- (View.MessageBoard.Animator.Attack.get_html
- model
- attacker_id
- defender_id
- Nothing
- )
-
- _ -> (Util.Html.nothing)
diff --git a/src/map-editor/src/View/MessageBoard/Animator/Attack.elm b/src/map-editor/src/View/MessageBoard/Animator/Attack.elm
deleted file mode 100644
index 211ada4..0000000
--- a/src/map-editor/src/View/MessageBoard/Animator/Attack.elm
+++ /dev/null
@@ -1,297 +0,0 @@
-module View.MessageBoard.Animator.Attack exposing (get_html)
-
--- Elm -------------------------------------------------------------------------
-import Array
-
-import Html
-import Html.Attributes
-
--- Battlemap -------------------------------------------------------------------
-import Struct.Attack
-import Struct.Character
-import Struct.Event
-import Struct.Model
-
-import View.Controlled.CharacterCard
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_effect_text : Struct.Attack.Type -> String
-get_effect_text attack =
- (
- (
- case attack.precision of
- Struct.Attack.Hit -> " hit for "
- Struct.Attack.Graze -> " grazed for "
- Struct.Attack.Miss -> " missed."
- )
- ++
- (
- if (attack.precision == Struct.Attack.Miss)
- then
- ""
- else
- (
- ((toString attack.damage) ++ " damage")
- ++
- (
- if (attack.critical)
- then " (Critical Hit)."
- else "."
- )
- )
- )
- )
-
-get_empty_attack_html : (Html.Html Struct.Event.Type)
-get_empty_attack_html =
- (Html.div
- [
- (Html.Attributes.class "battlemap-message-attack-text")
- ]
- []
- )
-
-get_attack_html : (
- Struct.Character.Type ->
- Struct.Character.Type ->
- Struct.Attack.Type ->
- (Html.Html Struct.Event.Type)
- )
-get_attack_html attacker defender attack =
- let
- attacker_name = (Struct.Character.get_name attacker)
- defender_name = (Struct.Character.get_name defender)
- in
- (Html.div
- [
- (Html.Attributes.class "battlemap-message-attack-text")
- ]
- [
- (Html.text
- (
- case (attack.order, attack.parried) of
- (Struct.Attack.Counter, True) ->
- (
- defender_name
- ++ " attempted to strike back, but "
- ++ attacker_name
- ++ " parried, and "
- ++ (get_effect_text attack)
- )
-
- (Struct.Attack.Counter, _) ->
- (
- defender_name
- ++ " striked back, and "
- ++ (get_effect_text attack)
- )
-
- (_, True) ->
- (
- attacker_name
- ++ " attempted a hit, but "
- ++ defender_name
- ++ " parried, and "
- ++ (get_effect_text attack)
- )
-
- (_, _) ->
- (attacker_name ++ " " ++ (get_effect_text attack))
- )
- )
- ]
- )
-
-get_attack_animation_class : (
- Struct.Attack.Type ->
- Struct.Character.Type ->
- String
- )
-get_attack_animation_class attack char =
- if (attack.critical)
- then
- "battlemap-animated-portrait-attack-critical"
- else
- "battlemap-animated-portrait-attacks"
-
-get_defense_animation_class : (
- Struct.Attack.Type ->
- Struct.Character.Type ->
- String
- )
-get_defense_animation_class attack char =
- if (attack.damage == 0)
- then
- if (attack.precision == Struct.Attack.Miss)
- then
- "battlemap-animated-portrait-dodges"
- else
- "battlemap-animated-portrait-undamaged"
- else if ((Struct.Character.get_current_health char) > 0)
- then
- if (attack.precision == Struct.Attack.Graze)
- then
- "battlemap-animated-portrait-grazed-damage"
- else
- "battlemap-animated-portrait-damaged"
- else
- if (attack.precision == Struct.Attack.Graze)
- then
- "battlemap-animated-portrait-grazed-death"
- else
- "battlemap-animated-portrait-dies"
-
-get_attacker_card : (
- (Maybe Struct.Attack.Type) ->
- Struct.Character.Type ->
- (Html.Html Struct.Event.Type)
- )
-get_attacker_card maybe_attack char =
- (Html.div
- (case maybe_attack of
- Nothing ->
- if ((Struct.Character.get_current_health char) > 0)
- then
- [
- (Html.Attributes.class "battlemap-animated-portrait")
- ]
- else
- [
- (Html.Attributes.class "battlemap-animated-portrait-absent"),
- (Html.Attributes.class "battlemap-animated-portrait")
- ]
-
- (Just attack) ->
- [
- (Html.Attributes.class
- (case (attack.order, attack.parried) of
- (Struct.Attack.Counter, True) ->
- (get_attack_animation_class attack char)
-
- (Struct.Attack.Counter, _) ->
- (get_defense_animation_class attack char)
-
- (_, True) ->
- (get_defense_animation_class attack char)
-
- (_, _) ->
- (get_attack_animation_class attack char)
- )
- ),
- (Html.Attributes.class "battlemap-animated-portrait")
- ]
- )
- [
- (View.Controlled.CharacterCard.get_minimal_html
- (Struct.Character.get_player_ix char)
- char
- )
- ]
- )
-
-get_defender_card : (
- (Maybe Struct.Attack.Type) ->
- Struct.Character.Type ->
- (Html.Html Struct.Event.Type)
- )
-get_defender_card maybe_attack char =
- (Html.div
- (case maybe_attack of
- Nothing ->
- if ((Struct.Character.get_current_health char) > 0)
- then
- [
- (Html.Attributes.class "battlemap-animated-portrait")
- ]
- else
- [
- (Html.Attributes.class "battlemap-animated-portrait-absent"),
- (Html.Attributes.class "battlemap-animated-portrait")
- ]
-
- (Just attack) ->
- [
- (Html.Attributes.class
- (case (attack.order, attack.parried) of
- (Struct.Attack.Counter, True) ->
- (get_defense_animation_class attack char)
-
- (Struct.Attack.Counter, _) ->
- (get_attack_animation_class attack char)
-
- (_, True) ->
- (get_attack_animation_class attack char)
-
- (_, _) ->
- (get_defense_animation_class attack char)
- )
- ),
- (Html.Attributes.class "battlemap-animated-portrait")
- ]
- )
- [
- (View.Controlled.CharacterCard.get_minimal_html -1 char)
- ]
- )
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_placeholder_html : (
- (Array.Array Struct.Character.Type) ->
- Int ->
- Int ->
- (Maybe Struct.Attack.Type) ->
- (Html.Html Struct.Event.Type)
- )
-get_placeholder_html characters attacker_ix defender_ix maybe_attack =
- case
- (
- (Array.get attacker_ix characters),
- (Array.get defender_ix characters)
- )
- of
- ((Just atkchar), (Just defchar)) ->
- (Html.div
- [
- (Html.Attributes.class "battlemap-message-board"),
- (Html.Attributes.class "battlemap-message-attack")
- ]
- (
- [
- (get_attacker_card maybe_attack atkchar),
- (
- case maybe_attack of
- (Just attack) ->
- (get_attack_html atkchar defchar attack)
-
- Nothing ->
- (get_empty_attack_html)
- ),
- (get_defender_card maybe_attack defchar)
- ]
- )
- )
-
- _ ->
- (Html.div
- [
- ]
- [
- (Html.text "Error: Attack with unknown characters")
- ]
- )
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_html : (
- Struct.Model.Type ->
- Int ->
- Int ->
- (Maybe Struct.Attack.Type) ->
- (Html.Html Struct.Event.Type)
- )
-get_html model attacker_ix defender_ix maybe_attack =
- (get_placeholder_html model.characters attacker_ix defender_ix maybe_attack)
diff --git a/src/map-editor/src/View/MessageBoard/Error.elm b/src/map-editor/src/View/MessageBoard/Error.elm
index 642634a..5e961a7 100644
--- a/src/map-editor/src/View/MessageBoard/Error.elm
+++ b/src/map-editor/src/View/MessageBoard/Error.elm
@@ -24,8 +24,8 @@ get_html : (
get_html model error =
(Html.div
[
- (Html.Attributes.class "battlemap-message-board"),
- (Html.Attributes.class "battlemap-error")
+ (Html.Attributes.class "map-message-board"),
+ (Html.Attributes.class "map-error")
]
[
(Html.text (Struct.Error.to_string error))
diff --git a/src/map-editor/src/View/MessageBoard/Help.elm b/src/map-editor/src/View/MessageBoard/Help.elm
index 15a33a5..4225518 100644
--- a/src/map-editor/src/View/MessageBoard/Help.elm
+++ b/src/map-editor/src/View/MessageBoard/Help.elm
@@ -10,7 +10,6 @@ import Struct.HelpRequest
import Struct.Model
import View.MessageBoard.Help.Guide
-import View.MessageBoard.Help.Rank
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
@@ -23,15 +22,12 @@ get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)
get_html model =
(Html.div
[
- (Html.Attributes.class "battlemap-message-board"),
- (Html.Attributes.class "battlemap-message-board-help")
+ (Html.Attributes.class "map-message-board"),
+ (Html.Attributes.class "map-message-board-help")
]
(
case model.help_request of
Struct.HelpRequest.None ->
(View.MessageBoard.Help.Guide.get_html_contents model)
-
- (Struct.HelpRequest.HelpOnRank rank) ->
- (View.MessageBoard.Help.Rank.get_html_contents rank)
)
)
diff --git a/src/map-editor/src/View/MessageBoard/Help/Guide.elm b/src/map-editor/src/View/MessageBoard/Help/Guide.elm
index a10b96e..526abf0 100644
--- a/src/map-editor/src/View/MessageBoard/Help/Guide.elm
+++ b/src/map-editor/src/View/MessageBoard/Help/Guide.elm
@@ -5,7 +5,6 @@ import Html
import Html.Attributes
-- Battlemap -------------------------------------------------------------------
-import Struct.CharacterTurn
import Struct.Event
import Struct.Model
@@ -18,52 +17,13 @@ get_header_html title =
[]
[
(Html.div
- [(Html.Attributes.class "battlemap-help-guide-icon")]
+ [(Html.Attributes.class "map-help-guide-icon")]
[]
),
(Html.text title)
]
)
-get_selected_character_html_contents : (List (Html.Html Struct.Event.Type))
-get_selected_character_html_contents =
- [
- (get_header_html "Controlling a Character"),
- (Html.text
- (
- "Click on a target tile to select a path or use the manual"
- ++ " controls (on the left panel) to make your own. Click on the"
- ++ " destination tile again to confirm (this can be reverted)."
- )
- )
- ]
-
-get_moved_character_html_contents : (List (Html.Html Struct.Event.Type))
-get_moved_character_html_contents =
- [
- (get_header_html "Selecting a Target"),
- (Html.text
- (
- "You can now choose a target in range. Dashed tiles indicate"
- ++ " where your character will not be able to defend themselves"
- ++ " against counter attacks."
- )
- )
- ]
-
-get_chose_target_html_contents : (List (Html.Html Struct.Event.Type))
-get_chose_target_html_contents =
- [
- (get_header_html "Finalizing the Character's Turn"),
- (Html.text
- (
- "If you are satisfied with your choices, you can end this"
- ++ " character's turn and see the results unfold. Otherwise, click"
- ++ " on the abort button to undo it all."
- )
- )
- ]
-
get_default_html_contents : (List (Html.Html Struct.Event.Type))
get_default_html_contents =
[
@@ -85,16 +45,4 @@ get_html_contents : (
Struct.Model.Type ->
(List (Html.Html Struct.Event.Type))
)
-get_html_contents model =
- case (Struct.CharacterTurn.get_state model.char_turn) of
- Struct.CharacterTurn.SelectedCharacter ->
- (get_selected_character_html_contents)
-
- Struct.CharacterTurn.MovedCharacter ->
- (get_moved_character_html_contents)
-
- Struct.CharacterTurn.ChoseTarget ->
- (get_chose_target_html_contents)
-
- _ ->
- (get_default_html_contents)
+get_html_contents model = (get_default_html_contents)
diff --git a/src/map-editor/src/View/MessageBoard/Help/Rank.elm b/src/map-editor/src/View/MessageBoard/Help/Rank.elm
deleted file mode 100644
index 95477d3..0000000
--- a/src/map-editor/src/View/MessageBoard/Help/Rank.elm
+++ /dev/null
@@ -1,97 +0,0 @@
-module View.MessageBoard.Help.Rank exposing (get_html_contents)
-
--- Elm -------------------------------------------------------------------------
-import Html
-import Html.Attributes
-
--- Battlemap -------------------------------------------------------------------
-import Struct.Character
-import Struct.Event
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_guide_icon_html : (Html.Html Struct.Event.Type)
-get_guide_icon_html =
- (Html.div
- [(Html.Attributes.class "battlemap-help-guide-icon")]
- []
- )
-
-get_header_with_icon_html : String -> String -> (Html.Html Struct.Event.Type)
-get_header_with_icon_html title rank_name =
- (Html.h1
- []
- [
- (get_guide_icon_html),
- (Html.text (title ++ " - ")),
- (Html.div
- [
- (Html.Attributes.class
- "battlemap-message-board-help-figure"
- ),
- (Html.Attributes.class
- ("battlemap-character-card-" ++ rank_name ++ "-status")
- )
- ]
- []
- )
- ]
- )
-
-get_target_help_message : (List (Html.Html Struct.Event.Type))
-get_target_help_message =
- [
- (get_header_with_icon_html "Protected Character" "target"),
- (Html.text
- (
- "Players that lose all of their Protected Characters are"
- ++ " eliminated."
- )
- )
- ]
-
-get_commander_help_message : (List (Html.Html Struct.Event.Type))
-get_commander_help_message =
- [
- (get_header_with_icon_html "Critical Character" "commander"),
- (Html.text
- (
- "Players that lose any of their Critical Characters are"
- ++ " eliminated."
- )
- )
- ]
-
-get_optional_help_message : (List (Html.Html Struct.Event.Type))
-get_optional_help_message =
- [
- (Html.h1
- []
- [
- (get_guide_icon_html),
- (Html.text "Reinforcement Character")
- ]
- ),
- (Html.text
- (
- "Unless it is their very last character, losing a"
- ++ " Reinforcement characters never causes a player to be"
- ++ " eliminated."
- )
- )
- ]
-
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_html_contents : (
- Struct.Character.Rank ->
- (List (Html.Html Struct.Event.Type))
- )
-get_html_contents rank =
- case rank of
- Struct.Character.Target -> (get_target_help_message)
- Struct.Character.Commander -> (get_commander_help_message)
- Struct.Character.Optional -> (get_optional_help_message)
diff --git a/src/map-editor/src/View/SubMenu.elm b/src/map-editor/src/View/SubMenu.elm
index 8537452..75b5101 100644
--- a/src/map-editor/src/View/SubMenu.elm
+++ b/src/map-editor/src/View/SubMenu.elm
@@ -8,19 +8,15 @@ import Html.Attributes
import Html.Lazy
-- Battlemap -------------------------------------------------------------------
-import Struct.CharacterTurn
import Struct.Event
import Struct.Model
import Struct.UI
import Util.Html
-import View.Controlled.CharacterCard
-
-import View.SubMenu.Characters
+import View.SubMenu.Tiles
import View.SubMenu.Settings
import View.SubMenu.Status
-import View.SubMenu.Timeline
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
@@ -35,19 +31,12 @@ get_inner_html model tab =
Struct.UI.StatusTab ->
(View.SubMenu.Status.get_html model)
- Struct.UI.CharactersTab ->
- (Html.Lazy.lazy2
- (View.SubMenu.Characters.get_html)
- model.characters
- model.player_ix
- )
+ Struct.UI.TilesTab ->
+ (View.SubMenu.Tiles.get_html)
Struct.UI.SettingsTab ->
(View.SubMenu.Settings.get_html model)
- Struct.UI.TimelineTab ->
- (View.SubMenu.Timeline.get_html model)
-
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
@@ -56,30 +45,9 @@ get_html model =
case (Struct.UI.try_getting_displayed_tab model.ui) of
(Just tab) ->
(Html.div
- [(Html.Attributes.class "battlemap-sub-menu")]
+ [(Html.Attributes.class "map-sub-menu")]
[(get_inner_html model tab)]
)
Nothing ->
- case (Struct.CharacterTurn.try_getting_target model.char_turn) of
- (Just char_ref) ->
- case (Array.get char_ref model.characters) of
- (Just char) ->
- (Html.div
- [(Html.Attributes.class "battlemap-sub-menu")]
- [
- (Html.text "Targeting:"),
- (Html.Lazy.lazy3
- (View.Controlled.CharacterCard.get_summary_html)
- model.char_turn
- model.player_ix
- char
- )
- ]
- )
-
- Nothing ->
- (Util.Html.nothing)
-
- Nothing ->
- (Util.Html.nothing)
+ (Util.Html.nothing)
diff --git a/src/map-editor/src/View/SubMenu/Characters.elm b/src/map-editor/src/View/SubMenu/Characters.elm
deleted file mode 100644
index be5bac4..0000000
--- a/src/map-editor/src/View/SubMenu/Characters.elm
+++ /dev/null
@@ -1,69 +0,0 @@
-module View.SubMenu.Characters exposing (get_html)
-
--- Elm -------------------------------------------------------------------------
-import Array
-
-import Html
-import Html.Attributes
-import Html.Events
-
--- Battlemap -------------------------------------------------------------------
-import Struct.Character
-import Struct.Event
-
-import View.Controlled.CharacterCard
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_character_element_html : (
- Int ->
- Struct.Character.Type ->
- (Html.Html Struct.Event.Type)
- )
-get_character_element_html player_ix char =
- (Html.div
- [
- (Html.Attributes.class "battlemap-characters-element"),
- (
- if (Struct.Character.is_alive char)
- then
- (Html.Attributes.class "clickable")
- else
- (Html.Attributes.class "")
- ),
- (Html.Events.onClick
- (Struct.Event.LookingForCharacter (Struct.Character.get_index char))
- ),
- (
- if (Struct.Character.is_enabled char)
- then
- (Html.Attributes.class "battlemap-characters-element-active")
- else
- (Html.Attributes.class "battlemap-characters-element-inactive")
- )
- ]
- [
- (View.Controlled.CharacterCard.get_minimal_html player_ix char)
- ]
- )
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_html : (
- (Array.Array Struct.Character.Type) ->
- Int ->
- (Html.Html Struct.Event.Type)
- )
-get_html characters player_ix =
- (Html.div
- [
- (Html.Attributes.class "battlemap-tabmenu-content"),
- (Html.Attributes.class "battlemap-tabmenu-characters-tab")
- ]
- (List.map
- (get_character_element_html player_ix)
- (Array.toList characters)
- )
- )
diff --git a/src/map-editor/src/View/SubMenu/Settings.elm b/src/map-editor/src/View/SubMenu/Settings.elm
index 22aa99a..1661053 100644
--- a/src/map-editor/src/View/SubMenu/Settings.elm
+++ b/src/map-editor/src/View/SubMenu/Settings.elm
@@ -30,30 +30,12 @@ get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)
get_html model =
(Html.div
[
- (Html.Attributes.class "battlemap-tabmenu-content"),
- (Html.Attributes.class "battlemap-tabmenu-settings-tab")
+ (Html.Attributes.class "map-tabmenu-content"),
+ (Html.Attributes.class "map-tabmenu-settings-tab")
]
[
(scale_button (0.75) "Zoom -"),
(scale_button 0 "Zoom Reset"),
- (scale_button (1.15) "Zoom +"),
- (Html.button
- [
- (Html.Events.onClick Struct.Event.DebugTeamSwitchRequest)
- ]
- [ (Html.text "[DEBUG] Switch team") ]
- ),
- (Html.button
- [
- (Html.Events.onClick Struct.Event.DebugLoadBattlemapRequest)
- ]
- [ (Html.text "[DEBUG] Load battlemap") ]
- ),
- (Html.button
- [
- (Html.Events.onClick Struct.Event.DebugTestAnimation)
- ]
- [ (Html.text "[DEBUG] Test animations") ]
- )
+ (scale_button (1.15) "Zoom +")
]
)
diff --git a/src/map-editor/src/View/SubMenu/Status.elm b/src/map-editor/src/View/SubMenu/Status.elm
index f67c85e..5c47552 100644
--- a/src/map-editor/src/View/SubMenu/Status.elm
+++ b/src/map-editor/src/View/SubMenu/Status.elm
@@ -13,7 +13,6 @@ import Struct.Location
import Struct.Model
import Struct.UI
-import View.SubMenu.Status.CharacterInfo
import View.SubMenu.Status.TileInfo
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
@@ -26,8 +25,8 @@ get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)
get_html model =
(Html.div
[
- (Html.Attributes.class "battlemap-footer-tabmenu-content"),
- (Html.Attributes.class "battlemap-footer-tabmenu-content-status")
+ (Html.Attributes.class "map-footer-tabmenu-content"),
+ (Html.Attributes.class "map-footer-tabmenu-content-status")
]
[
(case (Struct.UI.get_previous_action model.ui) of
@@ -37,17 +36,6 @@ get_html model =
(Struct.Location.from_ref loc)
)
- (Just (Struct.UI.SelectedCharacter target_char)) ->
- case (Array.get target_char model.characters) of
- (Just char) ->
- (Html.Lazy.lazy2
- (View.SubMenu.Status.CharacterInfo.get_html)
- model.player_ix
- char
- )
-
- _ -> (Html.text "Error: Unknown character selected.")
-
_ ->
(Html.text "Nothing is being focused.")
)
diff --git a/src/map-editor/src/View/SubMenu/Status/CharacterInfo.elm b/src/map-editor/src/View/SubMenu/Status/CharacterInfo.elm
index a927158..646bb53 100644
--- a/src/map-editor/src/View/SubMenu/Status/CharacterInfo.elm
+++ b/src/map-editor/src/View/SubMenu/Status/CharacterInfo.elm
@@ -25,7 +25,7 @@ get_html : (
get_html player_ix char =
(Html.div
[
- (Html.Attributes.class "battlemap-tabmenu-character-info")
+ (Html.Attributes.class "map-tabmenu-character-info")
]
[
(Html.text ("Focusing:")),
diff --git a/src/map-editor/src/View/SubMenu/Status/TileInfo.elm b/src/map-editor/src/View/SubMenu/Status/TileInfo.elm
index a009bc3..0ac727e 100644
--- a/src/map-editor/src/View/SubMenu/Status/TileInfo.elm
+++ b/src/map-editor/src/View/SubMenu/Status/TileInfo.elm
@@ -6,11 +6,11 @@ import Dict
import Html
import Html.Attributes
--- Struct.Battlemap -------------------------------------------------------------------
+-- Map Editor ------------------------------------------------------------------
import Constants.IO
import Constants.Movement
-import Struct.Battlemap
+import Struct.Map
import Struct.Event
import Struct.Location
import Struct.Model
@@ -24,10 +24,10 @@ get_icon : (Struct.Tile.Instance -> (Html.Html Struct.Event.Type))
get_icon tile =
(Html.div
[
- (Html.Attributes.class "battlemap-tile-card-icon"),
+ (Html.Attributes.class "map-tile-card-icon"),
(Html.Attributes.class
(
- "battlemap-tile-variant-"
+ "map-tile-variant-"
++ (toString (Struct.Tile.get_variant_id tile))
)
),
@@ -60,7 +60,7 @@ get_name model tile =
(Just tile_type) ->
(Html.div
[
- (Html.Attributes.class "battlemap-tile-card-name")
+ (Html.Attributes.class "map-tile-card-name")
]
[
(Html.text (Struct.Tile.get_name tile_type))
@@ -80,7 +80,7 @@ get_cost tile =
in
(Html.div
[
- (Html.Attributes.class "battlemap-tile-card-cost")
+ (Html.Attributes.class "map-tile-card-cost")
]
[
(Html.text text)
@@ -94,7 +94,7 @@ get_location tile =
in
(Html.div
[
- (Html.Attributes.class "battlemap-tile-card-location")
+ (Html.Attributes.class "map-tile-card-location")
]
[
(Html.text
@@ -118,17 +118,17 @@ get_html : (
(Html.Html Struct.Event.Type)
)
get_html model loc =
- case (Struct.Battlemap.try_getting_tile_at loc model.battlemap) of
+ case (Struct.Map.try_getting_tile_at loc model.map) of
(Just tile) ->
(Html.div
[
- (Html.Attributes.class "battlemap-tile-card")
+ (Html.Attributes.class "map-tile-card")
]
[
(get_name model tile),
(Html.div
[
- (Html.Attributes.class "battlemap-tile-card-top")
+ (Html.Attributes.class "map-tile-card-top")
]
[
(get_icon tile),
diff --git a/src/map-editor/src/View/SubMenu/Tiles.elm b/src/map-editor/src/View/SubMenu/Tiles.elm
new file mode 100644
index 0000000..067339a
--- /dev/null
+++ b/src/map-editor/src/View/SubMenu/Tiles.elm
@@ -0,0 +1,27 @@
+module View.SubMenu.Tiles exposing (get_html)
+
+-- Elm -------------------------------------------------------------------------
+import Html
+import Html.Attributes
+import Html.Events
+
+-- Battlemap -------------------------------------------------------------------
+import Struct.Event
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+get_html : (Html.Html Struct.Event.Type)
+get_html =
+ (Html.div
+ [
+ (Html.Attributes.class "map-tabmenu-content"),
+ (Html.Attributes.class "map-tabmenu-tiles-tab")
+ ]
+ [
+ ]
+ )
diff --git a/src/map-editor/src/View/ToolBox.elm b/src/map-editor/src/View/ToolBox.elm
deleted file mode 100644
index 8a36fb8..0000000
--- a/src/map-editor/src/View/ToolBox.elm
+++ /dev/null
@@ -1,133 +0,0 @@
-module View.Controlled exposing (get_html)
-
--- Elm -------------------------------------------------------------------------
-import Html
-import Html.Attributes
-import Html.Events
-
--- Struct.Battlemap -------------------------------------------------------------------
-import Struct.CharacterTurn
-import Struct.Event
-import Struct.Navigator
-
-import Util.Html
-
-import View.Controlled.CharacterCard
-import View.Controlled.ManualControls
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-has_a_path : Struct.CharacterTurn.Type -> Bool
-has_a_path char_turn =
- case (Struct.CharacterTurn.try_getting_navigator char_turn) of
- (Just nav) -> ((Struct.Navigator.get_path nav) /= [])
- Nothing -> False
-
-
-attack_button : Struct.CharacterTurn.Type -> (Html.Html Struct.Event.Type)
-attack_button char_turn =
- (Html.button
- [ (Html.Events.onClick Struct.Event.AttackWithoutMovingRequest) ]
- [
- (Html.text
- (
- if (has_a_path char_turn)
- then ("Go & Select Target")
- else ("Select Target")
- )
- )
- ]
- )
-
-abort_button : (Html.Html Struct.Event.Type)
-abort_button =
- (Html.button
- [ (Html.Events.onClick Struct.Event.AbortTurnRequest) ]
- [ (Html.text "Abort") ]
- )
-
-end_turn_button : String -> (Html.Html Struct.Event.Type)
-end_turn_button suffix =
- (Html.button
- [
- (Html.Events.onClick Struct.Event.TurnEnded),
- (Html.Attributes.class "battlemap-end-turn-button")
- ]
- [ (Html.text ("End Turn" ++ suffix)) ]
- )
-
-inventory_button : (Html.Html Struct.Event.Type)
-inventory_button =
- (Html.button
- [ (Html.Events.onClick Struct.Event.WeaponSwitchRequest) ]
- [ (Html.text "Switch Weapon") ]
- )
-
-get_available_actions : (
- Struct.CharacterTurn.Type ->
- (List (Html.Html Struct.Event.Type))
- )
-get_available_actions char_turn =
- case (Struct.CharacterTurn.get_state char_turn) of
- Struct.CharacterTurn.SelectedCharacter ->
- [
- (attack_button char_turn),
- (inventory_button),
- (end_turn_button " Doing Nothing"),
- (abort_button)
- ]
-
- Struct.CharacterTurn.MovedCharacter ->
- [
- (end_turn_button " Without Attacking"),
- (abort_button)
- ]
-
- Struct.CharacterTurn.ChoseTarget ->
- [
- (end_turn_button " By Attacking"),
- (abort_button)
- ]
-
- _ ->
- [
- ]
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_html : Struct.CharacterTurn.Type -> Int -> (Html.Html Struct.Event.Type)
-get_html char_turn player_ix =
- case
- (Struct.CharacterTurn.try_getting_active_character char_turn)
- of
- (Just char) ->
- (Html.div
- [(Html.Attributes.class "battlemap-controlled")]
- [
- (View.Controlled.CharacterCard.get_summary_html
- char_turn
- player_ix
- char
- ),
- (
- if
- (
- (Struct.CharacterTurn.get_state char_turn)
- ==
- Struct.CharacterTurn.SelectedCharacter
- )
- then
- (View.Controlled.ManualControls.get_html)
- else
- (Util.Html.nothing)
- ),
- (Html.div
- [(Html.Attributes.class "battlemap-controlled-actions")]
- (get_available_actions char_turn)
- )
- ]
- )
-
- Nothing -> (Util.Html.nothing)
diff --git a/src/map-editor/src/View/Toolbox.elm b/src/map-editor/src/View/Toolbox.elm
new file mode 100644
index 0000000..77c4033
--- /dev/null
+++ b/src/map-editor/src/View/Toolbox.elm
@@ -0,0 +1,27 @@
+module View.Toolbox exposing (get_html)
+
+-- Elm -------------------------------------------------------------------------
+import Html
+import Html.Attributes
+import Html.Events
+
+-- Struct.Battlemap -------------------------------------------------------------------
+import Struct.Event
+import Struct.Toolbox
+
+import Util.Html
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+get_html : Struct.Toolbox.Type -> (Html.Html Struct.Event.Type)
+get_html tb =
+ (Html.div
+ [(Html.Attributes.class "map-toolbox")]
+ [
+ ]
+ )