Elin Modding Docs Doc
Loading...
Searching...
No Matches
UIHangIcon.cs
1using System;
2using UnityEngine;
3using UnityEngine.Events;
4using UnityEngine.UI;
5
6// Token: 0x0200051F RID: 1311
7public class UIHangIcon : EMono
8{
9 // Token: 0x06002320 RID: 8992 RVA: 0x000C5C94 File Offset: 0x000C3E94
10 private void Awake()
11 {
12 if (!this.image && this.button)
13 {
14 this.image = this.button.image;
15 }
16 this.original = this.image.sprite;
17 if (this.button && !this.rightClick)
18 {
19 this.button.onClick.AddListener(new UnityAction(this.OnClick));
20 }
21 this.Refresh();
22 }
23
24 // Token: 0x06002321 RID: 8993 RVA: 0x000C5D14 File Offset: 0x000C3F14
25 public void OnClickCorner()
26 {
27 SE.Play("Ambience/Random/windchime1");
28 }
29
30 // Token: 0x06002322 RID: 8994 RVA: 0x000C5D20 File Offset: 0x000C3F20
31 public void OnClick()
32 {
33 if (!EMono.core.IsGameStarted)
34 {
35 return;
36 }
37 ActionMode.DefaultMode.Activate(true, false);
38 if (EMono.ui.contextMenu.isActive)
39 {
40 EMono.ui.contextMenu.currentMenu.Hide();
41 EInput.rightMouse.Consume();
42 }
43 LayerCollectible layerCollectible = EMono.ui.ToggleLayer<LayerCollectible>(null);
44 if (layerCollectible == null)
45 {
46 return;
47 }
48 EMono.ui.hud.hint.Show("h_hang", true);
49 layerCollectible.onClick = delegate(Hoard.Item a)
50 {
51 EMono.player.hangIcons[this.id] = a.id;
52 if (this != null && base.gameObject != null)
53 {
54 this.Refresh();
55 }
56 return true;
57 };
58 }
59
60 // Token: 0x06002323 RID: 8995 RVA: 0x000C5DB8 File Offset: 0x000C3FB8
61 public void Refresh()
62 {
63 if (!Core.Instance)
64 {
65 return;
66 }
67 if (!EMono.core.IsGameStarted || (this.windowCorner && !EMono.core.config.ui.cornerHoard))
68 {
69 this.image.sprite = (UIHangIcon.lastCorner = EMono.core.refs.spritesCorner.NextItem(UIHangIcon.lastCorner));
70 }
71 else
72 {
73 string text;
74 if (!this.windowCorner)
75 {
76 text = EMono.player.hangIcons.TryGetValue(this.id, null);
77 }
78 else
79 {
80 Hoard.Item item = EMono.player.hoard.items.RandomItem<string, Hoard.Item>();
81 text = ((item != null) ? item.id : null);
82 }
83 string str = text;
84 if (!str.IsEmpty())
85 {
86 this.image.sprite = EMono.player.hoard.GetSprite(str);
87 }
88 }
89 this.image.SetNativeSize();
90 }
91
92 // Token: 0x040012AB RID: 4779
93 public Image image;
94
95 // Token: 0x040012AC RID: 4780
96 public UIButton button;
97
98 // Token: 0x040012AD RID: 4781
99 public string id;
100
101 // Token: 0x040012AE RID: 4782
102 public bool rightClick;
103
104 // Token: 0x040012AF RID: 4783
105 public bool windowCorner;
106
107 // Token: 0x040012B0 RID: 4784
108 private Sprite original;
109
110 // Token: 0x040012B1 RID: 4785
111 public static Sprite lastCorner;
112}
Definition EMono.cs:6
Definition Hoard.cs:10