internal

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2024 License: AGPL-3.0 Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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