Elin Decompiled Documentation EA 23.359.1 Nightly
Loading...
Searching...
No Matches
LayerSkinDeco Class Reference
Inheritance diagram for LayerSkinDeco:
ELayer Layer IUISkin

Public Member Functions

override void OnInit ()
 
void SetWidget (Widget _widget)
 
override void OnUpdateInput ()
 
void Activate (SkinDecoActor actor)
 
override void OnKill ()
 
- 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)
 
T AddLayer< T > ()
 
T AddLayer< T > (string id)
 
T AddLayerDontCloseOthers< T > ()
 
T AddLayerDontCloseOthers< T > (string path)
 
Layer AddLayerDontCloseOthers (Layer l)
 
T GetOrAddLayer< T > ()
 
virtual void OnBeforeAddLayer ()
 
virtual void OnAfterAddLayer ()
 
Layer AddLayer (Layer l)
 
void ToggleLayer (string id)
 
T 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)
 
T 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 ()
 

Static Public Member Functions

static List< Sprite > GetCustomSprites (bool rescan=false)
 
- 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)
 

Public Attributes

Widget widget
 
Transform widgetHolder
 
- 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< Layer > layers = new List<Layer>()
 
Vector2 lastParentPos
 
List< Window > windows = new List<Window>()
 
string langHint
 

Static Public Attributes

static List< Sprite > customSprites
 
- 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" }
 

Properties

List< SkinDeco > decos [get]
 
SkinConfig cfg [get]
 
- 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]
 

Additional Inherited Members

- 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
 

Detailed Description

Definition at line 7 of file LayerSkinDeco.cs.

Member Function Documentation

◆ Activate()

void LayerSkinDeco.Activate ( SkinDecoActor  actor)
inline

Definition at line 189 of file LayerSkinDeco.cs.

190 {
191 actor.image.raycastTarget = true;
192 actor.transform.SetParent(base.transform, worldPositionStays: true);
193 UIDragPanel uIDragPanel = actor.gameObject.AddComponent<UIDragPanel>();
194 uIDragPanel.target = actor.Rect();
195 uIDragPanel.bound = actor.Rect();
196 uIDragPanel.clamp = false;
197 foreach (SkinDeco deco in decos)
198 {
199 deco.actor?.Refresh();
200 }
201 }
List< SkinDeco > decos
void Refresh(bool editing=true)
SkinDecoActor actor
Definition: SkinDeco.cs:8

References SkinDeco.actor, decos, and SkinDecoActor.Refresh().

Referenced by OnUpdateInput(), and SetWidget().

◆ GetCustomSprites()

static List< Sprite > LayerSkinDeco.GetCustomSprites ( bool  rescan = false)
inlinestatic

Definition at line 20 of file LayerSkinDeco.cs.

21 {
22 if (customSprites == null || rescan)
23 {
24 List<DirectoryInfo> list = new List<DirectoryInfo>
25 {
26 new DirectoryInfo(CorePath.custom + "Deco")
27 };
28 if (customSprites == null)
29 {
30 list.AddRange(PackageIterator.GetDirectories("Deco"));
31 }
32 if (customSprites == null)
33 {
34 customSprites = new List<Sprite>();
35 }
36 Dictionary<string, FileInfo> dictionary = new Dictionary<string, FileInfo>();
37 foreach (FileInfo item in list.SelectMany((DirectoryInfo d) => d.GetFiles("*.png")))
38 {
39 dictionary["_" + item.Name] = item;
40 }
41 foreach (Sprite customSprite in customSprites)
42 {
43 dictionary.Remove(customSprite.name);
44 }
45 foreach (KeyValuePair<string, FileInfo> item2 in dictionary)
46 {
47 item2.Deconstruct(out var key, out var value);
48 string text = key;
49 Texture2D texture2D = IO.LoadPNG(value.FullName, FilterMode.Bilinear);
50 if ((bool)texture2D)
51 {
52 Sprite sprite = Sprite.Create(texture2D, new Rect(0f, 0f, texture2D.width, texture2D.height), new Vector2(0.5f, 0.5f));
53 sprite.name = text;
54 customSprites.Add(sprite);
55 }
56 }
57 }
58 return customSprites;
59 }
static string custom
Definition: CorePath.cs:159
Definition: IO.cs:10
static Texture2D LoadPNG(string _path, FilterMode filter=FilterMode.Point)
Definition: IO.cs:473
static List< Sprite > customSprites

References CorePath.custom, customSprites, and item.

Referenced by Widget.InstantiateDeco(), and OnUpdateInput().

◆ OnInit()

override void LayerSkinDeco.OnInit ( )
inlinevirtual

Reimplemented from Layer.

Definition at line 61 of file LayerSkinDeco.cs.

62 {
63 base.OnInit();
64 }

◆ OnKill()

override void LayerSkinDeco.OnKill ( )
inlinevirtual

Reimplemented from Layer.

Definition at line 203 of file LayerSkinDeco.cs.

204 {
205 widget.transform.SetParent(ELayer.ui.widgets.transform, worldPositionStays: false);
207 foreach (SkinDeco deco in decos)
208 {
209 SkinDecoActor actor = deco.actor;
210 actor.image.raycastTarget = false;
211 UnityEngine.Object.DestroyImmediate(actor.gameObject.GetComponent<UIDragPanel>());
212 actor.transform.SetParent(widget.transform, worldPositionStays: true);
213 deco.x = (int)actor.Rect().anchoredPosition.x;
214 deco.y = (int)actor.Rect().anchoredPosition.y;
215 actor.Refresh(editing: false);
216 }
217 }
Definition: ELayer.cs:4
static UI ui
Definition: ELayer.cs:21
void RefreshOrder()
Definition: Widget.cs:272

References SkinDeco.actor, decos, SkinDecoActor.Refresh(), Widget.RefreshOrder(), ELayer.ui, and widget.

◆ OnUpdateInput()

override void LayerSkinDeco.OnUpdateInput ( )
inlinevirtual

Reimplemented from Layer.

Definition at line 76 of file LayerSkinDeco.cs.

77 {
79 {
81 {
82 return;
83 }
84 SkinDecoActor selected = InputModuleEX.GetComponentOf<SkinDecoActor>();
85 Vector3 clickPos = Input.mousePosition;
86 UIContextMenu m = ELayer.ui.CreateContextMenu();
87 if ((bool)selected)
88 {
89 SkinDeco deco = selected.owner;
90 m.AddButton("editColor", delegate
91 {
92 ELayer.ui.AddLayer<LayerColorPicker>().SetColor(deco.color, Color.white, delegate(PickerState state, Color _c)
93 {
94 deco.color = _c;
95 selected.Refresh();
96 });
97 });
98 m.AddButton("bringToTop", delegate
99 {
100 decos.Remove(deco);
101 decos.Add(deco);
102 selected.transform.SetAsLastSibling();
103 });
104 m.AddSlider("rotation", (float n) => (n * 45f).ToString() ?? "", deco.rz, delegate(float a)
105 {
106 deco.rz = (int)a;
107 selected.Refresh();
108 }, 0f, 7f, isInt: true);
109 m.AddSlider("size", (float n) => n.ToString() ?? "", Mathf.Abs(deco.sx), delegate(float a)
110 {
111 deco.sx = (int)a * ((deco.sx > 0) ? 1 : (-1));
112 deco.sy = (int)a * ((deco.sy > 0) ? 1 : (-1));
113 selected.Refresh();
114 }, 10f, 400f, isInt: true);
115 m.AddToggle("shadow", deco.shadow, delegate(bool a)
116 {
117 deco.shadow = a;
118 selected.Refresh();
119 });
120 m.AddToggle("reverse", deco.reverse, delegate(bool a)
121 {
122 deco.reverse = a;
123 selected.Refresh();
124 });
125 m.AddToggle("placeBeforeWidget", deco.bottom, delegate(bool a)
126 {
127 deco.bottom = a;
128 selected.Refresh();
129 });
130 m.AddButton("removeDeco", delegate
131 {
132 widget.RemoveDeco(selected.owner);
133 });
134 }
135 else
136 {
137 UIContextMenu uIContextMenu = m.AddChild("addDeco");
138 UIList uIList = Util.Instantiate<UIList>("UI/Element/List/ListImageGrid", uIContextMenu);
139 uIList.callbacks = new UIList.Callback<Sprite, UIButton>
140 {
141 onInstantiate = delegate(Sprite a, UIButton _b)
142 {
143 _b.icon.sprite = a;
144 },
145 onClick = delegate(Sprite a, UIButton _b)
146 {
147 SkinDeco skinDeco = new SkinDeco
148 {
149 sx = 100,
150 sy = 100,
151 color = Color.white
152 };
153 if (a.name.StartsWith("_"))
154 {
155 skinDeco.name = a.name;
156 skinDeco.id = 0;
157 }
158 else
159 {
160 skinDeco.id = int.Parse(a.name.Remove(0, 4));
161 }
162 widget.AddDeco(skinDeco);
163 SkinDecoActor actor = skinDeco.actor;
164 Activate(actor);
165 actor.transform.position = clickPos;
166 EInput.Consume();
167 m.Hide();
168 }
169 };
170 foreach (Sprite item in Resources.LoadAll<Sprite>("Media/Graphics/Deco/").Concat(GetCustomSprites(rescan: true)))
171 {
172 uIList.Add(item);
173 }
174 uIList.Refresh();
175 }
176 m.Show();
177 }
179 {
180 UIContextMenu uIContextMenu2 = ELayer.ui.CreateContextMenu();
181 uIContextMenu2.AddButton("quitEdit", delegate
182 {
183 Close();
184 });
185 uIContextMenu2.Show();
186 }
187 }
PickerState
Definition: PickerState.cs:2
bool dragging
Definition: ButtonState.cs:43
bool clicked
Definition: ButtonState.cs:37
Definition: EInput.cs:8
static void Consume(int _skipFrame)
Definition: EInput.cs:667
static ButtonState leftMouse
Definition: EInput.cs:360
static ButtonState rightMouse
Definition: EInput.cs:362
void Activate(SkinDecoActor actor)
static List< Sprite > GetCustomSprites(bool rescan=false)
virtual void Close()
Definition: Layer.cs:468
SkinDeco owner
Definition: SkinDecoActor.cs:6
int sy
Definition: SkinDeco.cs:67
string name
Definition: SkinDeco.cs:14
int rz
Definition: SkinDeco.cs:91
Color color
Definition: SkinDeco.cs:79
bool bottom
Definition: SkinDeco.cs:139
bool reverse
Definition: SkinDeco.cs:127
int sx
Definition: SkinDeco.cs:55
bool shadow
Definition: SkinDeco.cs:115
UIContextMenuItem AddToggle(string idLang="", bool isOn=false, UnityAction< bool > action=null)
void Show(UIItem i)
UIContextMenuItem AddSlider(string text, Func< float, string > textFunc, float value, Action< float > action, float min=0f, float max=1f, bool isInt=false, bool hideOther=true, bool useInput=false)
void AddButton(Func< string > funcText, UnityAction action=null)
UIContextMenu AddChild(string idLang, TextAnchor anchor)
Definition: UIList.cs:9
override void Add(object item)
Definition: UIList.cs:357
virtual void Refresh(bool highlightLast=false)
Definition: UIList.cs:479
Definition: Util.cs:10
static Transform Instantiate(string path, Component parent=null)
Definition: Util.cs:67
void RemoveDeco(SkinDeco deco)
Definition: Widget.cs:624
void AddDeco(SkinDeco deco)
Definition: Widget.cs:618

References Activate(), SkinDeco.actor, UIContextMenu.AddButton(), UIContextMenu.AddChild(), Widget.AddDeco(), UIContextMenu.AddSlider(), UIContextMenu.AddToggle(), SkinDeco.bottom, ButtonState.clicked, Layer.Close(), Color, SkinDeco.color, EInput.Consume(), decos, ButtonState.down, ButtonState.dragging, GetCustomSprites(), UIContextMenu.Hide(), item, EInput.leftMouse, SkinDeco.name, SkinDecoActor.owner, SkinDecoActor.Refresh(), Widget.RemoveDeco(), SkinDeco.reverse, EInput.rightMouse, SkinDeco.rz, SkinDeco.shadow, UIContextMenu.Show(), SkinDeco.sx, SkinDeco.sy, ELayer.ui, Util, and widget.

◆ SetWidget()

void LayerSkinDeco.SetWidget ( Widget  _widget)
inline

Definition at line 66 of file LayerSkinDeco.cs.

67 {
68 widget = _widget;
69 foreach (SkinDeco deco in decos)
70 {
71 Activate(deco.actor);
72 }
73 widget.transform.SetParent(widgetHolder, worldPositionStays: false);
74 }
Transform widgetHolder

References Activate(), SkinDeco.actor, decos, widget, and widgetHolder.

Member Data Documentation

◆ customSprites

List<Sprite> LayerSkinDeco.customSprites
static

Definition at line 12 of file LayerSkinDeco.cs.

Referenced by GetCustomSprites().

◆ widget

Widget LayerSkinDeco.widget

Definition at line 10 of file LayerSkinDeco.cs.

Referenced by OnKill(), OnUpdateInput(), and SetWidget().

◆ widgetHolder

Transform LayerSkinDeco.widgetHolder

Definition at line 14 of file LayerSkinDeco.cs.

Referenced by SetWidget().

Property Documentation

◆ cfg

SkinConfig LayerSkinDeco.cfg
get

Definition at line 18 of file LayerSkinDeco.cs.

◆ decos

List<SkinDeco> LayerSkinDeco.decos
get

Definition at line 16 of file LayerSkinDeco.cs.

Referenced by Activate(), OnKill(), OnUpdateInput(), and SetWidget().


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