Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
UIImage.cs
Go to the documentation of this file.
1using UnityEngine;
2using UnityEngine.UI;
3
4public class UIImage : Image, IUISkin
5{
6 public bool useSkinSize = true;
7
9
11
13
14 public Vector2 sizeFix;
15
16 public Image frame;
17
18 protected override void Awake()
19 {
20 ApplySkin();
21 base.Awake();
22 }
23
24 public void ApplySkin()
25 {
26 if (!Application.isPlaying)
27 {
28 return;
29 }
31 baseSkinRoot.ApplySkin(this);
32 if (imageType == ImageType.Line)
33 {
34 color = baseSkinRoot.Colors.colorLine;
35 }
36 if (frameType != 0)
37 {
38 if (!frame)
39 {
40 frame = Util.Instantiate<Image>("UI/Element/Other/BGFrame", this);
41 frame.transform.SetParent(base.transform.parent, worldPositionStays: false);
42 frame.transform.SetSiblingIndex(base.transform.GetSiblingIndex());
43 }
44 SkinRootStatic skinRootStatic = baseSkinRoot as SkinRootStatic;
45 if ((bool)skinRootStatic && skinRootStatic.useFrame)
46 {
47 frame.sprite = skinRootStatic.assets.frame1.sprite;
48 if (useSkinSize)
49 {
50 frame.Rect().sizeDelta = skinRootStatic.assets.frame1.size;
51 }
52 frame.SetActive(enable: true);
53 }
54 else
55 {
56 frame.SetActive(enable: false);
57 }
58 }
59 else if ((bool)frame)
60 {
61 frame.SetActive(enable: false);
62 }
63 }
64
65 protected override void OnPopulateMesh(VertexHelper vh)
66 {
67 if (color.a == 0f || !base.sprite)
68 {
69 vh.Clear();
70 }
71 else
72 {
73 base.OnPopulateMesh(vh);
74 }
75 }
76}
FrameType
Definition: FrameType.cs:2
ImageType
Definition: ImageType.cs:2
virtual void ApplySkin(UIImage t)
Definition: BaseSkinRoot.cs:16
virtual SkinColorProfile Colors
Definition: BaseSkinRoot.cs:7
SkinRootStatic currentSkin
Definition: SkinManager.cs:53
static SkinManager Instance
Definition: SkinManager.cs:78
void ApplySkin()
Definition: UIImage.cs:24
FrameType frameType
Definition: UIImage.cs:10
bool useSkinSize
Definition: UIImage.cs:6
BaseSkinRoot skinRoot
Definition: UIImage.cs:12
Image frame
Definition: UIImage.cs:16
ImageType imageType
Definition: UIImage.cs:8
Vector2 sizeFix
Definition: UIImage.cs:14
override void Awake()
Definition: UIImage.cs:18
override void OnPopulateMesh(VertexHelper vh)
Definition: UIImage.cs:65