dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit e13e10738a37f7840aa690c66f594c265876739f
parent 891a15901a6b83a657942dcd1f3769893d9e4682
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Sat,  9 Dec 2023 03:15:30 -0500

UI

Diffstat:
Mpkg/web/handlers/poker/events.go | 1+
Mpkg/web/handlers/poker/poker.go | 42+++++++++++++++++++++++++++++++-----------
2 files changed, 32 insertions(+), 11 deletions(-)

diff --git a/pkg/web/handlers/poker/events.go b/pkg/web/handlers/poker/events.go @@ -8,6 +8,7 @@ type PokerEvent struct { Left int Reveal bool Angle string + Player string } type GameStartedEvent struct { diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -644,8 +644,8 @@ var dealerTokenPos = [][]int{ {125, 714}, {246, 732}, {384, 607}, - {388, 379}, - {388, 190}, + {369, 379}, + {367, 190}, {363, 123}, } @@ -726,6 +726,7 @@ func dealerThread(db *database.DkfDB, g *PokerGame, roomID string) { if p.isAllIn() { continue } + roomUserTopic := roomTopic + "_" + p.Username seatData := seats[p.SeatIdx] time.Sleep(time.Second) if p.Folded.Load() { @@ -740,16 +741,30 @@ func dealerThread(db *database.DkfDB, g *PokerGame, roomID string) { top = seatData.Top2 } + seatData1 := seats[p.SeatIdx] + if p.SeatIdx == 0 { + seatData1.Left -= 30 + } else if p.SeatIdx == 1 { + seatData1.Left -= 31 + } else if p.SeatIdx == 2 { + seatData1.Top -= 8 + } + if cardIdx == 2 { + seatData1.Left += 53 + } + evt := PokerEvent{ID: "card" + itoa(idx), Name: "", Idx: idx, Top: top, Left: left, Angle: seatData.Angle} + evt1 := PokerEvent{ID: "card" + itoa(idx), Name: card, Idx: idx, Top: seatData1.Top, Left: seatData1.Left, Reveal: true, Player: p.Username} PokerPubSub.Pub(roomTopic, evt) - PokerPubSub.Pub(roomTopic+"_"+p.Username, YourCardEvent{Idx: cardIdx, Name: card}) + PokerPubSub.Pub(roomUserTopic, YourCardEvent{Idx: cardIdx, Name: card}) + PokerPubSub.Pub(roomUserTopic, evt1) p.CardsMtx.Lock() p.Cards = append(p.Cards, PlayerCard{Idx: idx, Name: card}) p.CardsMtx.Unlock() - g.Ongoing.AddEvent(evt) + g.Ongoing.AddEvent(evt, evt1) } } @@ -1617,12 +1632,12 @@ body { #foldBtn { width: 50px; height: 30px; } #callBtn { width: 50px; height: 30px; } #betBtn { width: 145px; height: 70px; } -#countdown1 { top: 74px; left: 617px; position: absolute; display: none; z-index: 100; } -#countdown2 { top: 194px; left: 630px; position: absolute; display: none; z-index: 100; } -#countdown3 { top: 309px; left: 589px; position: absolute; display: none; z-index: 100; } -#countdown4 { top: 330px; left: 440px; position: absolute; display: none; z-index: 100; } -#countdown5 { top: 332px; left: 250px; position: absolute; display: none; z-index: 100; } -#countdown6 { top: 291px; left: 78px; position: absolute; display: none; z-index: 100; } +#countdown1 { top: 46px; left: 717px; position: absolute; display: none; z-index: 100; } +#countdown2 { top: 167px; left: 729px; position: absolute; display: none; z-index: 100; } +#countdown3 { top: 405px; left: 668px; position: absolute; display: none; z-index: 100; } +#countdown4 { top: 404px; left: 375px; position: absolute; display: none; z-index: 100; } +#countdown5 { top: 404px; left: 185px; position: absolute; display: none; z-index: 100; } +#countdown6 { top: 404px; left: 59px; position: absolute; display: none; z-index: 100; } #mainPot { position: absolute; top: 240px; left: 250px; } #winner { position: absolute; top: 265px; left: 250px; } #yourCard1 { font-size: 22px; display: inline-block; margin-right: 15px; } @@ -1783,7 +1798,12 @@ func PokerHandler(c echo.Context) error { g.Ongoing.EventsMtx.RLock() for _, evt := range g.Ongoing.Events { - send(getPokerEventHtml(evt, "0s")) + if evt.Player == "" { + send(getPokerEventHtml(evt, "0s")) + } + if evt.Player == authUser.Username.String() { + send(getPokerEventHtml(evt, "0s")) + } } g.Ongoing.EventsMtx.RUnlock()