Documentation ¶
Index ¶
- Variables
- type Controller
- type Session
- func (s Session) Context() context.Context
- func (s Session) GetController() (Controller, error)
- func (s Session) GetIntFromFlash(key string) int
- func (s Session) GetIntFromStore(key string) int
- func (s Session) GetStringFromFlash(key string) string
- func (s Session) GetStringFromStore(key string) string
- func (s Session) ID() string
- func (s Session) Logger() *zerolog.Logger
- func (s Session) Resume()
- func (s Session) SetController(name string)
- func (s Session) SetInFlash(key string, value interface{})
- func (s Session) SetInStore(key string, value interface{})
- func (s Session) SetStringInStore(key string, value string)
- func (s Session) Start()
- func (s Session) Stop()
- func (s Session) WriteToConnection(data string)
- func (s Session) WriteToConnectionF(format string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
View Source
var ControllerRegistry = controllerRegistry{}
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller interface { // Name returns the name of the controller. If multiple controllers of the same name are registered with the world // then the last one registered will be used. This enables the developer to override specific controllers with their // own implementation. Name() string // Start is called when the controller is set. Start(session Session) error // Resume called when the world restarts, causing the portal to reset-assert the session. Resume(session Session) error // Stop is called when the controller is unset. Stop(session Session) error // HandleInput is called when the player sends input to the world. HandleInput(session Session, input string) error }
Controller is the interface for a session controller. A session controller handles interactions from the player session to the game world
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session represents the link between the world and portal.
func New ¶
func New(e *events.AssertSession) *Session
func (Session) GetController ¶
func (s Session) GetController() (Controller, error)
GetController returns the current controller or an error if a controller of that controller does not exist
func (Session) GetIntFromFlash ¶
func (Session) GetIntFromStore ¶
func (Session) GetStringFromFlash ¶
func (Session) GetStringFromStore ¶
func (Session) SetController ¶
func (Session) SetInFlash ¶
func (Session) SetInStore ¶
func (Session) SetStringInStore ¶
func (Session) WriteToConnection ¶
WriteToConnection writes the given string to the connection. It breaks it up by lines and sends each line to the connection. If an error occurs, it will stop the session.
func (Session) WriteToConnectionF ¶
Click to show internal directories.
Click to hide internal directories.