Skip to content

Commit

Permalink
Create ClubTag as a built-in component instead to avoid dependency er… (
Browse files Browse the repository at this point in the history
  • Loading branch information
snixtho authored Jul 31, 2024
1 parent dbc1687 commit a19a24b
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 9 deletions.
2 changes: 2 additions & 0 deletions src/EvoSC.Manialinks/ManialinkManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using EvoSC.Manialinks.Interfaces.Models;
using EvoSC.Manialinks.Models;
using EvoSC.Manialinks.Themes;
using EvoSC.Manialinks.Themes.AdvancedComponents;
using EvoSC.Manialinks.Util;
using GbxRemoteNet;
using GbxRemoteNet.Events;
Expand Down Expand Up @@ -74,6 +75,7 @@ public ManialinkManager(ILogger<ManialinkManager> logger, IServerClient server,
themeManager.AddThemeAsync<DefaultSeparatorTheme>();
themeManager.AddThemeAsync<DefaultSelectTheme>();
themeManager.AddThemeAsync<DefaultDialogTheme>();
themeManager.AddThemeAsync<DefaultClubTagTheme>();

_engine.GlobalVariables["Util"] = new GlobalManialinkUtils(themeManager);
_engine.GlobalVariables["Icons"] = new GameIcons();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<component>
<property type="double" name="h" />
<property type="int" name="hidden" default="0" />
<property type="bool" name="hidden" default="false" />

<template>
<!-- Club Tag Background -->
<quad id="club_bg"
size="{{ h * 2 }} {{ h }}"
valign="center"
modulatecolor="{{ Theme.ScoreboardModule_ClubTag_Bg }}"
modulatecolor="{{ Theme.UI_ClubTag_Bg }}"
image="file://Media/Manialinks/Nadeo/Trackmania/Menus/PageClub/ClubActivities/Clubs_ActivityIcon_Mask.dds"
alphamask="file://Media/Manialinks/Nadeo/Trackmania/Menus/PageClub/ClubActivities/Clubs_ActivityIcon_Mask.dds"
hidden="{{ hidden }}"
hidden="{{ hidden ? 1 : 0 }}"
/>

<!-- Club Tag Text -->
Expand All @@ -21,8 +21,8 @@
halign="center"
textsize="0.9"
textfont="{{ Font.Regular }}"
hidden="{{ hidden }}"
textcolor="{{ Theme.ScoreboardModule_PlayerRow_Text }}"
hidden="{{ hidden ? 1 : 0 }}"
textcolor="{{ Theme.UI_TextPrimary }}"
/>
</template>
</component>
</component>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using EvoSC.Common.Interfaces.Themes;
using EvoSC.Common.Themes;
using EvoSC.Common.Themes.Attributes;

namespace EvoSC.Manialinks.Themes.AdvancedComponents;

[Theme(Name = "ClubTag Component", Description = "Default theme for the ClubTag component.")]
public class DefaultClubTagTheme(IThemeManager theme) : Theme<DefaultClubTagTheme>
{
private readonly dynamic _theme = theme.Theme;

public override Task ConfigureAsync()
{
Set("UI.ClubTag.Bg").To(_theme.UI_BgHighlight);

return Task.CompletedTask;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<import component="Scoreboard.Components.PlayerRow.PointsBox" as="PointsBox"/>
<import component="Scoreboard.Components.PlayerRow.PositionBox" as="Position"/>
<import component="Scoreboard.Components.PlayerRow.PlayerActions" as="PlayerActions"/>
<import component="Scoreboard.Components.PlayerRow.ClubTag" as="ClubTag"/>
<import component="EvoSC.Advanced.ClubTag" as="ClubTag"/>

<property type="double" name="w"/>
<property type="double" name="padding"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<component>
<import component="Scoreboard.Components.PlayerRow.ClubTag" as="ClubTag"/>
<import component="EvoSC.Advanced.ClubTag" as="ClubTag"/>

<property type="string" name="backgroundColor"/>
<property type="string" name="headerColor"/>
Expand Down Expand Up @@ -78,7 +78,7 @@

<frame id="name_box" pos="0 {{ h / -2.0 }}">
<ClubTag h="{{ h / 2.0 }}"
hidden="{{ 1 }}"
hidden="{{ true }}"
/>
<label id="name_label"
size="{{ centerBoxWidth - 10.0 }} {{ h }}"
Expand Down

0 comments on commit a19a24b

Please sign in to comment.