Files
galaxy-game/pkg/model/client/client.go
T
2026-03-12 23:45:06 +02:00

46 lines
1.1 KiB
Go

package client
import (
"galaxy/model/order"
"galaxy/model/report"
)
type Client interface {
// Version returns semantic version of the Client
Version() string
// Run initializes necessary UI layout an settings, and activates client's main window.
// This is a blocking operation until client's main window is closed.
Run() error
// Shutdown closes client's main window and performing all necessary data persistence.
Shutdown()
// OnConnection receives an event when connection with client's server may be established (true) or connectivity lost (false).
OnConnection(bool)
}
type GameID string
func (i GameID) String() string {
return string(i)
}
type State struct {
// TODO: store user's login key
GameState []GameState `json:"gameState"`
ActiveGameID GameID `json:"activeGameId"`
}
type GameState struct {
ID GameID `json:"id"`
LastTurn uint `json:"lastTurn"`
ActiveTurn uint `json:"activeTurn"`
}
type GameData struct {
Turn uint `json:"turn"`
Report report.Report `json:"report"`
Order *order.Order `json:"order,omitempty"`
}