Elin Decompiled Documentation EA 23.307 Stable
Loading...
Searching...
No Matches
LayerPixelPaint Class Reference
Inheritance diagram for LayerPixelPaint:
ELayer Layer IUISkin

Public Member Functions

void SetCanvas (TraitCanvas c)
 
void InitPaint ()
 
void DialogLoad (Action onLoad=null)
 
- Public Member Functions inherited from ELayer
override void OnBeforeAddLayer ()
 
void InitInspector ()
 
sealed override void Init ()
 
override void OnAfterAddLayer ()
 
void TryShowHelp ()
 
void AddLayerToUI (string id)
 
void TryShowHint (string _langHint=null)
 
void TalkHomeMemeber (string id)
 
void TalkMaid (string id)
 
override void OnRightClick ()
 
- Public Member Functions inherited from Layer
virtual string GetTextHeader (Window window)
 
virtual bool HeaderIsListOf (int id)
 
virtual void Init ()
 
virtual void OnInit ()
 
virtual void OnAfterInit ()
 
virtual void ApplySkin ()
 
void ShowScreenLock (string id)
 
void UpdateInput ()
 
virtual void OnUpdateInput ()
 
virtual void OnRightClick ()
 
virtual bool OnBack ()
 
virtual void OnChangeLayer ()
 
virtual void OnCreate ()
 
void _AddLayer (string id)
 
Layer AddLayer (string id)
 
AddLayer< T > ()
 
AddLayer< T > (string id)
 
AddLayerDontCloseOthers< T > ()
 
Layer AddLayerDontCloseOthers (Layer l)
 
GetOrAddLayer< T > ()
 
virtual void OnBeforeAddLayer ()
 
virtual void OnAfterAddLayer ()
 
Layer AddLayer (Layer l)
 
void ToggleLayer (string id)
 
ToggleLayer< T > (string id=null)
 
void WaitAndClose ()
 
void OnClickClose ()
 
virtual void Close ()
 
void CloseLayers ()
 
void RemoveLayers (bool removeImportant=false)
 
bool RemoveLayer< T > ()
 
void RemoveLayer (Layer l)
 
virtual void OnKill ()
 
Layer SetOnKill (Action action)
 
void DisableClose ()
 
void Delay (float duration=0.05f)
 
Layer SetDelay (float d)
 
Layer GetLayer (string id)
 
GetLayer< T > (bool fromTop=false)
 
Layer GetTopLayer ()
 
void SwitchContent (int idWindow, int i)
 
virtual void OnSwitchContent (Window window)
 
Layer SetTitles (string langList, string idHeaderRow=null)
 
bool IsBlockWidgetClick ()
 
bool IsHideHud ()
 
bool IsAllowGeneralInput ()
 
bool IsUseBlur ()
 
bool IsPointerOnLayer ()
 
void ApplySkin ()
 

Public Attributes

PixelPaint paint
 
GridLayoutGroup layoutColors
 
ColorPicker picker
 
Action onApply
 
- Public Attributes inherited from Layer
Option option
 
UnityEvent onKill
 
Anime animeIn
 
Anime animeOut
 
bool closeOthers
 
bool defaultActionMode = true
 
Button screenLock
 
Layer parent
 
string idLayer
 
List< Layerlayers = new List<Layer>()
 
Vector2 lastParentPos
 
List< Windowwindows = new List<Window>()
 
string langHint
 

Private Member Functions

void Update ()
 

Additional Inherited Members

- Static Public Member Functions inherited from ELayer
static int rnd (int a)
 
- Static Public Member Functions inherited from Layer
static T Create< T > ()
 
static T Create< T > (string path)
 
static Layer Create (string path)
 
- Static Public Attributes inherited from Layer
static int skipInput
 
static bool closeOnRightClick
 
static bool rightClicked
 
static bool cancelKeyDown
 
static bool ignoreSounds
 
static Transform blurStopInstance
 
static string[] searchPath = new string[3] { "Layer", "Layer/Dialog", "Layer/LayerHome" }
 
- Protected Member Functions inherited from ELayer
sealed override void _Close ()
 
sealed override void Kill ()
 
- Protected Member Functions inherited from Layer
virtual void Awake ()
 
virtual void _Close ()
 
virtual void Kill ()
 
- Protected Attributes inherited from Layer
RectTransform _rect
 
bool isDestroyed
 
- Properties inherited from ELayer
static Core core [get]
 
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static FactionBranch Branch [get]
 
static Faction Home [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static CoreConfig config [get]
 
static GameSetting setting [get]
 
static ColorProfile Colors [get]
 
static SourceManager sources [get]
 
static World world [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 
bool IsFloat [get]
 
virtual string IdHelp [get]
 
- Properties inherited from Layer
Layer TopLayer [get]
 
string uid [get]
 
virtual RectTransform rectLayers [get]
 
virtual bool blockWidgetClick [get]
 

Detailed Description

Definition at line 7 of file LayerPixelPaint.cs.

Member Function Documentation

◆ DialogLoad()

void LayerPixelPaint.DialogLoad ( Action  onLoad = null)
inline

Definition at line 88 of file LayerPixelPaint.cs.

89 {
91 {
92 string[] array = StandaloneFileBrowser.OpenFilePanel("Load PNG Image", CorePath.CustomDrawing, "png", multiselect: false);
93 if (array.Length != 0)
94 {
95 Texture2D texture2D = IO.LoadPNG(array[0]);
96 if (texture2D != null)
97 {
98 int num = (paint.size.x - texture2D.width) / 2;
99 int num2 = (paint.size.y - texture2D.height) / 2;
100 if (num < 0)
101 {
102 num = 0;
103 }
104 if (num2 < 0)
105 {
106 num2 = 0;
107 }
108 for (int i = 0; i < texture2D.height && i < paint.size.y; i++)
109 {
110 for (int j = 0; j < texture2D.width && j < paint.size.x; j++)
111 {
112 paint.tex.SetPixel(num + j, num2 + i, texture2D.GetPixel(j, i));
113 }
114 }
115 paint.tex.Apply();
116 SE.Change();
117 UnityEngine.Object.Destroy(texture2D);
118 }
119 }
120 });
121 }
void WaitForEndOfFrame(Action action)
Definition: BaseCore.cs:61
static string CustomDrawing
Definition: CorePath.cs:210
Definition: ELayer.cs:4
static Core core
Definition: ELayer.cs:7
static string[] OpenFilePanel(string title, string directory, string extension, bool multiselect)

References ELayer.core, CorePath.CustomDrawing, SFB.StandaloneFileBrowser.OpenFilePanel(), and BaseCore.WaitForEndOfFrame().

Referenced by InitPaint().

◆ InitPaint()

void LayerPixelPaint.InitPaint ( )
inline

Definition at line 51 of file LayerPixelPaint.cs.

52 {
53 UIItem t = layoutColors.CreateMold<UIItem>();
54 for (int i = 0; i < 8; i++)
55 {
57 int _i = i;
58 item.button1.icon.color = IntColor.FromInt(ELayer.core.config.colors[_i]);
59 item.button1.SetOnClick(delegate
60 {
61 picker.SelectColor(item.button1.icon.color);
62 });
63 item.button2.SetOnClick(delegate
64 {
65 item.button1.icon.color = picker.SelectedColor;
67 SE.Tab();
68 });
69 }
70 layoutColors.RebuildLayout();
71 windows[0].AddBottomButton("apply", delegate
72 {
73 onApply?.Invoke();
74 });
75 windows[0].AddBottomButton("loadImage", delegate
76 {
77 DialogLoad(delegate
78 {
79 });
80 });
81 windows[0].AddBottomButton("cancel", delegate
82 {
83 Close();
84 });
85 paint.Init();
86 }
int[] colors
Definition: CoreConfig.cs:633
CoreConfig config
Definition: Core.cs:70
void SelectColor(Color newColor)
Definition: ColorPicker.cs:218
static int ToInt(ref Color c)
Definition: IntColor.cs:24
static Color32 FromInt(int i)
Definition: IntColor.cs:15
PixelPaint paint
GridLayoutGroup layoutColors
ColorPicker picker
void DialogLoad(Action onLoad=null)
List< Window > windows
Definition: Layer.cs:116
virtual void Close()
Definition: Layer.cs:463
void Init()
Definition: PixelPaint.cs:94
Definition: UIItem.cs:5
Definition: Util.cs:10
static Transform Instantiate(string path, Component parent=null)
Definition: Util.cs:67

References Layer.Close(), CoreConfig.colors, Core.config, ELayer.core, DialogLoad(), IntColor.FromInt(), PixelPaint.Init(), item, layoutColors, onApply, paint, picker, Empyrean.ColorPicker.ColorPicker.SelectColor(), Empyrean.ColorPicker.ColorPicker.SelectedColor, IntColor.ToInt(), Util, and Layer.windows.

Referenced by SetCanvas().

◆ SetCanvas()

void LayerPixelPaint.SetCanvas ( TraitCanvas  c)
inline

Definition at line 25 of file LayerPixelPaint.cs.

26 {
27 onApply = delegate
28 {
29 c.owner.PlaySound(c.owner.material.GetSoundImpact());
31 Thing thing = c.owner.Split(1);
32 thing.c_textureData = paint.tex.EncodeToPNG();
33 thing.isModified = true;
34 thing.ClearPaintSprite();
35 thing.GetPaintSprite();
36 thing.renderer.RefreshSprite();
37 Close();
38 };
39 paint.scale = c.SizeGrid;
40 paint.size = new Vector2Int(c.Width, c.Height);
41 InitPaint();
42 if (c.owner.c_textureData != null)
43 {
44 paint.tex.LoadImage(c.owner.c_textureData);
45 }
46 paint.imageMask.texture = c.owner.GetSprite().texture;
47 paint.imageMask.SetNativeSize();
48 paint.imagePreview.SetNativeSize();
49 }
AnimeID
Definition: AnimeID.cs:2
void PlayAnime(AnimeID id, bool force)
void RefreshSprite()
Thing Split(int a)
Definition: Card.cs:3568
SourceMaterial.Row material
Definition: Card.cs:2091
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:6472
Sprite GetPaintSprite()
Definition: Card.cs:7414
virtual Sprite GetSprite(int dir=0)
Definition: Card.cs:6391
byte[] c_textureData
Definition: Card.cs:1969
CardRenderer renderer
Definition: Card.cs:64
void ClearPaintSprite()
Definition: Card.cs:7404
RawImage imagePreview
Definition: PixelPaint.cs:11
Texture2D tex
Definition: PixelPaint.cs:23
RawImage imageMask
Definition: PixelPaint.cs:13
Definition: Thing.cs:8
virtual int Width
Definition: TraitCanvas.cs:14
virtual int SizeGrid
Definition: TraitCanvas.cs:18
virtual int Height
Definition: TraitCanvas.cs:16
Card owner
Definition: Trait.cs:28

References Card.c_textureData, Card.ClearPaintSprite(), Layer.Close(), Card.GetPaintSprite(), Card.GetSprite(), TraitCanvas.Height, PixelPaint.imageMask, PixelPaint.imagePreview, InitPaint(), Card.material, onApply, Trait.owner, paint, CardRenderer.PlayAnime(), Card.PlaySound(), CardRenderer.RefreshSprite(), Card.renderer, TraitCanvas.SizeGrid, Card.Split(), PixelPaint.tex, and TraitCanvas.Width.

◆ Update()

void LayerPixelPaint.Update ( )
inlineprivate

Definition at line 17 of file LayerPixelPaint.cs.

18 {
19 if (Input.GetKeyDown(KeyCode.Escape))
20 {
21 Close();
22 }
23 }

References Layer.Close().

Member Data Documentation

◆ layoutColors

GridLayoutGroup LayerPixelPaint.layoutColors

Definition at line 11 of file LayerPixelPaint.cs.

Referenced by InitPaint().

◆ onApply

Action LayerPixelPaint.onApply

Definition at line 15 of file LayerPixelPaint.cs.

Referenced by InitPaint(), and SetCanvas().

◆ paint

PixelPaint LayerPixelPaint.paint

Definition at line 9 of file LayerPixelPaint.cs.

Referenced by InitPaint(), and SetCanvas().

◆ picker

ColorPicker LayerPixelPaint.picker

Definition at line 13 of file LayerPixelPaint.cs.

Referenced by InitPaint().


The documentation for this class was generated from the following file: