-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathRitsuLibFramework.RelicVisibility.cs
More file actions
59 lines (55 loc) · 2.31 KB
/
RitsuLibFramework.RelicVisibility.cs
File metadata and controls
59 lines (55 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using MegaCrit.Sts2.Core.Models;
using MegaCrit.Sts2.Core.Nodes;
using MegaCrit.Sts2.Core.Nodes.Relics;
using STS2RitsuLib.Relics.Visibility;
namespace STS2RitsuLib
{
public static partial class RitsuLibFramework
{
/// <summary>
/// Registers a relic visibility rule. Returning false hides the relic from normal relic UI.
/// 注册遗物可见性规则。返回 false 会将该遗物从正常遗物 UI 中隐藏。
/// </summary>
/// <returns>
/// A disposable registration handle.
/// 可释放的注册句柄。
/// </returns>
public static IDisposable RegisterRelicVisibilityRule(string modId, Func<RelicModel, bool> isVisible)
{
return ModRelicVisibilityRegistry.Register(modId, isVisible);
}
/// <summary>
/// Returns whether RitsuLib should show a relic in normal relic UI.
/// 返回 RitsuLib 是否应在正常遗物 UI 中显示该遗物。
/// </summary>
public static bool IsRelicVisible(RelicModel relic)
{
return ModRelicVisibilityRegistry.IsVisible(relic);
}
/// <summary>
/// Refreshes the active run relic UI after relic visibility state changes.
/// 在遗物可见性状态变化后,刷新当前跑局的遗物 UI。
/// </summary>
/// <returns>
/// True if an active relic inventory was found and changed.
/// 如果找到当前遗物栏且内容发生变化,则返回 true。
/// </returns>
public static bool RefreshRelicVisibility()
{
return ModRelicVisibilityUi.Refresh(NRun.Instance?.GlobalUi?.RelicInventory);
}
/// <summary>
/// Refreshes a specific relic inventory after relic visibility state changes.
/// 在遗物可见性状态变化后,刷新指定遗物栏。
/// </summary>
/// <returns>
/// True if the inventory contents changed.
/// 如果遗物栏内容发生变化,则返回 true。
/// </returns>
public static bool RefreshRelicVisibility(NRelicInventory inventory)
{
ArgumentNullException.ThrowIfNull(inventory);
return ModRelicVisibilityUi.Refresh(inventory);
}
}
}