Урны: в лимит входят все урны; блок «всего / доступно / до следующей» в «Содержимом» (#65)
Лимит считает урны любого рода (сборщик, логист, рабочий, ремонтник, лутер, старатель); пересечение зон - только у сборщика. Блок справа от ячеек урны (windowBagStorage, CinerariumLimitPanel.cs). Тексты описаний урн и отказа по лимиту - на 13 языках. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
108ff82914
commit
aa26e97b71
@@ -0,0 +1,70 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
namespace NecromancerTome
|
||||
{
|
||||
/// <summary>
|
||||
/// Лимит урн в «Содержимом» (#65; 20.10: «индикатор, сколько урн уже поставлено и сколько ещё можно»; 23.10, по скриншоту
|
||||
/// с цифрами в заголовке: «У нас есть куча пространства под черепом или справа от него... Всего цинерариев. Доступно
|
||||
/// цинерариев. И до разблокировки ещё одного нужно упокоить зомби столько-то»). Блок дописан в окно игры windowBagStorage
|
||||
/// (Config/XUi_InGame/windows.xml), справа от ячеек урны; в сумках волка и транспорта (то же окно) скрыт.
|
||||
/// </summary>
|
||||
[Preserve]
|
||||
public class XUiC_NecroUrnLimit : XUiController
|
||||
{
|
||||
XUiV_Label _placed, _available, _next;
|
||||
float _nextRefresh;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
_placed = GetChildById("placed")?.ViewComponent as XUiV_Label;
|
||||
_available = GetChildById("available")?.ViewComponent as XUiV_Label;
|
||||
_next = GetChildById("next")?.ViewComponent as XUiV_Label;
|
||||
}
|
||||
|
||||
public override void OnOpen()
|
||||
{
|
||||
base.OnOpen();
|
||||
_nextRefresh = 0f;
|
||||
Refresh();
|
||||
}
|
||||
|
||||
public override void Update(float _dt)
|
||||
{
|
||||
base.Update(_dt);
|
||||
if (Time.time >= _nextRefresh)
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
void Refresh()
|
||||
{
|
||||
_nextRefresh = Time.time + 1f;
|
||||
TEFeatureCinerarium urn = CinerariumContents.Urn;
|
||||
int have = 0, limit = 0, next = 0;
|
||||
bool show = urn != null && TEFeatureCinerarium.LimitNumbers(out have, out limit, out int _, out next);
|
||||
ViewComponent.IsVisible = show;
|
||||
if (!show)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Справа от ячеек урны: у рабочего и старателя их две (череп и образец).
|
||||
int slots = urn.IsWorker || urn.IsProspector ? 2 : 1;
|
||||
ViewComponent.Position = new Vector2i(slots * 75 + 12, -49);
|
||||
if (_placed != null)
|
||||
{
|
||||
_placed.Text = string.Format(Localization.Get("necroCinerariumPlaced"), have);
|
||||
}
|
||||
if (_available != null)
|
||||
{
|
||||
_available.Text = string.Format(Localization.Get("necroCinerariumAvailable"), Mathf.Max(0, limit - have));
|
||||
}
|
||||
if (_next != null)
|
||||
{
|
||||
_next.Text = string.Format(Localization.Get("necroCinerariumNext"), next);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user