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) SyncState(rooms *RoomsStore)
- func (ac *ActionDispatcher) SyncUsers(users *UsersStore)
- func (ac *ActionDispatcher) SyncWaitingRoom(rooms *RoomsStore)
- func (ac *ActionDispatcher) TPS(rooms *RoomsStore)
- func (ac *ActionDispatcher) UserSignIn(un string)
- 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
- type Store
- type User
- type UsersState
- type UsersStore
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, s *Store) *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) SyncState ¶
func (ac *ActionDispatcher) SyncState(rooms *RoomsStore)
func (*ActionDispatcher) SyncUsers ¶
func (ac *ActionDispatcher) SyncUsers(users *UsersStore)
func (*ActionDispatcher) SyncWaitingRoom ¶
func (ac *ActionDispatcher) SyncWaitingRoom(rooms *RoomsStore)
func (*ActionDispatcher) TPS ¶
func (ac *ActionDispatcher) TPS(rooms *RoomsStore)
func (*ActionDispatcher) UserSignIn ¶
func (ac *ActionDispatcher) UserSignIn(un string)
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 PlayerConn ¶
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) *RoomsStore
func (*RoomsStore) FindCurrentWaitingRoom ¶
func (rs *RoomsStore) FindCurrentWaitingRoom() *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 }
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{}
Click to show internal directories.
Click to hide internal directories.