Elin Modding Docs Doc
Loading...
Searching...
No Matches
ButtonHotItem.cs
1using System;
2using UnityEngine;
3using UnityEngine.UI;
4
5// Token: 0x020005EC RID: 1516
7{
8 // Token: 0x17000C06 RID: 3078
9 // (get) Token: 0x060029BC RID: 10684 RVA: 0x000EB686 File Offset: 0x000E9886
10 public override float extFixY
11 {
12 get
13 {
14 return 10f;
15 }
16 }
17
18 // Token: 0x060029BD RID: 10685 RVA: 0x000EB690 File Offset: 0x000E9890
19 public override void RefreshItem()
20 {
21 HotItem item = this.item as HotItem;
22 bool flag = item != null;
23 this.instantClick = !this.widget.hotbar.IsUserHotbar;
24 base.onClick.RemoveAllListeners();
25 this.dragParent = ((flag && this.widget.CanRegisterItem) ? this.widget : null);
26 this.icon.enabled = flag;
27 base.interactable = (flag || this.widget.CanRegisterItem || !this.widget.IsSealed);
28 if (flag && item.Hidden)
29 {
30 this.icon.enabled = false;
31 base.interactable = false;
32 }
33 this.mainText.SetActive(this.widget.extra.showShortcut);
34 base.image.sprite = Core.Instance.refs.spritesHighlight[0];
35 HotItem item2 = item;
36 base.transition = ((item2 != null) ? item2.Transition : Selectable.Transition.SpriteSwap);
37 if (flag)
38 {
39 item.button = this;
40 item.hotbar = this.widget.hotbar;
41 base.onClick.AddListener(delegate()
42 {
43 if (EClass.ui.BlockInput)
44 {
45 SE.BeepSmall();
46 return;
47 }
48 if (WidgetHotbar.registering)
49 {
50 this.RegisterHotbar();
51 return;
52 }
53 if (!this.widget.Visible)
54 {
55 this.widget.ToggleVisible();
56 }
57 UIButton.buttonPos = this.transform.position;
58 item.OnClick(this, this.widget.hotbar);
59 EInput.Consume(0);
60 });
61 this.onRightClick = delegate()
62 {
63 item.OnRightClick(this);
64 };
65 this.tooltip.enable = !item.TextTip.IsEmpty();
66 this.tooltip.offset = new Vector3(0f, (float)((this.widget.transform.position.y < 200f) ? 70 : -20), 0f);
67 this.tooltip.onShowTooltip = delegate(UITooltip t)
68 {
69 string textTip = item.TextTip;
70 t.textMain.text = textTip;
71 };
72 this.icon.material = (item.UseUIObjMaterial ? EClass.core.refs.matUIObj : null);
73 item.SetImage(this.icon);
74 this.Refresh();
75 return;
76 }
77 this.subText.SetActive(false);
78 this.tooltip.enable = false;
79 base.onClick.AddListener(delegate()
80 {
81 if (EClass.ui.BlockInput)
82 {
83 SE.BeepSmall();
84 return;
85 }
86 if (WidgetHotbar.registering)
87 {
88 this.RegisterHotbar();
89 return;
90 }
91 this.widget.OnClickEmptyItem(this);
92 });
93 this.onRightClick = null;
94 }
95
96 // Token: 0x060029BE RID: 10686 RVA: 0x000EB8EC File Offset: 0x000E9AEC
97 public void Refresh()
98 {
99 if (this.item == null)
100 {
101 return;
102 }
103 HotItem hotItem = this.item as HotItem;
104 hotItem.SetSubText(this.subText);
105 if (hotItem.Thing != null)
106 {
107 this.card = hotItem.Thing;
108 }
109 }
110
111 // Token: 0x060029BF RID: 10687 RVA: 0x000EB92E File Offset: 0x000E9B2E
112 public void RegisterHotbar()
113 {
114 SE.SelectHotitem();
115 this.widget.SetItem(this, WidgetHotbar.registeringItem);
116 Core.Instance.ui.RemoveLayer<LayerRegisterHotbar>();
117 }
118
119 // Token: 0x060029C0 RID: 10688 RVA: 0x000EB956 File Offset: 0x000E9B56
120 public override void OnHover()
121 {
122 if (WidgetHotbar.registering)
123 {
124 return;
125 }
126 base.OnHover();
127 }
128
129 // Token: 0x04001799 RID: 6041
130 [NonSerialized]
131 public new int index;
132
133 // Token: 0x0400179A RID: 6042
134 public WidgetHotbar widget;
135}