ui

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PositiveIntegerValidator

func PositiveIntegerValidator(max int) func(text string, ch rune) bool

Types

type ActionDisplay added in v0.0.3

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

func NewActionDisplay added in v0.0.3

func NewActionDisplay(cp *CompanyProvider) *ActionDisplay

func (*ActionDisplay) GetTextView added in v0.0.3

func (a *ActionDisplay) GetTextView() *tview.TextView

func (*ActionDisplay) Update added in v0.0.3

func (a *ActionDisplay) Update(cards []*game.Card)

type ActionList

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

func NewActionList

func NewActionList(cp *CompanyProvider, cards []*game.Card, cb func(*game.Card)) *ActionList

func (*ActionList) GetList

func (a *ActionList) GetList() *tview.List

type CompanyList

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

func NewCompanyList

func NewCompanyList(cp *CompanyProvider, cb func(int)) *CompanyList

func (*CompanyList) GetList

func (c *CompanyList) GetList() *tview.List

type CompanyProvider

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

func NewCompanyProvider

func NewCompanyProvider() *CompanyProvider

func (*CompanyProvider) ColorByIndex

func (p *CompanyProvider) ColorByIndex(index int) string

func (*CompanyProvider) Companies

func (p *CompanyProvider) Companies() []string

func (*CompanyProvider) CompanyByIndex

func (p *CompanyProvider) CompanyByIndex(index int) string

func (*CompanyProvider) SetCompanies

func (p *CompanyProvider) SetCompanies(companies []string)

type ConfirmPanel

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

func NewConfirmPanel

func NewConfirmPanel(result chan bool) *ConfirmPanel

func (*ConfirmPanel) GetForm

func (c *ConfirmPanel) GetForm() *tview.Form

type ErrorModal

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

ErrorModal is a modal that displays an error message.

func NewErrorModal

func NewErrorModal(err error) *ErrorModal

NewErrorModal creates a new ErrorModal.

func (*ErrorModal) GetModal

func (e *ErrorModal) GetModal() *tview.Modal

GetModal returns the underlying tview.Modal.

func (*ErrorModal) SetHandler

func (e *ErrorModal) SetHandler(handler func(buttonIndex int, buttonLabel string)) *ErrorModal

SetHandler sets the done func for the modal.

type GraphPanel

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

func NewGraphPanel

func NewGraphPanel(cp *CompanyProvider) *GraphPanel

func (*GraphPanel) Add

func (p *GraphPanel) Add(prices [4]int)

func (*GraphPanel) GetGrid

func (p *GraphPanel) GetGrid() *tview.Grid

type HistoryPanel

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

func NewHistoryPanel

func NewHistoryPanel(cp *CompanyProvider) *HistoryPanel

func (*HistoryPanel) AddAction

func (p *HistoryPanel) AddAction(a *message.Action)

func (*HistoryPanel) AddTrade

func (p *HistoryPanel) AddTrade(d *message.Trade)

func (*HistoryPanel) GetTextView

func (p *HistoryPanel) GetTextView() *tview.TextView

type LobbyForm

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

func NewLobbyForm

func NewLobbyForm(readyCb func(bool), leaveCb func()) *LobbyForm

func (*LobbyForm) GetForm

func (l *LobbyForm) GetForm() *tview.Form

func (*LobbyForm) Reset

func (l *LobbyForm) Reset()

func (*LobbyForm) Update

func (l *LobbyForm) Update(state []message.Readiness)

type LoginData

type LoginData struct {
	Username     string
	Host         string
	Port         uint16
	ReconnectKey string
	TLS          bool
}

LoginData is the data returned by the LoginForm.

type LoginForm

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

LoginForm wraps a tview.Form and adds some validation logic.

func NewLoginForm

func NewLoginForm(loginCb func(*LoginData), quitCb func()) *LoginForm

NewLoginForm creates a new LoginForm.

func (*LoginForm) GetForm

func (l *LoginForm) GetForm() *tview.Form

GetForm returns the underlying tview.Form.

func (*LoginForm) SetReconnectKey

func (l *LoginForm) SetReconnectKey(key string)

type PlayerProvider

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

func NewPlayerProvider

func NewPlayerProvider(players []string) *PlayerProvider

func (*PlayerProvider) OpponentsByPlayer

func (p *PlayerProvider) OpponentsByPlayer(player string) []string

func (*PlayerProvider) Players

func (p *PlayerProvider) Players() []string

type ServerStatusPanel

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

func NewServerStatus

func NewServerStatus() *ServerStatusPanel

func (*ServerStatusPanel) GetTextView

func (p *ServerStatusPanel) GetTextView() *tview.TextView

func (*ServerStatusPanel) SetConnection

func (p *ServerStatusPanel) SetConnection(isConnected bool)

func (*ServerStatusPanel) SetHost

func (p *ServerStatusPanel) SetHost(host string)

func (*ServerStatusPanel) SetReconnectKey

func (p *ServerStatusPanel) SetReconnectKey(key string)

type StandingsPanel

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

func NewStandingsPanel

func NewStandingsPanel(cp *CompanyProvider) *StandingsPanel

func (*StandingsPanel) GetGrid

func (p *StandingsPanel) GetGrid() *tview.Grid

func (*StandingsPanel) Update

func (p *StandingsPanel) Update(state *message.GameState)

type TitlePanel

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

func NewTitlePanel

func NewTitlePanel() *TitlePanel

func (*TitlePanel) GetTextView

func (p *TitlePanel) GetTextView() *tview.TextView

type TradeForm

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

func NewTradeForm

func NewTradeForm(cp *CompanyProvider, tradeType message.TradeType, company, maxAmount int, cb func(int)) *TradeForm

func (*TradeForm) GetForm

func (t *TradeForm) GetForm() *tview.Form

type TradeMenu

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

func NewTradeMenu

func NewTradeMenu(cb func(option TradeOption)) *TradeMenu

func (*TradeMenu) GetList

func (t *TradeMenu) GetList() *tview.List

type TradeOption

type TradeOption int
const (
	Buy TradeOption = iota
	Sell
	EndTurn
)

type TurnPanel

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

func NewTurnPanel

func NewTurnPanel() *TurnPanel

func (*TurnPanel) GetTextView

func (p *TurnPanel) GetTextView() *tview.TextView

func (*TurnPanel) Update

func (p *TurnPanel) Update(maxTurns, currentTurn int, playerOrder []string, currentPlayer int)

type VersionPanel

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

func NewVersionPanel

func NewVersionPanel() *VersionPanel

func (*VersionPanel) GetTextView

func (p *VersionPanel) GetTextView() *tview.TextView

func (*VersionPanel) SetVersion

func (p *VersionPanel) SetVersion(v string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳