blob: 9fc9a935b8431ff0dca3c7e90d06444aa02423c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
module ElmModule.Update exposing (update)
-- Elm -------------------------------------------------------------------------
-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.Model
import Struct.UI
import Update.Story
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
update : (
Struct.Event.Type ->
Struct.Model.Type ->
(Struct.Model.Type, (Cmd Struct.Event.Type))
)
update event model =
case event of
(Struct.Event.ChoiceSelected ix) ->
((Update.Story.select_choice ix model), Cmd.none)
Struct.Event.None -> (model, Cmd.none)
(Struct.Event.LoadStory http_result) ->
case http_result of
(Ok story) ->
(
(Update.Story.start
{model |
tonkadur =
{story |
random_seed = model.tonkadur.random_seed
}
}
),
Cmd.none
)
(Err error) ->
(
{model |
ui =
(Struct.UI.display_string_error
"Failed to load story"
model.ui
)
},
Cmd.none
)
|