diff --git a/TMWTInterfacesHider/info.toml b/TMWTInterfacesHider/info.toml index f9c3eef..6c1b9af 100644 --- a/TMWTInterfacesHider/info.toml +++ b/TMWTInterfacesHider/info.toml @@ -1,4 +1,4 @@ [meta] name = "TMWT Interfaces Remover" category = "TMWT" -version = "1.0" +version = "1.1" diff --git a/TMWTInterfacesHider/main.as b/TMWTInterfacesHider/main.as index 9300cc1..6b7c5dc 100644 --- a/TMWTInterfacesHider/main.as +++ b/TMWTInterfacesHider/main.as @@ -32,6 +32,7 @@ CGameUILayer@ findUILayer(const MwFastBuffer _UILayers, string _M void Main() { while(true) { + yield(); auto app = cast(GetApp()); auto network = cast(app.Network); auto serverinfo = cast(network.ServerInfo); @@ -43,6 +44,9 @@ void Main() { InterfacesAreHidden = false; } + // Prevent to continue the loop when not needed + if (!HideInterfaces && !InterfacesAreHidden) continue; + CGameManiaAppPlayground@ ManiaApp = cast(network.ClientManiaAppPlayground); if (ManiaApp !is null) { if (UILayer_LiveRanking is null) { @@ -51,6 +55,11 @@ void Main() { if (UILayer_TeamsScores is null) { @UILayer_TeamsScores = findUILayer(ManiaApp.UILayers, "UIModule_TMWTTeams_Header"); } + if (UILayer_TeamsScores is null && UILayer_LiveRanking is null) { + UI::ShowNotification("\\$77d" + Icons::User + " \\$fffTMWT Interfaces Remover", "Can't find Interfaces to hide, disabling the plugin"); + HideInterfaces = false; + InterfacesAreHidden = false; + } if (HideInterfaces && !InterfacesAreHidden && ManiaApp.UI.UISequence == CGamePlaygroundUIConfig::EUISequence::Playing) { if (HideLiveRanking && UILayer_LiveRanking !is null) { UILayer_LiveRanking.IsVisible = false; @@ -76,6 +85,6 @@ void Main() { @UILayer_LiveRanking = null; @UILayer_TeamsScores = null; } - yield(); + } }