const array C_ModuleToDisable = { "UIModule_ChampionSpring2022_MatchInfo", "UIModule_ChampionSpring2022_ScoresHeader", "UIModule_ChampionSpring2022_Sponsors", "UIModule_ChampionCup_LiveRanking", "UIModule_ChampionCup_SpectatorInfo", "UIModule_ChampionCup_Chat", "UIModule_ChampionCup_MapInfo", "UIModule_ChampionCup_Countdown", "UIModule_Race_ScoresTable", "UIModule_ChampionCup_Sign16x9_1", "UIModule_ChampionCup_Sign16x9_2", "UIModule_ChampionCup_Sign16x9_3", "UIModule_ChampionCup_Sign16x9_4", "UIModule_ChampionCup_Sign16x9_5", "UIModule_ChampionCup_Sign64x10_64x10_Start", "UIModule_ChampionCup_Sign64x10_64x10_Finish", "UIModule_ChampionCup_Sign64x10_64x10_Checkpoint", "UIModule_ChampionCup_Sign2x3_1" }; void Main() { auto Network = cast(GetApp().Network); /** * Unload already loaded custom UI */ if (Network.ClientManiaAppPlayground !is null) { CGameManiaAppPlayground @ManiaApp = Network.ClientManiaAppPlayground; array Manialinks = GetManialinkFiles(); array CustomInterfacesIds; for (uint i = 0; i < Manialinks.Length; i++) { CustomInterfacesIds.InsertLast(Path::GetFileNameWithoutExtension(Manialinks[i])); } MwFastBuffer UILayers = ManiaApp.UILayers; for (uint i = 0; i < UILayers.Length; i++) { CGameUILayer @UILayer = UILayers[i]; string ManialinkPage = UILayer.ManialinkPage; array FirstLines = ManialinkPage.Split("\n", 5); if (FirstLines.Length > 0) { for (uint j = 0; j < FirstLines.Length - 1; j++) { if (FirstLines[j].Contains(' -1) { print("Updating existing layer " + LayerId); UILayer.ManialinkPage = GetManialinkPage(LayerId); } else { print("Destroying not existing layer " + LayerId); ManiaApp.UILayerDestroy(UILayer); } } } } } } } } uint count = 0; while(true) { yield(); if (Network.ClientManiaAppPlayground !is null) { CGameManiaAppPlayground @ManiaApp = Network.ClientManiaAppPlayground; MwFastBuffer UILayers = ManiaApp.UILayers; if (count != UILayers.Length) { print('Walking through UILayers'); array CustomUIModulesLoaded = {}; for (uint i = 0; i < UILayers.Length; i++) { CGameUILayer @UILayer = UILayers[i]; string ManialinkPage = UILayer.ManialinkPage; array FirstLines = ManialinkPage.Split("\n", 5); if (FirstLines.Length > 0) { for (uint j = 0; j < FirstLines.Length - 1; j++) { if (FirstLines[j].Contains(' -1) { print('Deleting ' + id); ManiaApp.UILayerDestroy(UILayers[i]); } if (id.StartsWith('Custom_TMWC2024_')) { CustomUIModulesLoaded.InsertLast(id); } } } } } } array Manialinks = GetManialinkFiles(); for (uint i = 0; i < Manialinks.Length; i++) { string FilePath = Manialinks[i]; string FileName = Path::GetFileName(FilePath); if (FileName.EndsWith('.xml')) { string LayerId = Path::GetFileNameWithoutExtension(FileName); if (CustomUIModulesLoaded.Find(LayerId) == -1) { print("Loading layer " + LayerId); CGameUILayer @UILayer = ManiaApp.UILayerCreate(); UILayer.ManialinkPage = GetManialinkPage(LayerId); if (LayerId.Contains("_Sign16x9Small") || LayerId.Contains("_Sign155Small")) { UILayer.Type = CGameUILayer::EUILayerType::ScreenIn3d; UILayer.AttachId = "155_StadiumSmall"; } else if (LayerId.Contains("_Sign16x9") || LayerId.Contains("_Sign155")) { UILayer.Type = CGameUILayer::EUILayerType::ScreenIn3d; UILayer.AttachId = "155_Stadium"; } else if (LayerId.Contains("_Sign2x3")) { UILayer.Type = CGameUILayer::EUILayerType::ScreenIn3d; UILayer.AttachId = "2x3_Stadium"; } else if (LayerId.Contains("_Markers")) { UILayer.Type = CGameUILayer::EUILayerType::Markers; } } } } count = ManiaApp.UILayers.Length; } } else { count = 0; } } } array GetManialinkFiles() { return IO::IndexFolder(Meta::ExecutingPlugin().SourcePath + '/Manialinks/', false); } string GetManialinkPage(string _Id) { IO::FileSource Xml('Manialinks/' + _Id + '.xml'); return Xml.ReadToEnd(); }