Some small edits suggested by Ellen.
Main change is adding number of tricks to Table, Split and Play
Change-Id: I582fa539477954b778cdfa0c8c504db12b44dad3
diff --git a/go/src/hearts/assets/0-DBlue.png b/go/src/hearts/assets/0-DBlue.png
new file mode 100644
index 0000000..ddcfba3
--- /dev/null
+++ b/go/src/hearts/assets/0-DBlue.png
Binary files differ
diff --git a/go/src/hearts/assets/1-DBlue.png b/go/src/hearts/assets/1-DBlue.png
new file mode 100644
index 0000000..1dffcf5
--- /dev/null
+++ b/go/src/hearts/assets/1-DBlue.png
Binary files differ
diff --git a/go/src/hearts/assets/2-DBlue.png b/go/src/hearts/assets/2-DBlue.png
new file mode 100644
index 0000000..d731d2f
--- /dev/null
+++ b/go/src/hearts/assets/2-DBlue.png
Binary files differ
diff --git a/go/src/hearts/assets/3-DBlue.png b/go/src/hearts/assets/3-DBlue.png
new file mode 100644
index 0000000..40bcd3e
--- /dev/null
+++ b/go/src/hearts/assets/3-DBlue.png
Binary files differ
diff --git a/go/src/hearts/assets/4-DBlue.png b/go/src/hearts/assets/4-DBlue.png
new file mode 100644
index 0000000..5370873
--- /dev/null
+++ b/go/src/hearts/assets/4-DBlue.png
Binary files differ
diff --git a/go/src/hearts/assets/5-DBlue.png b/go/src/hearts/assets/5-DBlue.png
new file mode 100644
index 0000000..1e38302
--- /dev/null
+++ b/go/src/hearts/assets/5-DBlue.png
Binary files differ
diff --git a/go/src/hearts/assets/6-DBlue.png b/go/src/hearts/assets/6-DBlue.png
new file mode 100644
index 0000000..ac61b37
--- /dev/null
+++ b/go/src/hearts/assets/6-DBlue.png
Binary files differ
diff --git a/go/src/hearts/assets/7-DBlue.png b/go/src/hearts/assets/7-DBlue.png
new file mode 100644
index 0000000..318f154
--- /dev/null
+++ b/go/src/hearts/assets/7-DBlue.png
Binary files differ
diff --git a/go/src/hearts/assets/8-DBlue.png b/go/src/hearts/assets/8-DBlue.png
new file mode 100644
index 0000000..e575f10
--- /dev/null
+++ b/go/src/hearts/assets/8-DBlue.png
Binary files differ
diff --git a/go/src/hearts/assets/9-DBlue.png b/go/src/hearts/assets/9-DBlue.png
new file mode 100644
index 0000000..c750e10
--- /dev/null
+++ b/go/src/hearts/assets/9-DBlue.png
Binary files differ
diff --git a/go/src/hearts/assets/RoundedRectangle-Gray.png b/go/src/hearts/assets/RoundedRectangle-Gray.png
index bde49b9..6c1eb64 100644
--- a/go/src/hearts/assets/RoundedRectangle-Gray.png
+++ b/go/src/hearts/assets/RoundedRectangle-Gray.png
Binary files differ
diff --git a/go/src/hearts/assets/RoundedRectangle-LBlue.png b/go/src/hearts/assets/RoundedRectangle-LBlue.png
index dba6d48..f0497eb 100644
--- a/go/src/hearts/assets/RoundedRectangle-LBlue.png
+++ b/go/src/hearts/assets/RoundedRectangle-LBlue.png
Binary files differ
diff --git a/go/src/hearts/assets/WatchSpot.png b/go/src/hearts/assets/WatchSpot.png
index 440011f..c689c14 100644
--- a/go/src/hearts/assets/WatchSpot.png
+++ b/go/src/hearts/assets/WatchSpot.png
Binary files differ
diff --git a/go/src/hearts/img/reposition/reposition.go b/go/src/hearts/img/reposition/reposition.go
index 3f2a477..8bc1aef 100644
--- a/go/src/hearts/img/reposition/reposition.go
+++ b/go/src/hearts/img/reposition/reposition.go
@@ -7,6 +7,8 @@
package reposition
import (
+ "time"
+
"hearts/img/coords"
"hearts/img/direction"
"hearts/img/staticimg"
@@ -231,6 +233,12 @@
for _, o := range u.Other {
BringNodeToFront(o.GetNode(), u)
}
+ for _, img := range u.Buttons {
+ BringNodeToFront(img.GetNode(), u)
+ }
+ for _, img := range u.ModText {
+ BringNodeToFront(img.GetNode(), u)
+ }
imgs := []*staticimg.StaticImg{u.BackgroundImgs[0], u.DropTargets[0]}
for _, i := range imgs {
dims := i.GetDimensions()
@@ -291,6 +299,16 @@
to := coords.MakeVec(from.X, from.Y+topOfBanner)
AnimateImageNoChannel(img, to, img.GetDimensions(), u)
}
+ for _, img := range u.ModText {
+ from := img.GetCurrent()
+ var to *coords.Vec
+ if from.Y < 0 {
+ to = coords.MakeVec(from.X, from.Y+topOfBanner)
+ } else {
+ to = coords.MakeVec(from.X, from.Y+topOfBanner-10)
+ }
+ AnimateImageNoChannel(img, to, img.GetDimensions(), u)
+ }
for i, img := range bannerImgs {
from := img.GetCurrent()
to := coords.MakeVec(from.X, from.Y+topOfBanner-10)
@@ -325,6 +343,16 @@
to := coords.MakeVec(from.X, from.Y-topOfBanner)
AnimateImageNoChannel(img, to, img.GetDimensions(), u)
}
+ for _, img := range u.ModText {
+ from := img.GetCurrent()
+ var to *coords.Vec
+ if from.Y < topOfBanner {
+ to = coords.MakeVec(from.X, from.Y-topOfBanner)
+ } else {
+ to = coords.MakeVec(from.X, from.Y-topOfBanner+10)
+ }
+ AnimateImageNoChannel(img, to, img.GetDimensions(), u)
+ }
for i, img := range bannerImgs {
from := img.GetCurrent()
to := coords.MakeVec(from.X, from.Y-topOfBanner+10)
@@ -359,6 +387,7 @@
// Animation for when a trick is taken, when app is in the table view
func AnimateTableCardTakeTrick(cards []*card.Card, dir direction.Direction, quit chan bool, u *uistate.UIState) {
+ <-time.After(2 * time.Second)
for _, c := range cards {
BringNodeToFront(c.GetNode(), u)
}
diff --git a/go/src/hearts/img/texture/texture.go b/go/src/hearts/img/texture/texture.go
index a112d6c..5a4c71c 100644
--- a/go/src/hearts/img/texture/texture.go
+++ b/go/src/hearts/img/texture/texture.go
@@ -241,7 +241,9 @@
"M-Lower.png", "N-Lower.png", "O-Lower.png", "P-Lower.png", "Q-Lower.png", "R-Lower.png", "S-Lower.png", "T-Lower.png",
"U-Lower.png", "V-Lower.png", "W-Lower.png", "X-Lower.png", "Y-Lower.png", "Z-Lower.png", "Space.png", "Colon.png", "Bang.png",
"1.png", "2.png", "3.png", "4.png", "5.png", "6.png", "7.png", "8.png", "9.png", "0.png", "1-Red.png", "2-Red.png", "3-Red.png",
- "4-Red.png", "5-Red.png", "6-Red.png", "7-Red.png", "8-Red.png", "9-Red.png", "0-Red.png", "A-Upper-DBlue.png", "B-Upper-DBlue.png",
+ "4-Red.png", "5-Red.png", "6-Red.png", "7-Red.png", "8-Red.png", "9-Red.png", "0-Red.png", "1-DBlue.png", "2-DBlue.png",
+ "3-DBlue.png", "4-DBlue.png", "5-DBlue.png", "6-DBlue.png", "7-DBlue.png", "8-DBlue.png", "9-DBlue.png", "0-DBlue.png",
+ "A-Upper-DBlue.png", "B-Upper-DBlue.png",
"C-Upper-DBlue.png", "D-Upper-DBlue.png", "E-Upper-DBlue.png", "F-Upper-DBlue.png", "G-Upper-DBlue.png", "H-Upper-DBlue.png",
"I-Upper-DBlue.png", "J-Upper-DBlue.png", "K-Upper-DBlue.png", "L-Upper-DBlue.png", "M-Upper-DBlue.png", "N-Upper-DBlue.png",
"O-Upper-DBlue.png", "P-Upper-DBlue.png", "Q-Upper-DBlue.png", "R-Upper-DBlue.png", "S-Upper-DBlue.png", "T-Upper-DBlue.png",
diff --git a/go/src/hearts/img/uistate/uistate.go b/go/src/hearts/img/uistate/uistate.go
index d9c405e..b6d90c0 100644
--- a/go/src/hearts/img/uistate/uistate.go
+++ b/go/src/hearts/img/uistate/uistate.go
@@ -64,6 +64,7 @@
DropTargets []*staticimg.StaticImg
Buttons []*staticimg.StaticImg
Other []*staticimg.StaticImg
+ ModText []*staticimg.StaticImg
CurCard *card.Card // the card that is currently clicked on
CurImg *staticimg.StaticImg // the image that is currently clicked on
// lastMouseXY is in Px: divide by pixelsPerPt to get Pt
@@ -110,6 +111,7 @@
DropTargets: make([]*staticimg.StaticImg, 0),
Buttons: make([]*staticimg.StaticImg, 0),
Other: make([]*staticimg.StaticImg, 0),
+ ModText: make([]*staticimg.StaticImg, 0),
LastMouseXY: coords.MakeVec(-1, -1),
NumPlayers: numPlayers,
NumSuits: numSuits,
diff --git a/go/src/hearts/img/view/view.go b/go/src/hearts/img/view/view.go
index e41f594..4781754 100644
--- a/go/src/hearts/img/view/view.go
+++ b/go/src/hearts/img/view/view.go
@@ -25,6 +25,7 @@
"golang.org/x/mobile/exp/sprite"
)
+// Arrange view: For seating players
func LoadArrangeView(u *uistate.UIState) {
u.CurView = uistate.Arrange
<-time.After(1 * time.Second)
@@ -32,52 +33,22 @@
resetImgs(u)
resetScene(u)
addHeader(u)
- sitImg := u.Texs["SitSpot.png"]
watchImg := u.Texs["WatchSpot.png"]
- arrangeBlockLength := u.WindowSize.X - 4*u.Padding
+ arrangeBlockLength := u.WindowSize.X - 4*u.Padding - u.CardDim.X
if u.WindowSize.Y < u.WindowSize.X {
- arrangeBlockLength = u.WindowSize.Y - 4*u.Padding
+ arrangeBlockLength = u.WindowSize.Y - 4*u.Padding - u.CardDim.Y
}
arrangeDim := coords.MakeVec(arrangeBlockLength/3-4*u.Padding, arrangeBlockLength/3-4*u.Padding)
- nilDim := coords.MakeVec(0, 0)
// player 0 seat
- sitPos := coords.MakeVec((u.WindowSize.X-arrangeDim.X)/2, u.WindowSize.Y-arrangeDim.Y-2*u.Padding)
- if u.PlayerData[0] == 0 {
- u.Buttons = append(u.Buttons, texture.MakeImgWithoutAlt(sitImg, sitPos, arrangeDim, u))
- } else {
- u.Buttons = append(u.Buttons, texture.MakeImgWithoutAlt(sitImg, sitPos, nilDim, u))
- avatar := uistate.GetAvatar(0, u)
- u.BackgroundImgs = append(u.BackgroundImgs, texture.MakeImgWithoutAlt(avatar, sitPos, arrangeDim, u))
- }
+ addArrangePlayer(0, arrangeDim, arrangeBlockLength, u)
// player 1 seat
- sitPos = coords.MakeVec((u.WindowSize.X-arrangeDim.X)/2-arrangeDim.X-2*u.Padding, u.WindowSize.Y-2*arrangeDim.Y-4*u.Padding)
- if u.PlayerData[1] == 0 {
- u.Buttons = append(u.Buttons, texture.MakeImgWithoutAlt(sitImg, sitPos, arrangeDim, u))
- } else {
- u.Buttons = append(u.Buttons, texture.MakeImgWithoutAlt(sitImg, sitPos, nilDim, u))
- avatar := uistate.GetAvatar(1, u)
- u.BackgroundImgs = append(u.BackgroundImgs, texture.MakeImgWithoutAlt(avatar, sitPos, arrangeDim, u))
- }
+ addArrangePlayer(1, arrangeDim, arrangeBlockLength, u)
// player 2 seat
- sitPos = coords.MakeVec((u.WindowSize.X-arrangeDim.X)/2, u.WindowSize.Y-3*arrangeDim.Y-6*u.Padding)
- if u.PlayerData[2] == 0 {
- u.Buttons = append(u.Buttons, texture.MakeImgWithoutAlt(sitImg, sitPos, arrangeDim, u))
- } else {
- u.Buttons = append(u.Buttons, texture.MakeImgWithoutAlt(sitImg, sitPos, nilDim, u))
- avatar := uistate.GetAvatar(2, u)
- u.BackgroundImgs = append(u.BackgroundImgs, texture.MakeImgWithoutAlt(avatar, sitPos, arrangeDim, u))
- }
+ addArrangePlayer(2, arrangeDim, arrangeBlockLength, u)
// player 3 seat
- sitPos = coords.MakeVec((u.WindowSize.X-arrangeDim.X)/2+arrangeDim.X+2*u.Padding, u.WindowSize.Y-2*arrangeDim.Y-4*u.Padding)
- if u.PlayerData[3] == 0 {
- u.Buttons = append(u.Buttons, texture.MakeImgWithoutAlt(sitImg, sitPos, arrangeDim, u))
- } else {
- u.Buttons = append(u.Buttons, texture.MakeImgWithoutAlt(sitImg, sitPos, nilDim, u))
- avatar := uistate.GetAvatar(3, u)
- u.BackgroundImgs = append(u.BackgroundImgs, texture.MakeImgWithoutAlt(avatar, sitPos, arrangeDim, u))
- }
+ addArrangePlayer(3, arrangeDim, arrangeBlockLength, u)
// table
- watchPos := coords.MakeVec((u.WindowSize.X-arrangeDim.X)/2, u.WindowSize.Y-2*arrangeDim.Y-4*u.Padding)
+ watchPos := coords.MakeVec((u.WindowSize.X-arrangeDim.X)/2, (u.WindowSize.Y+arrangeBlockLength)/2-2*arrangeDim.Y-4*u.Padding)
u.Buttons = append(u.Buttons, texture.MakeImgWithoutAlt(watchImg, watchPos, arrangeDim, u))
}
@@ -199,6 +170,8 @@
dropCard.Move(dropTargetPos, dropTargetDimensions, u.Eng)
u.Cards = append(u.Cards, dropCard)
}
+ // number of tricks each player has taken
+ SetNumTricksTable(u)
// adding 4 player icons, text, and device icons
playerIconImage := uistate.GetAvatar(0, u)
playerIconX := (u.WindowSize.X - u.PlayerIconDim.X) / 2
@@ -302,7 +275,7 @@
deviceIconPos = coords.MakeVec(playerIconPos.X-deviceIconDim.X, playerIconPos.Y+u.PlayerIconDim.Y-deviceIconDim.Y)
u.BackgroundImgs = append(u.BackgroundImgs,
texture.MakeImgWithoutAlt(deviceIconImage, deviceIconPos, deviceIconDim, u))
- //adding cards
+ // adding cards
for _, p := range u.CurTable.GetPlayers() {
// cards in hand
hand := p.GetHand()
@@ -409,6 +382,7 @@
addPlaySlot(u)
addHand(u)
addPlayHeader(getTurnText(u), false, u)
+ SetNumTricksHand(u)
if u.Debug {
addDebugBar(u)
}
@@ -425,6 +399,7 @@
resetScene(u)
addPlayHeader(getTurnText(u), !reloading, u)
addSplitViewPlayerIcons(!reloading, u)
+ SetNumTricksHand(u)
addHand(u)
if u.Debug {
addDebugBar(u)
@@ -435,17 +410,59 @@
}
}
-// TODO(emshack): When go mobile implements sprite.engine.Unregister, use this instead
func ChangePlayMessage(message string, u *uistate.UIState) {
// remove text and replace with message
- var emptyTex sprite.SubTex
for _, img := range u.Other {
- u.Eng.SetSubTex(img.GetNode(), emptyTex)
+ u.Scene.RemoveChild(img.GetNode())
}
- u.Eng.SetSubTex(u.Buttons[0].GetNode(), emptyTex)
+ u.Scene.RemoveChild(u.Buttons[0].GetNode())
u.Other = make([]*staticimg.StaticImg, 0)
u.Buttons = make([]*staticimg.StaticImg, 0)
addPlayHeader(message, false, u)
+ for _, img := range u.Other {
+ reposition.BringNodeToFront(img.GetNode(), u)
+ }
+ for _, img := range u.Buttons {
+ reposition.BringNodeToFront(img.GetNode(), u)
+ }
+ for _, img := range u.ModText {
+ reposition.BringNodeToFront(img.GetNode(), u)
+ }
+}
+
+func addArrangePlayer(player int, arrangeDim *coords.Vec, arrangeBlockLength float32, u *uistate.UIState) {
+ sitImg := u.Texs["SitSpot.png"]
+ var sitPos *coords.Vec
+ switch player {
+ case 0:
+ sitPos = coords.MakeVec((u.WindowSize.X-arrangeDim.X)/2, (u.WindowSize.Y+arrangeBlockLength)/2-arrangeDim.Y-2*u.Padding)
+ case 1:
+ sitPos = coords.MakeVec((u.WindowSize.X-arrangeDim.X)/2-arrangeDim.X-2*u.Padding, (u.WindowSize.Y+arrangeBlockLength)/2-2*arrangeDim.Y-4*u.Padding)
+ case 2:
+ sitPos = coords.MakeVec((u.WindowSize.X-arrangeDim.X)/2, (u.WindowSize.Y+arrangeBlockLength)/2-3*arrangeDim.Y-6*u.Padding)
+ case 3:
+ sitPos = coords.MakeVec((u.WindowSize.X-arrangeDim.X)/2+arrangeDim.X+2*u.Padding, (u.WindowSize.Y+arrangeBlockLength)/2-2*arrangeDim.Y-4*u.Padding)
+ }
+ if u.PlayerData[player] == 0 {
+ u.Buttons = append(u.Buttons, texture.MakeImgWithoutAlt(sitImg, sitPos, arrangeDim, u))
+ } else {
+ u.Buttons = append(u.Buttons, texture.MakeImgWithoutAlt(sitImg, sitPos, coords.MakeVec(0, 0), u))
+ avatar := uistate.GetAvatar(player, u)
+ u.BackgroundImgs = append(u.BackgroundImgs, texture.MakeImgWithoutAlt(avatar, sitPos, arrangeDim, u))
+ name := uistate.GetName(player, u)
+ var center *coords.Vec
+ if player == 2 {
+ center = coords.MakeVec(sitPos.X+arrangeDim.X/2, sitPos.Y-u.Padding-20)
+ } else {
+ center = coords.MakeVec(sitPos.X+arrangeDim.X/2, sitPos.Y+arrangeDim.Y+u.Padding)
+ }
+ scaler := float32(4)
+ maxWidth := arrangeDim.X
+ textImgs := texture.MakeStringImgCenterAlign(name, "", "", true, center, scaler, maxWidth, u)
+ for _, text := range textImgs {
+ u.BackgroundImgs = append(u.BackgroundImgs, text)
+ }
+ }
}
func addSplitViewPlayerIcons(beforeSplitAnimation bool, u *uistate.UIState) {
@@ -700,6 +717,107 @@
}
}
+func SetNumTricksTable(u *uistate.UIState) {
+ // remove old num tricks
+ for _, img := range u.Other {
+ u.Scene.RemoveChild(img.GetNode())
+ }
+ u.Other = make([]*staticimg.StaticImg, 0)
+ // set new num tricks
+ scaler := float32(4)
+ for i, d := range u.DropTargets {
+ dropTargetDimensions := d.GetDimensions()
+ dropTargetPos := d.GetCurrent()
+ numTricks := u.CurTable.GetPlayers()[i].GetNumTricks()
+ if numTricks > 0 {
+ trickText := " tricks"
+ if numTricks == 1 {
+ trickText = " trick"
+ }
+ tMax := dropTargetDimensions.Y
+ var textImgs []*staticimg.StaticImg
+ switch i {
+ case 0:
+ tCenter := coords.MakeVec(dropTargetPos.X+dropTargetDimensions.X/2, dropTargetPos.Y+dropTargetDimensions.Y+u.Padding)
+ textImgs = texture.MakeStringImgCenterAlign(strconv.Itoa(numTricks)+trickText, "", "", true, tCenter, scaler, tMax, u)
+ case 1:
+ tRight := coords.MakeVec(dropTargetPos.X-u.Padding, dropTargetPos.Y+dropTargetDimensions.Y/2-10)
+ textImgs = texture.MakeStringImgRightAlign(strconv.Itoa(numTricks)+trickText, "", "", true, tRight, scaler, tMax, u)
+ case 2:
+ tCenter := coords.MakeVec(dropTargetPos.X+dropTargetDimensions.X/2, dropTargetPos.Y-u.Padding-20)
+ textImgs = texture.MakeStringImgCenterAlign(strconv.Itoa(numTricks)+trickText, "", "", true, tCenter, scaler, tMax, u)
+ case 3:
+ tLeft := coords.MakeVec(dropTargetPos.X+dropTargetDimensions.X+u.Padding, dropTargetPos.Y+dropTargetDimensions.Y/2-10)
+ textImgs = texture.MakeStringImgLeftAlign(strconv.Itoa(numTricks)+trickText, "", "", true, tLeft, scaler, tMax, u)
+ }
+ for _, text := range textImgs {
+ u.Other = append(u.Other, text)
+ }
+ }
+ }
+}
+
+func SetNumTricksHand(u *uistate.UIState) {
+ // remove old num tricks
+ for _, img := range u.ModText {
+ u.Scene.RemoveChild(img.GetNode())
+ }
+ u.ModText = make([]*staticimg.StaticImg, 0)
+ // set new num tricks
+ b := u.Buttons[0]
+ center := coords.MakeVec(u.Padding+b.GetDimensions().X/2, b.GetCurrent().Y-3*u.Padding)
+ scaler := float32(4)
+ max := b.GetDimensions().Y
+ numTricks := u.CurTable.GetPlayers()[u.CurPlayerIndex].GetNumTricks()
+ if numTricks > 0 {
+ trickText := "tricks"
+ if numTricks == 1 {
+ trickText = "trick"
+ }
+ numImgs := texture.MakeStringImgCenterAlign(strconv.Itoa(numTricks), "DBlue", "DBlue", true, center, scaler, max, u)
+ for _, text := range numImgs {
+ u.ModText = append(u.ModText, text)
+ }
+ center = coords.MakeVec(center.X, center.Y+15)
+ textImgs := texture.MakeStringImgCenterAlign(trickText, "DBlue", "DBlue", true, center, scaler, max, u)
+ for _, text := range textImgs {
+ u.ModText = append(u.ModText, text)
+ }
+ }
+ if u.CurView == uistate.Split {
+ for i, d := range u.DropTargets {
+ dropTargetDimensions := d.GetDimensions()
+ dropTargetPos := d.GetCurrent()
+ numTricks := u.CurTable.GetPlayers()[(u.CurPlayerIndex+i)%u.NumPlayers].GetNumTricks()
+ if numTricks > 0 {
+ trickText := " tricks"
+ if numTricks == 1 {
+ trickText = " trick"
+ }
+ tMax := dropTargetDimensions.Y
+ var textImgs []*staticimg.StaticImg
+ switch i {
+ case 0:
+ tCenter := coords.MakeVec(dropTargetPos.X+dropTargetDimensions.X/2, dropTargetPos.Y+dropTargetDimensions.Y+u.Padding)
+ textImgs = texture.MakeStringImgCenterAlign(strconv.Itoa(numTricks)+trickText, "", "", true, tCenter, scaler, tMax, u)
+ case 1:
+ tRight := coords.MakeVec(dropTargetPos.X-u.Padding, dropTargetPos.Y+dropTargetDimensions.Y/2-10)
+ textImgs = texture.MakeStringImgRightAlign(strconv.Itoa(numTricks)+trickText, "", "", true, tRight, scaler, tMax, u)
+ case 2:
+ tCenter := coords.MakeVec(dropTargetPos.X+dropTargetDimensions.X/2, dropTargetPos.Y-u.Padding-20)
+ textImgs = texture.MakeStringImgCenterAlign(strconv.Itoa(numTricks)+trickText, "", "", true, tCenter, scaler, tMax, u)
+ case 3:
+ tLeft := coords.MakeVec(dropTargetPos.X+dropTargetDimensions.X+u.Padding, dropTargetPos.Y+dropTargetDimensions.Y/2-10)
+ textImgs = texture.MakeStringImgLeftAlign(strconv.Itoa(numTricks)+trickText, "", "", true, tLeft, scaler, tMax, u)
+ }
+ for _, text := range textImgs {
+ u.ModText = append(u.ModText, text)
+ }
+ }
+ }
+ }
+}
+
func addPassDrops(u *uistate.UIState) {
// adding blue background banner for drop targets
topOfHand := u.WindowSize.Y - 5*(u.CardDim.Y+u.Padding) - (2 * u.Padding / 5) - u.BottomPadding
@@ -914,7 +1032,7 @@
u.DropTargets = make([]*staticimg.StaticImg, 0)
u.Buttons = make([]*staticimg.StaticImg, 0)
u.Other = make([]*staticimg.StaticImg, 0)
- u.CurCard = nil
+ u.ModText = make([]*staticimg.StaticImg, 0)
}
func resetScene(u *uistate.UIState) {
diff --git a/go/src/hearts/logic/player/player.go b/go/src/hearts/logic/player/player.go
index 086d46c..3eacd6d 100644
--- a/go/src/hearts/logic/player/player.go
+++ b/go/src/hearts/logic/player/player.go
@@ -51,6 +51,12 @@
return p.passedFrom
}
+// Returns the number of tricks p has taken
+// Assumes each trick is 4 cards
+func (p *Player) GetNumTricks() int {
+ return len(p.tricks) / 4
+}
+
// Returns the score of p
func (p *Player) GetScore() int {
return p.score
diff --git a/go/src/hearts/logic/table/table.go b/go/src/hearts/logic/table/table.go
index 0df0732..017b9d4 100644
--- a/go/src/hearts/logic/table/table.go
+++ b/go/src/hearts/logic/table/table.go
@@ -37,7 +37,7 @@
heartsBroken: false,
firstTrick: true,
winCondition: 100,
- dir: direction.Right,
+ dir: direction.None,
}
}
diff --git a/go/src/hearts/syncbase/util/util.go b/go/src/hearts/syncbase/util/util.go
index 202016f..a146d80 100644
--- a/go/src/hearts/syncbase/util/util.go
+++ b/go/src/hearts/syncbase/util/util.go
@@ -8,12 +8,12 @@
const (
// switch back to my mountpoint with the following code:
- //MountPoint = "users/emshack@google.com"
- MountPoint = "/192.168.86.254:8101"
- UserID = 123234234
+ MountPoint = "users/emshack@google.com"
+ //MountPoint = "/192.168.86.254:8101"
+ UserID = 12355
UserColor = 16777215
UserAvatar = "player0.jpeg"
- UserName = "Emily"
+ UserName = "Em"
SBName = "syncbase"
AppName = "app"
DbName = "db"
diff --git a/go/src/hearts/syncbase/watch/watch.go b/go/src/hearts/syncbase/watch/watch.go
index e5bc8eb..91b4bb6 100644
--- a/go/src/hearts/syncbase/watch/watch.go
+++ b/go/src/hearts/syncbase/watch/watch.go
@@ -231,6 +231,7 @@
quit := make(chan bool)
u.AnimChans = append(u.AnimChans, quit)
reposition.AnimateTableCardTakeTrick(trickCards, trickDir, quit, u)
+ view.SetNumTricksTable(u)
}
} else if u.CurView == uistate.Split {
if roundOver {
@@ -267,11 +268,11 @@
if u.CurPlayerIndex != recipient {
message := uistate.GetName(recipient, u) + "'s trick"
view.ChangePlayMessage(message, u)
- <-time.After(1 * time.Second)
+ <-time.After(2 * time.Second)
view.LoadPlayView(u)
} else {
view.ChangePlayMessage("Your trick", u)
- <-time.After(1 * time.Second)
+ <-time.After(2 * time.Second)
view.LoadPlayView(u)
}
} else if u.CurPlayerIndex != playerInt {
diff --git a/go/src/hearts/touchhandler/touchhandler.go b/go/src/hearts/touchhandler/touchhandler.go
index ac92827..2dc4f60 100644
--- a/go/src/hearts/touchhandler/touchhandler.go
+++ b/go/src/hearts/touchhandler/touchhandler.go
@@ -150,6 +150,8 @@
}
}
+//&& u.PlayerData[u.CurPlayerIndex] == 0
+
func beginClickArrange(t touch.Event, u *uistate.UIState) {
buttonList := findClickedButton(t, u)
if len(buttonList) > 0 {