client

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, ad *ActionDispatcher, rs *RouterStore, opt Options) error

Types

type ActionDispatcher

type ActionDispatcher struct {
	// contains filtered or unexported fields
}

ActionDispatcher is in charge of dispatching actions to the application dispatcher

func NewActionDispatcher

func NewActionDispatcher(d *flux.Dispatcher, s *store.Store, l *slog.Logger, opt Options) *ActionDispatcher

NewActionDispatcher initializes the action dispatcher with the give dispatcher

func (*ActionDispatcher) CheckVersion added in v1.1.0

func (ac *ActionDispatcher) CheckVersion()

func (*ActionDispatcher) CreateLobby added in v1.1.0

func (ac *ActionDispatcher) CreateLobby(lid, o, ln string, lmp int)

func (*ActionDispatcher) DeleteLobby added in v1.1.0

func (ac *ActionDispatcher) DeleteLobby(lid string)

func (*ActionDispatcher) Dispatch

func (ac *ActionDispatcher) Dispatch(a *action.Action)

Dispatch is a helper to access to the internal dispatch directly with an action. This should only be used from the WS Handler to forward server actions directly

func (*ActionDispatcher) ExitVs1WaitingRoom added in v1.2.0

func (ac *ActionDispatcher) ExitVs1WaitingRoom(un string)

func (*ActionDispatcher) ExitVs6WaitingRoom added in v1.2.0

func (ac *ActionDispatcher) ExitVs6WaitingRoom(un string)

func (*ActionDispatcher) GoHome

func (ac *ActionDispatcher) GoHome()

GoHome will move the camera to the current player home line

func (*ActionDispatcher) JoinLobby added in v1.1.0

func (ac *ActionDispatcher) JoinLobby(lid, un string, ib bool)

func (*ActionDispatcher) JoinVs1WaitingRoom added in v1.2.0

func (ac *ActionDispatcher) JoinVs1WaitingRoom(un string)

func (*ActionDispatcher) JoinVs6WaitingRoom added in v1.2.0

func (ac *ActionDispatcher) JoinVs6WaitingRoom(un string)

func (*ActionDispatcher) LeaveLobby added in v1.1.0

func (ac *ActionDispatcher) LeaveLobby(lid, un string)

func (*ActionDispatcher) NavigateTo

func (ac *ActionDispatcher) NavigateTo(route string)

NavigateTo navigates to the given route

func (*ActionDispatcher) RefreshLobbies added in v1.1.0

func (ac *ActionDispatcher) RefreshLobbies()

func (*ActionDispatcher) SelectLobby added in v1.1.0

func (ac *ActionDispatcher) SelectLobby(lid string)

func (*ActionDispatcher) SignUpSubmit

func (ac *ActionDispatcher) SignUpSubmit(un string)

func (*ActionDispatcher) StartLobby added in v1.1.0

func (ac *ActionDispatcher) StartLobby(lid string)

func (*ActionDispatcher) WindowResizing

func (ac *ActionDispatcher) WindowResizing(w, h int)

WindowResizing new sizes of the window

type Game

type Game struct {
	Game *game.Game

	Logger *slog.Logger
}

Game is the main struct that is the initializer of the main loop. It holds all the other Stores and the Map

func NewGame added in v1.0.3

func NewGame(s *store.Store, d *flux.Dispatcher, l *slog.Logger) *Game

func (*Game) Draw

func (g *Game) Draw(screen *ebiten.Image)

func (*Game) Update

func (g *Game) Update() error

type LobbiesView added in v1.1.0

type LobbiesView struct {
	Store  *Store
	Logger *slog.Logger
	// contains filtered or unexported fields
}

func NewLobbiesView added in v1.1.0

func NewLobbiesView(s *Store, l *slog.Logger) *LobbiesView

func (*LobbiesView) Draw added in v1.1.0

func (lv *LobbiesView) Draw(screen *ebiten.Image)

func (*LobbiesView) Update added in v1.1.0

func (lv *LobbiesView) Update() error

type NewLobbyView added in v1.1.0

type NewLobbyView struct {
	Store  *Store
	Logger *slog.Logger
	// contains filtered or unexported fields
}

func NewNewLobbyView added in v1.1.0

func NewNewLobbyView(s *Store, l *slog.Logger) *NewLobbyView

func (*NewLobbyView) Draw added in v1.1.0

func (nl *NewLobbyView) Draw(screen *ebiten.Image)

func (*NewLobbyView) Update added in v1.1.0

func (nl *NewLobbyView) Update() error

type Options

type Options struct {
	HostURL string
	ScreenW int
	ScreenH int
	Version string
}

type RootState added in v1.1.0

type RootState struct {
	TotalUsers int
}

type RootStore added in v1.1.0

type RootStore struct {
	*flux.ReduceStore

	Store  *Store
	Logger *slog.Logger
	// contains filtered or unexported fields
}

func NewRootStore added in v1.1.0

func NewRootStore(d *flux.Dispatcher, s *Store, l *slog.Logger) (*RootStore, error)

func (*RootStore) Draw added in v1.1.0

func (rs *RootStore) Draw(screen *ebiten.Image)

func (*RootStore) Reduce added in v1.1.0

func (rs *RootStore) Reduce(state, a interface{}) interface{}

func (*RootStore) Update added in v1.1.0

func (rs *RootStore) Update() error

type RouterState

type RouterState struct {
	Route string
}

type RouterStore

type RouterStore struct {
	*flux.ReduceStore
	// contains filtered or unexported fields
}

func NewRouterStore

func NewRouterStore(d *flux.Dispatcher, su *SignUpStore, ros *RootStore, wr6 *Vs6WaitingRoomStore, wr1 *Vs1WaitingRoomStore, g *Game, lv *LobbiesView, nlv *NewLobbyView, slv *ShowLobbyView, l *slog.Logger) *RouterStore

func (*RouterStore) Draw

func (rs *RouterStore) Draw(screen *ebiten.Image)

func (*RouterStore) Layout

func (rs *RouterStore) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int)

func (*RouterStore) Reduce

func (rs *RouterStore) Reduce(state, a interface{}) interface{}

func (*RouterStore) Update

func (rs *RouterStore) Update() error

type ShowLobbyView added in v1.1.0

type ShowLobbyView struct {
	Store  *Store
	Logger *slog.Logger
	// contains filtered or unexported fields
}

func NewShowLobbyView added in v1.1.0

func NewShowLobbyView(s *Store, l *slog.Logger) *ShowLobbyView

func (*ShowLobbyView) Draw added in v1.1.0

func (sl *ShowLobbyView) Draw(screen *ebiten.Image)

func (*ShowLobbyView) Update added in v1.1.0

func (sl *ShowLobbyView) Update() error

type SignUpState

type SignUpState struct {
	Error string

	VersionError string
}

type SignUpStore

type SignUpStore struct {
	*flux.ReduceStore

	Store  *store.Store
	Logger *slog.Logger
	// contains filtered or unexported fields
}

func NewSignUpStore

func NewSignUpStore(d *flux.Dispatcher, s *store.Store, l *slog.Logger) (*SignUpStore, error)

func (*SignUpStore) Draw

func (su *SignUpStore) Draw(screen *ebiten.Image)

func (*SignUpStore) Reduce

func (su *SignUpStore) Reduce(state, a interface{}) interface{}

func (*SignUpStore) Update

func (su *SignUpStore) Update() error

type Store

type Store struct {
	*store.Store

	Users *UserStore
}

func NewStore

func NewStore(ss *store.Store, us *UserStore) *Store

type UserState

type UserState struct {
	Username string
}

type UserStore

type UserStore struct {
	*flux.ReduceStore
}

func NewUserStore

func NewUserStore(d *flux.Dispatcher) *UserStore

func (*UserStore) Reduce

func (u *UserStore) Reduce(state, a interface{}) interface{}

func (*UserStore) Username

func (us *UserStore) Username() string

type Vs1WaitingRoomState added in v1.2.0

type Vs1WaitingRoomState struct {
	TotalPlayers int
	Size         int
}

type Vs1WaitingRoomStore added in v1.2.0

type Vs1WaitingRoomStore struct {
	*flux.ReduceStore

	Store  *Store
	Logger *slog.Logger
	// contains filtered or unexported fields
}

func NewVs1WaitingRoomStore added in v1.2.0

func NewVs1WaitingRoomStore(d *flux.Dispatcher, s *Store, l *slog.Logger) *Vs1WaitingRoomStore

func (*Vs1WaitingRoomStore) Draw added in v1.2.0

func (wr *Vs1WaitingRoomStore) Draw(screen *ebiten.Image)

func (*Vs1WaitingRoomStore) Reduce added in v1.2.0

func (wr *Vs1WaitingRoomStore) Reduce(state, a interface{}) interface{}

func (*Vs1WaitingRoomStore) Update added in v1.2.0

func (wr *Vs1WaitingRoomStore) Update() error

type Vs6WaitingRoomState added in v1.2.0

type Vs6WaitingRoomState struct {
	TotalPlayers int
	Size         int
	Countdown    int
}

type Vs6WaitingRoomStore added in v1.2.0

type Vs6WaitingRoomStore struct {
	*flux.ReduceStore

	Store  *Store
	Logger *slog.Logger
	// contains filtered or unexported fields
}

func NewVs6WaitingRoomStore added in v1.2.0

func NewVs6WaitingRoomStore(d *flux.Dispatcher, s *Store, l *slog.Logger) *Vs6WaitingRoomStore

func (*Vs6WaitingRoomStore) Draw added in v1.2.0

func (wr *Vs6WaitingRoomStore) Draw(screen *ebiten.Image)

func (*Vs6WaitingRoomStore) Reduce added in v1.2.0

func (wr *Vs6WaitingRoomStore) Reduce(state, a interface{}) interface{}

func (*Vs6WaitingRoomStore) Update added in v1.2.0

func (wr *Vs6WaitingRoomStore) Update() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL