client

package
v0.0.0-...-de431f0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectRoundTrip

type ConnectRoundTrip struct {
	ActorAlreadyConnected <-chan game.RespActorAlreadyConnected
	Connected             <-chan RespConnected
	Error                 <-chan error
	// contains filtered or unexported fields
}

type CreateRoundTrip

type CreateRoundTrip struct {
	Success     <-chan RespLoggedIn
	ActorExists <-chan game.RespActorExists
	Error       <-chan error
	// contains filtered or unexported fields
}

Represents a create request -> response roundtrip. The caller should select from all the channels to recv the response.

type InitialState

type InitialState struct {
	// The entity that represents the actor in the world.
	Entity game.ActorEntityState

	// The initial state of the world.
	WorldState rpg2d.WorldState
}

type InputConn

type InputConn interface {
	SendMoveRequest(game.MoveRequest)
	SendUseRequest(game.UseRequest)
	SendChatRequest(game.ChatRequest)
}

type LoggedInConn

type LoggedInConn interface {
	// Signals the server to connect the actor
	// into simulation. This extra step after
	// a successful login enables the client to
	// prepare the renderer, load all the assets,
	// before the actor is actually placed into the
	// world and becomes vulnerable.
	ConnectActor(name string) ConnectRoundTrip
}

type LoginConn

type LoginConn interface {
	// Non-blocking login actor request
	AttemptLogin(name, password string) LoginRoundTrip
	// Non-blocking create actor request
	CreateActor(name, password string) CreateRoundTrip
}

func NewLoginConn

func NewLoginConn(conn game.Conn) LoginConn

Create a new connection that can login or create an actor.

type LoginRoundTrip

type LoginRoundTrip struct {
	Success               <-chan RespLoggedIn
	ActorAlreadyConnected <-chan game.RespActorAlreadyConnected
	ActorDoesntExist      <-chan game.RespActorDoesntExist
	AuthFailed            <-chan game.RespAuthFailed
	Error                 <-chan error
	// contains filtered or unexported fields
}

Represents a login request -> response roundtrip. The caller should select from all the channels to recv the response.

type RespConnected

type RespConnected struct {
	UpdateConn
	InputConn
	InitialState InitialState
}

type RespLoggedIn

type RespLoggedIn struct {
	Name string
	LoggedInConn
}

type UpdateConn

type UpdateConn interface {
	NextUpdate() (rpg2d.WorldStateDiff, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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