ui calculator

This commit is contained in:
Ilia Denisov
2026-03-30 19:38:24 +02:00
committed by GitHub
parent 17f366cd6b
commit a7793f5416
37 changed files with 2046 additions and 270 deletions
+23
View File
@@ -128,6 +128,15 @@ func (s *fsStorage) SaveStateAsync(state client.State, callback func(error)) {
}()
}
func (s *fsStorage) ReportExistsAsync(id client.GameID, turn uint, callback func(bool, error)) {
go func() {
exists, err := s.gameDataExistsSync(id, turn)
if callback != nil {
callback(exists, err)
}
}()
}
func (s *fsStorage) LoadReportAsync(id client.GameID, turn uint, callback func(report.Report, error)) {
go func() {
rep, err := s.loadReportSync(id, turn)
@@ -343,6 +352,20 @@ func (s *fsStorage) saveOrderSync(id client.GameID, turn uint, o order.Order) er
}))
}
func (s *fsStorage) gameDataExistsSync(id client.GameID, turn uint) (bool, error) {
absPath, err := s.resolvePath(gameTurnFilePath(id, turn))
if err != nil {
return false, classifyStorageError(err)
}
exists, err := s.fileExistsUnlocked(absPath)
if err != nil {
return false, classifyStorageError(err)
}
return exists, nil
}
func (s *fsStorage) loadGameDataSync(id client.GameID, turn uint) (client.GameData, error) {
absPath, err := s.resolvePath(gameTurnFilePath(id, turn))
if err != nil {