Elin Modding Docs Doc
Loading...
Searching...
No Matches
WidgetSideScreen.cs
1using System;
2using UnityEngine;
3using UnityEngine.UI;
4
5// Token: 0x02000638 RID: 1592
6public class WidgetSideScreen : Widget
7{
8 // Token: 0x06002CA7 RID: 11431 RVA: 0x000FA855 File Offset: 0x000F8A55
9 public override object CreateExtra()
10 {
11 return new WidgetSideScreen.Extra();
12 }
13
14 // Token: 0x17000CAC RID: 3244
15 // (get) Token: 0x06002CA8 RID: 11432 RVA: 0x000FA85C File Offset: 0x000F8A5C
16 public override bool AlwaysBottom
17 {
18 get
19 {
20 return true;
21 }
22 }
23
24 // Token: 0x17000CAD RID: 3245
25 // (get) Token: 0x06002CA9 RID: 11433 RVA: 0x000FA85F File Offset: 0x000F8A5F
26 public WidgetSideScreen.Extra extra
27 {
28 get
29 {
30 return base.config.extra as WidgetSideScreen.Extra;
31 }
32 }
33
34 // Token: 0x17000CAE RID: 3246
35 // (get) Token: 0x06002CAA RID: 11434 RVA: 0x000FA871 File Offset: 0x000F8A71
36 // (set) Token: 0x06002CAB RID: 11435 RVA: 0x000FA888 File Offset: 0x000F8A88
37 public Color bgColor
38 {
39 get
40 {
41 return IntColor.FromInt(this.extra.bgColor);
42 }
43 set
44 {
45 this.extra.bgColor = IntColor.ToInt(ref value);
46 }
47 }
48
49 // Token: 0x06002CAC RID: 11436 RVA: 0x000FA89C File Offset: 0x000F8A9C
50 public override void OnActivate()
51 {
52 this.Refresh();
53 this.OnChangeResolution();
54 }
55
56 // Token: 0x06002CAD RID: 11437 RVA: 0x000FA8AC File Offset: 0x000F8AAC
57 public override void OnSetContextMenu(UIContextMenu m)
58 {
59 SkinConfig skin = base.config.skin;
60 UIContextMenu uicontextMenu = m.AddChild("setting");
61 uicontextMenu.AddToggle("reverse", this.extra.reverse, delegate(bool a)
62 {
63 this.extra.reverse = !this.extra.reverse;
64 this.OnChangeResolution();
65 });
66 uicontextMenu.AddSlider("width", (float a) => a.ToString() ?? "", (float)this.extra.width, delegate(float a)
67 {
68 this.extra.width = (int)a;
69 this.OnChangeResolution();
70 }, 10f, 50f, true, true, false);
71 uicontextMenu.AddSlider("image", (float a) => a.ToString() ?? "", (float)this.extra.idImage, delegate(float a)
72 {
73 this.extra.idImage = (int)a;
74 this.OnChangeResolution();
75 }, 0f, (float)(this.sprites.Length - 1), true, true, false);
76 uicontextMenu.AddButton("colorBG", delegate()
77 {
78 EMono.ui.AddLayer<LayerColorPicker>().SetColor(this.bgColor, Color.white, delegate(PickerState state, Color _c)
79 {
80 this.bgColor = _c;
81 this.OnChangeResolution();
82 });
83 }, true);
84 base.SetBaseContextMenu(m);
85 }
86
87 // Token: 0x06002CAE RID: 11438 RVA: 0x000FA9B8 File Offset: 0x000F8BB8
88 public void Refresh()
89 {
90 EMono.scene.cam.rect = (this.extra.reverse ? new Rect(0.01f * (float)this.extra.width, 0f, 1f + 0.01f * (float)this.extra.width, 1f) : new Rect(-0.01f * (float)this.extra.width, 0f, 1f, 1f));
91 }
92
93 // Token: 0x06002CAF RID: 11439 RVA: 0x000FAA44 File Offset: 0x000F8C44
94 public override void OnChangeResolution()
95 {
96 base.OnChangeResolution();
97 RectTransform rectTransform = this.Rect();
98 float x = 0.01f * (float)Screen.width * (float)this.extra.width / EMono.core.uiScale + 50f;
99 float num = (float)Screen.height / EMono.core.uiScale + 50f;
100 rectTransform.sizeDelta = new Vector2(x, num);
101 if (this.extra.reverse)
102 {
103 rectTransform.SetAnchor(0f, 0.5f, 0f, 0.5f);
104 rectTransform.anchoredPosition = new Vector2(rectTransform.sizeDelta.x * 0.5f, 0f);
105 }
106 else
107 {
108 rectTransform.SetAnchor(1f, 0.5f, 1f, 0.5f);
109 rectTransform.anchoredPosition = new Vector2(rectTransform.sizeDelta.x * -0.5f, 0f);
110 }
111 this.Refresh();
112 this.imagePic.SetActive(this.extra.idImage > 0);
113 Sprite sprite = this.sprites[this.extra.idImage];
114 if (sprite)
115 {
116 this.imagePic.sprite = sprite;
117 this.imagePic.rectTransform.sizeDelta = new Vector2(num * (float)sprite.texture.width / (float)sprite.texture.height, num);
118 this.imagePic.color = this.bgColor;
119 }
120 }
121
122 // Token: 0x06002CB0 RID: 11440 RVA: 0x000FABBB File Offset: 0x000F8DBB
123 private void OnEnable()
124 {
125 this.Refresh();
126 }
127
128 // Token: 0x06002CB1 RID: 11441 RVA: 0x000FABC3 File Offset: 0x000F8DC3
129 private void OnDisable()
130 {
131 EMono.scene.cam.rect = new Rect(0f, 0f, 1f, 1f);
132 }
133
134 // Token: 0x0400190D RID: 6413
135 public Sprite[] sprites;
136
137 // Token: 0x0400190E RID: 6414
138 public Image imagePic;
139
140 // Token: 0x02000BA9 RID: 2985
141 public class Extra
142 {
143 // Token: 0x04002EAD RID: 11949
144 public int width;
145
146 // Token: 0x04002EAE RID: 11950
147 public int height;
148
149 // Token: 0x04002EAF RID: 11951
150 public int idImage;
151
152 // Token: 0x04002EB0 RID: 11952
153 public int bgColor;
154
155 // Token: 0x04002EB1 RID: 11953
156 public bool reverse;
157 }
158}
Definition EMono.cs:6