2using System.Collections.Generic;
3using System.Runtime.Serialization;
7using UnityEngine.EventSystems;
8using UnityEngine.Events;
11[RequireComponent(typeof(RectTransform), typeof(EventTrigger))]
50 public Button.ButtonClickedEvent
action;
57 public Rect
bound =
new Rect(400f, 300f, 1000f, 1000f);
97 [JsonObject(MemberSerialization.OptIn)]
116 public int[]
ints =
new int[20];
119 public HashSet<int>
cats =
new HashSet<int>();
150 return 0.01f * (float)
ints[1];
154 ints[1] = (int)(value * 100f);
162 return 0.01f * (float)
ints[2];
166 ints[2] = (int)(value * 100f);
174 return 0.01f * (float)
ints[3];
178 ints[3] = (int)(value * 100f);
186 return 0.01f * (float)
ints[4];
190 ints[4] = (int)(value * 100f);
202 ints[5] = (int)value;
214 ints[6] = (int)value;
250 ints[9] = (int)value;
274 ints[11] = (int)value;
298 ints[13] = (int)value;
310 ints[14] = (int)value;
326 ints[15] = (int)value;
571 if (
ints.Length < 20)
573 Array.Resize(ref
ints, 20);
575 b1.Bits = (uint)
ints[0];
580 for (
int i = 0; i <
ints.Length; i++)
582 if (i != 1 && i != 2)
589 b1.Bits = (uint)
ints[0];
594 public static Dictionary<string, SaveData>
dictData =
new Dictionary<string, SaveData>();
596 public static Dictionary<string, int>
dictTab =
new Dictionary<string, int>();
712 public CanvasGroup
cg;
778 if (!(
layer ==
null))
844 _canvas = GetComponentInParent<Canvas>();
919 for (
int i = 0; i < 4; i++)
939 controller.window =
this;
945 if (!base.gameObject.GetComponent<
Canvas>())
947 base.gameObject.AddComponent<
Canvas>();
948 base.gameObject.AddComponent<GraphicRaycaster>();
950 cg = base.gameObject.GetComponent<CanvasGroup>();
953 cg = base.gameObject.AddComponent<CanvasGroup>();
976 setting.allowResize =
false;
977 setting.saveWindow =
false;
1039 case Type.AlignToMouse:
1040 leftSide = Input.mousePosition.x > (float)Screen.width / 1.5f;
1042 _rect.position = Input.mousePosition +
new Vector3(60f * (
leftSide ? (-1f) : 1f), 0f, 0f);
1046 leftSide = Input.mousePosition.x > (float)Screen.width / 1.7f;
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"));
1057 GameObject go = base.gameObject;
1066 tweenAnime = setting.anime.Play(this.Rect());
1073 bool flag = (float)(Screen.width / 2 - 40) > base.transform.position.x;
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;
1121 saveData.open =
false;
1138 Image image =
deco1;
1140 image.color = color2;
1155 image2.GetComponent<Shadow>().enabled =
shadowEnabled.GetValueOrDefault();
1158 bgShadow.enabled =
false;
1166 if ((
bool)component)
1221 if ((
bool)tab2.content && !tab2.content.IsPrefab())
1223 tab2.content.SetActive(tab2 == tab);
1235 tab.
content.SetActive(enable:
true);
1238 tab.
content.SetActive(enable:
true);
1246 if (!text.IsEmpty())
1255 else if ((
bool)
layer)
1262 public void SetTitles(
string langList,
string idHeaderRow =
null)
1265 if (!list[0].IsEmpty())
1269 if (list.Length >= 3)
1276 UIHeader[] array = componentsInChildren;
1277 for (
int i = 0; i < array.Length; i++)
1279 array[i].SetActive(enable:
false);
1281 for (
int j = 0; j < list.Length - 3 && componentsInChildren.Length >= j + 1; j++)
1283 componentsInChildren[j].SetActive(!list[j + 3].IsEmpty());
1284 componentsInChildren[j].
SetText(list[j + 3]);
1295 public void AddHeader(
string langLeft =
null,
string langRight =
null)
1302 if (!langLeft.IsEmpty())
1304 componentsInChildren[0].
SetText(langLeft);
1306 if (componentsInChildren.Length > 1)
1308 if (langRight.IsEmpty())
1310 componentsInChildren[1].SetActive(enable:
false);
1314 componentsInChildren[1].
SetText(langRight);
1321 ScrollRect componentInChildren = GetComponentInChildren<ScrollRect>();
1322 if ((
bool)componentInChildren)
1326 UnityEngine.Object.DestroyImmediate(
rectHeader.gameObject);
1331 Vector2 sizeDelta = viewport.sizeDelta;
1333 viewport.anchoredPosition = sizeDelta;
1334 viewport.sizeDelta = sizeDelta;
1336 Transform c =
Util.Instantiate(
"UI/Element/Header/" +
id, componentInChildren.transform);
1344 rectTransform.pivot =
new Vector2(0.5f, 0.5f);
1345 rectTransform.anchoredPosition = Vector2.zero;
1350 T val =
Util.Instantiate<T>(
"UI/Content/" + typeof(T).Name,
view);
1362 tab.
content.SetActive(enable:
false);
1364 tab.content = content;
1383 if (!tab.disable && (
bool)tab.button)
1405 if (!flag && (
bool)tab.customTab)
1407 GameObject obj =
new GameObject();
1408 obj.AddComponent<
RectTransform>().sizeDelta =
new Vector2(22f, 1f);
1409 obj.transform.SetParent(
rectTab);
1414 tab.button = uIButton;
1415 if (!tab.langTooltip.IsEmpty())
1417 uIButton.tooltip.enable =
true;
1418 uIButton.tooltip.lang = tab.langTooltip;
1420 if ((
bool)tab.sprite)
1422 uIButton.icon.sprite = tab.sprite;
1426 uIButton.SetActive(enable:
false);
1429 tab.button.onClick.AddListener(delegate
1436 rectTab.RebuildLayout(recursive:
true);
1451 langTooltip = langTooltip
1490 uIButton.onClick.AddListener(onClick);
1493 uIButton.transform.SetAsFirstSibling();
1495 uIButton.RebuildLayout(recursive:
true);
1502 rectTransform.sizeDelta =
new Vector2(size, 20f);
1503 rectTransform.SetParent(
rectBottom, worldPositionStays:
false);
1512 Shadow component =
imageBG.GetComponent<Shadow>();
1513 if ((
bool)component)
1517 component.enabled =
false;
1521 component.enabled =
true;
1527 cg.alpha = (enable ? 1f : alpha);
1528 GetComponent<GraphicRaycaster>().enabled = enable;
1544 entry.eventID = EventTriggerType.PointerEnter;
1545 entry.callback.AddListener(delegate(BaseEventData d)
1551 entry.eventID = EventTriggerType.PointerExit;
1552 entry.callback.AddListener(delegate(BaseEventData d)
1558 entry.eventID = EventTriggerType.PointerDown;
1559 entry.callback.AddListener(delegate(BaseEventData d)
1565 entry.eventID = EventTriggerType.PointerUp;
1566 entry.callback.AddListener(delegate(BaseEventData d)
1625 bool flag =
InputModuleEX.
IsPointerOver(
this) && (
saveData ==
null || !saveData.shiftToShowMenu || Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift));
1634 cgFloatMenu.alpha = alpha;
1651 if (
_rect.anchoredPosition.x != anchoredPosition2.x ||
_rect.anchoredPosition.y != anchoredPosition2.y)
1653 _rect.anchoredPosition = anchoredPosition2;
1663 base.transform.SetAsFirstSibling();
1704 if (Input.GetMouseButtonDown(0))
1715 if (Input.GetMouseButtonUp(0))
1729 UIDynamicList[] componentsInChildren = GetComponentsInChildren<UIDynamicList>();
1730 for (
int i = 0; i < componentsInChildren.Length; i++)
1756 int siblingIndex = window.transform.GetSiblingIndex();
1757 if (siblingIndex > num)
1762 base.transform.SetSiblingIndex(num);
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;
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;
1796 if (data.button == PointerEventData.InputButton.Left && !(
EInput.
dragHack < 0.1f))
1798 base.transform.SetAsLastSibling();
1838 if (!topComponentOf || !(topComponentOf !=
this))
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;
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);
1860 Vector3 vector3 = vector - vector2;
1861 if (vector3.x == 0f && vector3.y == 0f)
1865 if (
Canvas.renderMode == RenderMode.ScreenSpaceCamera)
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));
1870 Vector3 vector4 = vector - vector2;
1874 Vector3 zero = Vector3.zero;
1875 Vector2 zero2 = Vector2.zero;
1879 float width = bound.width;
1880 float height = bound.height;
1887 float num = sizeDelta.y + vector3.y;
1888 if (num > y && num < height)
1891 zero2.y = vector3.y;
1896 float num2 = sizeDelta.y - vector3.y;
1897 if (num2 > y && num2 < height)
1900 zero2.y = 0f - vector3.y;
1903 position.y += zero.y;
1910 float num3 = size.y + vector3.y;
1911 if (num3 > y && num3 < height)
1914 zero2.y = vector3.y;
1919 float num4 = size.y - vector3.y;
1920 if (num4 > y && num4 < height)
1923 zero2.y = 0f - vector3.y;
1926 position.y += zero.y;
1936 float num5 = sizeDelta.x + vector3.x;
1937 if (num5 > x && num5 < width)
1940 zero2.x = vector3.x;
1945 float num6 = sizeDelta.x - vector3.x;
1946 if (num6 > x && num6 < width)
1949 zero2.x = 0f - vector3.x;
1952 position.x += zero.x;
1959 float num7 = size.x + vector3.x;
1960 if (num7 > x && num7 < width)
1963 zero2.x = vector3.x;
1968 float num8 = size.x - vector3.x;
1969 if (num8 > x && num8 < width)
1972 zero2.x = 0f - vector3.x;
1975 position.x += zero.x;
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);
1984 RectTransform.sizeDelta = sizeDelta;
1985 RectTransform.position = position;
1987 this.RebuildLayout(recursive:
true);
1998 if ((
bool)componentOf && componentOf.GetComponentInParent<
Window>() ==
this)
2028 Scrollbar componentOf =
InputModuleEX.GetComponentOf<Scrollbar>();
2029 if ((
bool)componentOf && componentOf.GetComponentInParent<
Window>() ==
this)
2034 if ((
bool)componentOf2 && componentOf2.GetComponentInParent<
Window>() ==
this)
2053 if (
item !=
null && (
bool)
item.GetComponent<ScrollRect>())
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
List< Action > actionsLateUpdate
static CursorInfo ResizeWE
static CursorInfo ResizeNWSE
static void SetCursor(CursorInfo info=null, int _priority=0)
static CursorInfo ResizeNS
static CursorInfo ResizeNESW
static int ToInt(ref Color c)
static Color32 FromInt(int i)
static string[] GetList(string id)
virtual void OnSwitchContent(Window window)
virtual string GetTextHeader(Window window)
void Apply(RectTransform rect)
static SkinRootStatic CurrentSkin
SkinColorProfileEx colorsEx
virtual void OnSwitchContent(int idTab)
virtual void OnInstantiate()
void Select(UIButton button, bool check=true)
virtual void Init(int index=0, UnityAction< int > action=null, bool directChildren=false)
void SetLang(string idLang)
virtual void OnSwitchContent(Window window)
FilterResult IsFilterPass(string text)
ContainerSharedType sharedType
RectPosition customAnchor
void CopyFrom(SaveData data)
void _OnDeserialized(StreamingContext context)
void OnSerializing(StreamingContext context)
Button.ButtonClickedEvent action
UISelectableGroup groupTab
void ProcessCursorChanges()
RectTransform _rectTransform
void RefreshTipPivotPosition()
WindowMenu menuLeftBottom
Vector3 LastScreenCursorPosition
void SwitchContent(UIContent content)
void SetInteractable(bool enable, float alpha=0.5f)
void BuildTabs(int index=-1)
bool IsProcessingMovement
void SetCaption(string text)
Vector3[] _captionCorners
Vector3[] FrameOuterCorners
RectTransform RectTransform
bool CursorOverTopBorder(bool canExceed=false)
Vector3[] _frameInnerCorners
void Init(Layer _layer=null)
int GetTab(UIContent content)
bool CursorOverLeftBorder(bool canExceed=false)
UIButton AddBottomButton(string idLang, UnityAction onClick, bool setFirst=false)
UIContent SwitchContent(int index)
void SetRect(RectData data, bool mousePos=false)
Vector3 CorrectedLossyScale
EventTrigger _eventTrigger
Vector3 _correctedLossyScale
RectTransform tipPiovotLeft
WindowController controller
bool CursorOverRightBorder(bool canExceed=false)
void OnPointerEnter(PointerEventData data)
T SetContent< T >(int tabIndex=-1, string id=null)
static Dictionary< string, SaveData > dictData
void ClearBottomButtons()
void OnChangeResolution()
void OnApplicationFocus(bool focus)
void LoadHeader(string id="HeaderRow")
RectTransform tipPivotRight
static bool animateWindow
void AddBottomSpace(int size=20)
bool IsResizingOverBottom
void SetContent(int tabIndex, UIContent content)
EventTrigger EventTrigger
List< CanvasGroup > listCgFloat
Setting.Tab AddTab(string idLang, UIContent content=null, Action action=null, Sprite sprite=null, string langTooltip=null)
void SwitchContent(string name)
void OnPointerUp(PointerEventData data)
RectTransform rectCaption
void SwitchContent(Setting.Tab tab)
void OnPointerDown(PointerEventData data)
bool CursorOverBottomBorder(bool canExceed=false)
bool IsProcessingCursorChanges
void OnPointerExit(PointerEventData data)
static Dictionary< string, int > dictTab
Vector3[] _frameOuterCorners
void AddHeader(string langLeft=null, string langRight=null)
void SetTitles(string langList, string idHeaderRow=null)
void RecalculatePositionCaches()
Vector3[] FrameInnerCorners