Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
Window.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Runtime.Serialization;
4using DG.Tweening;
5using Newtonsoft.Json;
6using UnityEngine;
7using UnityEngine.EventSystems;
8using UnityEngine.Events;
9using UnityEngine.UI;
10
11[RequireComponent(typeof(RectTransform), typeof(EventTrigger))]
12public class Window : MonoBehaviour, IChangeResolution, IUISkin
13{
14 public enum Type
15 {
16 Default,
18 Side
19 }
20
21 [Serializable]
22 public class Setting
23 {
24 [Serializable]
25 public class Tab
26 {
27 public string idLang;
28
29 public string langTooltip;
30
32
34
35 public Action action;
36
37 public bool disable;
38
39 public Sprite sprite;
40
42
43 public object refObj;
44 }
45
46 public class BottomAction
47 {
48 public string idLang;
49
50 public Button.ButtonClickedEvent action;
51 }
52
53 public string textCaption;
54
55 public Sprite spriteCaption;
56
57 public Rect bound = new Rect(400f, 300f, 1000f, 1000f);
58
59 public bool asWidget;
60
61 public bool allowMove;
62
63 public bool allowResize;
64
65 public bool saveWindow;
66
67 public bool bottomBack;
68
69 public bool dontBringToTop;
70
71 public bool transparent = true;
72
73 public bool tabAfterCaption;
74
75 public bool openLastTab = true;
76
77 public bool alwaysShowTab;
78
79 public Type type;
80
81 public List<Tab> tabs;
82
83 public Anime anime;
84
85 public Vector2 posFix;
86
87 public bool usePosFix = true;
88
89 public Vector2 clampMargin = new Vector2(-1f, -1f);
90
91 public Vector2 resizeGrid;
92
93 public string rightMenuAlias;
94 }
95
96 [Serializable]
97 [JsonObject(MemberSerialization.OptIn)]
98 public class SaveData
99 {
100 public enum CategoryType
101 {
102 Main,
103 Sub,
104 Exact,
105 None
106 }
107
108 public enum FilterResult
109 {
110 Pass,
111 Block,
113 }
114
115 [JsonProperty]
116 public int[] ints = new int[20];
117
118 [JsonProperty]
119 public HashSet<int> cats = new HashSet<int>();
120
121 [JsonProperty]
122 public string filter;
123
124 [JsonIgnore]
125 public string[] _filterStrs;
126
127 [JsonIgnore]
128 public int[] filterOptions;
129
131
132 public bool userFilter => !filter.IsEmpty();
133
134 public string[] filterStrs
135 {
136 get
137 {
138 if (_filterStrs == null)
139 {
140 return BuildFilter();
141 }
142 return _filterStrs;
143 }
144 }
145
146 public float x
147 {
148 get
149 {
150 return 0.01f * (float)ints[1];
151 }
152 set
153 {
154 ints[1] = (int)(value * 100f);
155 }
156 }
157
158 public float y
159 {
160 get
161 {
162 return 0.01f * (float)ints[2];
163 }
164 set
165 {
166 ints[2] = (int)(value * 100f);
167 }
168 }
169
170 public float w
171 {
172 get
173 {
174 return 0.01f * (float)ints[3];
175 }
176 set
177 {
178 ints[3] = (int)(value * 100f);
179 }
180 }
181
182 public float h
183 {
184 get
185 {
186 return 0.01f * (float)ints[4];
187 }
188 set
189 {
190 ints[4] = (int)(value * 100f);
191 }
192 }
193
195 {
196 get
197 {
198 return ints[5].ToEnum<RectPosition>();
199 }
200 set
201 {
202 ints[5] = (int)value;
203 }
204 }
205
207 {
208 get
209 {
210 return ints[6].ToEnum<AutodumpFlag>();
211 }
212 set
213 {
214 ints[6] = (int)value;
215 }
216 }
217
218 public int size
219 {
220 get
221 {
222 return ints[7];
223 }
224 set
225 {
226 ints[7] = value;
227 }
228 }
229
230 public Color32 color
231 {
232 get
233 {
234 return IntColor.FromInt(ints[8]);
235 }
236 set
237 {
238 ints[8] = IntColor.ToInt(value);
239 }
240 }
241
243 {
244 get
245 {
246 return ints[9].ToEnum<ContainerSharedType>();
247 }
248 set
249 {
250 ints[9] = (int)value;
251 }
252 }
253
254 public int priority
255 {
256 get
257 {
258 return ints[10];
259 }
260 set
261 {
262 ints[10] = value;
263 }
264 }
265
267 {
268 get
269 {
270 return ints[11].ToEnum<ContainerFlag>();
271 }
272 set
273 {
274 ints[11] = (int)value;
275 }
276 }
277
278 public int columns
279 {
280 get
281 {
282 return ints[12];
283 }
284 set
285 {
286 ints[12] = value;
287 }
288 }
289
291 {
292 get
293 {
294 return ints[13].ToEnum<RectPosition>();
295 }
296 set
297 {
298 ints[13] = (int)value;
299 }
300 }
301
303 {
304 get
305 {
306 return ints[14].ToEnum<CategoryType>();
307 }
308 set
309 {
310 ints[14] = (int)value;
311 }
312 }
313
315 {
316 get
317 {
318 if (ints[15] != 0)
319 {
320 return ints[15].ToEnum<UIList.SortMode>();
321 }
322 return UIList.SortMode.ByCategory;
323 }
324 set
325 {
326 ints[15] = (int)value;
327 }
328 }
329
330 public bool open
331 {
332 get
333 {
334 return b1[0];
335 }
336 set
337 {
338 b1[0] = value;
339 }
340 }
341
342 public bool useBG
343 {
344 get
345 {
346 return b1[1];
347 }
348 set
349 {
350 b1[1] = value;
351 }
352 }
353
354 public bool firstSorted
355 {
356 get
357 {
358 return b1[2];
359 }
360 set
361 {
362 b1[2] = value;
363 }
364 }
365
366 public bool excludeDump
367 {
368 get
369 {
370 return b1[3];
371 }
372 set
373 {
374 b1[3] = value;
375 }
376 }
377
378 public bool excludeCraft
379 {
380 get
381 {
382 return b1[4];
383 }
384 set
385 {
386 b1[4] = value;
387 }
388 }
389
391 {
392 get
393 {
394 return b1[5];
395 }
396 set
397 {
398 b1[5] = value;
399 }
400 }
401
402 public bool fixedPos
403 {
404 get
405 {
406 return b1[6];
407 }
408 set
409 {
410 b1[6] = value;
411 }
412 }
413
414 public bool compress
415 {
416 get
417 {
418 return b1[7];
419 }
420 set
421 {
422 b1[7] = value;
423 }
424 }
425
426 public bool advDistribution
427 {
428 get
429 {
430 return b1[8];
431 }
432 set
433 {
434 b1[8] = value;
435 }
436 }
437
438 public bool noRotten
439 {
440 get
441 {
442 return b1[9];
443 }
444 set
445 {
446 b1[9] = value;
447 }
448 }
449
450 public bool onlyRottable
451 {
452 get
453 {
454 return b1[10];
455 }
456 set
457 {
458 b1[10] = value;
459 }
460 }
461
462 public bool alwaysSort
463 {
464 get
465 {
466 return b1[11];
467 }
468 set
469 {
470 b1[11] = value;
471 }
472 }
473
474 public bool sort_ascending
475 {
476 get
477 {
478 return b1[12];
479 }
480 set
481 {
482 b1[12] = value;
483 }
484 }
485
486 public bool shiftToShowMenu
487 {
488 get
489 {
490 return b1[13];
491 }
492 set
493 {
494 b1[13] = value;
495 }
496 }
497
498 public FilterResult IsFilterPass(string text)
499 {
500 bool flag = false;
501 bool flag2 = false;
502 for (int i = 0; i < filterStrs.Length; i++)
503 {
504 switch (filterOptions[i])
505 {
506 case 0:
507 if (text.Contains(filterStrs[i]))
508 {
509 flag = true;
510 }
511 flag2 = true;
512 break;
513 case 1:
514 if (text.Contains(filterStrs[i]))
515 {
516 return FilterResult.Block;
517 }
518 break;
519 case 2:
520 if (text.Contains(filterStrs[i]))
521 {
522 return FilterResult.PassWithoutFurtherTest;
523 }
524 break;
525 }
526 }
527 if (!flag && flag2)
528 {
529 return FilterResult.Block;
530 }
531 return FilterResult.Pass;
532 }
533
534 public string[] BuildFilter()
535 {
536 _filterStrs = filter.Replace('、', ',').Split(',');
537 filterOptions = new int[filterStrs.Length];
538 for (int i = 0; i < _filterStrs.Length; i++)
539 {
540 if (_filterStrs[i].Length != 0)
541 {
542 switch (_filterStrs[i][0])
543 {
544 case '-':
545 filterOptions[i] = 1;
546 _filterStrs[i] = _filterStrs[i].Replace("-", "");
547 break;
548 case '+':
549 filterOptions[i] = 2;
550 _filterStrs[i] = _filterStrs[i].Replace("+", "");
551 break;
552 case '"':
553 case '\'':
554 _filterStrs[i] = _filterStrs[i].Replace("\"", "");
555 break;
556 }
557 }
558 }
559 return _filterStrs;
560 }
561
563 private void OnSerializing(StreamingContext context)
564 {
565 ints[0] = (int)b1.Bits;
566 }
567
568 [OnDeserialized]
569 private void _OnDeserialized(StreamingContext context)
570 {
571 if (ints.Length < 20)
572 {
573 Array.Resize(ref ints, 20);
574 }
575 b1.Bits = (uint)ints[0];
576 }
577
578 public void CopyFrom(SaveData data)
579 {
580 for (int i = 0; i < ints.Length; i++)
581 {
582 if (i != 1 && i != 2)
583 {
584 ints[i] = data.ints[i];
585 }
586 }
587 cats = IO.DeepCopy(data.cats);
588 filter = data.filter;
589 b1.Bits = (uint)ints[0];
590 _filterStrs = null;
591 }
592 }
593
594 public static Dictionary<string, SaveData> dictData = new Dictionary<string, SaveData>();
595
596 public static Dictionary<string, int> dictTab = new Dictionary<string, int>();
597
598 public static bool openLastTab;
599
600 public static bool animateWindow;
601
602 public bool leftSide = true;
603
604 public bool isFloat;
605
607
609
611
613
614 public Image iconCaption;
615
616 public Image deco1;
617
618 public Image deco2;
619
621
623
625
627
629
631
633
635
637
639
641
643
645
647
649
651
653
655
657
659
661
663
664 public Tween tweenAnime;
665
666 public CanvasGroup cgBG;
667
668 public CanvasGroup cgFloatMenu;
669
671
672 public List<CanvasGroup> listCgFloat;
673
675
676 [NonSerialized]
677 public Layer layer;
678
679 private LayoutGroup layoutWindow;
680
681 public float FrameOffsetL = -15f;
682
683 public float FrameOffsetR = -15f;
684
685 public float FrameOffsetTop = -30f;
686
687 public float FrameThickness = 14f;
688
689 public float CaptionHeight = 50f;
690
691 public float frameOffsetY = 5f;
692
693 [NonSerialized]
694 public int idTab;
695
696 [NonSerialized]
697 public int windowIndex;
698
699 [NonSerialized]
701
702 [NonSerialized]
704
705 [NonSerialized]
707
708 [NonSerialized]
710
711 [NonSerialized]
712 public CanvasGroup cg;
713
714 [NonSerialized]
715 public Vector2 posBottom;
716
717 [NonSerialized]
718 public Vector2 posTab;
719
720 [NonSerialized]
721 public Vector2 posCaption;
722
723 [NonSerialized]
725
726 private bool? shadowEnabled;
727
728 private Shadow bgShadow;
729
731
732 public Vector2 attachFix;
733
735
737
739
740 private Vector3 _correctedLossyScale;
741
742 private Vector3[] _frameOuterCorners;
743
744 private Vector3[] _frameInnerCorners;
745
746 private Vector3[] _captionCorners;
747
749
751
752 private bool IsProcessingResize;
753
754 private bool IsResizingOverTop;
755
757
758 private bool IsResizingOverLeft;
759
761
763
764 private Vector3 dragStartPos;
765
766 private Vector3 dragOffset;
767
768 private bool scrolling;
769
770 private bool isTop;
771
772 private float floatAlpha;
773
774 public string idWindow
775 {
776 get
777 {
778 if (!(layer == null))
779 {
780 return layer.uid + windowIndex;
781 }
782 return "nolayer";
783 }
784 }
785
787 {
788 get
789 {
790 if (setting.tabs.Count <= 0)
791 {
792 return null;
793 }
794 return setting.tabs[idTab];
795 }
796 }
797
799 {
800 get
801 {
802 if (CurrentTab == null || !CurrentTab.content)
803 {
804 return null;
805 }
806 return CurrentTab.content;
807 }
808 }
809
810 public bool AutoAnchor
811 {
812 get
813 {
814 if (!isFloat || (bool)attachedWindow)
815 {
816 if (saveData != null)
817 {
818 return saveData.customAnchor != RectPosition.Auto;
819 }
820 return false;
821 }
822 return true;
823 }
824 }
825
827 {
828 get
829 {
830 if (!(skinRoot != null))
831 {
833 }
834 return skinRoot;
835 }
836 }
837
839 {
840 get
841 {
842 if (!_canvas)
843 {
844 _canvas = GetComponentInParent<Canvas>();
845 }
846 return _canvas;
847 }
848 }
849
851 {
852 get
853 {
854 if (!_eventTrigger)
855 {
856 _eventTrigger = GetComponent<EventTrigger>();
857 }
858 return _eventTrigger;
859 }
860 }
861
863 {
864 get
865 {
866 if (!_rectTransform)
867 {
868 _rectTransform = base.transform as RectTransform;
869 }
870 return _rectTransform;
871 }
872 }
873
874 public Vector3 CorrectedLossyScale
875 {
876 get
877 {
878 if (_correctedLossyScale == Vector3.zero)
879 {
880 _correctedLossyScale = Canvas.CorrectLossyScale();
881 }
883 }
884 }
885
886 public Vector3[] FrameOuterCorners
887 {
888 get
889 {
890 if (_frameOuterCorners == null || _frameOuterCorners.Length != 4)
891 {
892 _frameOuterCorners = new Vector3[4];
894 }
895 return _frameOuterCorners;
896 }
897 }
898
899 public Vector3[] FrameInnerCorners
900 {
901 get
902 {
903 if (_frameInnerCorners == null || _frameInnerCorners.Length != 4)
904 {
905 _frameInnerCorners = new Vector3[4];
907 }
908 return _frameInnerCorners;
909 }
910 }
911
912 public Vector3[] CaptionCorners
913 {
914 get
915 {
916 if (_captionCorners == null || _captionCorners.Length != 4)
917 {
918 _captionCorners = new Vector3[4];
919 for (int i = 0; i < 4; i++)
920 {
922 }
927 }
928 return _captionCorners;
929 }
930 }
931
932 public bool isStatic => false;
933
934 private void Awake()
935 {
936 controller = base.gameObject.GetComponent<WindowController>();
937 if ((bool)controller)
938 {
939 controller.window = this;
940 }
941 menuLeft = new WindowMenu("Left", this);
942 menuRight = new WindowMenu(setting.rightMenuAlias.IsEmpty("Right"), this);
943 menuBottom = new WindowMenu("Bottom", this);
944 menuLeftBottom = new WindowMenu("LeftBottom", this);
945 if (!base.gameObject.GetComponent<Canvas>())
946 {
947 base.gameObject.AddComponent<Canvas>();
948 base.gameObject.AddComponent<GraphicRaycaster>();
949 }
950 cg = base.gameObject.GetComponent<CanvasGroup>();
951 if (cg == null)
952 {
953 cg = base.gameObject.AddComponent<CanvasGroup>();
954 }
955 posTab = rectTab.anchoredPosition;
956 posBottom = rectBottom.anchoredPosition;
957 layoutWindow = GetComponent<LayoutGroup>();
958 posCaption = new Vector2(layoutWindow.padding.left, layoutWindow.padding.top);
960 {
961 rectTab.SetSiblingIndex(rectCaption.GetSiblingIndex());
962 }
963 if ((bool)imageBG)
964 {
965 bgShadow = imageBG.GetComponent<Shadow>();
966 }
967 _rect = this.Rect();
968 }
969
970 public void Init(Layer _layer = null)
971 {
972 _rect = this.Rect();
973 layer = _layer;
974 if (!setting.asWidget)
975 {
976 setting.allowResize = false;
977 setting.saveWindow = false;
978 }
980 {
981 saveData = dictData.TryGetValue(idWindow);
982 }
983 if (saveData != null)
984 {
985 if (saveData.customAnchor != 0)
986 {
987 saveData.anchor = saveData.customAnchor;
988 }
989 if (AutoAnchor)
990 {
991 _rect.SetAnchor(saveData.anchor);
992 }
993 _rect.anchoredPosition = new Vector2(saveData.x, saveData.y);
994 _rect.sizeDelta = new Vector2(saveData.w, saveData.h);
995 }
996 else if (setting.usePosFix)
997 {
998 _rect.anchoredPosition += setting.posFix;
999 }
1000 if (openLastTab && setting.openLastTab && setting.tabs.Count > idTab && !setting.tabs[dictTab.TryGetValue(idWindow, 0)].disable)
1001 {
1002 idTab = dictTab.TryGetValue(idWindow, 0);
1003 }
1004 if (setting.textCaption.IsEmpty())
1005 {
1006 textCaption.SetActive(enable: false);
1007 iconCaption.SetActive(enable: false);
1008 }
1009 else
1010 {
1011 if (Lang.GetList(setting.textCaption) != null)
1012 {
1014 }
1015 else
1016 {
1018 }
1019 if ((bool)setting.spriteCaption)
1020 {
1021 iconCaption.sprite = setting.spriteCaption;
1022 }
1023 }
1024 BuildTabs();
1025 bool flag = !(layer == null) && layer.option.canClose;
1026 if (flag && setting.bottomBack)
1027 {
1028 AddBottomButton("back", Close, setFirst: true);
1029 }
1030 if ((bool)buttonClose && buttonClose.gameObject.activeSelf)
1031 {
1032 buttonClose.onClick.RemoveAllListeners();
1033 buttonClose.onClick.AddListener(Close);
1034 buttonClose.SetActive(flag);
1035 }
1036 rectBottom.RebuildLayout(recursive: true);
1037 switch (setting.type)
1038 {
1039 case Type.AlignToMouse:
1040 leftSide = Input.mousePosition.x > (float)Screen.width / 1.5f;
1041 _rect.pivot = new Vector2(leftSide ? 1 : 0, _rect.pivot.y);
1042 _rect.position = Input.mousePosition + new Vector3(60f * (leftSide ? (-1f) : 1f), 0f, 0f);
1043 break;
1044 case Type.Side:
1045 {
1046 leftSide = Input.mousePosition.x > (float)Screen.width / 1.7f;
1047 float num = BaseCore.Instance.uiScale * (_rect.sizeDelta.x * 0.5f + 30f);
1048 _rect.position = new Vector3(leftSide ? num : ((float)Screen.width - num), _rect.position.y, 0f);
1049 setting.anime = Resources.Load<Anime>("Media/Anime/" + (leftSide ? "In Window from left" : "In Window from right"));
1050 break;
1051 }
1052 }
1055 InitPanel();
1056 ApplySkin();
1057 GameObject go = base.gameObject;
1058 if (!setting.anime || !animateWindow)
1059 {
1060 return;
1061 }
1063 {
1064 if ((bool)setting.anime && go != null)
1065 {
1066 tweenAnime = setting.anime.Play(this.Rect());
1067 }
1068 });
1069 }
1070
1072 {
1073 bool flag = (float)(Screen.width / 2 - 40) > base.transform.position.x;
1074 if ((bool)tipPiovotLeft)
1075 {
1076 tipPiovotLeft.SetActive(!flag || !tipPivotRight);
1077 }
1078 if ((bool)tipPivotRight)
1079 {
1080 tipPivotRight.SetActive(flag || !tipPiovotLeft);
1081 }
1082 }
1083
1084 public void SetRect(RectData data, bool mousePos = false)
1085 {
1086 data.Apply(_rect);
1087 if (mousePos)
1088 {
1089 _rect.position = EInput.uiMousePosition;
1090 }
1091 }
1092
1093 public void UpdateSaveData()
1094 {
1095 if (setting.saveWindow)
1096 {
1097 if (saveData == null)
1098 {
1099 saveData = new SaveData();
1100 }
1102 }
1103 if (saveData != null)
1104 {
1105 saveData.anchor = ((saveData.customAnchor == RectPosition.Auto) ? _rect.GetAnchor() : saveData.customAnchor);
1106 _rect.SetAnchor(saveData.anchor);
1107 Vector2 anchoredPosition = _rect.anchoredPosition;
1108 Vector2 sizeDelta = _rect.sizeDelta;
1109 saveData.x = anchoredPosition.x;
1110 saveData.y = anchoredPosition.y;
1111 saveData.w = sizeDelta.x;
1112 saveData.h = sizeDelta.y;
1113 }
1114 }
1115
1116 public void OnKill()
1117 {
1119 if (saveData != null)
1120 {
1121 saveData.open = false;
1122 }
1123 if (setting.openLastTab)
1124 {
1126 }
1127 }
1128
1129 public void ApplySkin()
1130 {
1131 SkinRootStatic skin = Skin;
1132 if ((bool)cg && setting.transparent)
1133 {
1134 cg.alpha = skin.transparency;
1135 }
1136 if ((bool)deco1)
1137 {
1138 Image image = deco1;
1139 Color color2 = (deco2.color = skin.colorsEx.deco1);
1140 image.color = color2;
1141 }
1142 layoutWindow.padding = skin.positions.paddingWindow;
1143 rectBottom.anchoredPosition = posBottom + skin.positions.bottom;
1145 {
1146 rectTab.anchoredPosition = posTab + skin.positions.tab;
1147 }
1148 Image image2 = imageBG?.frame;
1149 if (!shadowEnabled.HasValue)
1150 {
1151 shadowEnabled = bgShadow?.enabled ?? false;
1152 }
1153 if ((bool)image2 && skin.useFrame)
1154 {
1155 image2.GetComponent<Shadow>().enabled = shadowEnabled.GetValueOrDefault();
1156 if ((bool)bgShadow)
1157 {
1158 bgShadow.enabled = false;
1159 }
1160 }
1161 else if ((bool)bgShadow)
1162 {
1163 bgShadow.enabled = shadowEnabled.GetValueOrDefault();
1164 }
1165 Outline component = textCaption.GetComponent<Outline>();
1166 if ((bool)component)
1167 {
1168 component.enabled = skin.captionOutline;
1169 }
1170 if ((bool)rectDeco)
1171 {
1172 rectDeco.SetActive(skin.useDeco);
1173 }
1174 if ((bool)rectCorner && imageBG.imageType != ImageType.BG_Window_Board)
1175 {
1176 rectCorner.anchoredPosition = skin.positions.windowCorner;
1177 }
1178 if ((bool)menuLeft.layout)
1179 {
1180 menuLeft.layout.Rect().anchoredPosition = skin.positions.leftMenu;
1181 }
1182 if ((bool)bgCaption)
1183 {
1184 bgCaption.SetActive(skin.captionBG && textCaption.gameObject.activeInHierarchy);
1185 }
1186 if (skin.alwaysShadow || skin.noShadow)
1187 {
1188 EnableShadow();
1189 }
1190 }
1191
1192 public T SwitchContent<T>() where T : UIContent
1193 {
1194 SwitchContent(GetTab(typeof(T).Name.Replace("Content", "")));
1195 return CurrentContent as T;
1196 }
1197
1198 public void SwitchContent(UIContent content)
1199 {
1200 SwitchContent(GetTab(content));
1201 }
1202
1203 public void SwitchContent(string name)
1204 {
1205 SwitchContent(GetTab(name));
1206 }
1207
1208 public void SwitchContent(Setting.Tab tab)
1209 {
1210 SwitchContent(setting.tabs.IndexOf(tab));
1211 }
1212
1213 public UIContent SwitchContent(int index)
1214 {
1215 idTab = index;
1216 if (setting.tabs.Count > 0)
1217 {
1218 Setting.Tab tab = setting.tabs[index];
1219 foreach (Setting.Tab tab2 in setting.tabs)
1220 {
1221 if ((bool)tab2.content && !tab2.content.IsPrefab())
1222 {
1223 tab2.content.SetActive(tab2 == tab);
1224 }
1225 }
1226 if ((bool)groupTab)
1227 {
1228 groupTab.Select(setting.tabs[index].button);
1229 }
1230 if ((bool)tab.content)
1231 {
1232 if (tab.content.IsPrefab())
1233 {
1234 tab.content = Util.Instantiate(tab.content, view);
1235 tab.content.SetActive(enable: true);
1236 tab.content.OnInstantiate();
1237 }
1238 tab.content.SetActive(enable: true);
1240 }
1241 if (tab.action != null)
1242 {
1243 tab.action();
1244 }
1245 string text = ((layer == null) ? "" : layer.GetTextHeader(this));
1246 if (!text.IsEmpty())
1247 {
1248 SetCaption(text);
1249 }
1250 }
1251 if ((bool)controller)
1252 {
1254 }
1255 else if ((bool)layer)
1256 {
1257 layer.OnSwitchContent(this);
1258 }
1259 return CurrentContent;
1260 }
1261
1262 public void SetTitles(string langList, string idHeaderRow = null)
1263 {
1264 string[] list = Lang.GetList(langList);
1265 if (!list[0].IsEmpty())
1266 {
1267 SetCaption(list[0]);
1268 }
1269 if (list.Length >= 3)
1270 {
1271 if (!rectHeader || idHeaderRow != null)
1272 {
1273 LoadHeader(idHeaderRow);
1274 }
1275 UIHeader[] componentsInChildren = rectHeader.GetComponentsInChildren<UIHeader>(includeInactive: true);
1276 UIHeader[] array = componentsInChildren;
1277 for (int i = 0; i < array.Length; i++)
1278 {
1279 array[i].SetActive(enable: false);
1280 }
1281 for (int j = 0; j < list.Length - 3 && componentsInChildren.Length >= j + 1; j++)
1282 {
1283 componentsInChildren[j].SetActive(!list[j + 3].IsEmpty());
1284 componentsInChildren[j].SetText(list[j + 3]);
1285 }
1286 }
1287 }
1288
1289 public void SetCaption(string text)
1290 {
1291 textCaption.SetText(text);
1292 textCaption.RebuildLayout();
1293 }
1294
1295 public void AddHeader(string langLeft = null, string langRight = null)
1296 {
1297 if (!rectHeader)
1298 {
1299 LoadHeader();
1300 }
1301 UIHeader[] componentsInChildren = rectHeader.GetComponentsInChildren<UIHeader>(includeInactive: true);
1302 if (!langLeft.IsEmpty())
1303 {
1304 componentsInChildren[0].SetText(langLeft);
1305 }
1306 if (componentsInChildren.Length > 1)
1307 {
1308 if (langRight.IsEmpty())
1309 {
1310 componentsInChildren[1].SetActive(enable: false);
1311 }
1312 else
1313 {
1314 componentsInChildren[1].SetText(langRight);
1315 }
1316 }
1317 }
1318
1319 public void LoadHeader(string id = "HeaderRow")
1320 {
1321 ScrollRect componentInChildren = GetComponentInChildren<ScrollRect>();
1322 if ((bool)componentInChildren)
1323 {
1324 if ((bool)rectHeader)
1325 {
1326 UnityEngine.Object.DestroyImmediate(rectHeader.gameObject);
1327 }
1328 else
1329 {
1330 RectTransform viewport = componentInChildren.viewport;
1331 Vector2 sizeDelta = viewport.sizeDelta;
1332 sizeDelta.y -= 30f;
1333 viewport.anchoredPosition = sizeDelta;
1334 viewport.sizeDelta = sizeDelta;
1335 }
1336 Transform c = Util.Instantiate("UI/Element/Header/" + id, componentInChildren.transform);
1337 rectHeader = c.Rect();
1338 }
1339 }
1340
1341 public void SetPosition()
1342 {
1343 RectTransform rectTransform = this.Rect();
1344 rectTransform.pivot = new Vector2(0.5f, 0.5f);
1345 rectTransform.anchoredPosition = Vector2.zero;
1346 }
1347
1348 public T SetContent<T>(int tabIndex = -1, string id = null) where T : UIContent
1349 {
1350 T val = Util.Instantiate<T>("UI/Content/" + typeof(T).Name, view);
1351 SetContent(tabIndex, val);
1352 return val;
1353 }
1354
1355 public void SetContent(int tabIndex, UIContent content)
1356 {
1357 if (tabIndex != -1)
1358 {
1359 Setting.Tab tab = setting.tabs[tabIndex];
1360 if ((bool)tab.content && !tab.content.IsPrefab())
1361 {
1362 tab.content.SetActive(enable: false);
1363 }
1364 tab.content = content;
1365 tab.button = rectTab.GetComponentsInChildren<UIButton>()[tabIndex];
1366 }
1367 }
1368
1369 public T GetContent<T>() where T : UIContent
1370 {
1371 if ((bool)CurrentContent)
1372 {
1373 return CurrentContent as T;
1374 }
1375 return null;
1376 }
1377
1378 public bool NextTab(int a)
1379 {
1380 List<Setting.Tab> list = new List<Setting.Tab>();
1381 foreach (Setting.Tab tab in setting.tabs)
1382 {
1383 if (!tab.disable && (bool)tab.button)
1384 {
1385 list.Add(tab);
1386 }
1387 }
1388 if (list.Count > 1)
1389 {
1390 ((a < 0) ? list.NextItem(CurrentTab) : list.PrevItem(CurrentTab)).button._OnPress();
1391 return true;
1392 }
1393 return false;
1394 }
1395
1396 public void BuildTabs(int index = -1)
1397 {
1398 if (setting.tabs.Count > 0)
1399 {
1400 bool flag = false;
1401 foreach (Setting.Tab tab in setting.tabs)
1402 {
1403 if (!tab.button)
1404 {
1405 if (!flag && (bool)tab.customTab)
1406 {
1407 GameObject obj = new GameObject();
1408 obj.AddComponent<RectTransform>().sizeDelta = new Vector2(22f, 1f);
1409 obj.transform.SetParent(rectTab);
1410 flag = true;
1411 }
1412 UIButton uIButton = (tab.customTab ? Util.Instantiate(tab.customTab, rectTab) : (moldTab ? Util.Instantiate(moldTab, rectTab) : Util.Instantiate<UIButton>("UI/Window/Base/Element/ButtonTab", rectTab)));
1413 uIButton.mainText.SetLang(tab.idLang);
1414 tab.button = uIButton;
1415 if (!tab.langTooltip.IsEmpty())
1416 {
1417 uIButton.tooltip.enable = true;
1418 uIButton.tooltip.lang = tab.langTooltip;
1419 }
1420 if ((bool)tab.sprite)
1421 {
1422 uIButton.icon.sprite = tab.sprite;
1423 }
1424 if (tab.disable)
1425 {
1426 uIButton.SetActive(enable: false);
1427 }
1428 }
1429 tab.button.onClick.AddListener(delegate
1430 {
1431 SwitchContent(tab);
1432 });
1433 }
1434 }
1435 rectTab.SetActive(setting.tabs.Count > 1 || setting.alwaysShowTab);
1436 rectTab.RebuildLayout(recursive: true);
1437 if ((bool)groupTab)
1438 {
1439 groupTab.Init(index);
1440 }
1441 }
1442
1443 public Setting.Tab AddTab(string idLang, UIContent content = null, Action action = null, Sprite sprite = null, string langTooltip = null)
1444 {
1445 Setting.Tab tab = new Setting.Tab
1446 {
1447 idLang = idLang,
1448 content = content,
1449 action = action,
1450 sprite = sprite,
1451 langTooltip = langTooltip
1452 };
1453 setting.tabs.Add(tab);
1454 return tab;
1455 }
1456
1457 public int GetTab(UIContent content)
1458 {
1459 for (int i = 0; i < setting.tabs.Count; i++)
1460 {
1461 if (content == setting.tabs[i].content)
1462 {
1463 return i;
1464 }
1465 }
1466 return 0;
1467 }
1468
1469 public int GetTab(string name)
1470 {
1471 for (int i = 0; i < setting.tabs.Count; i++)
1472 {
1473 if (setting.tabs[i].content.name == name)
1474 {
1475 return i;
1476 }
1477 }
1478 return 0;
1479 }
1480
1482 {
1483 rectBottom.DestroyChildren();
1484 }
1485
1486 public UIButton AddBottomButton(string idLang, UnityAction onClick, bool setFirst = false)
1487 {
1488 UIButton uIButton = (moldBottom ? Util.Instantiate(moldBottom, rectBottom) : Util.Instantiate<UIButton>("UI/Window/Base/Element/ButtonBottom", rectBottom));
1489 uIButton.mainText.SetLang(idLang);
1490 uIButton.onClick.AddListener(onClick);
1491 if (setFirst)
1492 {
1493 uIButton.transform.SetAsFirstSibling();
1494 }
1495 uIButton.RebuildLayout(recursive: true);
1496 return uIButton;
1497 }
1498
1499 public void AddBottomSpace(int size = 20)
1500 {
1501 RectTransform rectTransform = new GameObject().AddComponent<RectTransform>();
1502 rectTransform.sizeDelta = new Vector2(size, 20f);
1503 rectTransform.SetParent(rectBottom, worldPositionStays: false);
1504 }
1505
1506 public void EnableShadow()
1507 {
1508 if (!imageBG)
1509 {
1510 return;
1511 }
1512 Shadow component = imageBG.GetComponent<Shadow>();
1513 if ((bool)component)
1514 {
1515 if (Skin.noShadow)
1516 {
1517 component.enabled = false;
1518 return;
1519 }
1520 component.effectColor = Skin.shadowColor;
1521 component.enabled = true;
1522 }
1523 }
1524
1525 public void SetInteractable(bool enable, float alpha = 0.5f)
1526 {
1527 cg.alpha = (enable ? 1f : alpha);
1528 GetComponent<GraphicRaycaster>().enabled = enable;
1529 }
1530
1531 public void Close()
1532 {
1533 if ((bool)layer)
1534 {
1536 }
1537 }
1538
1539 public void InitPanel()
1540 {
1541 if (!isStatic)
1542 {
1543 EventTrigger.Entry entry = new EventTrigger.Entry();
1544 entry.eventID = EventTriggerType.PointerEnter;
1545 entry.callback.AddListener(delegate(BaseEventData d)
1546 {
1547 OnPointerEnter(d as PointerEventData);
1548 });
1549 EventTrigger.triggers.Add(entry);
1550 entry = new EventTrigger.Entry();
1551 entry.eventID = EventTriggerType.PointerExit;
1552 entry.callback.AddListener(delegate(BaseEventData d)
1553 {
1554 OnPointerExit(d as PointerEventData);
1555 });
1556 EventTrigger.triggers.Add(entry);
1557 entry = new EventTrigger.Entry();
1558 entry.eventID = EventTriggerType.PointerDown;
1559 entry.callback.AddListener(delegate(BaseEventData d)
1560 {
1561 OnPointerDown(d as PointerEventData);
1562 });
1563 EventTrigger.triggers.Add(entry);
1564 entry = new EventTrigger.Entry();
1565 entry.eventID = EventTriggerType.PointerUp;
1566 entry.callback.AddListener(delegate(BaseEventData d)
1567 {
1568 OnPointerUp(d as PointerEventData);
1569 });
1570 EventTrigger.triggers.Add(entry);
1572 if (AutoAnchor)
1573 {
1574 SetAnchor();
1575 }
1576 ClampToScreen();
1577 }
1578 }
1579
1581 {
1582 if (!isStatic)
1583 {
1585 if (AutoAnchor)
1586 {
1587 SetAnchor();
1588 }
1590 ClampToScreen();
1591 }
1592 }
1593
1594 public void SetAnchor()
1595 {
1596 _rect.SetAnchor((saveData != null) ? saveData.customAnchor : RectPosition.Auto);
1597 }
1598
1600 {
1601 _frameInnerCorners = null;
1602 _frameOuterCorners = null;
1603 _captionCorners = null;
1604 }
1605
1606 public void OnApplicationFocus(bool focus)
1607 {
1609 IsProcessingMovement = false;
1610 IsResizingOverBottom = false;
1611 IsResizingOverLeft = false;
1612 IsResizingOverRight = false;
1613 }
1614
1615 private void Update()
1616 {
1618 if (isStatic)
1619 {
1620 return;
1621 }
1622 isTop = InputModuleEX.GetComponentOf<Window>() == this;
1623 if (isFloat && (bool)cgFloatMenu && cgFloatMenu.enabled)
1624 {
1625 bool flag = InputModuleEX.IsPointerOver(this) && (saveData == null || !saveData.shiftToShowMenu || Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift));
1626 floatAlpha = Mathf.Clamp(floatAlpha + (flag ? 2f : (-2f)) * Time.deltaTime * 1.5f, 0.5f, 1f);
1627 if ((bool)cgBG)
1628 {
1629 cgBG.alpha = floatAlpha;
1630 }
1631 float alpha = (floatAlpha - 0.5f) * 2f;
1632 if ((bool)cgFloatMenu)
1633 {
1634 cgFloatMenu.alpha = alpha;
1635 }
1636 cgFloatMenu.SetActive(cgFloatMenu.alpha > 0f);
1637 foreach (CanvasGroup item in listCgFloat)
1638 {
1639 item.alpha = alpha;
1640 }
1641 }
1642 if ((bool)attachedWindow)
1643 {
1644 Vector2 anchoredPosition = attachedWindow._rect.anchoredPosition;
1645 Vector2 anchoredPosition2 = new Vector2(anchoredPosition.x, anchoredPosition.y - attachedWindow._rect.sizeDelta.y) + attachFix;
1646 if (!_rect.anchorMin.Equals(attachedWindow._rect.anchorMin) || !_rect.anchorMax.Equals(attachedWindow._rect.anchorMax))
1647 {
1648 _rect.anchorMin = attachedWindow._rect.anchorMin;
1649 _rect.anchorMax = attachedWindow._rect.anchorMax;
1650 }
1651 if (_rect.anchoredPosition.x != anchoredPosition2.x || _rect.anchoredPosition.y != anchoredPosition2.y)
1652 {
1653 _rect.anchoredPosition = anchoredPosition2;
1654 }
1655 if (_rect.sizeDelta.x != attachedWindow._rect.sizeDelta.x)
1656 {
1657 _rect.sizeDelta = new Vector2(attachedWindow._rect.sizeDelta.x, _rect.sizeDelta.y);
1658 }
1659 rectCaption.SetActive(enable: false);
1660 }
1661 if (setting.dontBringToTop && base.transform.GetSiblingIndex() != 0)
1662 {
1663 base.transform.SetAsFirstSibling();
1664 }
1665 if (scrolling)
1666 {
1668 IsProcessingMovement = false;
1669 IsResizingOverBottom = false;
1670 IsResizingOverLeft = false;
1671 IsResizingOverRight = false;
1673 }
1674 else
1675 {
1677 {
1679 }
1681 {
1683 }
1685 {
1686 ProcessResize();
1687 }
1688 if (isTop)
1689 {
1691 {
1693 }
1695 {
1697 }
1699 {
1701 }
1702 }
1703 }
1704 if (Input.GetMouseButtonDown(0))
1705 {
1706 if ((bool)InputModuleEX.GetComponentOf<Scrollbar>())
1707 {
1708 scrolling = true;
1709 }
1711 {
1712 BringToTop();
1713 }
1714 }
1715 if (Input.GetMouseButtonUp(0))
1716 {
1718 {
1719 IsProcessingMovement = false;
1720 if (AutoAnchor)
1721 {
1722 SetAnchor();
1723 }
1724 }
1725 scrolling = false;
1728 {
1729 UIDynamicList[] componentsInChildren = GetComponentsInChildren<UIDynamicList>();
1730 for (int i = 0; i < componentsInChildren.Length; i++)
1731 {
1732 componentsInChildren[i].OnResizeWindow();
1733 }
1734 IsProcessingResize = false;
1735 }
1737 IsResizingOverTop = false;
1738 IsResizingOverBottom = false;
1739 IsResizingOverLeft = false;
1740 IsResizingOverRight = false;
1741 }
1742 LastScreenCursorPosition = Input.mousePosition;
1743 LastScreenCursorPosition.x = Mathf.Clamp(LastScreenCursorPosition.x, 0f, Canvas.pixelRect.width);
1744 LastScreenCursorPosition.y = Mathf.Clamp(LastScreenCursorPosition.y, 0f, Canvas.pixelRect.height);
1745 }
1746
1747 public void BringToTop()
1748 {
1749 if (!layer)
1750 {
1751 return;
1752 }
1753 int num = 0;
1754 foreach (Window window in layer.windows)
1755 {
1756 int siblingIndex = window.transform.GetSiblingIndex();
1757 if (siblingIndex > num)
1758 {
1759 num = siblingIndex;
1760 }
1761 }
1762 base.transform.SetSiblingIndex(num);
1763 }
1764
1765 public void ClampToScreen()
1766 {
1767 RectTransform rectTransform = base.transform.parent.Rect();
1768 RectTransform rectTransform2 = base.transform.Rect();
1769 Transform transform = base.transform;
1770 Vector3 localPosition = base.transform.localPosition;
1771 Vector3 vector = rectTransform.rect.min - rectTransform2.rect.min;
1772 Vector3 vector2 = rectTransform.rect.max - rectTransform2.rect.max;
1773 float num = ((setting.clampMargin.x == -1f) ? 20f : setting.clampMargin.x);
1774 float num2 = ((setting.clampMargin.y == -1f) ? 40f : setting.clampMargin.y);
1775 localPosition.x = Mathf.Clamp(transform.localPosition.x, vector.x + num - 50f, vector2.x - num);
1776 localPosition.y = Mathf.Clamp(transform.localPosition.y, vector.y + num2 - 50f, vector2.y - num2 + 50f);
1777 transform.localPosition = localPosition;
1778 }
1779
1780 private void OnPointerEnter(PointerEventData data)
1781 {
1782 IsProcessingCursorChanges = !Input.GetMouseButton(0);
1783 }
1784
1785 private void OnPointerExit(PointerEventData data)
1786 {
1788 if (!IsProcessingResize && !Input.GetMouseButton(0))
1789 {
1791 }
1792 }
1793
1794 private void OnPointerDown(PointerEventData data)
1795 {
1796 if (data.button == PointerEventData.InputButton.Left && !(EInput.dragHack < 0.1f))
1797 {
1798 base.transform.SetAsLastSibling();
1800 IsResizingOverBottom = setting.allowResize && CursorOverBottomBorder();
1801 IsResizingOverLeft = setting.allowResize && CursorOverLeftBorder();
1802 IsResizingOverRight = setting.allowResize && CursorOverRightBorder();
1804 dragStartPos = Input.mousePosition;
1805 dragOffset = base.transform.position - dragStartPos;
1807 }
1808 }
1809
1810 private void OnPointerUp(PointerEventData data)
1811 {
1812 }
1813
1815 {
1817 {
1819 {
1820 SetCursor(CursorSystem.ResizeNWSE);
1821 }
1823 {
1824 SetCursor(CursorSystem.ResizeNESW);
1825 }
1827 {
1828 SetCursor(CursorSystem.ResizeNS);
1829 }
1831 {
1832 SetCursor(CursorSystem.ResizeWE);
1833 }
1834 }
1835 void SetCursor(CursorInfo info)
1836 {
1837 Window topComponentOf = InputModuleEX.GetTopComponentOf<Window>();
1838 if (!topComponentOf || !(topComponentOf != this))
1839 {
1840 CursorSystem.SetCursor(info);
1841 }
1842 }
1843 }
1844
1845 private void ProcessMovement()
1846 {
1847 Vector3 mousePosition = Input.mousePosition;
1848 mousePosition.x = Mathf.Clamp(mousePosition.x, 0f, Canvas.pixelRect.width);
1849 mousePosition.y = Mathf.Clamp(mousePosition.y, 0f, Canvas.pixelRect.height);
1850 base.transform.position = Input.mousePosition + dragOffset;
1851 ClampToScreen();
1852 }
1853
1854 private void ProcessResize()
1855 {
1856 Vector3 vector = Input.mousePosition;
1857 vector.x = Mathf.Clamp(vector.x, 0f, Canvas.pixelRect.width);
1858 vector.y = Mathf.Clamp(vector.y, 0f, Canvas.pixelRect.height);
1859 Vector3 vector2 = LastScreenCursorPosition;
1860 Vector3 vector3 = vector - vector2;
1861 if (vector3.x == 0f && vector3.y == 0f)
1862 {
1863 return;
1864 }
1865 if (Canvas.renderMode == RenderMode.ScreenSpaceCamera)
1866 {
1867 vector = Canvas.worldCamera.ScreenToWorldPoint(new Vector3(vector.x, vector.y, Canvas.planeDistance));
1868 vector2 = Canvas.worldCamera.ScreenToWorldPoint(new Vector3(vector2.x, vector2.y, Canvas.planeDistance));
1869 }
1870 Vector3 vector4 = vector - vector2;
1871 Vector3 position = RectTransform.position;
1872 Vector2 sizeDelta = RectTransform.sizeDelta;
1873 Vector2 size = RectTransform.rect.size;
1874 Vector3 zero = Vector3.zero;
1875 Vector2 zero2 = Vector2.zero;
1876 Rect bound = setting.bound;
1877 float x = bound.x;
1878 float y = bound.y;
1879 float width = bound.width;
1880 float height = bound.height;
1882 {
1883 if (RectTransform.anchorMin.y == RectTransform.anchorMax.y)
1884 {
1886 {
1887 float num = sizeDelta.y + vector3.y;
1888 if (num > y && num < height)
1889 {
1890 zero.y = vector4.y * RectTransform.pivot.y;
1891 zero2.y = vector3.y;
1892 }
1893 }
1894 else if (IsResizingOverBottom)
1895 {
1896 float num2 = sizeDelta.y - vector3.y;
1897 if (num2 > y && num2 < height)
1898 {
1899 zero.y = vector4.y * (1f - RectTransform.pivot.y);
1900 zero2.y = 0f - vector3.y;
1901 }
1902 }
1903 position.y += zero.y;
1904 sizeDelta.y += zero2.y / CorrectedLossyScale.y;
1905 }
1906 else
1907 {
1909 {
1910 float num3 = size.y + vector3.y;
1911 if (num3 > y && num3 < height)
1912 {
1913 zero.y = vector4.y * RectTransform.pivot.y;
1914 zero2.y = vector3.y;
1915 }
1916 }
1917 else if (IsResizingOverBottom)
1918 {
1919 float num4 = size.y - vector3.y;
1920 if (num4 > y && num4 < height)
1921 {
1922 zero.y = vector4.y * (1f - RectTransform.pivot.y);
1923 zero2.y = 0f - vector3.y;
1924 }
1925 }
1926 position.y += zero.y;
1927 sizeDelta.y += zero2.y / CorrectedLossyScale.y;
1928 }
1929 }
1931 {
1932 if (RectTransform.anchorMin.x == RectTransform.anchorMax.x)
1933 {
1935 {
1936 float num5 = sizeDelta.x + vector3.x;
1937 if (num5 > x && num5 < width)
1938 {
1939 zero.x = vector4.x * RectTransform.pivot.x;
1940 zero2.x = vector3.x;
1941 }
1942 }
1943 else if (IsResizingOverLeft)
1944 {
1945 float num6 = sizeDelta.x - vector3.x;
1946 if (num6 > x && num6 < width)
1947 {
1948 zero.x = vector4.x * (1f - RectTransform.pivot.x);
1949 zero2.x = 0f - vector3.x;
1950 }
1951 }
1952 position.x += zero.x;
1953 sizeDelta.x += zero2.x / CorrectedLossyScale.x;
1954 }
1955 else
1956 {
1958 {
1959 float num7 = size.x + vector3.x;
1960 if (num7 > x && num7 < width)
1961 {
1962 zero.x = vector4.x * RectTransform.pivot.x;
1963 zero2.x = vector3.x;
1964 }
1965 }
1966 else if (IsResizingOverLeft)
1967 {
1968 float num8 = size.x - vector3.x;
1969 if (num8 > x && num8 < width)
1970 {
1971 zero.x = vector4.x * (1f - RectTransform.pivot.x);
1972 zero2.x = 0f - vector3.x;
1973 }
1974 }
1975 position.x += zero.x;
1976 sizeDelta.x += zero2.x / CorrectedLossyScale.x;
1977 }
1978 }
1979 if (setting.resizeGrid != Vector2.zero)
1980 {
1981 sizeDelta.x = setting.resizeGrid.x * (float)(int)(sizeDelta.x / setting.resizeGrid.x);
1982 sizeDelta.y = setting.resizeGrid.y * (float)(int)(sizeDelta.y / setting.resizeGrid.y);
1983 }
1984 RectTransform.sizeDelta = sizeDelta;
1985 RectTransform.position = position;
1987 this.RebuildLayout(recursive: true);
1988 }
1989
1990 private bool CursorOverTopBorder(bool canExceed = false)
1991 {
1992 return false;
1993 }
1994
1995 private bool CursorOverBottomBorder(bool canExceed = false)
1996 {
1997 UIButton componentOf = InputModuleEX.GetComponentOf<UIButton>();
1998 if ((bool)componentOf && componentOf.GetComponentInParent<Window>() == this)
1999 {
2000 return false;
2001 }
2002 if (canExceed)
2003 {
2004 return LastScreenCursorPosition.y <= FrameInnerCorners[0].y;
2005 }
2007 {
2008 return LastScreenCursorPosition.x <= FrameOuterCorners[2].x;
2009 }
2010 return false;
2011 }
2012
2013 private bool CursorOverLeftBorder(bool canExceed = false)
2014 {
2015 if (canExceed)
2016 {
2017 return LastScreenCursorPosition.x <= FrameInnerCorners[0].x;
2018 }
2020 {
2021 return LastScreenCursorPosition.y <= FrameOuterCorners[1].y;
2022 }
2023 return false;
2024 }
2025
2026 private bool CursorOverRightBorder(bool canExceed = false)
2027 {
2028 Scrollbar componentOf = InputModuleEX.GetComponentOf<Scrollbar>();
2029 if ((bool)componentOf && componentOf.GetComponentInParent<Window>() == this)
2030 {
2031 return false;
2032 }
2033 UIButton componentOf2 = InputModuleEX.GetComponentOf<UIButton>();
2034 if ((bool)componentOf2 && componentOf2.GetComponentInParent<Window>() == this)
2035 {
2036 return false;
2037 }
2038 if (canExceed)
2039 {
2040 return LastScreenCursorPosition.x >= FrameInnerCorners[3].x;
2041 }
2043 {
2044 return LastScreenCursorPosition.y <= FrameOuterCorners[1].y;
2045 }
2046 return false;
2047 }
2048
2049 private bool CursorOverCaption()
2050 {
2051 foreach (GameObject item in InputModuleEX.GetList())
2052 {
2053 if (item != null && (bool)item.GetComponent<ScrollRect>())
2054 {
2055 return false;
2056 }
2057 }
2058 return true;
2059 }
2060
2061 private bool CursorOverWindow()
2062 {
2064 {
2065 return LastScreenCursorPosition.y <= FrameOuterCorners[1].y;
2066 }
2067 return false;
2068 }
2069}
AutodumpFlag
Definition: AutodumpFlag.cs:2
ContainerFlag
Definition: ContainerFlag.cs:5
ContainerSharedType
ImageType
Definition: ImageType.cs:2
RectPosition
Definition: RectPosition.cs:2
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
Definition: Anime.cs:6
virtual float uiScale
Definition: BaseCore.cs:46
static BaseCore Instance
Definition: BaseCore.cs:11
List< Action > actionsLateUpdate
Definition: BaseCore.cs:29
static CursorInfo ResizeWE
Definition: CursorSystem.cs:50
static CursorInfo ResizeNWSE
Definition: CursorSystem.cs:52
static void SetCursor(CursorInfo info=null, int _priority=0)
static CursorInfo ResizeNS
Definition: CursorSystem.cs:48
static CursorInfo ResizeNESW
Definition: CursorSystem.cs:54
Definition: EInput.cs:8
static Vector3 uiMousePosition
Definition: EInput.cs:369
static float dragHack
Definition: EInput.cs:327
static bool IsPointerOver(Component c)
static List< GameObject > GetList()
static int ToInt(ref Color c)
Definition: IntColor.cs:24
static Color32 FromInt(int i)
Definition: IntColor.cs:15
Definition: Lang.cs:6
static string[] GetList(string id)
Definition: Lang.cs:114
bool canClose
Definition: Layer.cs:29
Definition: Layer.cs:9
Option option
Definition: Layer.cs:84
virtual void OnSwitchContent(Window window)
Definition: Layer.cs:684
void OnClickClose()
Definition: Layer.cs:455
List< Window > windows
Definition: Layer.cs:116
virtual string GetTextHeader(Window window)
Definition: Layer.cs:131
void Apply(RectTransform rect)
Definition: RectData.cs:17
static SkinRootStatic CurrentSkin
Definition: SkinManager.cs:82
SkinColorProfileEx colorsEx
Positions positions
UIText mainText
Definition: UIButton.cs:102
virtual void OnSwitchContent(int idTab)
Definition: UIContent.cs:3
virtual void OnInstantiate()
Definition: UIContent.cs:7
void OnResizeWindow()
void SetText(string s)
Definition: UIHeader.cs:24
Image frame
Definition: UIImage.cs:16
Definition: UIList.cs:9
SortMode
Definition: UIList.cs:27
void Select(UIButton button, bool check=true)
virtual void Init(int index=0, UnityAction< int > action=null, bool directChildren=false)
Definition: UIText.cs:6
void SetText(string s)
Definition: UIText.cs:159
void SetLang(string idLang)
Definition: UIText.cs:240
virtual void OnSwitchContent(Window window)
LayoutGroup layout
Definition: WindowMenu.cs:11
FilterResult IsFilterPass(string text)
Definition: Window.cs:498
ContainerSharedType sharedType
Definition: Window.cs:243
CategoryType category
Definition: Window.cs:303
bool shiftToShowMenu
Definition: Window.cs:487
bool excludeDump
Definition: Window.cs:367
bool sort_ascending
Definition: Window.cs:475
RectPosition customAnchor
Definition: Window.cs:291
bool excludeCraft
Definition: Window.cs:379
string[] BuildFilter()
Definition: Window.cs:534
ContainerFlag flag
Definition: Window.cs:267
string filter
Definition: Window.cs:122
bool noRightClickClose
Definition: Window.cs:391
HashSet< int > cats
Definition: Window.cs:119
bool userFilter
Definition: Window.cs:132
bool compress
Definition: Window.cs:415
bool noRotten
Definition: Window.cs:439
UIList.SortMode sortMode
Definition: Window.cs:315
int[] filterOptions
Definition: Window.cs:128
bool fixedPos
Definition: Window.cs:403
bool onlyRottable
Definition: Window.cs:451
bool advDistribution
Definition: Window.cs:427
bool alwaysSort
Definition: Window.cs:463
RectPosition anchor
Definition: Window.cs:195
BitArray32 b1
Definition: Window.cs:130
void CopyFrom(SaveData data)
Definition: Window.cs:578
void _OnDeserialized(StreamingContext context)
Definition: Window.cs:569
string[] _filterStrs
Definition: Window.cs:125
AutodumpFlag autodump
Definition: Window.cs:207
void OnSerializing(StreamingContext context)
Definition: Window.cs:563
string[] filterStrs
Definition: Window.cs:135
bool firstSorted
Definition: Window.cs:355
int[] ints
Definition: Window.cs:116
Color32 color
Definition: Window.cs:231
Button.ButtonClickedEvent action
Definition: Window.cs:50
Sprite sprite
Definition: Window.cs:39
string langTooltip
Definition: Window.cs:29
UIButton customTab
Definition: Window.cs:41
Action action
Definition: Window.cs:35
string idLang
Definition: Window.cs:27
UIButton button
Definition: Window.cs:33
UIContent content
Definition: Window.cs:31
object refObj
Definition: Window.cs:43
bool allowResize
Definition: Window.cs:63
Vector2 clampMargin
Definition: Window.cs:89
bool transparent
Definition: Window.cs:71
Rect bound
Definition: Window.cs:57
string rightMenuAlias
Definition: Window.cs:93
Sprite spriteCaption
Definition: Window.cs:55
bool openLastTab
Definition: Window.cs:75
bool tabAfterCaption
Definition: Window.cs:73
bool bottomBack
Definition: Window.cs:67
string textCaption
Definition: Window.cs:53
bool saveWindow
Definition: Window.cs:65
Anime anime
Definition: Window.cs:83
bool alwaysShowTab
Definition: Window.cs:77
bool dontBringToTop
Definition: Window.cs:69
Vector2 posFix
Definition: Window.cs:85
bool asWidget
Definition: Window.cs:59
bool usePosFix
Definition: Window.cs:87
bool allowMove
Definition: Window.cs:61
List< Tab > tabs
Definition: Window.cs:81
Type type
Definition: Window.cs:79
Vector2 resizeGrid
Definition: Window.cs:91
Definition: Window.cs:13
SaveData saveData
Definition: Window.cs:724
UISelectableGroup groupTab
Definition: Window.cs:658
void ProcessCursorChanges()
Definition: Window.cs:1814
bool IsResizingOverTop
Definition: Window.cs:754
Canvas _canvas
Definition: Window.cs:734
RectTransform _rectTransform
Definition: Window.cs:738
void RefreshTipPivotPosition()
Definition: Window.cs:1071
bool isStatic
Definition: Window.cs:932
WindowMenu menuLeftBottom
Definition: Window.cs:703
UIButton buttonExtra
Definition: Window.cs:632
Vector3 LastScreenCursorPosition
Definition: Window.cs:762
bool CursorOverCaption()
Definition: Window.cs:2049
static bool openLastTab
Definition: Window.cs:598
void SwitchContent(UIContent content)
Definition: Window.cs:1198
UIButton buttonShared
Definition: Window.cs:634
WindowMenu menuRight
Definition: Window.cs:709
void SetInteractable(bool enable, float alpha=0.5f)
Definition: Window.cs:1525
float FrameOffsetR
Definition: Window.cs:683
void OnKill()
Definition: Window.cs:1116
Tween tweenAnime
Definition: Window.cs:664
int windowIndex
Definition: Window.cs:697
Vector3 dragStartPos
Definition: Window.cs:764
SkinRootStatic skinRoot
Definition: Window.cs:662
void BuildTabs(int index=-1)
Definition: Window.cs:1396
Image iconCaption
Definition: Window.cs:614
bool IsProcessingMovement
Definition: Window.cs:750
UIButton buttonSort
Definition: Window.cs:628
void SetPosition()
Definition: Window.cs:1341
float CaptionHeight
Definition: Window.cs:689
Setting.Tab CurrentTab
Definition: Window.cs:787
void SetCaption(string text)
Definition: Window.cs:1289
UIButton buttonHelp
Definition: Window.cs:626
Window attachedWindow
Definition: Window.cs:730
UIButton buttonQuickSort
Definition: Window.cs:630
Vector3[] _captionCorners
Definition: Window.cs:746
Vector3[] FrameOuterCorners
Definition: Window.cs:887
UIContent CurrentContent
Definition: Window.cs:799
RectTransform RectTransform
Definition: Window.cs:863
bool CursorOverTopBorder(bool canExceed=false)
Definition: Window.cs:1990
Vector3[] _frameInnerCorners
Definition: Window.cs:744
void ProcessMovement()
Definition: Window.cs:1845
void Init(Layer _layer=null)
Definition: Window.cs:970
Canvas Canvas
Definition: Window.cs:839
int GetTab(UIContent content)
Definition: Window.cs:1457
RectTransform rectDeco
Definition: Window.cs:654
bool CursorOverLeftBorder(bool canExceed=false)
Definition: Window.cs:2013
UIText textCaption
Definition: Window.cs:610
UIButton AddBottomButton(string idLang, UnityAction onClick, bool setFirst=false)
Definition: Window.cs:1486
Setting setting
Definition: Window.cs:606
UIContent SwitchContent(int index)
Definition: Window.cs:1213
CanvasGroup cgFloatMenu
Definition: Window.cs:668
void SetRect(RectData data, bool mousePos=false)
Definition: Window.cs:1084
void ClampToScreen()
Definition: Window.cs:1765
Vector2 posBottom
Definition: Window.cs:715
void Update()
Definition: Window.cs:1615
int idTab
Definition: Window.cs:694
Vector3 CorrectedLossyScale
Definition: Window.cs:875
float frameOffsetY
Definition: Window.cs:691
CanvasGroup cg
Definition: Window.cs:712
bool leftSide
Definition: Window.cs:602
RectTransform rectBottom
Definition: Window.cs:646
EventTrigger _eventTrigger
Definition: Window.cs:736
Image deco2
Definition: Window.cs:618
bool IsResizingOverLeft
Definition: Window.cs:758
Vector3 _correctedLossyScale
Definition: Window.cs:740
Vector2 attachFix
Definition: Window.cs:732
RectTransform tipPiovotLeft
Definition: Window.cs:650
WindowController controller
Definition: Window.cs:660
bool CursorOverRightBorder(bool canExceed=false)
Definition: Window.cs:2026
void OnPointerEnter(PointerEventData data)
Definition: Window.cs:1780
LayoutGroup layoutWindow
Definition: Window.cs:679
Vector3 dragOffset
Definition: Window.cs:766
T SetContent< T >(int tabIndex=-1, string id=null)
Definition: Window.cs:1348
void Awake()
Definition: Window.cs:934
void InitPanel()
Definition: Window.cs:1539
static Dictionary< string, SaveData > dictData
Definition: Window.cs:594
void ClearBottomButtons()
Definition: Window.cs:1481
UIImage bgCaption
Definition: Window.cs:622
void OnChangeResolution()
Definition: Window.cs:1580
Image deco1
Definition: Window.cs:616
void ProcessResize()
Definition: Window.cs:1854
void OnApplicationFocus(bool focus)
Definition: Window.cs:1606
T GetContent< T >()
Definition: Window.cs:1369
float FrameOffsetTop
Definition: Window.cs:685
void LoadHeader(string id="HeaderRow")
Definition: Window.cs:1319
UICollider bgCollider
Definition: Window.cs:670
RectTransform tipPivotRight
Definition: Window.cs:652
static bool animateWindow
Definition: Window.cs:600
void AddBottomSpace(int size=20)
Definition: Window.cs:1499
string idWindow
Definition: Window.cs:775
float floatAlpha
Definition: Window.cs:772
bool IsResizingOverBottom
Definition: Window.cs:756
Button buttonClose
Definition: Window.cs:624
UIText textStats
Definition: Window.cs:612
void SetContent(int tabIndex, UIContent content)
Definition: Window.cs:1355
void Close()
Definition: Window.cs:1531
void UpdateSaveData()
Definition: Window.cs:1093
Vector2 posTab
Definition: Window.cs:718
EventTrigger EventTrigger
Definition: Window.cs:851
List< CanvasGroup > listCgFloat
Definition: Window.cs:672
Setting.Tab AddTab(string idLang, UIContent content=null, Action action=null, Sprite sprite=null, string langTooltip=null)
Definition: Window.cs:1443
void EnableShadow()
Definition: Window.cs:1506
RectTransform rectHeader
Definition: Window.cs:656
RectTransform _rect
Definition: Window.cs:674
void SwitchContent(string name)
Definition: Window.cs:1203
float FrameOffsetL
Definition: Window.cs:681
bool AutoAnchor
Definition: Window.cs:811
bool isFloat
Definition: Window.cs:604
void SetAnchor()
Definition: Window.cs:1594
SkinRootStatic Skin
Definition: Window.cs:827
bool scrolling
Definition: Window.cs:768
int GetTab(string name)
Definition: Window.cs:1469
void OnPointerUp(PointerEventData data)
Definition: Window.cs:1810
Layer layer
Definition: Window.cs:677
RectTransform rectCorner
Definition: Window.cs:640
T SwitchContent< T >()
Definition: Window.cs:1192
RectTransform rectCaption
Definition: Window.cs:642
RectTransform rectTab
Definition: Window.cs:644
void ApplySkin()
Definition: Window.cs:1129
bool? shadowEnabled
Definition: Window.cs:726
bool IsProcessingResize
Definition: Window.cs:752
void SwitchContent(Setting.Tab tab)
Definition: Window.cs:1208
bool isTop
Definition: Window.cs:770
float FrameThickness
Definition: Window.cs:687
void BringToTop()
Definition: Window.cs:1747
Type
Definition: Window.cs:15
bool CursorOverWindow()
Definition: Window.cs:2061
void OnPointerDown(PointerEventData data)
Definition: Window.cs:1794
bool CursorOverBottomBorder(bool canExceed=false)
Definition: Window.cs:1995
RectTransform rectStats
Definition: Window.cs:648
bool IsProcessingCursorChanges
Definition: Window.cs:748
CanvasGroup cgBG
Definition: Window.cs:666
bool NextTab(int a)
Definition: Window.cs:1378
void OnPointerExit(PointerEventData data)
Definition: Window.cs:1785
static Dictionary< string, int > dictTab
Definition: Window.cs:596
Vector3[] _frameOuterCorners
Definition: Window.cs:742
UIImage imageBG
Definition: Window.cs:620
Vector3[] CaptionCorners
Definition: Window.cs:913
WindowMenu menuBottom
Definition: Window.cs:706
UIButton moldTab
Definition: Window.cs:636
WindowMenu menuLeft
Definition: Window.cs:700
void AddHeader(string langLeft=null, string langRight=null)
Definition: Window.cs:1295
UIButton moldBottom
Definition: Window.cs:638
void SetTitles(string langList, string idHeaderRow=null)
Definition: Window.cs:1262
void RecalculatePositionCaches()
Definition: Window.cs:1599
Shadow bgShadow
Definition: Window.cs:728
Vector3[] FrameInnerCorners
Definition: Window.cs:900
UIContentView view
Definition: Window.cs:608
bool IsResizingOverRight
Definition: Window.cs:760
Vector2 posCaption
Definition: Window.cs:721
uint Bits
Definition: BitArray32.cs:6