Урна-логист: фильтр по 22 группам предметов в «Содержимом» (вместо образца); дух засыпает, когда игрок дальше 40 м
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d8e7c8c66a
commit
0290a73477
@@ -0,0 +1,84 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
namespace NecromancerTome
|
||||
{
|
||||
/// <summary>
|
||||
/// Фильтр урны-логиста (16.10.2026): панель значков групп (CinerariumGroups) в окне «Содержимое» - окно necroUrnFilter
|
||||
/// добавлено в группу окон игры bagStorage рядом с ячейкой черепа (Config/XUi_InGame). Видна только у урны с нитями;
|
||||
/// у сумок транспорта и волка (та же группа окон) скрыта. Щелчок по значку включает/выключает группу; по умолчанию все
|
||||
/// включены. Выключенный значок - тёмный.
|
||||
/// </summary>
|
||||
[Preserve]
|
||||
public class XUiC_NecroUrnFilter : XUiController
|
||||
{
|
||||
readonly XUiController[] _icons = new XUiController[CinerariumGroups.Count];
|
||||
readonly XUiController[] _frames = new XUiController[CinerariumGroups.Count];
|
||||
static readonly Color On = Color.white;
|
||||
static readonly Color Off = new Color(0.25f, 0.25f, 0.25f, 0.6f);
|
||||
static readonly Color FrameOn = new Color(0.45f, 0.85f, 0.55f, 1f);
|
||||
static readonly Color FrameOff = new Color(0.2f, 0.2f, 0.2f, 1f);
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
for (int i = 0; i < CinerariumGroups.Count; i++)
|
||||
{
|
||||
int g = i;
|
||||
_icons[i] = GetChildById("g" + i);
|
||||
_frames[i] = GetChildById("f" + i);
|
||||
if (_icons[i] == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
_icons[i].OnPress += (_s, _m) => Toggle(g);
|
||||
if (_icons[i].ViewComponent is XUiV_Sprite sp)
|
||||
{
|
||||
sp.UIAtlas = "ItemIconAtlas";
|
||||
sp.SpriteName = CinerariumGroups.Icons[g];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnOpen()
|
||||
{
|
||||
base.OnOpen();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void Toggle(int _g)
|
||||
{
|
||||
TEFeatureCinerarium urn = CinerariumContents.Urn;
|
||||
if (urn == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
urn.ToggleGroup(_g);
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void Refresh()
|
||||
{
|
||||
TEFeatureCinerarium urn = CinerariumContents.Urn;
|
||||
bool show = urn != null && urn.IsLogist;
|
||||
ViewComponent.IsVisible = show;
|
||||
if (!show)
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < CinerariumGroups.Count; i++)
|
||||
{
|
||||
bool on = urn.GroupOn(i);
|
||||
if (_icons[i]?.ViewComponent is XUiV_Sprite sp)
|
||||
{
|
||||
sp.Color = on ? On : Off;
|
||||
sp.ToolTip = Localization.Get(CinerariumGroups.NameKey(i)) + " - " + Localization.Get(on ? "necroGroupOn" : "necroGroupOff");
|
||||
}
|
||||
if (_frames[i]?.ViewComponent is XUiV_Sprite fr)
|
||||
{
|
||||
fr.Color = on ? FrameOn : FrameOff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user