Add rating column to list of matches

This commit is contained in:
Trevor Slocum 2024-01-13 16:11:55 -08:00
parent e8baa5ed8e
commit 08fd3f1134
6 changed files with 31 additions and 12 deletions

View file

@ -1,3 +1,6 @@
1.2.6:
- Add rating column to list of matches
1.2.5:
- Add setting for auto-playing forced moves

View file

@ -41,7 +41,7 @@ import (
"golang.org/x/text/language"
)
const version = "v1.2.5"
const version = "v1.2.5p1"
const DefaultServerAddress = "wss://ws.bgammon.org"
@ -1115,6 +1115,9 @@ func NewGame() *Game {
statusLabel := newCenteredText(gotext.Get("Status"))
statusLabel.SetFollow(false)
statusLabel.SetScrollBarVisible(false)
ratingLabel := newCenteredText(gotext.Get("Rating"))
ratingLabel.SetFollow(false)
ratingLabel.SetScrollBarVisible(false)
pointsLabel := newCenteredText(gotext.Get("Points"))
pointsLabel.SetFollow(false)
pointsLabel.SetScrollBarVisible(false)
@ -1131,10 +1134,11 @@ func NewGame() *Game {
g.lobby.historyButton.SetVisible(false)
headerGrid := etk.NewGrid()
headerGrid.SetColumnSizes(indentA, indentB-indentA, -1, 300)
headerGrid.SetColumnSizes(indentA, indentB-indentA, indentB-indentA, -1, 300)
headerGrid.AddChildAt(statusLabel, 0, 0, 1, 1)
headerGrid.AddChildAt(pointsLabel, 1, 0, 1, 1)
headerGrid.AddChildAt(nameLabel, 2, 0, 1, 1)
headerGrid.AddChildAt(ratingLabel, 1, 0, 1, 1)
headerGrid.AddChildAt(pointsLabel, 2, 0, 1, 1)
headerGrid.AddChildAt(nameLabel, 3, 0, 1, 1)
headerGrid.AddChildAt(g.lobby.historyButton, 3, 0, 1, 1)
listGamesContainer = etk.NewGrid()

View file

@ -121,7 +121,7 @@ func NewLobby() *lobby {
matchList := etk.NewList(game.itemHeight(), l.selectMatch)
matchList.SetSelectionMode(etk.SelectRow)
matchList.SetColumnSizes(indentA, indentB-indentA, -1)
matchList.SetColumnSizes(indentA, indentB-indentA, indentB-indentA, -1)
matchList.SetHighlightColor(color.RGBA{79, 55, 30, 255})
matchList.AddChildAt(newCenteredText(gotext.Get("Loading...")), 0, 0)
l.availableMatchesList = matchList
@ -191,7 +191,7 @@ func (l *lobby) setGameList(games []bgammon.GameListing) {
_, lastSelection := l.availableMatchesList.SelectedItem()
var status string
var status, rating string
l.availableMatchesList.Clear()
for i, entry := range l.games {
if entry.Password {
@ -201,9 +201,15 @@ func (l *lobby) setGameList(games []bgammon.GameListing) {
} else {
status = gotext.Get("Available")
}
if entry.Rating == 0 {
rating = gotext.Get("None")
} else {
rating = fmt.Sprintf("%d", entry.Rating)
}
l.availableMatchesList.AddChildAt(newLabel(status), 0, i)
l.availableMatchesList.AddChildAt(newLabel(fmt.Sprintf("%d", entry.Points)), 1, i)
l.availableMatchesList.AddChildAt(newLabel(entry.Name), 2, i)
l.availableMatchesList.AddChildAt(newLabel(rating), 1, i)
l.availableMatchesList.AddChildAt(newLabel(fmt.Sprintf("%d", entry.Points)), 2, i)
l.availableMatchesList.AddChildAt(newLabel(entry.Name), 3, i)
}
if lastSelection >= 0 && lastSelection < len(l.games) {

View file

@ -184,6 +184,9 @@ msgstr ""
msgid "No"
msgstr ""
msgid "None"
msgstr ""
msgid "OK"
msgstr ""
@ -211,6 +214,9 @@ msgstr ""
msgid "Private"
msgstr ""
msgid "Rating"
msgstr ""
msgid "Read error"
msgstr ""
@ -338,4 +344,4 @@ msgid "You may need to upgrade your client."
msgstr ""
msgid "from %s to %s"
msgstr ""
msgstr ""

2
go.mod
View file

@ -3,7 +3,7 @@ module code.rocket9labs.com/tslocum/boxcars
go 1.17
require (
code.rocket9labs.com/tslocum/bgammon v0.0.0-20240113211439-3b818ab272bd
code.rocket9labs.com/tslocum/bgammon v0.0.0-20240114000531-eb958e27e786
code.rocket9labs.com/tslocum/bgammon-tabula-bot v0.0.0-20240111193502-f01ac821f8ba
code.rocket9labs.com/tslocum/etk v0.0.0-20240112010933-fb51eb32adda
code.rocket9labs.com/tslocum/tabula v0.0.0-20240108183445-695ea428ae21

4
go.sum
View file

@ -1,7 +1,7 @@
code.rocket9labs.com/tslocum/bei v0.0.0-20240108012722-6db380cc190b h1:Y0a14Kf/hSYepSmp4ZfDeE4CZZGBGBS97CNjCbKJm0c=
code.rocket9labs.com/tslocum/bei v0.0.0-20240108012722-6db380cc190b/go.mod h1:tS60/VNAJphKvDBkSLQhKALa15msIAuWWfEKNc4oFZc=
code.rocket9labs.com/tslocum/bgammon v0.0.0-20240113211439-3b818ab272bd h1:6W791Z6szmxXiFhx7FpkKMFVAokAKuX3MgZp+cqZorQ=
code.rocket9labs.com/tslocum/bgammon v0.0.0-20240113211439-3b818ab272bd/go.mod h1:LAki3jpHOsr4fwaK0xC9tkg+wgu/9ZNEqqx1zE3/HP4=
code.rocket9labs.com/tslocum/bgammon v0.0.0-20240114000531-eb958e27e786 h1:TeEoa8aH7zXQYoQNzGdWWGE4WhgEchr8fPiVOVBhoT0=
code.rocket9labs.com/tslocum/bgammon v0.0.0-20240114000531-eb958e27e786/go.mod h1:LAki3jpHOsr4fwaK0xC9tkg+wgu/9ZNEqqx1zE3/HP4=
code.rocket9labs.com/tslocum/bgammon-tabula-bot v0.0.0-20240111193502-f01ac821f8ba h1:9KpLZT8DAOV0Uk5rJZfNVdfn3MTGBM8gy3MEx3qM8aY=
code.rocket9labs.com/tslocum/bgammon-tabula-bot v0.0.0-20240111193502-f01ac821f8ba/go.mod h1:ZzucsodM8kqL3y3GYzDYrEUNrDlLlzMux7WVmJ06ZBI=
code.rocket9labs.com/tslocum/etk v0.0.0-20240112010933-fb51eb32adda h1:Ho2Jb3mRmpz1zLVlqeo7tmTgZK0ruL/Sr8BEy4bMnEw=