summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/map-editor')
-rw-r--r--src/map-editor/src/Comm/LoadTiles.elm31
-rw-r--r--src/map-editor/src/Comm/Send.elm16
-rw-r--r--src/map-editor/src/Constants/IO.elm.m46
-rw-r--r--src/map-editor/src/ElmModule/Init.elm15
4 files changed, 64 insertions, 4 deletions
diff --git a/src/map-editor/src/Comm/LoadTiles.elm b/src/map-editor/src/Comm/LoadTiles.elm
new file mode 100644
index 0000000..6175e7a
--- /dev/null
+++ b/src/map-editor/src/Comm/LoadTiles.elm
@@ -0,0 +1,31 @@
+module Comm.LoadTiles exposing (try)
+
+-- Elm -------------------------------------------------------------------------
+
+-- Battlemap -------------------------------------------------------------------
+import Comm.Send
+
+import Constants.IO
+
+import Struct.Event
+import Struct.Model
+
+--------------------------------------------------------------------------------
+-- TYPES ------------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+try : Struct.Model.Type -> (Maybe (Cmd Struct.Event.Type))
+try model =
+ (Just
+ (Comm.Send.empty_request
+ model
+ Constants.IO.tiles_data_url
+ )
+ )
diff --git a/src/map-editor/src/Comm/Send.elm b/src/map-editor/src/Comm/Send.elm
index 2b9c4aa..f620f68 100644
--- a/src/map-editor/src/Comm/Send.elm
+++ b/src/map-editor/src/Comm/Send.elm
@@ -1,4 +1,4 @@
-module Comm.Send exposing (try_sending)
+module Comm.Send exposing (try_sending, empty_request)
-- Elm -------------------------------------------------------------------------
import Http
@@ -66,3 +66,17 @@ try_sending model recipient try_encoding_fun =
)
Nothing -> Nothing
+
+empty_request : (
+ Struct.Model.Type ->
+ String ->
+ (Cmd Struct.Event.Type)
+ )
+empty_request model recipient =
+ (Http.send
+ Struct.Event.ServerReplied
+ (Http.get
+ recipient
+ (Json.Decode.list (decode))
+ )
+ )
diff --git a/src/map-editor/src/Constants/IO.elm.m4 b/src/map-editor/src/Constants/IO.elm.m4
index ed66c79..397efaa 100644
--- a/src/map-editor/src/Constants/IO.elm.m4
+++ b/src/map-editor/src/Constants/IO.elm.m4
@@ -3,6 +3,12 @@ module Constants.IO exposing (..)
base_url : String
base_url = "__CONF_SERVER_URL"
+data_url : String
+data_url = (base_url ++ "/asset/data/")
+
+tiles_data_url : String
+tiles_data_url = (base_url ++ "/asset/data/tiles.json")
+
map_editor_handler_url : String
map_editor_handler_url = (base_url ++ "/handler/map-editor")
diff --git a/src/map-editor/src/ElmModule/Init.elm b/src/map-editor/src/ElmModule/Init.elm
index 73230a3..09034dc 100644
--- a/src/map-editor/src/ElmModule/Init.elm
+++ b/src/map-editor/src/ElmModule/Init.elm
@@ -3,6 +3,7 @@ module ElmModule.Init exposing (init)
-- Elm -------------------------------------------------------------------------
-- Battlemap -------------------------------------------------------------------
+import Comm.LoadTiles
import Comm.LoadMap
import Struct.Event
@@ -21,8 +22,16 @@ init flags =
let model = (Struct.Model.new flags) in
(
model,
- (case (Comm.LoadMap.try model) of
- (Just cmd) -> cmd
- Nothing -> Cmd.none
+ (Cmd.batch
+ [
+ (case (Comm.LoadTiles.try model) of
+ (Just cmd) -> cmd
+ Nothing -> Cmd.none
+ ),
+ (case (Comm.LoadMap.try model) of
+ (Just cmd) -> cmd
+ Nothing -> Cmd.none
+ )
+ ]
)
)