parent
bb6ed81d91
commit
8ab10e65b2
7 changed files with 60 additions and 15 deletions
|
@ -1,5 +1,6 @@
|
|||
1.3.1:
|
||||
- Display doubling cube
|
||||
- Allow flipping opponent space numbers
|
||||
|
||||
1.3.0:
|
||||
- Remember password
|
||||
|
|
|
@ -126,6 +126,7 @@ type board struct {
|
|||
showPipCountCheckbox *etk.Checkbox
|
||||
showMovesCheckbox *etk.Checkbox
|
||||
flipBoardCheckbox *etk.Checkbox
|
||||
traditionalCheckbox *etk.Checkbox
|
||||
advancedMovementCheckbox *etk.Checkbox
|
||||
autoPlayCheckbox *etk.Checkbox
|
||||
selectSpeed *etk.Select
|
||||
|
@ -154,6 +155,7 @@ type board struct {
|
|||
showPipCount bool
|
||||
showMoves bool
|
||||
flipBoard bool
|
||||
traditional bool
|
||||
advancedMovement bool
|
||||
|
||||
widget *BoardWidget
|
||||
|
@ -408,6 +410,20 @@ func NewBoard() *board {
|
|||
}
|
||||
flipBoardLabel.SetVertical(etk.AlignCenter)
|
||||
|
||||
b.traditionalCheckbox = etk.NewCheckbox(b.toggleTraditionalCheckbox)
|
||||
b.traditionalCheckbox.SetBorderColor(triangleA)
|
||||
b.traditionalCheckbox.SetCheckColor(triangleA)
|
||||
b.traditionalCheckbox.SetSelected(b.traditional)
|
||||
|
||||
traditionalLabel := &ClickableText{
|
||||
Text: etk.NewText(gotext.Get("Flip opp. space numbers")),
|
||||
onSelected: func() {
|
||||
b.traditionalCheckbox.SetSelected(!b.traditionalCheckbox.Selected())
|
||||
b.toggleTraditionalCheckbox()
|
||||
},
|
||||
}
|
||||
traditionalLabel.SetVertical(etk.AlignCenter)
|
||||
|
||||
b.advancedMovementCheckbox = etk.NewCheckbox(b.toggleAdvancedMovementCheckbox)
|
||||
b.advancedMovementCheckbox.SetBorderColor(triangleA)
|
||||
b.advancedMovementCheckbox.SetCheckColor(triangleA)
|
||||
|
@ -440,9 +456,9 @@ func NewBoard() *board {
|
|||
checkboxGrid := etk.NewGrid()
|
||||
checkboxGrid.SetColumnSizes(72, 20, -1)
|
||||
if !AutoEnableTouchInput {
|
||||
checkboxGrid.SetRowSizes(-1, 20, -1, 20, -1, 20, -1, 20, -1, 20, -1, 20, -1, 20, -1)
|
||||
checkboxGrid.SetRowSizes(-1, 20, -1, 20, -1, 20, -1, 20, -1, 20, -1, 20, -1, 20, -1, 20, -1)
|
||||
} else {
|
||||
checkboxGrid.SetRowSizes(-1, 20, -1, 20, -1, 20, -1, 20, -1, 20, -1, 20, -1)
|
||||
checkboxGrid.SetRowSizes(-1, 20, -1, 20, -1, 20, -1, 20, -1, 20, -1, 20, -1, 20, -1)
|
||||
}
|
||||
{
|
||||
accountLabel := etk.NewText(gotext.Get("Account"))
|
||||
|
@ -484,7 +500,9 @@ func NewBoard() *board {
|
|||
checkboxGrid.AddChildAt(movesLabel, 2, 8, 1, 1)
|
||||
checkboxGrid.AddChildAt(cGrid(b.flipBoardCheckbox), 0, 10, 1, 1)
|
||||
checkboxGrid.AddChildAt(flipBoardLabel, 2, 10, 1, 1)
|
||||
gridY := 12
|
||||
checkboxGrid.AddChildAt(cGrid(b.traditionalCheckbox), 0, 12, 1, 1)
|
||||
checkboxGrid.AddChildAt(traditionalLabel, 2, 12, 1, 1)
|
||||
gridY := 14
|
||||
if !AutoEnableTouchInput {
|
||||
checkboxGrid.AddChildAt(cGrid(b.advancedMovementCheckbox), 0, gridY, 1, 1)
|
||||
checkboxGrid.AddChildAt(advancedMovementLabel, 2, gridY, 1, 1)
|
||||
|
@ -493,7 +511,7 @@ func NewBoard() *board {
|
|||
checkboxGrid.AddChildAt(cGrid(b.autoPlayCheckbox), 0, gridY, 1, 1)
|
||||
checkboxGrid.AddChildAt(autoPlayLabel, 2, gridY, 1, 1)
|
||||
|
||||
gridSize := 72 + 20 + 72 + 20 + 72 + 20 + 72 + 20 + 72 + 20 + 72
|
||||
gridSize := 72 + 20 + 72 + 20 + 72 + 20 + 72 + 20 + 72 + 20 + 72 + 20 + 72
|
||||
if !AutoEnableTouchInput {
|
||||
gridSize += 20 + 72
|
||||
}
|
||||
|
@ -1179,6 +1197,17 @@ func (b *board) toggleFlipBoardCheckbox() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (b *board) toggleTraditionalCheckbox() error {
|
||||
b.traditional = b.traditionalCheckbox.Selected()
|
||||
|
||||
traditional := 0
|
||||
if b.traditional {
|
||||
traditional = 1
|
||||
}
|
||||
b.Client.Out <- []byte(fmt.Sprintf("set traditional %d", traditional))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *board) toggleAdvancedMovementCheckbox() error {
|
||||
b.advancedMovement = b.advancedMovementCheckbox.Selected()
|
||||
|
||||
|
@ -2419,7 +2448,11 @@ func (b *board) processState() {
|
|||
if b.showMoves && b.gameState.Turn == 1 {
|
||||
b.playerMoves = expandMoves(b.gameState.Moves)
|
||||
} else if b.showMoves && b.gameState.Turn == 2 {
|
||||
b.opponentMoves = expandMoves(b.gameState.Moves)
|
||||
moves := b.gameState.Moves
|
||||
if b.gameState.Turn == 2 && b.traditional {
|
||||
moves = bgammon.FlipMoves(moves, 2, b.gameState.Variant)
|
||||
}
|
||||
b.opponentMoves = expandMoves(moves)
|
||||
} else {
|
||||
b.playerMoves, b.opponentMoves = nil, nil
|
||||
}
|
||||
|
|
16
game/game.go
16
game/game.go
|
@ -40,7 +40,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
version = "v1.3.0"
|
||||
version = "v1.3.0p1"
|
||||
baseButtonHeight = 54
|
||||
MaxDebug = 2
|
||||
DefaultServerAddress = "wss://ws.bgammon.org"
|
||||
|
@ -1592,7 +1592,11 @@ func (g *Game) handleEvent(e interface{}) {
|
|||
case *bgammon.EventFailedRoll:
|
||||
l(fmt.Sprintf("*** %s: %s", gotext.Get("Failed to roll"), ev.Reason))
|
||||
case *bgammon.EventMoved:
|
||||
lg(gotext.Get("%s moved %s", ev.Player, bgammon.FormatMoves(ev.Moves)))
|
||||
moves := ev.Moves
|
||||
if g.Board.gameState.Turn == 2 && game.Board.traditional {
|
||||
moves = bgammon.FlipMoves(moves, 2, g.Board.gameState.Variant)
|
||||
}
|
||||
lg(gotext.Get("%s moved %s", ev.Player, bgammon.FormatMoves(moves)))
|
||||
if ev.Player == g.Client.Username && !g.Board.gameState.Spectating && !g.Board.gameState.Forced {
|
||||
return
|
||||
}
|
||||
|
@ -1605,10 +1609,14 @@ func (g *Game) handleEvent(e interface{}) {
|
|||
}
|
||||
g.Lock()
|
||||
if g.Board.showMoves {
|
||||
moves := g.Board.gameState.Moves
|
||||
if g.Board.gameState.Turn == 2 && game.Board.traditional {
|
||||
moves = bgammon.FlipMoves(moves, 2, g.Board.gameState.Variant)
|
||||
}
|
||||
if g.Board.gameState.Turn == 1 {
|
||||
g.Board.playerMoves = expandMoves(g.Board.gameState.Moves)
|
||||
g.Board.playerMoves = expandMoves(moves)
|
||||
} else if g.Board.gameState.Turn == 2 {
|
||||
g.Board.opponentMoves = expandMoves(g.Board.gameState.Moves)
|
||||
g.Board.opponentMoves = expandMoves(moves)
|
||||
}
|
||||
}
|
||||
g.Board.Unlock()
|
||||
|
|
|
@ -130,6 +130,9 @@ msgstr ""
|
|||
msgid "Flip board"
|
||||
msgstr ""
|
||||
|
||||
msgid "Flip opp. space numbers"
|
||||
msgstr ""
|
||||
|
||||
msgid "Forced"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"PO-Revision-Date: 2024-01-22 19:36+0000\n"
|
||||
"Last-Translator: \"Andrew \\\"EGYT\\\"\" <hitechni134@gmail.com>\n"
|
||||
"PO-Revision-Date: 2024-02-15 17:02+0000\n"
|
||||
"Last-Translator: Сергій <sergiy.goncharuk.1@gmail.com>\n"
|
||||
"Language-Team: Ukrainian <https://hosted.weblate.org/projects/bgammon/"
|
||||
"boxcars/uk/>\n"
|
||||
"Language: uk\n"
|
||||
|
@ -165,7 +165,7 @@ msgid "Instant"
|
|||
msgstr "Моментально"
|
||||
|
||||
msgid "Join"
|
||||
msgstr "Приєднатися"
|
||||
msgstr "Увійти"
|
||||
|
||||
msgid "Join match"
|
||||
msgstr "Увійти в кімнату"
|
||||
|
|
2
go.mod
2
go.mod
|
@ -3,7 +3,7 @@ module code.rocket9labs.com/tslocum/boxcars
|
|||
go 1.17
|
||||
|
||||
require (
|
||||
code.rocket9labs.com/tslocum/bgammon v0.0.0-20240207225023-eacc21fcf3e4
|
||||
code.rocket9labs.com/tslocum/bgammon v0.0.0-20240220213331-09878764aaa3
|
||||
code.rocket9labs.com/tslocum/bgammon-tabula-bot v0.0.0-20240207200143-c6c7c8fc77ff
|
||||
code.rocket9labs.com/tslocum/etk v0.0.0-20240220192047-d17310185c80
|
||||
code.rocket9labs.com/tslocum/tabula v0.0.0-20240207195947-691c7a5d5265
|
||||
|
|
4
go.sum
4
go.sum
|
@ -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-20240207225023-eacc21fcf3e4 h1:STSsDtcXzdjsL72GcAFBeSx5qDYCfBsmKyI36N0THyc=
|
||||
code.rocket9labs.com/tslocum/bgammon v0.0.0-20240207225023-eacc21fcf3e4/go.mod h1:Ilb6S0QWLRDqT6q8J2UA4vp1+NQdBZZQvbIrCjXsQ90=
|
||||
code.rocket9labs.com/tslocum/bgammon v0.0.0-20240220213331-09878764aaa3 h1:vFF5e61UnjJ0jqdeAh9iOduEQNxya1JG4PBnkLlxatc=
|
||||
code.rocket9labs.com/tslocum/bgammon v0.0.0-20240220213331-09878764aaa3/go.mod h1:cmhRMMrLrsMlG3rhcGbfsPdk0VKSEZMfkFtpRMxm/h8=
|
||||
code.rocket9labs.com/tslocum/bgammon-tabula-bot v0.0.0-20240207200143-c6c7c8fc77ff h1:AVOfWaNp0AMq5BwDlPSfTHGtP3dJU5PPg/2hiH2QGhc=
|
||||
code.rocket9labs.com/tslocum/bgammon-tabula-bot v0.0.0-20240207200143-c6c7c8fc77ff/go.mod h1:uqJkislWmUDlsbIqBUiFyD5Eu6Q/sp1+t8LOtZoeMjw=
|
||||
code.rocket9labs.com/tslocum/etk v0.0.0-20240220192047-d17310185c80 h1:QNlTsKggfZMcybp2xNqO6TWg7rjk6t1/jAV/rmxiX9E=
|
||||
|
|
Loading…
Reference in a new issue