Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ways for the client to use player input via UI to produce server requests, based on the client's view (visualized for the player) of the game state.
- class MonadClient m => MonadClientUI m
- queryUI :: MonadClientUI m => m RequestUI
- pongUI :: MonadClientUI m => m RequestUI
- displayRespUpdAtomicUI :: MonadClientUI m => Bool -> State -> StateClient -> UpdAtomic -> m ()
- displayRespSfxAtomicUI :: MonadClientUI m => Bool -> SfxAtomic -> m ()
- srtFrontend :: (DebugModeCli -> SessionUI -> State -> StateClient -> chanServerUI -> IO ()) -> (DebugModeCli -> SessionUI -> State -> StateClient -> chanServerAI -> IO ()) -> KeyKind -> COps -> DebugModeCli -> ((FactionId -> chanServerUI -> IO ()) -> (FactionId -> chanServerAI -> IO ()) -> IO ()) -> IO ()
- data KeyKind
- data SessionUI
- data ColorMode
- displayMore :: MonadClientUI m => ColorMode -> Msg -> m Bool
- msgAdd :: MonadClientUI m => Msg -> m ()
- humanCommand :: forall m. MonadClientUI m => m RequestUI
Client UI monad
class MonadClient m => MonadClientUI m Source
The monad that gives the client access to UI operations.
MonadClientUI (CliImplementation resp req) |
Assorted UI operations
queryUI :: MonadClientUI m => m RequestUI Source
Handle the move of a UI player.
pongUI :: MonadClientUI m => m RequestUI Source
Client signals to the server that it's still online, flushes frames (if needed) and sends some extra info.
displayRespUpdAtomicUI :: MonadClientUI m => Bool -> State -> StateClient -> UpdAtomic -> m () Source
Visualize atomic actions sent to the client. This is done in the global state after the command is executed and after the client state is modified by the command.
displayRespSfxAtomicUI :: MonadClientUI m => Bool -> SfxAtomic -> m () Source
Display special effects (text, animation) sent to the client.
Startup
:: (DebugModeCli -> SessionUI -> State -> StateClient -> chanServerUI -> IO ()) | UI main loop |
-> (DebugModeCli -> SessionUI -> State -> StateClient -> chanServerAI -> IO ()) | AI main loop |
-> KeyKind | key and command content |
-> COps | game content |
-> DebugModeCli | client debug parameters |
-> ((FactionId -> chanServerUI -> IO ()) -> (FactionId -> chanServerAI -> IO ()) -> IO ()) | frontend main loop |
-> IO () |
Wire together game content, the main loops of game clients, the main game loop assigned to this frontend (possibly containing the server loop, if the whole game runs in one process), UI config and the definitions of game commands.
The information that is constant across a client playing session, including many consecutive games in a single session, but is completely disregarded and reset when a new playing session starts. This includes a frontend session and keybinding info.
Operations exposed for LoopClient
Color mode for the display.
displayMore :: MonadClientUI m => ColorMode -> Msg -> m Bool Source
Display a message with a -more-
prompt.
Return value indicates if the player tried to cancel/escape.
msgAdd :: MonadClientUI m => Msg -> m () Source
Add a message to the current report.
Internal operations
humanCommand :: forall m. MonadClientUI m => m RequestUI Source
Let the human player issue commands until any command takes time.