Elin Decompiled Documentation EA 23.300 Nightly
Loading...
Searching...
No Matches
UIItemPCCPart.cs
Go to the documentation of this file.
1using System;
2using UnityEngine;
3using UnityEngine.UI;
4
5public class UIItemPCCPart : EMono
6{
8
10
11 [NonSerialized]
12 public Sprite[] sprites = new Sprite[16];
13
14 private bool _init;
15
16 public void SetSpriteIndex(int dir, int frame)
17 {
18 if (_init)
19 {
20 button.icon.sprite = sprites[dir * 4 + frame];
21 }
22 }
23
24 public void SetSprites(Texture2D texture)
25 {
26 int num = texture.width / 4;
27 int num2 = texture.height / 4;
28 for (int i = 0; i < 4; i++)
29 {
30 for (int j = 0; j < 4; j++)
31 {
32 int num3 = j * num;
33 int num4 = (3 - i) * num2;
34 Rect rect = new Rect(num3, num4, num, num2);
35 sprites[i * 4 + j] = Sprite.Create(texture, rect, new Vector2(0.5f, 0.5f), 100f, 0u, SpriteMeshType.FullRect);
36 }
37 }
38 _init = true;
39 }
40}
Definition: EMono.cs:4
ButtonGeneral button
Definition: UIItemPCCPart.cs:7
void SetSprites(Texture2D texture)
Outline outline
Definition: UIItemPCCPart.cs:9
Sprite[] sprites
void SetSpriteIndex(int dir, int frame)