diff --git a/.gitignore b/.gitignore index 4fdbbab..58a1751 100644 --- a/.gitignore +++ b/.gitignore @@ -48,6 +48,7 @@ _testmain.go /fyne-cross /kqb-scoreboard.app +/kqb-scoreboard.exe # This file includes artifacts of Go build that should not be checked in. # For files created by specific development environment (e.g. editor), # use alternative ways to exclude files from git. diff --git a/main.go b/main.go index 2aaea6a..111d0db 100644 --- a/main.go +++ b/main.go @@ -40,7 +40,7 @@ type Stats struct { var h Team = Team{"Blue Team", PlaceholderImage, 1, 1, Stats{1, 1, 1, 1}} var a Team = Team{"Gold Team", PlaceholderImage, 1, 1, Stats{1, 1, 1, 1}} -var s Scoreboard = Scoreboard{&h, &a, 0, 0, 0, 0} +var s Scoreboard = Scoreboard{&h, &a, 0, 0, 0, 0, []ScoreboardSet{}} var logoPath string var FyneApp fyne.App diff --git a/scoreboard.go b/scoreboard.go index 11f193c..fd4d36e 100644 --- a/scoreboard.go +++ b/scoreboard.go @@ -10,12 +10,23 @@ type Scoreboard struct { AwayMaps int HomeGames int AwayGames int + // BlueBerries int + // GoldBerries int + // BlueEggs int + // GoldEggs int + Sets []ScoreboardSet +} + +type ScoreboardSet struct { + Away int + Home int } // IncrementHome accounts for when the home team wins a map func (s *Scoreboard) IncrementHome() { s.HomeMaps++ if s.HomeMaps == 3 { + s.Sets = append(s.Sets, ScoreboardSet{Away: s.AwayMaps, Home: s.HomeMaps}) s.HomeMaps = 0 s.AwayMaps = 0 s.HomeGames++ @@ -35,6 +46,7 @@ func (s *Scoreboard) DecrementHome() { func (s *Scoreboard) IncrementAway() { s.AwayMaps++ if s.AwayMaps == 3 { + s.Sets = append(s.Sets, ScoreboardSet{Away: s.AwayMaps, Home: s.HomeMaps}) s.HomeMaps = 0 s.AwayMaps = 0 s.AwayGames++ diff --git a/static/index.html b/static/index.html index 96204c5..2019614 100644 --- a/static/index.html +++ b/static/index.html @@ -60,19 +60,35 @@ document.getElementById("away-img").src = data.Away.Img } updateMapCSS(data) - if (data.HomeGames >= 3) { - document.getElementById("home-winner").classList.add("winner-background") - } else { - if(document.getElementById("home-winner").classList.contains("winner-background")) { - document.getElementById("home-winner").classList.remove("winner-background") - } + // if (data.HomeGames >= 3) { + // document.getElementById("home-winner").classList.add("winner-background") + // } else { + // if(document.getElementById("home-winner").classList.contains("winner-background")) { + // document.getElementById("home-winner").classList.remove("winner-background") + // } + // } + // if (data.AwayGames >= 3) { + // document.getElementById("away-winner").classList.add("winner-background") + // } else { + // if(document.getElementById("away-winner").classList.contains("winner-background")) { + // document.getElementById("away-winner").classList.remove("winner-background") + // } + // } + let homeRow = document.getElementById("home-row") + let awayRow = document.getElementById("away-row") + let x = homeRow.cells.length + let y = awayRow.cells.length + for(let i = x-1; i>0 ; i--) { + homeRow.deleteCell(i) } - if (data.AwayGames >= 3) { - document.getElementById("away-winner").classList.add("winner-background") - } else { - if(document.getElementById("away-winner").classList.contains("winner-background")) { - document.getElementById("away-winner").classList.remove("winner-background") - } + for(let j = y-1; j>0 ; j--) { + awayRow.deleteCell(j) + } + for(let [idx,set] of data.Sets.entries()) { + let homeCell = homeRow.insertCell(-1) + let awayCell = awayRow.insertCell(-1) + homeCell.innerText = set.Home + awayCell.innerText = set.Away } } function DarkModeToggle() { @@ -252,6 +268,16 @@
00:00
+
+ + + + + + + +
A
H
+
diff --git a/static/scoreboard.css b/static/scoreboard.css index b3a1064..8d44ece 100644 --- a/static/scoreboard.css +++ b/static/scoreboard.css @@ -63,10 +63,12 @@ body { .blue-text { color: #0192ff; + text-shadow: 2px 2px 8px #0192ff; } .gold-text { color: #f2ae12; + text-shadow: 2px 2px 8px #f2ae12; } .home-box { @@ -97,7 +99,7 @@ body { height: 4rem; background: #0192ff; border-radius: 50px / 25px; - border: 3px #0061ac solid; + border: 4px #0061ac solid; transform: rotate(-10deg); display:inline-block; } @@ -107,7 +109,7 @@ body { height: 4rem; background: #888888; border-radius: 50px / 25px; - border: 3px #0061ac solid; + border: 4px #0061ac solid; transform: rotate(-10deg); display:inline-block; } @@ -117,7 +119,7 @@ body { height: 4rem; background: #888888; border-radius: 50px / 25px; - border: 3px #af7e0d solid; + border: 4px #af7e0d solid; transform: rotate(10deg); display:inline-block; } @@ -128,7 +130,7 @@ body { width: 1.5rem; height: 4rem; border-radius: 50px / 25px; - border: 3px #af7e0d solid; + border: 4px #af7e0d solid; transform: rotate(10deg); display:inline-block; } @@ -181,11 +183,13 @@ body { } .home-outline { - border: 3px #0061ac solid; + border: 4px #0192ff solid; + box-shadow: 2px 2px 6px #0192ff; } .away-outline { - border: 3px #af7e0d solid; + border: 4px #f2ae12 solid; + box-shadow: 2px 2px 6px #f2ae12; } .timer-box { @@ -211,18 +215,45 @@ body { @keyframes textColorPalette { 0% { - color: #f2ae12; + border: 5px solid #f2ae12; } 25% { - color: #af7e0d; + border: 5px solid #af7e0d; } 50% { - color: #0192ff; + border: 5px solid #0192ff; } 75% { - color: #0061ac; + border: 5px solid #0061ac; } 100% { - color: #a055fb; + border: 5px solid #a055fb; } +} + +.set-box { + height: 90px; + width: 200px; + position: fixed; + /* line-height: 90px; */ + text-align: left; + vertical-align: middle; + font-size: 2em; + /* top: 50%; */ + left: 50%; + padding: 8px; + transform: translate(-50%, 0%); + background-color: black !important; + border-radius: 6px; + animation-name: textColorPalette; + animation-duration: 5s; + animation-iteration-count: infinite; + animation-direction: alternate; + animation-timing-function: linear; +} + + +table, td { + width: 100%; + padding: 5px; } \ No newline at end of file diff --git a/ui.go b/ui.go index e632a24..52aba05 100644 --- a/ui.go +++ b/ui.go @@ -83,7 +83,7 @@ func CustomTeamSelection(w fyne.Window) *fyne.Container { log.Println("Scoreboard Starting") blueTeam := Team{blueInput.Text, "avatar.png", 1, 1, Stats{0, 0, blueWinsInt, blueLossInt}} goldTeam := Team{goldInput.Text, "avatar.png", 1, 1, Stats{0, 0, goldWinsInt, goldLossInt}} - s = Scoreboard{&blueTeam, &goldTeam, 0, 0, 0, 0} + s = Scoreboard{&blueTeam, &goldTeam, 0, 0, 0, 0, []ScoreboardSet{}} StartScoreboard(w) }) saveButton.Style = widget.PrimaryButton @@ -111,7 +111,7 @@ func IGLTeamSelection(w fyne.Window, apiUrl string) *fyne.Container { saveButton := widget.NewButton("Start Scoreboard", func() { log.Println("Saved.") - s = Scoreboard{&blueTeam, &goldTeam, 0, 0, 0, 0} + s = Scoreboard{&blueTeam, &goldTeam, 0, 0, 0, 0, []ScoreboardSet{}} UpdateTeamLogo(&blueTeam) UpdateTeamLogo(&goldTeam) StartScoreboard(w) @@ -260,6 +260,7 @@ func ScoreboardContent(w fyne.Window, SetupEventHooks func(func())) *fyne.Contai s.HomeGames = 0 s.AwayGames = 0 s.AwayMaps = 0 + s.Sets = []ScoreboardSet{} RefreshScoreboardUI() UpdateScoreBoard(&s) })