Elin Modding Docs Doc
Loading...
Searching...
No Matches
LayerPixelPaint.cs
1using System;
2using Empyrean.ColorPicker;
3using UnityEngine;
4using UnityEngine.UI;
5
6// Token: 0x020005B3 RID: 1459
7public class LayerPixelPaint : ELayer
8{
9 // Token: 0x06002804 RID: 10244 RVA: 0x000E1F60 File Offset: 0x000E0160
10 public override void OnInit()
11 {
12 UIItem t = this.layoutColors.CreateMold(null);
13 for (int i = 0; i < 8; i++)
14 {
15 UIItem item = Util.Instantiate<UIItem>(t, this.layoutColors);
16 int _i = i;
17 item.button1.icon.color = IntColor.FromInt(ELayer.core.config.colors[_i]);
18 item.button1.SetOnClick(delegate
19 {
20 this.picker.SelectColor(item.button1.icon.color);
21 });
22 item.button2.SetOnClick(delegate
23 {
24 item.button1.icon.color = this.picker.SelectedColor;
25 ELayer.core.config.colors[_i] = IntColor.ToInt(this.picker.SelectedColor);
26 SE.Tab();
27 });
28 }
29 this.layoutColors.RebuildLayout(false);
30 this.windows[0].AddBottomButton("apply", delegate
31 {
32 Action action = this.onApply;
33 if (action == null)
34 {
35 return;
36 }
37 action();
38 }, false);
39 this.windows[0].AddBottomButton("cancel", delegate
40 {
41 this.Close();
42 }, false);
43 this.paint.Init();
44 }
45
46 // Token: 0x06002805 RID: 10245 RVA: 0x000E2080 File Offset: 0x000E0280
47 public void SetCanvas(TraitCanvas c)
48 {
49 this.onApply = delegate()
50 {
51 c.owner.PlaySound(c.owner.material.GetSoundImpact(null), 1f, true);
52 c.owner.renderer.PlayAnime(AnimeID.Shiver, default(Vector3), false);
53 Thing thing = c.owner.Split(1);
54 thing.c_textureData = this.paint.tex.EncodeToPNG();
55 thing.isModified = true;
56 thing.ClearPaintSprite();
57 thing.GetPaintSprite();
58 thing.renderer.RefreshSprite();
59 this.Close();
60 };
61 if (c.owner.c_textureData != null)
62 {
63 this.paint.tex.LoadImage(c.owner.c_textureData);
64 }
65 this.paint.imageMask.texture = c.owner.GetSprite(0).texture;
66 this.paint.imageMask.SetNativeSize();
67 this.paint.imagePreview.SetNativeSize();
68 }
69
70 // Token: 0x0400162A RID: 5674
71 public PixelPaint paint;
72
73 // Token: 0x0400162B RID: 5675
74 public GridLayoutGroup layoutColors;
75
76 // Token: 0x0400162C RID: 5676
77 public ColorPicker picker;
78
79 // Token: 0x0400162D RID: 5677
80 public Action onApply;
81}
Definition Thing.cs:10