Skip to content

Commit

Permalink
Merge branch 'master' into build
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Feb 13, 2022
2 parents 55d3199 + 270596e commit cf97096
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sac-overlays",
"version": "0.0.0",
"compatibleDashboardVersion": "^3.1.0",
"compatibleDashboardVersion": "^4.0.0",
"description": "Broadcast overlays for the Splatoon Advanced Circuit, a Splatoon tournament from Inkling Performance Labs and SAC staff.",
"author": {
"name": "inkfarer",
Expand Down
8 changes: 5 additions & 3 deletions src/graphics/break/scripts/stages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ activeRound.on('change', (newValue, oldValue) => {

updateGames(games, winners);

if (!games.isNewRound) {
if (!games.isNewMatch) {
setWinners(winners);
}
});
Expand All @@ -31,8 +31,10 @@ function getStageUrl(stageName: string): string {
}

async function updateGames(games: UpdatedGames, winners: Array<UpdatedWinner>): Promise<void> {
if (games.changedGames.length <= 0) return;

const stageElementIds = games.changedGames.map(game => `#stage_${game.index}`).join(', ');
const target = games.isNewRound ? '#stages-layout > .stage' : stageElementIds;
const target = games.isNewMatch ? '#stages-layout > .stage' : stageElementIds;
const tl = gsap.timeline({
defaults: {
force3D: false,
Expand All @@ -41,7 +43,7 @@ async function updateGames(games: UpdatedGames, winners: Array<UpdatedWinner>):
});

function createStageElems() {
if (games.isNewRound) {
if (games.isNewMatch) {
const modeTextMaxWidth = { '3': 380, '5': 258, '7': 217 }[games.changedGames.length];
stagesLayout.classList.remove('stage-count-3', 'stage-count-5', 'stage-count-7');
stagesLayout.classList.add(`stage-count-${games.changedGames.length}`);
Expand Down
1 change: 1 addition & 0 deletions src/graphics/break/styles/stages.scss
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
-webkit-box-decoration-break: clone;
box-shadow: 10px 0 0 $sac-accent, -10px 0 0 $sac-accent;
background-color: $sac-accent;
overflow-wrap: break-word;
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/graphics/helpers/stage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ import { ActiveRound } from 'schemas';
import { addDots } from './string';

export type ChangedGame = { index: number, stage: string, mode: string };
export type UpdatedGames = { isNewRound: boolean, isFirstLoad: boolean, changedGames: Array<ChangedGame> };
export type UpdatedGames = { isNewMatch: boolean, isFirstLoad: boolean, changedGames: Array<ChangedGame> };

export function getUpdatedGames(newValue: ActiveRound, oldValue: ActiveRound): UpdatedGames {
const gamesWithIndex = newValue.games.map((game, index) => ({
index,
...game
}));

if (!oldValue || newValue.round.id !== oldValue.round.id) {
if (!oldValue || newValue.match.id !== oldValue.match.id) {
return {
isNewRound: true,
isNewMatch: true,
isFirstLoad: !oldValue,
changedGames: gamesWithIndex
};
}

return {
isNewRound: false,
isNewMatch: false,
isFirstLoad: false,
changedGames: gamesWithIndex.filter((game, index) => {
const oldGame = oldValue.games[index];
Expand All @@ -38,7 +38,7 @@ export function getUpdatedWinners(newValue: ActiveRound, oldValue: ActiveRound):
oldWinner: oldValue?.games[index]?.winner
}));

if (!oldValue || newValue.round.id !== oldValue.round.id) {
if (!oldValue || newValue.match.id !== oldValue.match.id) {
return winners;
}

Expand Down

0 comments on commit cf97096

Please sign in to comment.