Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@if (dataModel.tournamentInfo().enabled) {
@if (dataModel.roundWinBox().type !== "disabled") {
<div
class="vw-875 vh-200 animate-duration-300 animate-style-keep shadow-timer/80 relative top-0 overflow-hidden rounded-sm shadow-md"
[class.animate-swish]="runAnimation"
Expand All @@ -9,10 +9,10 @@
<div
class="vw-875 vh-200 relative top-0 flex flex-col items-center justify-center overflow-hidden"
>
@if (tournamentBackgroundUrl()) {
@if (bannerBackgroundUrl()) {
<img
class="absolute top-0 left-0 -z-1 h-full w-full"
[src]="tournamentBackgroundUrl()"
[src]="bannerBackgroundUrl()"
alt=""
/>
} @else {
Expand All @@ -26,7 +26,7 @@
[src]="dataModel.teams()[0].teamUrl"
alt=""
/>
<img alt="" class="max-h-6/10" [src]="tournamentIconUrl()" (load)="preload = false" />
<img alt="" class="max-h-6/10" [src]="bannerTopIconUrl()" (load)="preload = false" />
<p class="font-unbounded text-3xl font-bold text-white uppercase">
{{ roundWonType() | translate }}
</p>
Expand All @@ -45,10 +45,10 @@
<div
class="vw-875 vh-200 absolute top-0 z-4 flex flex-row items-center justify-around overflow-hidden"
>
@if (tournamentBackgroundUrl()) {
@if (bannerBackgroundUrl()) {
<img
class="absolute top-0 left-0 -z-1 h-full w-full"
[src]="tournamentBackgroundUrl()"
[src]="bannerBackgroundUrl()"
alt=""
/>
} @else {
Expand All @@ -75,7 +75,7 @@
</div>
}
<div class="flex h-full flex-col items-center justify-center">
<img class="max-h-7/10" [src]="tournamentIconUrl()" alt="" />
<img class="max-h-7/10" [src]="bannerTopIconUrl()" alt="" />
<p class="font-unbounded text-3xl font-bold text-white uppercase">
{{
TranslateKeys.Endround_Round | translate: { rounds: dataModel.match().roundNumber }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Component, computed, effect, inject, signal, WritableSignal } from "@angular/core";
import { Component, computed, effect, inject, Signal, signal, WritableSignal } from "@angular/core";
import { TranslatePipe } from "@ngx-translate/core";
import { TranslateKeys } from "../../../services/i18nHelper";
import { DataModelService } from "../../../services/dataModel.service";
import { IRoundWinBox, IRoundWinBoxSponsors } from "../../../services/Types";

@Component({
selector: "app-endround",
Expand All @@ -26,6 +27,9 @@ export class EndroundBannerComponent {

clutch: number[] = [-1, -1];

roundWinBox: Signal<IRoundWinBox> = computed(() => this.dataModel.roundWinBox());
roundWonSponsor: Signal<IRoundWinBoxSponsors> = computed(() => this.calculateSponsor());

private calculateClutch(): void {
const teamOne = this.dataModel.match().teams[0];
const teamTwo = this.dataModel.match().teams[1];
Expand Down Expand Up @@ -58,12 +62,15 @@ export class EndroundBannerComponent {
if (player.isAlive) flawless = false;
});
for (const player of wonTeam.players) {
const killsFromLostTeam = player.killedPlayerNames.filter((playerName) =>
lostTeamPlayerNames.has(playerName),
);
if (new Set(killsFromLostTeam).size >= 5) {
ace = true;
break;
if (player.killedPlayerNames) {
const killsFromLostTeam = player.killedPlayerNames.filter((playerName) =>
lostTeamPlayerNames.has(playerName),
);

if (new Set(killsFromLostTeam).size >= 5) {
ace = true;
break;
}
}
if (player.deathsThisRound >= 1) flawless = false;
if (!(player.killsThisRound >= 1)) teamAce = false;
Expand All @@ -77,15 +84,70 @@ export class EndroundBannerComponent {
return TranslateKeys.Endround_RoundWin;
}

tournamentBackgroundUrl = computed(() => {
const backdrop = this.dataModel.tournamentInfo().backdropUrl;
if (backdrop && backdrop !== "") return backdrop;
private calculateSponsor(): IRoundWinBoxSponsors {
const teamwon = this.teamWon();
const roundWonType = this.roundWonType();

const initialSponsor: IRoundWinBoxSponsors = {
wonTeam: "all",
roundCeremonie: ["all"],
iconUrl: "",
backdropUrl: "",
};

if (this.roundWinBox().sponsors.length == 0) return initialSponsor;

const sponsor: IRoundWinBoxSponsors = this.roundWinBox().sponsors[0];

for (const spons of this.roundWinBox().sponsors) {
if (
spons.wonTeam == "all" ||
(spons.wonTeam == "left" && teamwon == 0) ||
(spons.wonTeam == "right" && teamwon == 1)
) {
if (
spons.roundCeremonie.includes("all") ||
(spons.roundCeremonie.includes("normal") &&
roundWonType == TranslateKeys.Endround_RoundWin) ||
(spons.roundCeremonie.includes("ace") &&
roundWonType == TranslateKeys.Endround_RoundAce) ||
(spons.roundCeremonie.includes("clutch") &&
roundWonType == TranslateKeys.Endround_RoundClutch) ||
(spons.roundCeremonie.includes("teamAce") &&
roundWonType == TranslateKeys.Endround_RoundTeamAce) ||
(spons.roundCeremonie.includes("flawless") &&
roundWonType == TranslateKeys.Endround_RoundFlawless) ||
(spons.roundCeremonie.includes("thrifty") &&
roundWonType == TranslateKeys.Endround_RoundThrifty)
) {
return spons;
}
}
}
return sponsor;
}

bannerBackgroundUrl = computed(() => {
const backdropSponsor = this.roundWonSponsor().backdropUrl;
const backdropTournament = this.dataModel.tournamentInfo().backdropUrl;
if (this.roundWinBox().type == "sponsors" && backdropSponsor && backdropSponsor !== "")
return backdropSponsor;
if (
this.roundWinBox().type == "tournamentInfo" &&
backdropTournament &&
backdropTournament !== ""
)
return backdropTournament;
else return false;
});

tournamentIconUrl = computed(() => {
const logo = this.dataModel.tournamentInfo().logoUrl;
if (logo && logo !== "") return logo;
bannerTopIconUrl = computed(() => {
const logoSponsor = this.roundWonSponsor().iconUrl;
const logoTournament = this.dataModel.tournamentInfo().logoUrl;
if (this.roundWinBox().type == "sponsors" && logoSponsor && logoSponsor !== "")
return logoSponsor;
if (this.roundWinBox().type == "tournamentInfo" && logoTournament && logoTournament !== "")
return logoTournament;
else return "assets/misc/logo.webp";
});

Expand All @@ -102,15 +164,14 @@ export class EndroundBannerComponent {
});

readonly waitingBackgroundClass = computed(() => {
const test = `gradient-head-to-head-${this.dataModel.teams()[0].isAttacking ? "attacker" : "defender"}`;
return test;
return `gradient-head-to-head-${this.dataModel.teams()[0].isAttacking ? "attacker" : "defender"}`;
});

readonly winningTeamBackgroundClass = computed(() => {
return `gradient-${this.leftWon() ? "left" : "right"}-${this.dataModel.match().attackersWon ? "attacker" : "defender"}`;
});

ref = effect(() => {
_ref = effect(() => {
const roundPhase = this.dataModel.match().roundPhase;
const roundNumber = this.dataModel.match().roundNumber;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export class TestingAgentSelectComponent implements OnInit {
right: "Group B",
},
tournamentInfo: {
enabled: true,
name: "",
logoUrl: "",
backdropUrl: "",
Expand All @@ -86,6 +85,10 @@ export class TestingAgentSelectComponent implements OnInit {
nameOverrides: {
overrides: [],
},
roundWinBox: {
type: "tournamentInfo",
sponsors: [],
},
},
timeoutState: {
techPause: false,
Expand Down
5 changes: 4 additions & 1 deletion src/app/overlays/testing/testing.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export class TestingComponent implements OnInit {
right: "Group B",
},
tournamentInfo: {
enabled: true,
name: "",
logoUrl: "",
backdropUrl: "",
Expand All @@ -95,6 +94,10 @@ export class TestingComponent implements OnInit {
removeTricodes: false,
},
nameOverrides: { overrides: [] },
roundWinBox: {
type: "tournamentInfo",
sponsors: [],
},
},
teams: [
{
Expand Down
14 changes: 13 additions & 1 deletion src/app/services/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export interface IToolsData {
watermarkInfo: IWatermarkInfo;
playercamsInfo: IPlayercamsInfo;
nameOverrides: INameOverrides;
roundWinBox: IRoundWinBox;
}

export interface ISeriesInfo {
Expand All @@ -115,7 +116,6 @@ export interface ITournamentInfo {
name: string;
logoUrl: string;
backdropUrl: string;
enabled: boolean;
}

export interface ITimeoutInfo {
Expand Down Expand Up @@ -149,6 +149,18 @@ export interface INameOverrides {
overrides: string[];
}

export interface IRoundWinBox {
type: "disabled" | "tournamentInfo" | "sponsors";
sponsors: IRoundWinBoxSponsors[];
}

export interface IRoundWinBoxSponsors {
wonTeam: "all" | "left" | "right";
roundCeremonie: ("all" | "normal" | "ace" | "clutch" | "teamAce" | "flawless" | "thrifty")[];
iconUrl: string;
backdropUrl: string;
}

export interface IOverridesPlayercamsData {
nameOverrides: string[];
enabledPlayers: string[];
Expand Down
6 changes: 5 additions & 1 deletion src/app/services/dataModel.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export class DataModelService {
public readonly playercamsInfo = computed(() => this.match().tools.playercamsInfo, {
equal: () => false,
});
public readonly roundWinBox = computed(() => this.match().tools.roundWinBox);

public readonly mapban = signal<IMapbanSessionData>(initialMapbanData, { equal: () => false });

Expand Down Expand Up @@ -166,7 +167,6 @@ export const initialMatchData: IMatchData = {
right: "",
},
tournamentInfo: {
enabled: false,
name: "",
logoUrl: "",
backdropUrl: "",
Expand All @@ -190,6 +190,10 @@ export const initialMatchData: IMatchData = {
},
playercamsInfo: { enable: false },
nameOverrides: { overrides: [] },
roundWinBox: {
type: "disabled",
sponsors: [],
},
},
timeoutState: {
techPause: false,
Expand Down
Loading