client io architecture

This commit is contained in:
Ilia Denisov
2026-03-12 18:45:46 +02:00
committed by GitHub
parent 2dafa69b93
commit 079b9facb0
36 changed files with 1810 additions and 460 deletions
+47
View File
@@ -0,0 +1,47 @@
package client
import (
"galaxy/model/order"
"galaxy/model/report"
)
type Client interface {
// 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 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"`
}
type Settings struct {
// TODO: use fyne.Storage for initializing and storing data
StoragePath string
}