Introduce InfoPanel.
InfoPanels are information displays that do not cost actions. One of them (the Prompt) is shown at the main menu; others can be made available as options in the menu, ether on an ongoing basis or for the current/next turn only.
This commit is contained in:
parent
fb5735d5b9
commit
7f8dcd63d6
13
cardsim/infopanel.go
Normal file
13
cardsim/infopanel.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package cardsim
|
||||||
|
|
||||||
|
// An InfoPanel displays some set of stats to the player. It does
|
||||||
|
// not consume an action. It must not advance the state of the game
|
||||||
|
// in any way.
|
||||||
|
type InfoPanel[C StatsCollection] interface {
|
||||||
|
// Title returns the title of this InfoPanel, which is also used as the
|
||||||
|
// label presented to the player to access this panel.
|
||||||
|
Title(p *Player[C]) (Message, error)
|
||||||
|
|
||||||
|
// Info returns the contents of this InfoPanel.
|
||||||
|
Info(p *Player[C]) ([]Message, error)
|
||||||
|
}
|
@ -12,8 +12,11 @@ type Player[C StatsCollection] struct {
|
|||||||
ActionsPerTurn int
|
ActionsPerTurn int
|
||||||
ActionsRemaining int
|
ActionsRemaining int
|
||||||
PermanentActions []Card[C]
|
PermanentActions []Card[C]
|
||||||
|
InfoPanels []InfoPanel[C]
|
||||||
|
Prompt InfoPanel[C]
|
||||||
Rules *RuleCollection[C]
|
Rules *RuleCollection[C]
|
||||||
Rand rand.Rand
|
Rand rand.Rand
|
||||||
Turn int
|
Turn int
|
||||||
PendingMessages []Message
|
TemporaryMessages []Message
|
||||||
|
TemporaryPanels []InfoPanel[C]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user