10 public override void OnInit()
12 UIItem t = this.layoutColors.CreateMold(
null);
13 for (
int i = 0; i < 8; i++)
15 UIItem item = Util.Instantiate<UIItem>(t, this.layoutColors);
17 item.button1.icon.color = IntColor.FromInt(
ELayer.core.config.colors[_i]);
18 item.button1.SetOnClick(delegate
20 this.picker.SelectColor(item.button1.icon.color);
22 item.button2.SetOnClick(delegate
24 item.button1.icon.color = this.picker.SelectedColor;
25 ELayer.core.config.colors[_i] = IntColor.ToInt(this.picker.SelectedColor);
29 this.layoutColors.RebuildLayout(
false);
30 this.windows[0].AddBottomButton(
"apply", delegate
32 Action action = this.onApply;
39 this.windows[0].AddBottomButton(
"cancel", delegate
49 this.onApply = delegate()
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();
61 if (c.owner.c_textureData !=
null)
63 this.paint.tex.LoadImage(c.owner.c_textureData);
65 this.paint.imageMask.texture = c.owner.GetSprite(0).texture;
66 this.paint.imageMask.SetNativeSize();
67 this.paint.imagePreview.SetNativeSize();
71 public PixelPaint paint;
74 public GridLayoutGroup layoutColors;
77 public ColorPicker picker;
80 public Action onApply;