Оссуарий: заголовок «Образцы» над ячейками образцов (#66)

22.10: «Переименуй». У коллекторов игры заголовок общий - «Инструменты»
(xuiTools); для котла при открытии окна ставится «Образцы» (13 языков),
у остальных возвращается родной. Проверено в test8.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
AlexCube
2026-10-22 23:49:21 +03:00
co-authored by Claude Opus 5.5
parent be7c203abe
commit a6a5c02b24
4 changed files with 30 additions and 0 deletions
+29
View File
@@ -144,6 +144,35 @@ namespace NecromancerTome
}
}
/// <summary>Заголовок над ячейками образцов (22.10: «Переименуй»): у коллекторов игры - «Инструменты» (xuiTools), у котла -
/// «Образцы». Окно общее, поэтому чужим возвращаем родное.</summary>
[HarmonyPatch(typeof(XUiC_DewCollectorModGrid), nameof(XUiC_DewCollectorModGrid.OnOpen))]
public static class Patch_XUiC_DewCollectorModGrid_OnOpen_GeoOssuaryHeader
{
public static void Postfix(XUiC_DewCollectorModGrid __instance)
{
XUiController window = __instance;
while (window.Parent != null && !(window.ViewComponent is XUiV_Window))
window = window.Parent;
XUiV_Label header = FindHeader(window);
if (header != null)
header.Text = Localization.Get(GeoOssuary.Is(__instance.tileEntity) ? "necroGeoOssuarySamples" : "xuiTools");
}
static XUiV_Label FindHeader(XUiController _c)
{
if (_c.ViewComponent is XUiV_Label l && (l.Text == Localization.Get("xuiTools") || l.Text == Localization.Get("necroGeoOssuarySamples")))
return l;
foreach (XUiController child in _c.Children)
{
XUiV_Label found = FindHeader(child);
if (found != null)
return found;
}
return null;
}
}
[HarmonyPatch(typeof(TileEntityCollector), nameof(TileEntityCollector.isDisabled))]
public static class Patch_TileEntityCollector_isDisabled_GeoOssuary
{