blob: e46eb6233f40b47d374774c009e215a37f729f4b (
plain)
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
|
using System.Collections.Generic;
using UnityEngine;
public class TFUIEnumMouseCatcher : ThronefallUIElement
{
public List<ThronefallUIElement> focusWhitelist = new List<ThronefallUIElement>();
public GameObject buttons;
private UIFrame targetFrame;
protected override void OnApply()
{
}
protected override void OnClear()
{
}
protected override void OnFocus()
{
buttons.SetActive(value: true);
targetFrame.onNewFocus.AddListener(ListenForUnfocus);
}
protected override void OnFocusAndSelect()
{
}
protected override void OnHardStateSet(SelectionState selectionState)
{
}
protected override void OnSelect()
{
}
private void Start()
{
targetFrame = GetComponentInParent<UIFrame>();
}
private void ListenForUnfocus()
{
if (!(targetFrame.CurrentFocus == this) && !focusWhitelist.Contains(targetFrame.CurrentFocus))
{
buttons.SetActive(value: false);
targetFrame.onNewFocus.RemoveListener(ListenForUnfocus);
}
}
}
|