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 => Maybe Msg -> m RequestUI
Client UI monad
class MonadClient m => MonadClientUI m Source
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
srtFrontend :: (DebugModeCli -> SessionUI -> State -> StateClient -> chanServerUI -> IO ()) -> (DebugModeCli -> SessionUI -> State -> StateClient -> chanServerAI -> IO ()) -> KeyKind -> COps -> DebugModeCli -> ((FactionId -> chanServerUI -> IO ()) -> (FactionId -> chanServerAI -> IO ()) -> IO ()) -> IO () Source
Wire together game content, the main loop 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.
Auxiliary AI and computer player clients have no sfs
nor sbinding
.
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 functions
humanCommand :: forall m. MonadClientUI m => Maybe Msg -> m RequestUI Source
Determine and process the next human player command. The argument is the last stop message due to running, if any.