scalata.infrastructure.controller

Members list

Type members

Classlikes

class ChampSelectController[F[_]](askClass: F[PlayerClasses])(implicit evidence$1: Sync[F]) extends Controller[F]

Controller for the champion-selection screen.

Controller for the champion-selection screen.

  • Delegates to ChampSelectUseCase to obtain the player’s chosen class.
  • Propagates the resulting (nextPhase, GameBuilder) pair.

Value parameters

askClass

effect that yields the selected PlayerClasses

Attributes

Supertypes
trait Controller[F]
class Object
trait Matchable
class Any
trait Controller[F[_]]

Base controller interface.

Base controller interface.

  • start – executes one screen / state step and returns a GameResult carrying the next (GameControllerState, GameBuilder).

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class GameController[F[_]](askCommand: GameSession => F[PlayerCommand])(implicit evidence$1: Sync[F]) extends Controller[F]

Controller that manages the Game-Running state.

Controller that manages the Game-Running state.

  • Builds an initial GameSession from the supplied GameBuilder.
  • Runs the main turn loop by delegating to GameRunningUseCase.
  • Handles Success / Error outcomes and decides the next GameControllerState.

Type parameters

F

effect type, usually IO

Value parameters

askCommand

side-effecting function that retrieves a PlayerCommand from the active view.

Attributes

Supertypes
trait Controller[F]
class Object
trait Matchable
class Any
class GameEngine[F[_]]

Orchestrates high-level state transitions of the game.

Orchestrates high-level state transitions of the game.

  • Picks the controller that matches the current GameControllerState.
  • Delegates one step to that controller.
  • Reads the returned GameResult and, if successful, recurses with the next phase and updated GameBuilder.
  • Ends with ExitCode.Success when any controller returns an error (e.g. player quit).

Type parameters

F

effect type (usually IO)

Attributes

Supertypes
class Object
trait Matchable
class Any
class GameOverController[F[_]](askRestart: F[Boolean])(implicit evidence$1: Sync[F]) extends Controller[F]

Controller for the GameOver screen.

Controller for the GameOver screen.

  • Invokes GameOverUseCase to ask the player whether to restart.
  • Returns either (GameControllerState.Menu, newBuilder) when the player chooses to restart, or propagates the quit signal.

Value parameters

askRestart

side-effecting Boolean (true=restart, false=quit)

Attributes

Supertypes
trait Controller[F]
class Object
trait Matchable
class Any
class MenuController[F[_]](askStart: F[Boolean])(implicit evidence$1: Sync[F]) extends Controller[F]

Controller for the main menu.

Controller for the main menu.

  • Calls GameStartUseCase to ask the player if a new run should begin.
  • Returns the next GameControllerState together with the updated GameBuilder.

Value parameters

askStart

effect that yields true to start or false to quit

Attributes

Supertypes
trait Controller[F]
class Object
trait Matchable
class Any