Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
WidgetMenuPanel.cs
Go to the documentation of this file.
1using System;
2using UnityEngine;
3using UnityEngine.UI;
4
6{
7 public class Extra
8 {
9 }
10
12
13 public LayoutGroup layout;
14
15 public LayoutGroup layout2;
16
17 public UIButton mold;
18
19 public RawImage imageGrid;
20
21 public int maxWidth;
22
23 public int marginLeft;
24
25 public int marginRight;
26
27 [NonSerialized]
29
30 [NonSerialized]
32
33 [NonSerialized]
35
36 [NonSerialized]
38
39 public Extra extra => base.config.extra as Extra;
40
41 private bool allMenu => EMono.debug.allMenu;
42
43 public override object CreateExtra()
44 {
45 return new Extra();
46 }
47
48 public override void OnActivate()
49 {
50 Instance = this;
51 mold.skinRoot = GetComponent<SkinRoot>();
52 Build();
53 }
54
55 public static void OnChangeMode()
56 {
57 if ((bool)Instance)
58 {
60 }
61 }
62
63 public void _OnChangeMode()
64 {
65 if ((bool)Instance && !(Instance == null))
66 {
68 int num = ((EMono._zone.mainFaction == EMono.pc.faction) ? 2 : 0) + (EMono._zone.CanEnterBuildModeAnywhere ? 1 : 0);
69 imageGrid.uvRect = new Rect(1f, 1f, num, 1f);
70 }
71 }
72
73 public override void OnChangeResolution()
74 {
75 base.OnChangeResolution();
76 }
77
78 public void FixSize()
79 {
80 }
81
82 public void Build()
83 {
84 layout.DestroyChildren();
85 layout2.DestroyChildren();
86 buttonBuild = AddButton(layout, "Inspect", delegate
87 {
88 if (EMono.ui.BlockInput)
89 {
90 SE.BeepSmall();
91 }
92 else
93 {
94 EMono.player.hotbars.ResetHotbar(3);
95 EMono.player.hotbars.bars[3].dirty = true;
96 EMono.player.hotbars.ResetHotbar(4);
97 EMono.player.hotbars.bars[4].dirty = true;
98 ActionMode.Inspect.Activate();
99 }
100 });
102 this.RebuildLayout(recursive: true);
103 }
104
105 public UIButton AddButton(LayoutGroup _layout, string id, Action action, bool enableSubtext = false)
106 {
107 UIButton uIButton = Util.Instantiate(mold, _layout);
108 uIButton.icon.sprite = SpriteSheet.Get("icon_" + id);
109 uIButton.subText.SetActive(enableSubtext);
110 uIButton.tooltip.text = id.lang();
111 if (action != null)
112 {
113 uIButton.onClick.AddListener(delegate
114 {
115 action();
116 });
117 }
118 return uIButton;
119 }
120
121 public override void OnSetContextMenu(UIContextMenu m)
122 {
123 UIContextMenu uIContextMenu = m.AddChild("style");
124 uIContextMenu.AddSlider("toggleButtonBG", (float a) => a.ToString() ?? "", base.config.skin.button, delegate(float a)
125 {
126 base.config.skin.button = (int)a;
127 ApplySkin();
128 }, 0f, base.config.skin.Skin.buttons.Count - 1, isInt: true);
129 SetGridContextMenu(uIContextMenu);
131 }
132}
Faction faction
Definition: Chara.cs:412
bool allMenu
Definition: CoreDebug.cs:234
Definition: EMono.cs:4
static Chara pc
Definition: EMono.cs:13
static Zone _zone
Definition: EMono.cs:19
static UI ui
Definition: EMono.cs:15
static CoreDebug debug
Definition: EMono.cs:45
static Sprite Get(string id)
Definition: SpriteSheet.cs:28
UIText subText
Definition: UIButton.cs:104
UIContextMenuItem AddSlider(string text, Func< float, string > textFunc, float value, Action< float > action, float min=0f, float max=1f, bool isInt=false, bool hideOther=true, bool useInput=false)
UIContextMenu AddChild(string idLang, TextAnchor anchor)
string lang
Definition: UIText.cs:9
static WidgetMenuPanel Instance
UIButton buttonPeople
LayoutGroup layout
override object CreateExtra()
UIButton buttonBuild
override void OnActivate()
LayoutGroup layout2
UIButton AddButton(LayoutGroup _layout, string id, Action action, bool enableSubtext=false)
static void OnChangeMode()
override void OnSetContextMenu(UIContextMenu m)
override void OnChangeResolution()
UIButton buttonGlobalMap
Definition: Widget.cs:7
virtual void ApplySkin()
Definition: Widget.cs:556
void SetBaseContextMenu(UIContextMenu m)
Definition: Widget.cs:608
void SetGridContextMenu(UIContextMenu m)
Definition: Widget.cs:709
bool CanEnterBuildModeAnywhere
Definition: Zone.cs:449