Elin Decompiled Documentation EA 23.102 Nightly
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Pages
LayerInfo.cs
Go to the documentation of this file.
1using UnityEngine;
2
3public class LayerInfo : ELayer
4{
6
7 public UINote note;
8
9 public bool examine;
10
11 public Vector2 size;
12
13 public Vector2 padding;
14
15 public override void OnAfterInit()
16 {
17 base.OnAfterInit();
18 TooltipManager.Instance.HideTooltips(immediate: true);
19 }
20
21 public void SetElement(Element e)
22 {
23 windows[0].SetCaption(e.Name);
25 }
26
27 public void Set(object o, bool _examine = false)
28 {
29 if (o is Thing)
30 {
31 SetThing(o as Thing, _examine);
32 }
33 }
34
35 public void Resize()
36 {
37 windows[0].Rect().sizeDelta = new Vector2(Mathf.Max(info.Rect().sizeDelta.x + padding.x, size.x), size.y);
38 }
39
40 public void SetThing(Thing t, bool _examine = false)
41 {
42 examine = _examine;
43 windows[0].SetCaption(t.NameSimple.ToTitleCase());
44 info.SetThing(t);
45 Resize();
46 }
47
48 public void SetBlock(Cell cell)
49 {
50 windows[0].SetCaption(cell.GetBlockName());
51 info.SetBlock(cell);
52 Resize();
53 }
54
55 public void SetFloor(Cell cell)
56 {
57 windows[0].SetCaption(cell.GetFloorName());
58 info.SetFloor(cell);
59 Resize();
60 }
61
62 public void SetLiquid(Cell cell)
63 {
64 windows[0].SetCaption(cell.GetLiquidName());
65 info.SetLiquid(cell);
66 Resize();
67 }
68
69 public void SetZone(Zone z)
70 {
71 note.Clear();
73 note.AddText(z.source.GetDetail());
74 note.Build();
75 Resize();
76 }
77
78 public void SetObj(Cell cell)
79 {
80 windows[0].SetCaption(cell.sourceObj.GetName());
81 info.SetObj(cell);
82 Resize();
83 }
84
85 public override void OnKill()
86 {
87 base.OnKill();
88 TweenUtil.Tween(0.2f, delegate
89 {
90 UIButton.TryShowTip<UIButton>(null, highlight: true, ignoreWhenRightClick: false);
91 });
92 }
93
94 public override void OnUpdateInput()
95 {
96 base.OnUpdateInput();
98 {
99 if (!Input.GetKey(EInput.keys.examine.key))
100 {
101 Close();
102 }
103 }
104 else if (Input.GetKeyDown(EInput.keys.examine.key))
105 {
106 Close();
107 }
108 }
109}
string NameSimple
Definition: Card.cs:2015
Definition: Cell.cs:7
string GetFloorName()
Definition: Cell.cs:1590
SourceObj.Row sourceObj
Definition: Cell.cs:1072
string GetBlockName()
Definition: Cell.cs:1585
string GetLiquidName()
Definition: Cell.cs:1644
InputSetting input
Definition: CoreConfig.cs:602
CoreConfig config
Definition: Core.cs:70
KeyCode key
Definition: EInput.cs:14
Definition: EInput.cs:8
static KeyMapManager keys
Definition: EInput.cs:367
Definition: ELayer.cs:4
static Core core
Definition: ELayer.cs:7
virtual string Name
Definition: ELEMENT.cs:294
void SetObj(Cell cell)
Definition: LayerInfo.cs:78
Vector2 size
Definition: LayerInfo.cs:11
void Set(object o, bool _examine=false)
Definition: LayerInfo.cs:27
UICardInfo info
Definition: LayerInfo.cs:5
void SetLiquid(Cell cell)
Definition: LayerInfo.cs:62
override void OnKill()
Definition: LayerInfo.cs:85
override void OnAfterInit()
Definition: LayerInfo.cs:15
bool examine
Definition: LayerInfo.cs:9
Vector2 padding
Definition: LayerInfo.cs:13
void Resize()
Definition: LayerInfo.cs:35
override void OnUpdateInput()
Definition: LayerInfo.cs:94
void SetElement(Element e)
Definition: LayerInfo.cs:21
void SetZone(Zone z)
Definition: LayerInfo.cs:69
void SetFloor(Cell cell)
Definition: LayerInfo.cs:55
void SetBlock(Cell cell)
Definition: LayerInfo.cs:48
void SetThing(Thing t, bool _examine=false)
Definition: LayerInfo.cs:40
UINote note
Definition: LayerInfo.cs:7
List< Window > windows
Definition: Layer.cs:116
virtual void Close()
Definition: Layer.cs:463
string GetName(int id)
Definition: SourceObj.cs:149
virtual string Name
Definition: Spatial.cs:495
SourceZone.Row source
Definition: Spatial.cs:441
Definition: Thing.cs:8
static TooltipManager Instance
void HideTooltips(bool immediate=false)
static void TryShowTip(Transform root=null, bool highlight=true, bool ignoreWhenRightClick=true)
Definition: UIButton.cs:778
void SetLiquid(Cell cell)
Definition: UICardInfo.cs:84
void SetObj(Cell cell)
Definition: UICardInfo.cs:94
void SetFloor(Cell cell)
Definition: UICardInfo.cs:74
void SetThing(Thing t)
Definition: UICardInfo.cs:39
void SetElement(Element e)
Definition: UICardInfo.cs:34
void SetBlock(Cell cell)
Definition: UICardInfo.cs:64
Definition: UINote.cs:6
void Clear()
Definition: UINote.cs:35
UIItem AddHeader(string text, Sprite sprite=null)
Definition: UINote.cs:79
UIItem AddText(string text, FontColor color=FontColor.DontChange)
Definition: UINote.cs:113
void Build()
Definition: UINote.cs:49
Definition: Zone.cs:12