replay

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PutTower is a type of action that represents putting a tower.
	PutTower = ActionType(iota)

	// SellTower is a type of action that represents selling a tower.
	SellTower

	// UpgradeTower is a type of action that represents upgrading a tower.
	UpgradeTower

	// TurnOff is a type of action that represents turning off a tower.
	TurnOff

	// TurnOn is a type of action that represents turning on a tower.
	TurnOn

	// TuneFirst is a type of action that represents tuning first.
	TuneFirst

	// TuneStrong is a type of action that represents tuning strong.
	TuneStrong

	// TuneWeak is a type of action that represents tuning weak.
	TuneWeak

	// Stop is a type of action that represents stopping the game.
	Stop
)

Variables

This section is empty.

Functions

func Save

func Save(filename string, w *Watcher) error

Save saves the watcher to the file. It returns an error if something went wrong.

Types

type Action

type Action struct {
	// F is a frame when the action is performed.
	F general.Frames `json:"f"`

	// Type is a type of the action.
	Type ActionType `json:"type"`

	// Info is an info of the action.
	Info any `json:"info"`
}

Action is an entity that represents an action.

func (*Action) UnmarshalJSON

func (a *Action) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the action.

type ActionType

type ActionType int

ActionType is a type of action.

type InfoPutTower

type InfoPutTower struct {
	// Name is a name of the tower.
	Name string `json:"name"`

	// X is a x coordinate of the tower.
	X int `json:"x"`

	// Y is a y coordinate of the tower.
	Y int `json:"y"`
}

InfoPutTower is an info of the action that represents putting a tower.

type InfoSellTower

type InfoSellTower struct {
	// Index is an index of the tower.
	Index int `json:"index"`
}

InfoSellTower is an info of the action that represents selling a tower.

type InfoStop

type InfoStop struct {
	// Null is a null.
	Null any `json:"null"`
}

InfoStop is an info of the action that represents stopping the game.

type InfoTuneFirst

type InfoTuneFirst struct {
	// Index is an index of the tower.
	Index int `json:"index"`
}

InfoTuneFirst is an info of the action that represents tuning first.

type InfoTuneStrong

type InfoTuneStrong struct {
	// Index is an index of the tower.
	Index int `json:"index"`
}

InfoTuneStrong is an info of the action that represents tuning strong.

type InfoTuneWeak

type InfoTuneWeak struct {
	// Index is an index of the tower.
	Index int `json:"index"`
}

InfoTuneWeak is an info of the action that represents tuning weak.

type InfoTurnOffTower

type InfoTurnOffTower struct {
	// Index is an index of the tower.
	Index int `json:"index"`
}

InfoTurnOffTower is an info of the action that represents turning off a tower.

type InfoTurnOnTower

type InfoTurnOnTower struct {
	// Index is an index of the tower.
	Index int `json:"index"`
}

InfoTurnOnTower is an info of the action that represents turning on a tower.

type InfoUpgradeTower

type InfoUpgradeTower struct {
	// Index is an index of the tower.
	Index int `json:"index"`
}

InfoUpgradeTower is an info of the action that represents upgrading a tower.

type Watcher

type Watcher struct {
	// Name is a name of the watcher.
	Name string `json:"name"`

	// Time is a time of the watcher.
	Time string `json:"time"`

	// InitPlayerMapState is an initial player map state.
	InitPlayerMapState ingame.PlayerMapState `json:"init_player_map_state"`

	// Actions is a list of actions.
	Actions []Action `json:"actions"`
}

Watcher is an entity that represents a watcher.

func (*Watcher) Append

func (wt *Watcher) Append(f general.Frames, at ActionType, info any)

Append appends an action to the watcher.

func (*Watcher) Read

func (wt *Watcher) Read(r io.Reader) error

Read reads the watcher.

func (*Watcher) Write

func (wt *Watcher) Write(w io.Writer) error

Write writes the watcher.

Jump to

Keyboard shortcuts

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