Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data LootAction
- data WelcomeDestination
- type DeckViewInput = [Card Core]
-
data Action
- = DeckBack
- | DeckGo DeckViewInput
- | EndGo End
- | GameAction' Move
- | LootAction' LootAction
- | LootGo Loot
- | LootFrom World
- | NoOp
- | SayHelloWorld
- | SceneAction' SceneAction
- | Keyboard (Set Int)
- | KeyboardArrows Arrows
- | WelcomeGo WelcomeDestination
- | WorldToGame Team Kind (Coord, Encounter)
- data SceneAction
- logUpdates :: (Monad m, Eq a, ToExpr a) => (Action -> a -> m a) -> Action -> a -> m a
- nextSchedToMiso :: NextSched -> [(Int, Action)]
- updateGameModel :: MonadError Text m => Game -> Move -> m (Game, NextSched)
- updateLootModel :: LootAction -> Loot -> Loot
- delayActions :: m -> [(Int, Action)] -> Effect Action m
- toSceneModel :: Scene () -> SceneModel
- toSecs :: Int -> Int
- tenthToSecs :: Int -> Int
- updateSceneModel :: SceneAction -> SceneModel -> Effect Action SceneModel
- updateWorldModel :: Action -> World -> Effect Action Model
- updateModel :: Action -> Model -> Effect Action Model
- unsafeInitialGameModel :: Difficulty -> Model -> Teams (Team, [Card Core]) -> T Core -> Game
- initialWelcomeModel :: Model -> Welcome
Documentation
data LootAction #
Actions internal to LootView
Pick Nat | Select a reward. The index is in the list of available rewards. |
Unpick Nat | Unselect a reward. The index is in the list of available rewards. |
Instances
Eq LootAction # | |
Defined in Update (==) :: LootAction -> LootAction -> Bool # (/=) :: LootAction -> LootAction -> Bool # | |
Show LootAction # | |
Defined in Update showsPrec :: Int -> LootAction -> ShowS # show :: LootAction -> String # showList :: [LootAction] -> ShowS # |
data WelcomeDestination #
To which page to go to, from the welcome page
Instances
Eq WelcomeDestination # | |
Defined in Update (==) :: WelcomeDestination -> WelcomeDestination -> Bool # (/=) :: WelcomeDestination -> WelcomeDestination -> Bool # | |
Show WelcomeDestination # | |
Defined in Update showsPrec :: Int -> WelcomeDestination -> ShowS # show :: WelcomeDestination -> String # showList :: [WelcomeDestination] -> ShowS # |
type DeckViewInput = [Card Core] #
Sum type for application events. If drop stuff doesn't work | think whether it's affected by https://github.com/dmjio/miso/issues/478
DeckBack | Leave |
DeckGo DeckViewInput | Leave a view, go to |
EndGo End | Go to end view |
GameAction' Move | |
LootAction' LootAction | Actions internal to |
LootGo Loot | Go to |
LootFrom World | Leave |
NoOp | |
SayHelloWorld | |
SceneAction' SceneAction | |
Keyboard (Set Int) | |
KeyboardArrows Arrows | Arrows have been pressed |
WelcomeGo WelcomeDestination | |
WorldToGame Team Kind (Coord, Encounter) | Leave |
data SceneAction #
Instances
Eq SceneAction # | |
Defined in Update (==) :: SceneAction -> SceneAction -> Bool # (/=) :: SceneAction -> SceneAction -> Bool # | |
Show SceneAction # | |
Defined in Update showsPrec :: Int -> SceneAction -> ShowS # show :: SceneAction -> String # showList :: [SceneAction] -> ShowS # |
nextSchedToMiso :: NextSched -> [(Int, Action)] #
Transforms a NextSched
into a value suitable for being
passed to delayActions
.
:: MonadError Text m | |
=> Game | The existing model |
-> Move | The incoming UI action |
-> m (Game, NextSched) |
We MUST return Sched
as the second element (as opposed to
Event
). This is used for GameIncrTurn
for example.
The second element must only contain delayed stuff, it's invalid
to return a list whose first element has 0. If we did that, we would
need to play this event right away, and then we would have new delayed
actions to consider which we wouldn't know how to merge with the first ones.
If you feel like adding a 0 event, you instead need to play this event
right away by doing a recursive call (or use playOne
)
updateLootModel :: LootAction -> Loot -> Loot #
Update a LootModel
according to the input LootAction
delayActions :: m -> [(Int, Action)] -> Effect Action m #
Function courtesy of @dmjio! Input type should be Int
. Nat
might
be too small (see tenthToSecs
).
toSceneModel :: Scene () -> SceneModel #
tenthToSecs :: Int -> Int #
Tenth of seconds to scheduling delay
updateSceneModel :: SceneAction -> SceneModel -> Effect Action SceneModel #
updateModel :: Action -> Model -> Effect Action Model #
Updates model, optionally introduces side effects | This function delegates to the various specialized functions | and is the only one to handle page changes. A page change event | is one that takes a model from a page and returns a model of another page. | Such an event cannot be dealt with a specialized function | (SpecializedAction -> SpecializedModel -> SpecializedModel), | it needs to be in `Action -> Model -> Model`.
An initial model, with a custom board. ! Not for production !\
initialWelcomeModel :: Model -> Welcome #