internal

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildCommand

type BuildCommand struct {
	Dev        []string `json:"dev"`
	Production []string `json:"prod"`
}

type BuildMode added in v0.2.0

type BuildMode int
const (
	Prod BuildMode = iota
	Dev
)

type BuildType added in v0.2.0

type BuildType int
const (
	UI BuildType = 1 << iota
	Game
)

type Builder

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

func NewBuilder

func NewBuilder(root string) (*Builder, error)

func (*Builder) Build

func (b *Builder) Build(mode BuildMode, types BuildType) ([]byte, []byte, error)

func (*Builder) Clean

func (b *Builder) Clean() error

func (*Builder) Manifest

func (b *Builder) Manifest() (*ManifestV1, error)

func (*Builder) WatchedFiles

func (b *Builder) WatchedFiles() ([]string, error)

type GameConfig

type GameConfig struct {
	Root          string       `json:"root"`
	BuildCommands BuildCommand `json:"build"`
	WatchPaths    []string     `json:"watchPaths"`
	OutputFile    string       `json:"out"`
}

type HistoryItem added in v0.2.0

type HistoryItem struct {
	Seq      int             `json:"seq"`
	State    json.RawMessage `json:"state"`
	Data     json.RawMessage `json:"data"`
	Position int             `json:"position"`
}

type InitialStateHistoryItem added in v0.2.0

type InitialStateHistoryItem struct {
	State    json.RawMessage `json:"state"`
	Players  []*Player       `json:"players"`
	Settings json.RawMessage `json:"settings"`
}

type ManifestV1

type ManifestV1 struct {
	MinimumPlayers int        `json:"minPlayers"`
	MaximumPlayers int        `json:"maxPlayers"`
	DefaultPlayers int        `json:"defaultPlayers,omitempty"`
	UI             UIConfig   `json:"ui"`
	Game           GameConfig `json:"game"`
}

type Move added in v0.2.0

type Move struct {
	Position int             `json:"position"`
	Data     json.RawMessage `json:"data"`
}

type Player added in v0.2.0

type Player struct {
	ID       string           `json:"id"`
	Color    string           `json:"color"`
	Name     string           `json:"name"`
	Position int              `json:"position"`
	Avatar   string           `json:"avatar"`
	Host     bool             `json:"host"`
	Settings *json.RawMessage `json:"settings,omitempty"`
}

type ReprocessRequest added in v0.2.0

type ReprocessRequest struct {
	Setup *SetupState `json:"setup"`
	Moves []*Move     `json:"moves"`
}

type ReprocessResponse added in v0.2.0

type ReprocessResponse struct {
	InitialState json.RawMessage   `json:"initialState"`
	Updates      []json.RawMessage `json:"updates"`
	Error        string            `json:"error,omitempty"`
}

type SaveStateData added in v0.2.0

type SaveStateData struct {
	RandomSeed   string                  `json:"randomSeed"`
	Settings     json.RawMessage         `json:"settings"`
	Players      []*Player               `json:"players"`
	History      []*HistoryItem          `json:"history"`
	InitialState InitialStateHistoryItem `json:"initialState"`
}

type Server

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

func NewServer

func NewServer(gameRoot string, manifest *ManifestV1, port int) (*Server, error)

func (*Server) BuildError

func (s *Server) BuildError(o, e string)

func (*Server) Reload

func (s *Server) Reload(t BuildType)

func (*Server) Serve

func (s *Server) Serve() error

type SetupState added in v0.2.0

type SetupState struct {
	RandomSeed string          `json:"randomSeed"`
	Players    []*Player       `json:"players"`
	Settings   json.RawMessage `json:"settings"`
}

type UIConfig

type UIConfig struct {
	Root            string       `json:"root"`
	BuildCommands   BuildCommand `json:"build"`
	WatchPaths      []string     `json:"watchPaths"`
	OutputDirectory string       `json:"outDir"`
}

Jump to

Keyboard shortcuts

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