blob: 9ea47afe1d15a9da43978406ce2d20652c0c0b07 (
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
using I2.Loc;
using MPUIKIT;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class PerkSelectionTooltipHelper : MonoBehaviour
{
public UIFrame targetFrame;
public TextMeshProUGUI selectionTitle;
public TextMeshProUGUI selectionDescription;
public Image selectionIcon;
public MPImageBasic background;
public UIParentResizer sizer;
public bool disableOnNullSelect;
public GameObject tooltipParent;
private TFUIEquippable currentElement;
public void OnSelection()
{
if (targetFrame.CurrentSelection == null)
{
return;
}
TFUIEquippable tFUIEquippable = targetFrame.CurrentSelection as TFUIEquippable;
if (tFUIEquippable == null)
{
if (disableOnNullSelect)
{
tooltipParent.SetActive(value: false);
}
return;
}
if ((bool)tooltipParent)
{
tooltipParent.SetActive(value: true);
}
currentElement = tFUIEquippable;
UpdateTooltip();
}
public void OnFocus()
{
if (targetFrame.CurrentFocus == null)
{
OnSelection();
return;
}
if ((bool)tooltipParent)
{
tooltipParent.SetActive(value: true);
}
TFUIEquippable tFUIEquippable = targetFrame.CurrentFocus as TFUIEquippable;
if (tFUIEquippable == null)
{
if (disableOnNullSelect)
{
tooltipParent.SetActive(value: false);
}
}
else
{
currentElement = tFUIEquippable;
UpdateTooltip();
}
}
public void UpdateTooltip()
{
if (currentElement == null)
{
return;
}
string text = "";
string text2 = "";
Equippable data = currentElement.Data;
if (currentElement.Locked)
{
text = LocalizationManager.GetTranslation("Menu/Locked");
text2 = LocalizationManager.GetTranslation("Menu/Locked Choice Description");
if (data is EquippableWeapon)
{
text2 = LocalizationManager.GetTranslation("Menu/Locked Weapon Description");
}
else if (data is EquippablePerk)
{
text2 = LocalizationManager.GetTranslation("Menu/Locked Perk Description");
}
else if (data is EquippableMutation)
{
text2 = LocalizationManager.GetTranslation("Menu/Locked Mutator Description");
}
selectionIcon.sprite = currentElement.IconImg.sprite;
}
else
{
text = LocalizationManager.GetTranslation(data.LOCIDENTIFIER_NAME);
text2 = LocalizationManager.GetTranslation(data.LOCIDENTIFIER_DESCRIPTION);
selectionIcon.sprite = data.icon;
}
selectionTitle.text = text;
selectionDescription.text = text2;
background.color = currentElement.GetBackgroundColor;
selectionIcon.color = currentElement.GetIconColor;
sizer.Trigger();
}
}
|