summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2017-12-06 17:04:11 +0100
committernsensfel <SpamShield0@noot-noot.org>2017-12-06 17:04:11 +0100
commitab36ffac64c2b13dcea6c114950cf00d4cae0efb (patch)
tree131fc0feb32102821b6fdc00524aeb3e10422673
parentfbe232187e36f6661709376d0994ee48e9b27274 (diff)
Still working on that reorganization...
-rw-r--r--src/battlemap/src/ElmModule/View.elm6
-rw-r--r--src/battlemap/src/Send/CharacterTurn.elm10
-rw-r--r--src/battlemap/src/Send/LoadBattlemap.elm8
-rw-r--r--src/battlemap/src/Send/Send.elm8
-rw-r--r--src/battlemap/src/Shim/Model.elm18
-rw-r--r--src/battlemap/src/Struct/Battlemap.elm3
-rw-r--r--src/battlemap/src/Struct/CharacterTurn.elm3
-rw-r--r--src/battlemap/src/Struct/Model.elm13
-rw-r--r--src/battlemap/src/Update/ChangeScale.elm2
-rw-r--r--src/battlemap/src/Update/EndTurn.elm45
-rw-r--r--src/battlemap/src/Update/HandleServerReply.elm34
-rw-r--r--src/battlemap/src/Update/HandleServerReply/AddChar.elm22
-rw-r--r--src/battlemap/src/Update/HandleServerReply/SetMap.elm19
-rw-r--r--src/battlemap/src/Update/SelectTile.elm71
-rw-r--r--src/battlemap/src/View/Battlemap.elm126
-rw-r--r--src/battlemap/src/View/Battlemap/Character.elm67
-rw-r--r--src/battlemap/src/View/Battlemap/Navigator.elm65
-rw-r--r--src/battlemap/src/View/Battlemap/Tile.elm26
-rw-r--r--src/battlemap/src/View/Footer.elm31
-rw-r--r--src/battlemap/src/View/SideBar.elm11
-rw-r--r--src/battlemap/src/View/SideBar/ManualControls.elm27
-rw-r--r--src/battlemap/src/View/SideBar/TabMenu.elm56
-rw-r--r--src/battlemap/src/View/SideBar/TabMenu/Characters.elm18
-rw-r--r--src/battlemap/src/View/SideBar/TabMenu/Settings.elm15
-rw-r--r--src/battlemap/src/View/SideBar/TabMenu/Status.elm87
-rw-r--r--src/battlemap/src/View/SideBar/Targets.elm37
26 files changed, 427 insertions, 401 deletions
diff --git a/src/battlemap/src/ElmModule/View.elm b/src/battlemap/src/ElmModule/View.elm
index e6e0295..a1f950d 100644
--- a/src/battlemap/src/ElmModule/View.elm
+++ b/src/battlemap/src/ElmModule/View.elm
@@ -39,11 +39,7 @@ view model =
(Html.Attributes.class "battlemap-container")
]
[
- (View.Battlemap.get_html
- model.battlemap
- (Struct.UI.get_zoom_level model.ui)
- (Dict.values model.characters)
- )
+ (View.Battlemap.get_html model)
]
),
(View.Footer.get_html model)
diff --git a/src/battlemap/src/Send/CharacterTurn.elm b/src/battlemap/src/Send/CharacterTurn.elm
index f7cf1c9..d58c794 100644
--- a/src/battlemap/src/Send/CharacterTurn.elm
+++ b/src/battlemap/src/Send/CharacterTurn.elm
@@ -4,15 +4,15 @@ module Send.CharacterTurn exposing (try)
import Json.Encode
-- Battlemap -------------------------------------------------------------------
+import Constants.IO
+
+import Send.Send
+
import Struct.Battlemap
import Struct.Direction
-import Struct.UI
import Struct.Event
import Struct.Model
-
-import Constants.IO
-
-import Send
+import Struct.UI
--------------------------------------------------------------------------------
-- TYPES ------------------------------------------------------------------------
diff --git a/src/battlemap/src/Send/LoadBattlemap.elm b/src/battlemap/src/Send/LoadBattlemap.elm
index 08bff57..a177206 100644
--- a/src/battlemap/src/Send/LoadBattlemap.elm
+++ b/src/battlemap/src/Send/LoadBattlemap.elm
@@ -4,12 +4,12 @@ module Send.LoadBattlemap exposing (try)
import Json.Encode
-- Battlemap -------------------------------------------------------------------
-import Struct.Model
-import Struct.Event
-
import Constants.IO
-import Send
+import Send.Send
+
+import Struct.Event
+import Struct.Model
--------------------------------------------------------------------------------
-- TYPES ------------------------------------------------------------------------
diff --git a/src/battlemap/src/Send/Send.elm b/src/battlemap/src/Send/Send.elm
index ec14ce6..d8420b1 100644
--- a/src/battlemap/src/Send/Send.elm
+++ b/src/battlemap/src/Send/Send.elm
@@ -1,14 +1,14 @@
-module Send exposing (Reply, try_sending)
+module Send.Send exposing (Reply, try_sending)
-- Elm -------------------------------------------------------------------------
+import Http
+
import Json.Decode
import Json.Encode
-import Http
-
-- Battlemap -------------------------------------------------------------------
-import Struct.Model
import Struct.Event
+import Struct.Model
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
diff --git a/src/battlemap/src/Shim/Model.elm b/src/battlemap/src/Shim/Model.elm
index 376250f..9503c25 100644
--- a/src/battlemap/src/Shim/Model.elm
+++ b/src/battlemap/src/Shim/Model.elm
@@ -3,12 +3,10 @@ module Shim.Model exposing (generate)
-- Elm -------------------------------------------------------------------------
import Dict
--- Battlemap -------------------------------------------------------------------
-import Battlemap
-
-import UI
-
-import Model
+-- Struct.Battlemap -------------------------------------------------------------------
+import Struct.Battlemap
+import Struct.Model
+import Struct.UI
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
@@ -17,16 +15,16 @@ import Model
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
---generate : Model.Type
+--generate : Struct.Model.Type
generate =
{
- state = Model.Default,
+ state = Struct.Model.Default,
error = Nothing,
- battlemap = (Battlemap.empty),
+ battlemap = (Struct.Battlemap.empty),
controlled_team = 0,
controlled_character = Nothing,
player_id = "0",
targets = [],
characters = (Dict.empty),
- ui = (UI.default)
+ ui = (Struct.UI.default)
}
diff --git a/src/battlemap/src/Struct/Battlemap.elm b/src/battlemap/src/Struct/Battlemap.elm
index bd1f3b0..93ea71d 100644
--- a/src/battlemap/src/Struct/Battlemap.elm
+++ b/src/battlemap/src/Struct/Battlemap.elm
@@ -101,8 +101,7 @@ empty =
{
width = 0,
height = 0,
- content = (Array.empty),
- navigator = Nothing
+ content = (Array.empty)
}
new : Int -> Int -> (List Struct.Tile.Type) -> Type
diff --git a/src/battlemap/src/Struct/CharacterTurn.elm b/src/battlemap/src/Struct/CharacterTurn.elm
index f234184..0d049e6 100644
--- a/src/battlemap/src/Struct/CharacterTurn.elm
+++ b/src/battlemap/src/Struct/CharacterTurn.elm
@@ -91,13 +91,12 @@ add_target ct target_ref =
remove_target : Type -> Int -> Type
remove_target ct i =
let
- new_targets = (List.drop i ct.list)
+ new_targets = (List.drop i ct.targets)
in
case new_targets of
[] ->
{ct |
state = MovedCharacter,
- path = path,
targets = []
}
diff --git a/src/battlemap/src/Struct/Model.elm b/src/battlemap/src/Struct/Model.elm
index dc1a13d..fb8a72a 100644
--- a/src/battlemap/src/Struct/Model.elm
+++ b/src/battlemap/src/Struct/Model.elm
@@ -14,15 +14,12 @@ import Dict
-- Battlemap -------------------------------------------------------------------
import Struct.Battlemap
+import Struct.Character
+import Struct.CharacterTurn
+import Struct.Error
import Struct.Location
-
import Struct.UI
-import Struct.Error
-
-import Struct.Character
-
-import Query.CharacterTurn
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
--------------------------------------------------------------------------------
@@ -40,7 +37,7 @@ type alias Type =
controlled_team: Int,
player_id: String,
ui: Struct.UI.Type,
- char_turn: Query.CharacterTurn
+ char_turn: Struct.CharacterTurn.Type
}
--------------------------------------------------------------------------------
@@ -71,7 +68,7 @@ reset model characters =
characters = characters,
error = Nothing,
ui = (Struct.UI.set_previous_action model.ui Nothing),
- char_turn = (Query.CharacterTurn.new)
+ char_turn = (Struct.CharacterTurn.new)
}
invalidate : Type -> Struct.Error.Type -> Type
diff --git a/src/battlemap/src/Update/ChangeScale.elm b/src/battlemap/src/Update/ChangeScale.elm
index 139c662..55cb547 100644
--- a/src/battlemap/src/Update/ChangeScale.elm
+++ b/src/battlemap/src/Update/ChangeScale.elm
@@ -2,8 +2,8 @@ module Update.ChangeScale exposing (apply_to)
-- Elm -------------------------------------------------------------------------
-- Battlemap -------------------------------------------------------------------
-import Struct.Model
import Struct.Event
+import Struct.Model
import Struct.UI
--------------------------------------------------------------------------------
diff --git a/src/battlemap/src/Update/EndTurn.elm b/src/battlemap/src/Update/EndTurn.elm
index fd0ec83..75c2c0d 100644
--- a/src/battlemap/src/Update/EndTurn.elm
+++ b/src/battlemap/src/Update/EndTurn.elm
@@ -1,30 +1,28 @@
-module Model.EndTurn exposing (apply_to)
+module Update.EndTurn exposing (apply_to)
-- Elm -------------------------------------------------------------------------
import Dict
--- Battlemap -------------------------------------------------------------------
-import Battlemap
-
-import Character
-
-import Error
-import Event
+-- Struct.Battlemap -------------------------------------------------------------------
+import Send.CharacterTurn
-import Model
+import Struct.Battlemap
+import Struct.Character
+import Struct.Error
+import Struct.Event
+import Struct.Model
-import Send.CharacterTurn
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-make_it_so : Model.Type -> (Model.Type, (Cmd Event.Type))
+make_it_so : Struct.Model.Type -> (Struct.Model.Type, (Cmd Struct.Event.Type))
make_it_so model =
- case (Battlemap.try_getting_navigator_location model.battlemap) of
+ case (Struct.Battlemap.try_getting_navigator_location model.battlemap) of
(Just location) ->
case (Send.CharacterTurn.try model) of
(Just cmd) ->
(
- (Model.reset
+ (Struct.Model.reset
model
(Dict.update
char_ref
@@ -32,8 +30,11 @@ make_it_so model =
case maybe_char of
(Just char) ->
(Just
- (Character.set_enabled
- (Character.set_location location char)
+ (Struct.Character.set_enabled
+ (Struct.Character.set_location
+ location
+ char
+ )
False
)
)
@@ -50,10 +51,10 @@ make_it_so model =
Nothing ->
(
- (Model.invalidate
+ (Struct.Model.invalidate
model
- (Error.new
- Error.Programming
+ (Struct.Error.new
+ Struct.Error.Programming
"EndTurn: model moving char, no navigator location."
)
),
@@ -63,7 +64,7 @@ make_it_so model =
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-apply_to : Model.Type -> (Model.Type, (Cmd Event.Type))
+apply_to : Struct.Model.Type -> (Struct.Model.Type, (Cmd Struct.Event.Type))
apply_to model =
case (Query.CharacterTurn.get_state model.char_turn) of
Query.CharacterTurn.MovedCharacter -> (make_it_so model)
@@ -71,10 +72,10 @@ apply_to model =
_ ->
(
- (Model.invalidate
+ (Struct.Model.invalidate
model
- (Error.new
- Error.IllegalAction
+ (Struct.Error.new
+ Struct.Error.IllegalAction
"This can only be done while moving a character."
)
),
diff --git a/src/battlemap/src/Update/HandleServerReply.elm b/src/battlemap/src/Update/HandleServerReply.elm
index 13c493c..fab1bbc 100644
--- a/src/battlemap/src/Update/HandleServerReply.elm
+++ b/src/battlemap/src/Update/HandleServerReply.elm
@@ -1,32 +1,34 @@
-module Model.HandleServerReply exposing (apply_to)
+module Update.HandleServerReply exposing (apply_to)
+
+-- Elm -------------------------------------------------------------------------
-- Battlemap -------------------------------------------------------------------
-import Model
-import Error
-import Event
+import Struct.Error
+import Struct.Event
+import Struct.Model
-import Model.HandleServerReply.SetMap
-import Model.HandleServerReply.AddChar
+import Update.HandleServerReply.AddChar
+import Update.HandleServerReply.SetMap
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-apply_command: (List String) -> Model.Type -> Model.Type
+apply_command: (List String) -> Struct.Model.Type -> Struct.Model.Type
apply_command cmd model =
case
cmd
of
["set_map", data] ->
- (Model.HandleServerReply.SetMap.apply_to model data)
+ (Struct.Model.HandleServerReply.SetMap.apply_to model data)
["add_char", data] ->
- (Model.HandleServerReply.AddChar.apply_to model data)
+ (Struct.Model.HandleServerReply.AddChar.apply_to model data)
_ ->
- (Model.invalidate
+ (Struct.Model.invalidate
model
- (Error.new
- Error.Programming
+ (Struct.Error.new
+ Struct.Error.Programming
(
"Received invalid command from server:"
++ (toString cmd)
@@ -38,17 +40,17 @@ apply_command cmd model =
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
apply_to : (
- Model.Type ->
+ Struct.Model.Type ->
(Result Http.Error (List (List String)) ->
- (Model.Type, (Cmd Event.Type))
+ (Struct.Model.Type, (Cmd Struct.Event.Type))
)
apply_to model query_result =
case query_result of
(Result.Err error) ->
(
- (Model.invalidate
+ (Struct.Model.invalidate
model
- (Error.new Error.Networking (toString error))
+ (Struct.Error.new Struct.Error.Networking (toString error))
),
Cmd.none
)
diff --git a/src/battlemap/src/Update/HandleServerReply/AddChar.elm b/src/battlemap/src/Update/HandleServerReply/AddChar.elm
index f5f30ba..517b942 100644
--- a/src/battlemap/src/Update/HandleServerReply/AddChar.elm
+++ b/src/battlemap/src/Update/HandleServerReply/AddChar.elm
@@ -1,15 +1,13 @@
-module Model.HandleServerReply.AddChar exposing (apply_to)
+module Update.HandleServerReply.AddChar exposing (apply_to)
-- Elm -------------------------------------------------------------------------
import Json.Decode
import Json.Decode.Pipeline
-- Battlemap -------------------------------------------------------------------
-import Character
-
-import Error
-
-import Model
+import Struct.Character
+import Struct.Error
+import Struct.Model
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
@@ -54,7 +52,7 @@ char_decoder =
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-apply_to : Model.Type -> String -> Model.Type
+apply_to : Struct.Model.Type -> String -> Struct.Model.Type
apply_to model serialized_char =
case
(Json.Decode.decodeString
@@ -63,9 +61,9 @@ apply_to model serialized_char =
)
of
(Result.Ok char_data) ->
- (Model.add_character
+ (Struct.Model.add_character
model
- (Character.new
+ (Struct.Character.new
char_data.id
char_data.name
char_data.icon
@@ -81,10 +79,10 @@ apply_to model serialized_char =
)
(Result.Err msg) ->
- (Model.invalidate
+ (Struct.Model.invalidate
model
- (Error.new
- Error.Programming
+ (Struct.Error.new
+ Struct.Error.Programming
("Could not deserialize character: " ++ msg)
)
)
diff --git a/src/battlemap/src/Update/HandleServerReply/SetMap.elm b/src/battlemap/src/Update/HandleServerReply/SetMap.elm
index e815093..f902493 100644
--- a/src/battlemap/src/Update/HandleServerReply/SetMap.elm
+++ b/src/battlemap/src/Update/HandleServerReply/SetMap.elm
@@ -1,16 +1,15 @@
-module Model.HandleServerReply.SetMap exposing (apply_to)
+module Update.HandleServerReply.SetMap exposing (apply_to)
-- Elm -------------------------------------------------------------------------
import Dict
import Json.Decode
-- Battlemap -------------------------------------------------------------------
-import Battlemap
-import Battlemap.Tile
-
import Data.Tile
-import Model
+import Struct.Battlemap
+import Struct.Model
+import Struct.Tile
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
@@ -25,9 +24,9 @@ type alias MapData =
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-deserialize_tile : Int -> Int -> Int -> Battlemap.Tile.Type
+deserialize_tile : Int -> Int -> Int -> Struct.Tile.Type
deserialize_tile map_width index id =
- (Battlemap.Tile.new
+ (Struct.Tile.new
(index % map_width)
(index // map_width)
(Data.Tile.get_icon id)
@@ -37,7 +36,7 @@ deserialize_tile map_width index id =
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-apply_to : Model.Type -> String -> Model.Type
+apply_to : Struct.Model.Type -> String -> Struct.Model.Type
apply_to model serialized_map =
case
(Json.Decode.decodeString
@@ -53,10 +52,10 @@ apply_to model serialized_map =
)
of
(Result.Ok map_data) ->
- (Model.reset
+ (Struct.Model.reset
{model |
battlemap =
- (Battlemap.new
+ (Struct.Battlemap.new
map_data.width
map_data.height
(List.indexedMap
diff --git a/src/battlemap/src/Update/SelectTile.elm b/src/battlemap/src/Update/SelectTile.elm
index 5ce3c3c..417aeb7 100644
--- a/src/battlemap/src/Update/SelectTile.elm
+++ b/src/battlemap/src/Update/SelectTile.elm
@@ -1,56 +1,55 @@
-module Model.SelectTile exposing (apply_to)
+module Update.SelectTile exposing (apply_to)
--- Battlemap -------------------------------------------------------------------
-import Battlemap
-import Battlemap.Direction
-import Battlemap.Location
-
-import Character
+-- Elrm ------------------------------------------------------------------------
-import Event
-
-import Model.RequestDirection
-import Model.EndTurn
+-- Battlemap -------------------------------------------------------------------
+import Struct.Battlemap
+import Struct.Character
+import Struct.Direction
+import Struct.Event
+import Struct.Location
+import Struct.Model
+import Struct.UI
-import UI
-import Model
+import Update.EndTurn
+import Update.RequestDirection
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-autopilot : Battlemap.Direction.Type -> Model.Type -> Model.Type
+autopilot : Struct.Direction.Type -> Struct.Model.Type -> Struct.Model.Type
autopilot dir model =
- (Model.RequestDirection.apply_to model dir)
+ (Update.RequestDirection.apply_to model dir)
go_to_tile : (
- Model.Type ->
- Character.Ref ->
- Battlemap.Location.Ref ->
- (Model.Type, (Cmd Event.Type))
+ Struct.Model.Type ->
+ Struct.Character.Ref ->
+ Struct.Location.Ref ->
+ (Struct.Model.Type, (Cmd Struct.Event.Type))
)
go_to_tile model char_ref loc_ref =
- case (Battlemap.try_getting_navigator_location model.battlemap) of
+ case (Struct.Battlemap.try_getting_navigator_location model.battlemap) of
(Just nav_loc) ->
- if (loc_ref == (Battlemap.Location.get_ref nav_loc))
+ if (loc_ref == (Struct.Location.get_ref nav_loc))
then
-- We are already there.
if
(
- (UI.get_previous_action model.ui)
+ (Struct.UI.get_previous_action model.ui)
==
- (Just (UI.SelectedLocation loc_ref))
+ (Just (Struct.UI.SelectedLocation loc_ref))
)
then
-- And we just clicked on that tile.
- (Model.EndTurn.apply_to model)
+ (Update.EndTurn.apply_to model)
else
-- And we didn't just click on that tile.
(
{model |
ui =
- (UI.set_previous_action
+ (Struct.UI.set_previous_action
model.ui
- (Just (UI.SelectedLocation loc_ref))
+ (Just (Struct.UI.SelectedLocation loc_ref))
)
},
Cmd.none
@@ -58,7 +57,7 @@ go_to_tile model char_ref loc_ref =
else
-- We have to try getting there.
case
- (Battlemap.try_getting_navigator_path_to
+ (Struct.Battlemap.try_getting_navigator_path_to
model.battlemap
loc_ref
)
@@ -70,7 +69,7 @@ go_to_tile model char_ref loc_ref =
(autopilot)
{model |
battlemap =
- (Battlemap.clear_navigator_path
+ (Struct.Battlemap.clear_navigator_path
model.battlemap
)
}
@@ -80,31 +79,31 @@ go_to_tile model char_ref loc_ref =
(
{new_model |
ui =
- (UI.set_previous_action
+ (Struct.UI.set_previous_action
new_model.ui
- (Just (UI.SelectedLocation loc_ref))
+ (Just (Struct.UI.SelectedLocation loc_ref))
)
},
Cmd.none
)
Nothing -> -- Clicked outside of the range indicator
- ((Model.reset model model.characters), Cmd.none)
+ ((Struct.Model.reset model model.characters), Cmd.none)
Nothing -> -- Clicked outside of the range indicator
- ((Model.reset model model.characters), Cmd.none)
+ ((Struct.Model.reset model model.characters), Cmd.none)
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
apply_to : (
- Model.Type ->
- Battlemap.Location.Ref ->
- (Model.Type, (Cmd Event.Type))
+ Struct.Model.Type ->
+ Struct.Location.Ref ->
+ (Struct.Model.Type, (Cmd Struct.Event.Type))
)
apply_to model loc_ref =
case model.controlled_character of
(Just char_ref) ->
(go_to_tile model char_ref loc_ref)
- _ -> ({model | state = (Model.InspectingTile loc_ref)}, Cmd.none)
+ _ -> ({model | state = (Struct.Model.InspectingTile loc_ref)}, Cmd.none)
diff --git a/src/battlemap/src/View/Battlemap.elm b/src/battlemap/src/View/Battlemap.elm
index 35f8237..56b2186 100644
--- a/src/battlemap/src/View/Battlemap.elm
+++ b/src/battlemap/src/View/Battlemap.elm
@@ -3,78 +3,35 @@ module View.Battlemap exposing (get_html)
-- Elm -------------------------------------------------------------------------
import Array
-import List
-
import Html
import Html.Attributes
import Html.Events
import Html.Lazy
--- Battlemap ------------------------------------------------------------------
-import Battlemap
-import Battlemap.Tile
-
-import Character
+import List
+-- Battlemap -------------------------------------------------------------------
import Constants.UI
+import Struct.Battlemap
+import Struct.Character
+import Struct.Event
+import Struct.Model
+import Struct.Tile
+
import Util.Html
-import View.Battlemap.Tile
+import View.Battlemap.Character
import View.Battlemap.Navigator
+import View.Battlemap.Tile
-import Event
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-char_on_map : Character.Type -> (Html.Html Event.Type)
-char_on_map char =
- let
- char_loc = (Character.get_location char)
- in
- (Html.div
- [
- (Html.Attributes.class "battlemap-character-icon"),
- (Html.Attributes.class
- (
- if (Character.is_enabled char)
- then
- "battlemap-character-icon-enabled"
- else
- "battlemap-character-icon-disabled"
- )
- ),
- (Html.Attributes.class "battlemap-tiled"),
- (Html.Attributes.class
- ("asset-character-icon-" ++ (Character.get_icon_id char))
- ),
- (Html.Attributes.class
- (
- "battlemap-character-team-"
- ++ (toString (Character.get_team char))
- )
- ),
- (Html.Events.onClick
- (Event.CharacterSelected (Character.get_ref char))
- ),
- (Html.Attributes.style
- [
- (
- "top",
- ((toString (char_loc.y * Constants.UI.tile_size)) ++ "px")
- ),
- (
- "left",
- ((toString (char_loc.x * Constants.UI.tile_size)) ++ "px")
- )
- ]
- )
- ]
- [
- ]
- )
-
-get_tiles_line_html : (List (Html.Html Event.Type)) -> (Html.Html Event.Type)
+get_tiles_line_html : (
+ (List (Html.Html Struct.Event.Type)) ->
+ (Html.Html Struct.Event.Type)
+ )
get_tiles_line_html tiles_list =
(Html.div
[
@@ -85,16 +42,16 @@ get_tiles_line_html tiles_list =
get_tiles_lines_html : (
Int ->
- Battlemap.Tile.Type ->
+ Struct.Tile.Type ->
(
Int,
- (List (Html.Html Event.Type)),
- (List (Html.Html Event.Type))
+ (List (Html.Html Struct.Event.Type)),
+ (List (Html.Html Struct.Event.Type))
) ->
(
Int,
- (List (Html.Html Event.Type)),
- (List (Html.Html Event.Type))
+ (List (Html.Html Struct.Event.Type)),
+ (List (Html.Html Struct.Event.Type))
)
)
get_tiles_lines_html max_index tile (curr_index, curr_line, result) =
@@ -105,7 +62,7 @@ get_tiles_lines_html max_index tile (curr_index, curr_line, result) =
[],
(
(get_tiles_line_html
- ((View.Battlemap.Tile.get_html tile) :: curr_line)
+ ((View.Tile.get_html tile) :: curr_line)
)
::
result
@@ -114,23 +71,20 @@ get_tiles_lines_html max_index tile (curr_index, curr_line, result) =
else
(
(curr_index - 1),
- ((View.Battlemap.Tile.get_html tile) :: curr_line),
+ ((View.Tile.get_html tile) :: curr_line),
result
)
-get_tiles_html : (
- Int ->
- (Array.Array Battlemap.Tile.Type) ->
- (Html.Html Event.Type)
- )
-get_tiles_html bmap_width tiles_array =
+get_tiles_html : Struct.Battlemap.Type -> (Html.Html Struct.Event.Type)
+get_tiles_html battlemap =
let
+ bmap_width (Struct.Battlemap.get_width battlemap)
max_index = (bmap_width - 1)
(_, last_line, other_lines) =
(Array.foldr
(get_tiles_lines_html max_index)
(max_index, [], [])
- tiles_array
+ (Struct.Battlemap.get_tiles battlemap)
)
in
(Html.div
@@ -139,16 +93,15 @@ get_tiles_html bmap_width tiles_array =
]
((get_tiles_line_html last_line) :: other_lines)
)
+
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
get_html : (
- Battlemap.Type ->
- Float ->
- (List Character.Type) ->
- (Html.Html Event.Type)
+ Struct.Model.Type ->
+ (Html.Html Struct.Event.Type)
)
-get_html battlemap scale characters =
+get_html model =
(Html.div
[
(Html.Attributes.class "battlemap-actual"),
@@ -156,26 +109,25 @@ get_html battlemap scale characters =
[
(
"transform",
- ("scale(" ++ (toString scale) ++ ")")
+ (
+ "scale("
+ ++
+ (toString (Struct.UI.get_scale model))
+ ++ ")"
+ )
)
]
)
]
(
(Html.Lazy.lazy
- (get_tiles_html (Battlemap.get_width battlemap))
- (Battlemap.get_tiles battlemap)
+ (get_tiles_html (Battlemap.get_width model.battlemap))
+ model.battlemap
)
::
(List.map
- (char_on_map)
- characters
+ (View.Battlemap.Character.get_html)
+ model.characters
)
- ++
- case (Battlemap.try_getting_navigator_summary battlemap) of
- (Just nav_summary) ->
- (View.Battlemap.Navigator.get_html nav_summary)
-
- Nothing -> [(Util.Html.nothing)]
)
)
diff --git a/src/battlemap/src/View/Battlemap/Character.elm b/src/battlemap/src/View/Battlemap/Character.elm
new file mode 100644
index 0000000..96641a3
--- /dev/null
+++ b/src/battlemap/src/View/Battlemap/Character.elm
@@ -0,0 +1,67 @@
+module View.Battlemap.Character exposing (get_html)
+
+-- Elm -------------------------------------------------------------------------
+import Html
+import Html.Attributes
+import Html.Events
+
+-- Battlemap ------------------------------------------------------------------
+import Constants.UI
+
+import Struct.Character
+import Struct.Event
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+get_html : Struct.Character.Type -> (Html.Html Struct.Event.Type)
+get_html char =
+ let
+ char_loc = (Struct.Character.get_location char)
+ in
+ (Html.div
+ [
+ (Html.Attributes.class "battlemap-character-icon"),
+ (Html.Attributes.class
+ (
+ if (Struct.Character.is_enabled char)
+ then
+ "battlemap-character-icon-enabled"
+ else
+ "battlemap-character-icon-disabled"
+ )
+ ),
+ (Html.Attributes.class "battlemap-tiled"),
+ (Html.Attributes.class
+ ("asset-character-icon-" ++ (Struct.Character.get_icon_id char))
+ ),
+ (Html.Attributes.class
+ (
+ "battlemap-character-team-"
+ ++ (toString (Struct.Character.get_team char))
+ )
+ ),
+ (Html.Events.onClick
+ (Struct.Event.CharacterSelected (Struct.Character.get_ref char))
+ ),
+ (Html.Attributes.style
+ [
+ (
+ "top",
+ ((toString (char_loc.y * Constants.UI.tile_size)) ++ "px")
+ ),
+ (
+ "left",
+ ((toString (char_loc.x * Constants.UI.tile_size)) ++ "px")
+ )
+ ]
+ )
+ ]
+ [
+ ]
+ )
+
diff --git a/src/battlemap/src/View/Battlemap/Navigator.elm b/src/battlemap/src/View/Battlemap/Navigator.elm
index 5e64e2e..1b99d47 100644
--- a/src/battlemap/src/View/Battlemap/Navigator.elm
+++ b/src/battlemap/src/View/Battlemap/Navigator.elm
@@ -1,25 +1,27 @@
module View.Battlemap.Navigator exposing (get_html)
-import List
+-- Elm -------------------------------------------------------------------------
import Html
import Html.Attributes
import Html.Events
-import Battlemap.Location
-import Battlemap.Direction
-import Battlemap.Marker
-import Battlemap.Navigator
+import List
+-- Battlemap -------------------------------------------------------------------
import Constants.UI
-import Event
+import Struct.Direction
+import Struct.Event
+import Struct.Location
+import Struct.Marker
+import Struct.Navigator
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
marker_get_html : (
- (Battlemap.Location.Ref, Battlemap.Marker.Type) ->
- (Html.Html Event.Type)
+ (Struct.Location.Ref, Struct.Marker.Type) ->
+ (Html.Html Struct.Event.Type)
)
marker_get_html (loc_ref, marker) =
(Html.div
@@ -31,7 +33,7 @@ marker_get_html (loc_ref, marker) =
"battlemap-"
++
(
- if (marker == Battlemap.Marker.CanGoTo)
+ if (marker == Struct.Marker.CanGoTo)
then
"can-go-to"
else
@@ -42,12 +44,12 @@ marker_get_html (loc_ref, marker) =
)
),
(Html.Events.onClick
- (Event.TileSelected loc_ref)
+ (Struct.Event.TileSelected loc_ref)
),
(Html.Attributes.style
(
let
- loc = (Battlemap.Location.from_ref loc_ref)
+ loc = (Struct.Location.from_ref loc_ref)
in
[
(
@@ -67,21 +69,21 @@ marker_get_html (loc_ref, marker) =
)
path_node_get_html : (
- Battlemap.Direction.Type ->
+ Struct.Direction.Type ->
(
- Battlemap.Location.Type,
- Battlemap.Direction.Type,
- (List (Html.Html Event.Type))
+ Struct.Location.Type,
+ Struct.Direction.Type,
+ (List (Html.Html Struct.Event.Type))
) ->
(
- Battlemap.Location.Type,
- Battlemap.Direction.Type,
- (List (Html.Html Event.Type))
+ Struct.Location.Type,
+ Struct.Direction.Type,
+ (List (Html.Html Struct.Event.Type))
)
)
path_node_get_html new_dir (curr_loc, prev_dir, curr_nodes) =
let
- new_loc = (Battlemap.Location.neighbor curr_loc new_dir)
+ new_loc = (Struct.Location.neighbor curr_loc new_dir)
in
(
new_loc,
@@ -95,13 +97,15 @@ path_node_get_html new_dir (curr_loc, prev_dir, curr_nodes) =
(
"battlemap-path-icon-"
++
- (Battlemap.Direction.to_string prev_dir)
+ (Struct.Direction.to_string prev_dir)
++
- (Battlemap.Direction.to_string new_dir)
+ (Struct.Direction.to_string new_dir)
)
),
(Html.Events.onClick
- (Event.TileSelected (Battlemap.Location.get_ref new_loc))
+ (Struct.Event.TileSelected
+ (Struct.Location.get_ref new_loc)
+ )
),
(Html.Attributes.style
[
@@ -133,9 +137,9 @@ path_node_get_html new_dir (curr_loc, prev_dir, curr_nodes) =
)
mark_the_spot : (
- Battlemap.Location.Type ->
- Battlemap.Direction.Type ->
- (Html.Html Event.Type)
+ Struct.Location.Type ->
+ Struct.Direction.Type ->
+ (Html.Html Struct.Event.Type)
)
mark_the_spot loc origin_dir =
(Html.div
@@ -146,11 +150,11 @@ mark_the_spot loc origin_dir =
(
"battlemap-path-icon-mark"
++
- (Battlemap.Direction.to_string origin_dir)
+ (Struct.Direction.to_string origin_dir)
)
),
(Html.Events.onClick
- (Event.TileSelected (Battlemap.Location.get_ref loc))
+ (Struct.Event.TileSelected (Struct.Location.get_ref loc))
),
(Html.Attributes.style
[
@@ -168,12 +172,13 @@ mark_the_spot loc origin_dir =
[
]
)
+
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
get_html : (
- Battlemap.Navigator.Summary ->
- (List (Html.Html Event.Type))
+ Struct.Navigator.Summary ->
+ (List (Html.Html Struct.Event.Type))
)
get_html nav_summary =
(
@@ -184,7 +189,7 @@ get_html nav_summary =
(final_loc, final_dir, path_node_htmls) =
(List.foldr
(path_node_get_html)
- (nav_summary.starting_location, Battlemap.Direction.None, [])
+ (nav_summary.starting_location, Struct.Direction.None, [])
nav_summary.path
)
in
diff --git a/src/battlemap/src/View/Battlemap/Tile.elm b/src/battlemap/src/View/Battlemap/Tile.elm
index 3577e00..376a442 100644
--- a/src/battlemap/src/View/Battlemap/Tile.elm
+++ b/src/battlemap/src/View/Battlemap/Tile.elm
@@ -1,33 +1,41 @@
module View.Battlemap.Tile exposing (get_html)
+-- Elm -------------------------------------------------------------------------
import Html
import Html.Attributes
import Html.Events
-import Battlemap.Tile
-import Battlemap.Location
-
+-- Battlemap -------------------------------------------------------------------
import Constants.UI
-import Event
+import Struct.Event
+import Struct.Location
+import Struct.Tile
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
get_html : (
- Battlemap.Tile.Type ->
- (Html.Html Event.Type)
+ Struct.Tile.Type ->
+ (Html.Html Struct.Event.Type)
)
get_html tile =
let
- tile_loc = (Battlemap.Tile.get_location tile)
+ tile_loc = (Struct.Tile.get_location tile)
in
(Html.div
[
(Html.Attributes.class "battlemap-tile-icon"),
(Html.Attributes.class "battlemap-tiled"),
(Html.Attributes.class
- ("asset-tile-" ++ (Battlemap.Tile.get_icon_id tile))
+ ("asset-tile-" ++ (Struct.Tile.get_icon_id tile))
),
(Html.Events.onClick
- (Event.TileSelected (Battlemap.Location.get_ref tile_loc))
+ (Struct.Event.TileSelected (Struct.Location.get_ref tile_loc))
)
-- ),
-- (Html.Attributes.style
diff --git a/src/battlemap/src/View/Footer.elm b/src/battlemap/src/View/Footer.elm
index 26a08ef..343fbd9 100644
--- a/src/battlemap/src/View/Footer.elm
+++ b/src/battlemap/src/View/Footer.elm
@@ -1,30 +1,27 @@
module View.Footer exposing (get_html)
-- Elm -------------------------------------------------------------------------
-import Html
-import Html.Attributes
-
import Dict
--- Battlemap -------------------------------------------------------------------
-import Battlemap
-import Character
-
-import Event
+import Html
+import Html.Attributes
-import Model
+-- Struct.Battlemap -------------------------------------------------------------------
+import Struct.Battlemap
+import Struct.Character
+import Struct.Event
+import Struct.Model
+import Struct.UI
import Util.Html
-import UI
-
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
get_curr_char_info_htmls : (
- Model.Type ->
- Character.Ref ->
- (List (Html.Html Event.Type))
+ Struct.Model.Type ->
+ Struct.Character.Ref ->
+ (List (Html.Html Struct.Event.Type))
)
get_curr_char_info_htmls model char_ref =
case (Dict.get char_ref model.characters) of
@@ -36,12 +33,12 @@ get_curr_char_info_htmls model char_ref =
++ char.name
++ ": "
++ (toString
- (Battlemap.get_navigator_remaining_points
+ (Struct.Battlemap.get_navigator_remaining_points
model.battlemap
)
)
++ "/"
- ++ (toString (Character.get_movement_points char))
+ ++ (toString (Struct.Character.get_movement_points char))
++ " movement points remaining."
)
)
@@ -53,7 +50,7 @@ get_curr_char_info_htmls model char_ref =
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_html : Model.Type -> (Html.Html Event.Type)
+get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)
get_html model =
case model.controlled_character of
(Just char_id) ->
diff --git a/src/battlemap/src/View/SideBar.elm b/src/battlemap/src/View/SideBar.elm
index aa76a6f..45a55ea 100644
--- a/src/battlemap/src/View/SideBar.elm
+++ b/src/battlemap/src/View/SideBar.elm
@@ -5,13 +5,12 @@ import Html
import Html.Attributes
-- Battlemap -------------------------------------------------------------------
-import Event
-
-import Model
+import Struct.Event
+import Struct.Model
+import Struct.UI
import Util.Html
-import UI
import View.SideBar.TabMenu
import View.SideBar.Targets
@@ -20,7 +19,7 @@ import View.SideBar.ManualControls
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_html : Model.Type -> (Html.Html Event.Type)
+get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)
get_html model =
(Html.div
[
@@ -36,7 +35,7 @@ get_html model =
(View.SideBar.Targets.get_html model)
),
(
- if (UI.has_manual_controls_enabled model.ui)
+ if (Struct.UI.has_manual_controls_enabled model.ui)
then
(View.SideBar.ManualControls.get_html)
else
diff --git a/src/battlemap/src/View/SideBar/ManualControls.elm b/src/battlemap/src/View/SideBar/ManualControls.elm
index 15edd2a..6dbd100 100644
--- a/src/battlemap/src/View/SideBar/ManualControls.elm
+++ b/src/battlemap/src/View/SideBar/ManualControls.elm
@@ -6,45 +6,48 @@ import Html.Attributes
import Html.Events
-- Battlemap -------------------------------------------------------------------
-import Battlemap.Direction
-
-import Event
+import Struct.Direction
+import Struct.Event
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-direction_button : Battlemap.Direction.Type -> String -> (Html.Html Event.Type)
+direction_button : (
+ Struct.Direction.Type ->
+ String ->
+ (Html.Html Struct.Event.Type)
+ )
direction_button dir label =
(Html.button
[
(Html.Events.onClick
- (Event.DirectionRequested dir)
+ (Struct.Event.DirectionRequested dir)
)
]
[ (Html.text label) ]
)
-end_turn_button : (Html.Html Event.Type)
+end_turn_button : (Html.Html Struct.Event.Type)
end_turn_button =
(Html.button
- [ (Html.Events.onClick Event.TurnEnded) ]
+ [ (Html.Events.onClick Struct.Event.TurnEnded) ]
[ (Html.text "End Turn") ]
)
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_html : (Html.Html Event.Type)
+get_html : (Html.Html Struct.Event.Type)
get_html =
(Html.div
[
(Html.Attributes.class "battlemap-manual-controls")
]
[
- (direction_button Battlemap.Direction.Left "Left"),
- (direction_button Battlemap.Direction.Down "Down"),
- (direction_button Battlemap.Direction.Up "Up"),
- (direction_button Battlemap.Direction.Right "Right"),
+ (direction_button Struct.Direction.Left "Left"),
+ (direction_button Struct.Direction.Down "Down"),
+ (direction_button Struct.Direction.Up "Up"),
+ (direction_button Struct.Direction.Right "Right"),
(end_turn_button)
]
)
diff --git a/src/battlemap/src/View/SideBar/TabMenu.elm b/src/battlemap/src/View/SideBar/TabMenu.elm
index 864618b..220e20a 100644
--- a/src/battlemap/src/View/SideBar/TabMenu.elm
+++ b/src/battlemap/src/View/SideBar/TabMenu.elm
@@ -6,30 +6,32 @@ import Html.Attributes
import Html.Events
-- Battlemap -------------------------------------------------------------------
-import Event
+import Struct.Error
+import Struct.Event
+import Struct.Model
+import Struct.UI
-import Error
-
-import Model
-
-import UI
import Util.Html
import View.SideBar.TabMenu.Characters
-import View.SideBar.TabMenu.Status
import View.SideBar.TabMenu.Settings
+import View.SideBar.TabMenu.Status
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_basic_button_html : UI.Tab -> (Html.Html Event.Type)
+get_basic_button_html : Struct.UI.Tab -> (Html.Html Struct.Event.Type)
get_basic_button_html tab =
(Html.button
- [ (Html.Events.onClick (Event.TabSelected tab)) ]
- [ (Html.text (UI.to_string tab)) ]
+ [ (Html.Events.onClick (Struct.Event.TabSelected tab)) ]
+ [ (Html.text (Struct.UI.to_string tab)) ]
)
-get_menu_button_html : UI.Tab -> UI.Tab -> (Html.Html Event.Type)
+get_menu_button_html : (
+ Struct.UI.Tab ->
+ Struct.UI.Tab ->
+ (Html.Html Struct.Event.Type)
+ )
get_menu_button_html selected_tab tab =
(Html.button
(
@@ -37,30 +39,30 @@ get_menu_button_html selected_tab tab =
then
[ (Html.Attributes.disabled True) ]
else
- [ (Html.Events.onClick (Event.TabSelected tab)) ]
+ [ (Html.Events.onClick (Struct.Event.TabSelected tab)) ]
)
- [ (Html.text (UI.to_string tab)) ]
+ [ (Html.text (Struct.UI.to_string tab)) ]
)
-get_active_tab_selector_html : UI.Tab -> (Html.Html Event.Type)
+get_active_tab_selector_html : Struct.UI.Tab -> (Html.Html Struct.Event.Type)
get_active_tab_selector_html selected_tab =
(Html.div
[
(Html.Attributes.class "battlemap-tabmenu-selector")
]
- (List.map (get_menu_button_html selected_tab) (UI.get_all_tabs))
+ (List.map (get_menu_button_html selected_tab) (Struct.UI.get_all_tabs))
)
-get_inactive_tab_selector_html : (Html.Html Event.Type)
+get_inactive_tab_selector_html : (Html.Html Struct.Event.Type)
get_inactive_tab_selector_html =
(Html.div
[
(Html.Attributes.class "battlemap-tabmenu-selector")
]
- (List.map (get_basic_button_html) (UI.get_all_tabs))
+ (List.map (get_basic_button_html) (Struct.UI.get_all_tabs))
)
-get_error_message_html : Model.Type -> (Html.Html Event.Type)
+get_error_message_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)
get_error_message_html model =
case model.error of
(Just error) ->
@@ -69,7 +71,7 @@ get_error_message_html model =
(Html.Attributes.class "battlemap-tabmenu-error-message")
]
[
- (Html.text (Error.to_string error))
+ (Html.text (Struct.Error.to_string error))
]
)
@@ -77,7 +79,7 @@ get_error_message_html model =
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_html : Model.Type -> (Html.Html Event.Type)
+get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)
get_html model =
(Html.div
[
@@ -88,24 +90,24 @@ get_html model =
::
(
let
- displayed_tab = (UI.try_getting_displayed_tab model.ui)
+ displayed_tab = (Struct.UI.try_getting_displayed_tab model.ui)
in
case displayed_tab of
- (Just UI.StatusTab) ->
+ (Just Struct.UI.StatusTab) ->
[
- (get_active_tab_selector_html UI.StatusTab),
+ (get_active_tab_selector_html Struct.UI.StatusTab),
(View.SideBar.TabMenu.Status.get_html model)
]
- (Just UI.CharactersTab) ->
+ (Just Struct.UI.CharactersTab) ->
[
- (get_active_tab_selector_html UI.CharactersTab),
+ (get_active_tab_selector_html Struct.UI.CharactersTab),
(View.SideBar.TabMenu.Characters.get_html model)
]
- (Just UI.SettingsTab) ->
+ (Just Struct.UI.SettingsTab) ->
[
- (get_active_tab_selector_html UI.SettingsTab),
+ (get_active_tab_selector_html Struct.UI.SettingsTab),
(View.SideBar.TabMenu.Settings.get_html model)
]
diff --git a/src/battlemap/src/View/SideBar/TabMenu/Characters.elm b/src/battlemap/src/View/SideBar/TabMenu/Characters.elm
index 7768ff2..cb2e53f 100644
--- a/src/battlemap/src/View/SideBar/TabMenu/Characters.elm
+++ b/src/battlemap/src/View/SideBar/TabMenu/Characters.elm
@@ -5,25 +5,25 @@ import Dict
import Html
import Html.Attributes
---import Html.Events
-- Battlemap -------------------------------------------------------------------
-import Character
-
-import Event
-
-import Model
+import Struct.Character
+import Struct.Event
+import Struct.Model
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_character_portrait_html : Character.Type -> (Html.Html Event.Type)
+get_character_portrait_html : (
+ Struct.Character.Type ->
+ (Html.Html Struct.Event.Type)
+ )
get_character_portrait_html char =
(Html.div
[
(Html.Attributes.class "battlemap-character-portrait"),
(Html.Attributes.class
- ("asset-char-portrait-" ++ (Character.get_portrait_id char))
+ ("asset-char-portrait-" ++ (Struct.Character.get_portrait_id char))
)
]
[
@@ -32,7 +32,7 @@ get_character_portrait_html char =
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_html : Model.Type -> (Html.Html Event.Type)
+get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)
get_html model =
(Html.div
[
diff --git a/src/battlemap/src/View/SideBar/TabMenu/Settings.elm b/src/battlemap/src/View/SideBar/TabMenu/Settings.elm
index d73956a..3f42739 100644
--- a/src/battlemap/src/View/SideBar/TabMenu/Settings.elm
+++ b/src/battlemap/src/View/SideBar/TabMenu/Settings.elm
@@ -6,19 +6,18 @@ import Html.Attributes
import Html.Events
-- Battlemap -------------------------------------------------------------------
-import Event
-
-import Model
+import Struct.Event
+import Struct.Model
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-scale_button : Float -> String -> (Html.Html Event.Type)
+scale_button : Float -> String -> (Html.Html Struct.Event.Type)
scale_button mod label =
(Html.button
[
(Html.Events.onClick
- (Event.ScaleChangeRequested mod)
+ (Struct.Event.ScaleChangeRequested mod)
)
]
[ (Html.text label) ]
@@ -27,7 +26,7 @@ scale_button mod label =
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_html : Model.Type -> (Html.Html Event.Type)
+get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)
get_html model =
(Html.div
[
@@ -40,13 +39,13 @@ get_html model =
(scale_button (1.15) "Zoom +"),
(Html.button
[
- (Html.Events.onClick Event.DebugTeamSwitchRequest)
+ (Html.Events.onClick Struct.Event.DebugTeamSwitchRequest)
]
[ (Html.text "[DEBUG] Switch team") ]
),
(Html.button
[
- (Html.Events.onClick Event.DebugLoadBattlemapRequest)
+ (Html.Events.onClick Struct.Event.DebugLoadBattlemapRequest)
]
[ (Html.text "[DEBUG] Load battlemap") ]
)
diff --git a/src/battlemap/src/View/SideBar/TabMenu/Status.elm b/src/battlemap/src/View/SideBar/TabMenu/Status.elm
index a0a66f9..7309b01 100644
--- a/src/battlemap/src/View/SideBar/TabMenu/Status.elm
+++ b/src/battlemap/src/View/SideBar/TabMenu/Status.elm
@@ -6,26 +6,27 @@ import Dict
import Html
import Html.Attributes
--- Battlemap -------------------------------------------------------------------
-import Battlemap
-import Battlemap.Location
-import Battlemap.Tile
-
-import Character
-
-import UI
+-- Struct.Battlemap -------------------------------------------------------------------
+import Struct.Battlemap
+import Struct.Character
+import Struct.Error
+import Struct.Event
+import Struct.Location
+import Struct.Model
+import Struct.Tile
+import Struct.UI
import Util.Html
-import Error
-import Event
-import Model
-
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_char_info_html : Model.Type -> Character.Ref -> (Html.Html Event.Type)
+get_char_info_html : (
+ Struct.Model.Type ->
+ Struct.Character.Ref ->
+ (Html.Html Struct.Event.Type)
+ )
get_char_info_html model char_ref =
case (Dict.get char_ref model.characters) of
Nothing -> (Html.text "Error: Unknown character selected.")
@@ -35,19 +36,23 @@ get_char_info_html model char_ref =
"Focusing "
++ char.name
++ " (Team "
- ++ (toString (Character.get_team char))
+ ++ (toString (Struct.Character.get_team char))
++ "): "
- ++ (toString (Character.get_movement_points char))
+ ++ (toString (Struct.Character.get_movement_points char))
++ " movement points; "
- ++ (toString (Character.get_attack_range char))
+ ++ (toString (Struct.Character.get_attack_range char))
++ " attack range. Health: "
- ++ (toString (Character.get_current_health char))
+ ++ (toString (Struct.Character.get_current_health char))
++ "/"
- ++ (toString (Character.get_max_health char))
+ ++ (toString (Struct.Character.get_max_health char))
)
)
-get_char_attack_info_html : Model.Type -> Character.Ref -> (Html.Html Event.Type)
+get_char_attack_info_html : (
+ Struct.Model.Type ->
+ Struct.Character.Ref ->
+ (Html.Html Struct.Event.Type)
+ )
get_char_attack_info_html model char_ref =
case (Dict.get char_ref model.characters) of
Nothing -> (Html.text "Error: Unknown character selected.")
@@ -57,36 +62,36 @@ get_char_attack_info_html model char_ref =
"Attacking "
++ char.name
++ " (Team "
- ++ (toString (Character.get_team char))
+ ++ (toString (Struct.Character.get_team char))
++ "): "
- ++ (toString (Character.get_movement_points char))
+ ++ (toString (Struct.Character.get_movement_points char))
++ " movement points; "
- ++ (toString (Character.get_attack_range char))
+ ++ (toString (Struct.Character.get_attack_range char))
++ " attack range. Health: "
- ++ (toString (Character.get_current_health char))
+ ++ (toString (Struct.Character.get_current_health char))
++ "/"
- ++ (toString (Character.get_max_health char))
+ ++ (toString (Struct.Character.get_max_health char))
)
)
-get_error_html : Error.Type -> (Html.Html Event.Type)
+get_error_html : Struct.Error.Type -> (Html.Html Struct.Event.Type)
get_error_html err =
(Html.div
[
(Html.Attributes.class "battlemap-tabmenu-error-message")
]
[
- (Html.text (Error.to_string err))
+ (Html.text (Struct.Error.to_string err))
]
)
get_tile_info_html : (
- Model.Type ->
- Battlemap.Location.Type ->
- (Html.Html Event.Type)
+ Struct.Model.Type ->
+ Struct.Location.Type ->
+ (Html.Html Struct.Event.Type)
)
get_tile_info_html model loc =
- case (Battlemap.try_getting_tile_at model.battlemap loc) of
+ case (Struct.Battlemap.try_getting_tile_at model.battlemap loc) of
(Just tile) ->
(Html.div
[
@@ -103,7 +108,7 @@ get_tile_info_html model loc =
(
"asset-tile-"
++
- (Battlemap.Tile.get_icon_id tile)
+ (Struct.Tile.get_icon_id tile)
)
)
]
@@ -121,9 +126,9 @@ get_tile_info_html model loc =
++ ", "
++ (toString loc.y)
++ "). {ID = "
- ++ (Battlemap.Tile.get_icon_id tile)
+ ++ (Struct.Tile.get_icon_id tile)
++ ", cost = "
- ++ (toString (Battlemap.Tile.get_cost tile))
+ ++ (toString (Struct.Tile.get_cost tile))
++ "}."
)
)
@@ -137,7 +142,7 @@ get_tile_info_html model loc =
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_html : Model.Type -> (Html.Html Event.Type)
+get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)
get_html model =
(Html.div
[
@@ -145,22 +150,22 @@ get_html model =
(Html.Attributes.class "battlemap-footer-tabmenu-content-status")
]
(case model.state of
- (Model.InspectingTile tile_loc) ->
- [(get_tile_info_html model (Battlemap.Location.from_ref tile_loc))]
+ (Struct.Model.InspectingTile tile_loc) ->
+ [(get_tile_info_html model (Struct.Location.from_ref tile_loc))]
- (Model.InspectingCharacter char_ref) ->
+ (Struct.Model.InspectingCharacter char_ref) ->
[(get_char_info_html model char_ref)]
_ ->
[
- (case (UI.get_previous_action model.ui) of
- (Just (UI.SelectedLocation loc)) ->
+ (case (Struct.UI.get_previous_action model.ui) of
+ (Just (Struct.UI.SelectedLocation loc)) ->
(get_tile_info_html
model
- (Battlemap.Location.from_ref loc)
+ (Struct.Location.from_ref loc)
)
- (Just (UI.SelectedCharacter target_char)) ->
+ (Just (Struct.UI.SelectedCharacter target_char)) ->
(get_char_info_html model target_char)
_ ->
diff --git a/src/battlemap/src/View/SideBar/Targets.elm b/src/battlemap/src/View/SideBar/Targets.elm
index f8d3cc6..e3e4006 100644
--- a/src/battlemap/src/View/SideBar/Targets.elm
+++ b/src/battlemap/src/View/SideBar/Targets.elm
@@ -7,25 +7,26 @@ import Html
import Html.Attributes
-- Battlemap -------------------------------------------------------------------
-import Battlemap
-import Battlemap.Location
-import Battlemap.Tile
-
-import Character
-
-import UI
+import Struct.Battlemap
+import Struct.Character
+import Struct.Error
+import Struct.Event
+import Struct.Location
+import Struct.Model
+import Struct.Tile
+import Struct.UI
import Util.Html
-import Error
-import Event
-import Model
-
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_target_info_html : Model.Type -> Character.Ref -> (Html.Html Event.Type)
+get_target_info_html : (
+ Struct.Model.Type ->
+ Struct.Character.Ref ->
+ (Html.Html Struct.Event.Type)
+ )
get_target_info_html model char_ref =
case (Dict.get char_ref model.characters) of
Nothing -> (Html.text "Error: Unknown character selected.")
@@ -35,22 +36,22 @@ get_target_info_html model char_ref =
"Attacking "
++ char.name
++ " (Team "
- ++ (toString (Character.get_team char))
+ ++ (toString (Struct.Character.get_team char))
++ "): "
- ++ (toString (Character.get_movement_points char))
+ ++ (toString (Struct.Character.get_movement_points char))
++ " movement points; "
- ++ (toString (Character.get_attack_range char))
+ ++ (toString (Struct.Character.get_attack_range char))
++ " attack range. Health: "
- ++ (toString (Character.get_current_health char))
+ ++ (toString (Struct.Character.get_current_health char))
++ "/"
- ++ (toString (Character.get_max_health char))
+ ++ (toString (Struct.Character.get_max_health char))
)
)
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_html : Model.Type -> (Html.Html Event.Type)
+get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)
get_html model =
(Html.div
[