Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
HotItemToggleVisible.cs
Go to the documentation of this file.
1using UnityEngine;
2
4{
5 public bool sticky;
6
7 public override string Name => "s_visible".lang();
8
9 public override string TextTip => null;
10
11 public override bool KeepVisibleWhenHighlighted => true;
12
13 public override bool UseIconForHighlight => true;
14
15 public override bool ShouldHighlight()
16 {
17 return sticky;
18 }
19
20 public override Sprite GetSprite(bool highlight)
21 {
22 if (!highlight)
23 {
24 return GetSprite();
25 }
26 return SpriteSheet.Get("icon_visible_highlight");
27 }
28
29 public override void OnHover(UIButton b)
30 {
31 ButtonHotItem buttonHotItem = b as ButtonHotItem;
32 if (!buttonHotItem.widget.Visible)
33 {
34 OnClick(buttonHotItem, buttonHotItem.widget.hotbar);
35 }
36 }
37
38 public override void OnClick(ButtonHotItem b, Hotbar h)
39 {
40 if (!b)
41 {
42 SE.Beep();
43 return;
44 }
45 if (b.widget.Visible)
46 {
47 SE.ClickGeneral();
48 sticky = !sticky;
49 }
50 else
51 {
52 SE.Play("pop_context");
54 }
56 }
57}
WidgetHotbar widget
override Sprite GetSprite()
Definition: HotItemIcon.cs:7
override void OnHover(UIButton b)
override void OnClick(ButtonHotItem b, Hotbar h)
override Sprite GetSprite(bool highlight)
override bool UseIconForHighlight
override bool KeepVisibleWhenHighlighted
override bool ShouldHighlight()
Definition: Hotbar.cs:5
static Sprite Get(string id)
Definition: SpriteSheet.cs:28
bool RefreshHighlight()
Hotbar hotbar
Definition: WidgetHotbar.cs:65
void ToggleVisible()