Skip to content

Commit

Permalink
Added Counter to Audiance DIsplay
Browse files Browse the repository at this point in the history
  • Loading branch information
cpapplefamily committed Feb 3, 2025
1 parent 1ff051f commit 7a9eaaf
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 40 deletions.
4 changes: 4 additions & 0 deletions game/grid.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ func (grid *Grid) HasAtLeastThreeRowsWithFiveCoral() bool {
return count >= 3
}

func (grid *Grid) TotalCoralScoredLvl1() int {
return grid.AutoLvL1Count[0] + grid.AutoLvL1Count[1] + grid.TeliopLvL1Count[0] + grid.TeliopLvL1Count[1]
}

/* func (grid *Grid) SuperchargedPoints() int {
return 3 * grid.NumSuperchargedNodes()
}
Expand Down
7 changes: 7 additions & 0 deletions game/score.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ var CoralRPThresholdPerLevel_WithoutCoop = 5
var CoralRPThresholdPerLevel_WithCoop = 5
var CoralRPThresholdRequiredLevels_WithoutCoop = 4
var CoralRPThresholdRequiredLevels_WithCoop = 3
var AlgaeCoopThreshold = 2

// Represents the state of a robot at the end of the match.
type EndgameStatus int
Expand Down Expand Up @@ -159,6 +160,12 @@ func (score *Score) Summarize(opponentScore *Score) *ScoreSummary {
// Calculate bonus ranking points.
/* summary.NumNotes = score.AmpSpeaker.TotalNotesScored()
summary.NumNotesGoal = MelodyBonusThresholdWithoutCoop */
summary.NumAlgae = score.AmpSpeaker.ProcessedAlgae
summary.NumAlgaeGoal = AlgaeCoopThreshold
summary.NumLvLCoral[0] = score.Grid.TotalCoralScoredLvl1()
summary.NumLvLCoral[1] = score.Grid.TotalCoralScoredPerRow()[1]
summary.NumLvLCoral[2] = score.Grid.TotalCoralScoredPerRow()[2]
summary.NumLvLCoral[3] = score.Grid.TotalCoralScoredPerRow()[3]

if score.AmpSpeaker.ProcessedAlgae >= 2 {
summary.CoopertitionCriteriaMet = true
Expand Down
3 changes: 3 additions & 0 deletions game/score_summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ type ScoreSummary struct {
BonusRankingPoints int
NumOpponentTechFouls int

NumAlgae int
NumAlgaeGoal int
NumLvLCoral [4]int
AlgaePoints int
EndgamePoints int
CoralRankingPoint bool
Expand Down
34 changes: 32 additions & 2 deletions static/css/audience_display.css
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,17 @@ html {
.score-right .score-fields {
justify-content: flex-end;
}
.score-notes {
.score-coral {
width: 100px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-family: "FuturaLTBold";
font-size: 15px;
color: #fff;
}
.score-algae {
width: 100px;
display: flex;
flex-direction: column;
Expand All @@ -146,7 +156,7 @@ html {
font-size: 20px;
color: #fff;
}
.score-notes i {
.score-algae i {
margin-top: -3px;
font-size: 25px;
}
Expand Down Expand Up @@ -656,3 +666,23 @@ html {
font-family: "FuturaLTBold";
line-height: 87px;
}
.scaled-image {
width: 50px;
height: 50px;
}
.level-row {
display: flex;
justify-content: space-between;
margin-bottom: 1px; /* Adjust as needed for spacing */
white-space: nowrap; /* Prevent text from wrapping */
}

.level-row div {
flex: 1;
padding-right: 2px; /* Add space between the text and the count */
}

.level-row span {
flex: 1;
text-align: right; /* Align the count to the right */
}
Binary file added static/img/fd_frc_reefscape_coral_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 14 additions & 5 deletions static/js/audience_display.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,20 @@ const handleMatchTime = function(data) {
const handleRealtimeScore = function(data) {
$(`#${redSide}ScoreNumber`).text(data.Red.ScoreSummary.Score - data.Red.ScoreSummary.StagePoints);
$(`#${blueSide}ScoreNumber`).text(data.Blue.ScoreSummary.Score - data.Blue.ScoreSummary.StagePoints);

$(`#${redSide}NoteNumerator`).text(data.Red.ScoreSummary.NumNotes);
$(`#${redSide}NoteDenominator`).text(data.Red.ScoreSummary.NumNotesGoal);
$(`#${blueSide}NoteNumerator`).text(data.Blue.ScoreSummary.NumNotes);
$(`#${blueSide}NoteDenominator`).text(data.Blue.ScoreSummary.NumNotesGoal);

$(`#${redSide}LvL4Count`).text(data.Red.ScoreSummary.NumLvLCoral[3]);
$(`#${redSide}LvL3Count`).text(data.Red.ScoreSummary.NumLvLCoral[2]);
$(`#${redSide}LvL2Count`).text(data.Red.ScoreSummary.NumLvLCoral[1]);
$(`#${redSide}LvL1Count`).text(data.Red.ScoreSummary.NumLvLCoral[0]);
$(`#${blueSide}LvL4Count`).text(data.Blue.ScoreSummary.NumLvLCoral[3]);
$(`#${blueSide}LvL3Count`).text(data.Blue.ScoreSummary.NumLvLCoral[2]);
$(`#${blueSide}LvL2Count`).text(data.Blue.ScoreSummary.NumLvLCoral[1]);
$(`#${blueSide}LvL1Count`).text(data.Blue.ScoreSummary.NumLvLCoral[0]);

$(`#${redSide}AlgaeNumerator`).text(data.Red.ScoreSummary.NumAlgae);
$(`#${redSide}AlgaeDenominator`).text(data.Red.ScoreSummary.NumAlgaeGoal);
$(`#${blueSide}AlgaeNumerator`).text(data.Blue.ScoreSummary.NumAlgae);
$(`#${blueSide}AlgaeDenominator`).text(data.Blue.ScoreSummary.NumAlgaeGoal);
if (currentMatch.Type === matchTypePlayoff) {
$(`#${redSide}NoteDenominator`).hide();
$(`#${blueSide}NoteDenominator`).hide();
Expand Down
105 changes: 72 additions & 33 deletions templates/audience_display.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,55 +32,94 @@
<img class="avatar" id="leftTeam3Avatar" src="" />
</div>
<div class="score-fields">
<div class="score-notes">
<div class="score-algae">
<div>
<span id="leftNoteNumerator"></span>
<span class="note-splitter">/</span>
<span id="leftNoteDenominator"></span>
<span id="leftAlgaeNumerator"></span>
<span class="algae-splitter">/</span>
<span id="leftAlgaeDenominator"></span>
</div>
<i class="bi-music-note-beamed"></i>
<img src="/static/img/fd_frc_reefscape_coral_03.png" alt="Music Note" class="scaled-image"/>
<!-- <i class="bi-music-note-beamed"></i> -->
</div>
<div class="score-lights" id="leftLights">
<div class="score-coral">
<div class="level-row">
<div>LvL 4 - </div>
<span id="leftLvL4Count"></span>
</div>
<div class="level-row">
<div>LvL 3 - </div>
<span id="leftLvL3Count"></span>
</div>
<div class="level-row">
<div>LvL 2 - </div>
<span id="leftLvL2Count"></span>
</div>
<div class="level-row">
<div>LvL 1 - </div>
<span id="leftLvL1Count"></span>
</div>
</div>
<!-- <div class="score-lights" id="leftLights">
<svg width="45" height="100">
<rect class="amp-light amp-high" x="17" y="30" width="28" height="18" fill="white" />
<rect class="amp-light amp-low" x="17" y="55" width="28" height="18" fill="white" />
<rect class="amp-light amp-coop" x="0" y="30" width="10" height="43" fill="white" />
</svg>
</div>
</div> -->
<div class="score-amplified" id="leftAmplified">
<svg width="70" height="100" id="progress">
<circle cx="35" cy="50" r="25" fill="none" stroke="white" stroke-width="5"
stroke-dasharray="158 158" stroke-dashoffset="5" transform="rotate(90, 35, 50)"/>
<text class="progress-time" x="35.5" y="61" font-size="30" text-anchor="middle" fill="white"></text>
</svg>
<text class="progress-time" x="35.5" y="61" font-size="30" text-anchor="middle" fill="white"></text>
</svg>
</div>
</div>
<div class="score-number" id="leftScoreNumber"></div>
</div>
<div class="score-number" id="leftScoreNumber"></div>
</div>
<div class="score score-right reversible-right">
<div class="score-number" id="rightScoreNumber"></div>
<div class="score-fields">
<div class="score-amplified" id="rightAmplified">
<svg width="70" height="100" id="progress">
<circle cx="35" cy="50" r="25" fill="none" stroke="white" stroke-width="5"
<div class="score score-right reversible-right">
<div class="score-number" id="rightScoreNumber"></div>
<div class="score-fields">
<div class="score-amplified" id="rightAmplified">
<svg width="70" height="100" id="progress">
<circle cx="35" cy="50" r="25" fill="none" stroke="white" stroke-width="5"
stroke-dasharray="158 158" stroke-dashoffset="-5" transform="rotate(90, 35, 50)"/>
<text class="progress-time" x="35.5" y="61" font-size="30" text-anchor="middle" fill="white"></text>
</svg>
</div>
<div class="score-lights" id="rightLights">
<svg width="45" height="100">
<rect class="amp-light amp-high" x="0" y="30" width="28" height="18" fill="white" />
<rect class="amp-light amp-low" x="0" y="55" width="28" height="18" fill="white" />
<rect class="amp-light amp-coop" x="35" y="30" width="10" height="43" fill="white" />
</svg>
</div>
<div class="score-notes">
<div>
<span id="rightNoteNumerator"></span>
<span class="note-splitter">/</span>
<span id="rightNoteDenominator"></span>
<text class="progress-time" x="35.5" y="61" font-size="30" text-anchor="middle" fill="white"></text>
</svg>
</div>
<i class="bi-music-note-beamed"></i>
<div class="score-coral">
<div class="level-row">
<div>LvL 4 - </div>
<span id="rightLvL4Count"></span>
</div>
<div class="level-row">
<div>LvL 3 - </div>
<span id="rightLvL3Count"></span>
</div>
<div class="level-row">
<div>LvL 2 - </div>
<span id="rightLvL2Count"></span>
</div>
<div class="level-row">
<div>LvL 1 - </div>
<span id="rightLvL1Count"></span>
</div>
</div>
<!-- <i class="bi-music-note-beamed"></i> -->
<!-- <div class="score-lights" id="rightLights">
<svg width="45" height="100">
<rect class="amp-light amp-high" x="0" y="30" width="28" height="18" fill="white" />
<rect class="amp-light amp-low" x="0" y="55" width="28" height="18" fill="white" />
<rect class="amp-light amp-coop" x="35" y="30" width="10" height="43" fill="white" />
</svg>
</div> -->
<div class="score-algae">
<div>
<span id="rightAlgaeNumerator"></span>
<span class="algae-splitter">/</span>
<span id="rightAlgaeDenominator"></span>
</div>
<img src="/static/img/fd_frc_reefscape_coral_03.png" alt="Music Note" class="scaled-image"/>
<!-- <i class="bi-music-note-beamed"></i> -->
</div>
</div>
<div class="avatars">
Expand Down

0 comments on commit 7a9eaaf

Please sign in to comment.