player

package
v0.0.0-...-8b058bf Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateChoosingPersona compositor.State = iota + 100
	StateCreatingPersona
	StateEditingPersona
)

Variables

This section is empty.

Functions

func AsSubModel

func AsSubModel() compositor.Option[*Model]

func WithPlayer

func WithPlayer(persona *player.Player) compositor.Option[*Model]

Types

type Model

type Model struct {
	tui.SharedModel
	*player.Player
	Substate Substate
}

func NewModel

func NewModel(api *flfa.Api, options ...compositor.Option[*Model]) *Model

func (*Model) Init

func (model *Model) Init() tea.Cmd

func (*Model) InitializePlayer

func (model *Model) InitializePlayer(name string, nextSubstate compositor.SubstateInterface[*Model]) tea.Cmd

func (*Model) LoadPlayer

func (model *Model) LoadPlayer() tea.Cmd

func (*Model) SavePlayer

func (model *Model) SavePlayer(nextSubstate compositor.SubstateInterface[*Model]) tea.Cmd

func (*Model) SetAndStartState

func (model *Model) SetAndStartState(state compositor.State) (cmd tea.Cmd)

func (*Model) SetAndStartSubstate

func (model *Model) SetAndStartSubstate(substate compositor.SubstateInterface[*Model]) (cmd tea.Cmd)

func (*Model) Update

func (model *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*Model) UpdateConfirmPreferred

func (model *Model) UpdateConfirmPreferred() (cmd tea.Cmd)

func (*Model) UpdateFallThrough

func (model *Model) UpdateFallThrough(msg tea.Msg) (cmd tea.Cmd)

func (*Model) UpdateName

func (model *Model) UpdateName(nextSubstate compositor.SubstateInterface[*Model]) tea.Cmd

func (*Model) UpdateOnKeyPress

func (model *Model) UpdateOnKeyPress(msg tea.KeyMsg) (cmd tea.Cmd)

func (*Model) UpdateOnSubmodelEnded

func (model *Model) UpdateOnSubmodelEnded() (cmd tea.Cmd)

func (*Model) UpdateSelectingPersona

func (model *Model) UpdateSelectingPersona() (cmd tea.Cmd)

func (*Model) View

func (model *Model) View() string

type Substate

type Substate struct {
	Choosing SubstateChoosing
	Creating SubstateCreating
	Editing  SubstateEditing
}

type SubstateChoosing

type SubstateChoosing int
const (
	SelectingPersona SubstateChoosing = iota
)

func (SubstateChoosing) Start

func (state SubstateChoosing) Start(model *Model) (cmd tea.Cmd)

func (SubstateChoosing) UpdateOnEnded

func (state SubstateChoosing) UpdateOnEnded(model *Model) (cmd tea.Cmd)

func (SubstateChoosing) UpdateOnEnter

func (state SubstateChoosing) UpdateOnEnter(model *Model) (cmd tea.Cmd)

func (SubstateChoosing) UpdateOnEsc

func (state SubstateChoosing) UpdateOnEsc(model *Model) (cmd tea.Cmd)

func (SubstateChoosing) UpdateOnFallThrough

func (state SubstateChoosing) UpdateOnFallThrough(model *Model, msg tea.Msg) (cmd tea.Cmd)

func (SubstateChoosing) View

func (state SubstateChoosing) View(model *Model) (view string)

type SubstateCreating

type SubstateCreating int
const (
	Naming SubstateCreating = iota
	DecidingIfPreferred
)

func (SubstateCreating) Start

func (state SubstateCreating) Start(model *Model) (cmd tea.Cmd)

func (SubstateCreating) UpdateOnEnded

func (state SubstateCreating) UpdateOnEnded(model *Model) (cmd tea.Cmd)

func (SubstateCreating) UpdateOnEnter

func (state SubstateCreating) UpdateOnEnter(model *Model) (cmd tea.Cmd)

func (SubstateCreating) UpdateOnEsc

func (state SubstateCreating) UpdateOnEsc(model *Model) (cmd tea.Cmd)

func (SubstateCreating) UpdateOnFallThrough

func (state SubstateCreating) UpdateOnFallThrough(model *Model, msg tea.Msg) (cmd tea.Cmd)

func (SubstateCreating) View

func (state SubstateCreating) View(model *Model) (view string)

type SubstateEditing

type SubstateEditing int
const (
	IdleEditing SubstateEditing = iota
	SelectingEditingOption
	Renaming
	ConfirmingRename
	ConfirmingPreferredStatusUpdate
)

func (SubstateEditing) Start

func (state SubstateEditing) Start(model *Model) (cmd tea.Cmd)

func (SubstateEditing) UpdateOnEnded

func (state SubstateEditing) UpdateOnEnded(model *Model) (cmd tea.Cmd)

func (SubstateEditing) UpdateOnEnter

func (state SubstateEditing) UpdateOnEnter(model *Model) (cmd tea.Cmd)

func (SubstateEditing) UpdateOnEsc

func (state SubstateEditing) UpdateOnEsc(model *Model) (cmd tea.Cmd)

func (SubstateEditing) UpdateOnFallThrough

func (state SubstateEditing) UpdateOnFallThrough(model *Model, msg tea.Msg) (cmd tea.Cmd)

func (SubstateEditing) View

func (state SubstateEditing) View(model *Model) (view string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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