Documentation ¶
Index ¶
- func New(ad *ActionDispatcher, s *Store, opt Options) error
- type ActionDispatcher
- func (ac *ActionDispatcher) Dispatch(a *action.Action)
- func (ac *ActionDispatcher) IncomeTick(rooms *RoomsStore)
- func (ac *ActionDispatcher) SyncLobbies(s *Store)
- func (ac *ActionDispatcher) SyncState(rooms *RoomsStore)
- func (ac *ActionDispatcher) SyncUsers(users *UsersStore)
- func (ac *ActionDispatcher) SyncVs1WaitingRoom(rooms *RoomsStore)
- func (ac *ActionDispatcher) SyncVs6WaitingRoom(rooms *RoomsStore)
- func (ac *ActionDispatcher) UserSignIn(un, ra string, ws *websocket.Conn)
- func (ac *ActionDispatcher) UserSignOut(un string)
- func (ac *ActionDispatcher) UserSignUp(un string)
- func (ac *ActionDispatcher) WaitRoomCountdownTick()
- type Game
- type Options
- type PlayerConn
- type Room
- type RoomsState
- type RoomsStore
- func (rs *RoomsStore) FindByID(rid string) *Room
- func (rs *RoomsStore) FindCurrentVs1WaitingRoom() *Room
- func (rs *RoomsStore) FindCurrentVs6WaitingRoom() *Room
- func (rs *RoomsStore) GetNextID(room string) int
- func (rs *RoomsStore) List() []*Room
- func (rs *RoomsStore) Reduce(state, a interface{}) interface{}
- type Store
- type User
- type UsersState
- type UsersStore
- type WS
- type WSConnector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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, l *slog.Logger, s *Store, ws WSConnector) *ActionDispatcher
NewActionDispatcher initializes the action dispatcher with the give dispatcher
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) IncomeTick ¶
func (ac *ActionDispatcher) IncomeTick(rooms *RoomsStore)
func (*ActionDispatcher) SyncLobbies ¶ added in v1.1.0
func (ac *ActionDispatcher) SyncLobbies(s *Store)
SyncLobbies will just sync the info of each lobby to the players on it
func (*ActionDispatcher) SyncState ¶
func (ac *ActionDispatcher) SyncState(rooms *RoomsStore)
func (*ActionDispatcher) SyncUsers ¶
func (ac *ActionDispatcher) SyncUsers(users *UsersStore)
func (*ActionDispatcher) SyncVs1WaitingRoom ¶ added in v1.2.0
func (ac *ActionDispatcher) SyncVs1WaitingRoom(rooms *RoomsStore)
func (*ActionDispatcher) SyncVs6WaitingRoom ¶ added in v1.2.0
func (ac *ActionDispatcher) SyncVs6WaitingRoom(rooms *RoomsStore)
func (*ActionDispatcher) UserSignIn ¶
func (ac *ActionDispatcher) UserSignIn(un, ra string, ws *websocket.Conn)
func (*ActionDispatcher) UserSignOut ¶
func (ac *ActionDispatcher) UserSignOut(un string)
func (*ActionDispatcher) UserSignUp ¶
func (ac *ActionDispatcher) UserSignUp(un string)
func (*ActionDispatcher) WaitRoomCountdownTick ¶
func (ac *ActionDispatcher) WaitRoomCountdownTick()
type RoomsState ¶
type RoomsStore ¶
type RoomsStore struct { *flux.ReduceStore Store *Store // contains filtered or unexported fields }
func NewRoomsStore ¶
func NewRoomsStore(d *flux.Dispatcher, s *Store, l *slog.Logger) *RoomsStore
func (*RoomsStore) FindByID ¶ added in v1.1.0
func (rs *RoomsStore) FindByID(rid string) *Room
func (*RoomsStore) FindCurrentVs1WaitingRoom ¶ added in v1.2.0
func (rs *RoomsStore) FindCurrentVs1WaitingRoom() *Room
func (*RoomsStore) FindCurrentVs6WaitingRoom ¶ added in v1.2.0
func (rs *RoomsStore) FindCurrentVs6WaitingRoom() *Room
func (*RoomsStore) GetNextID ¶
func (rs *RoomsStore) GetNextID(room string) int
func (*RoomsStore) List ¶
func (rs *RoomsStore) List() []*Room
func (*RoomsStore) Reduce ¶
func (rs *RoomsStore) Reduce(state, a interface{}) interface{}
type Store ¶
type Store struct { Rooms *RoomsStore Users *UsersStore Lobbies *store.Lobbies }
type UsersState ¶
type UsersStore ¶
type UsersStore struct { *flux.ReduceStore Store *Store // contains filtered or unexported fields }
func NewUsersStore ¶
func NewUsersStore(d *flux.Dispatcher, s *Store) *UsersStore
func (*UsersStore) FindByRemoteAddress ¶
func (us *UsersStore) FindByRemoteAddress(ra string) (User, bool)
func (*UsersStore) FindByUsername ¶
func (us *UsersStore) FindByUsername(un string) (User, bool)
func (*UsersStore) List ¶
func (us *UsersStore) List() []*User
func (*UsersStore) Reduce ¶
func (us *UsersStore) Reduce(state, a interface{}) interface{}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.