summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-10-19 17:15:49 +0200
committernsensfel <SpamShield0@noot-noot.org>2018-10-19 17:15:49 +0200
commitfc301462a384226c76d2487c402493adbb6b6dbe (patch)
tree7c064c46bfbc84d719e737a6b6e2bc7dc2759428
parent9805f1db85c0db13bff43986a6018217d8e67f49 (diff)
(Broken) Starting to work on item selection...
-rw-r--r--src/roster-editor/src/ElmModule/Update.elm25
-rw-r--r--src/roster-editor/src/Struct/Event.elm13
-rw-r--r--src/roster-editor/src/Update/SetArmor.elm39
3 files changed, 76 insertions, 1 deletions
diff --git a/src/roster-editor/src/ElmModule/Update.elm b/src/roster-editor/src/ElmModule/Update.elm
index 08aa207..6896a11 100644
--- a/src/roster-editor/src/ElmModule/Update.elm
+++ b/src/roster-editor/src/ElmModule/Update.elm
@@ -3,14 +3,24 @@ module ElmModule.Update exposing (update)
-- Elm -------------------------------------------------------------------------
-- Roster Editor ---------------------------------------------------------------
+import Struct.Armor
import Struct.Event
+import Struct.Glyph
+import Struct.GlyphBoard
import Struct.Model
+import Struct.Portrait
+import Struct.Weapon
import Update.GoToMainMenu
import Update.HandleServerReply
import Update.SelectCharacter
import Update.SelectTab
+import Update.SetArmor
+import Update.SetGlyph
+import Update.SetGlyphBoard
+import Update.SetPortrait
import Update.SetRequestedHelp
+import Update.SetWeapon
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
@@ -52,3 +62,18 @@ update event model =
Struct.Event.GoToMainMenu ->
(Update.GoToMainMenu.apply_to new_model)
+
+ (Struct.Event.SelectedPortrait ref) ->
+ (Update.SetPortrait.apply_to new_model ref)
+
+ (Struct.Event.SelectedArmor ref) ->
+ (Update.SetArmor.apply_to new_model ref)
+
+ (Struct.Event.SelectedWeapon ref) ->
+ (Update.SetWeapon.apply_to new_model ref)
+
+ (Struct.Event.SelectedGlyph ref) ->
+ (Update.SetGlyph.apply_to new_model ref)
+
+ (Struct.Event.SelectedGlyphBoard ref) ->
+ (Update.SetGlyphBoard.apply_to new_model ref)
diff --git a/src/roster-editor/src/Struct/Event.elm b/src/roster-editor/src/Struct/Event.elm
index b9e921c..f3dce39 100644
--- a/src/roster-editor/src/Struct/Event.elm
+++ b/src/roster-editor/src/Struct/Event.elm
@@ -4,10 +4,15 @@ module Struct.Event exposing (Type(..), attempted)
import Http
-- Roster Editor ---------------------------------------------------------------
+import Struct.Armor
import Struct.Error
-import Struct.ServerReply
+import Struct.Glyph
+import Struct.GlyphBoard
import Struct.HelpRequest
+import Struct.Portrait
+import Struct.ServerReply
import Struct.UI
+import Struct.Weapon
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
@@ -21,6 +26,12 @@ type Type =
| ServerReplied (Result Http.Error (List Struct.ServerReply.Type))
| TabSelected Struct.UI.Tab
+ | SelectedArmor Struct.Armor.Ref
+ | SelectedGlyph Struct.Glyph.Ref
+ | SelectedGlyphBoard Struct.GlyphBoard.Ref
+ | SelectedPortrait Struct.Portrait.Ref
+ | SelectedWeapon Struct.Weapon.Ref
+
attempted : (Result.Result err val) -> Type
attempted act =
case act of
diff --git a/src/roster-editor/src/Update/SetArmor.elm b/src/roster-editor/src/Update/SetArmor.elm
new file mode 100644
index 0000000..ee87f60
--- /dev/null
+++ b/src/roster-editor/src/Update/SetArmor.elm
@@ -0,0 +1,39 @@
+module Update.SetArmor exposing (apply_to)
+
+-- Elm -------------------------------------------------------------------------
+
+-- Roster Editor ---------------------------------------------------------------
+import Struct.Armor
+import Struct.Error
+import Struct.Event
+import Struct.Model
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+apply_to : (
+ Struct.Model.Type ->
+ Struct.Armor.Ref ->
+ (Struct.Model.Type, (Cmd Struct.Event.Type))
+ )
+apply_to model ref =
+ (
+ (
+ case model.edited_char of
+ (Just char) ->
+ {model |
+ edited_char =
+ (Just
+ )
+ }
+
+ Nothing ->
+ ... error
+
+ ),
+ Cmd.none
+ )