public BoxCollider2DRect(MonoBehaviour go) : base(go) { this.transform = go.transform; LeftEdge = new LeftEdge(this); RightEdge = new RightEdge(this); UpEdge = new UpEdge(this); DownEdge = new DownEdge(this); }
public UGUIRect(Behaviour go) : base(go) { this.transform = go.GetComponent <RectTransform>(); LeftEdge = new LeftEdge(this); RightEdge = new RightEdge(this); UpEdge = new UpEdge(this); DownEdge = new DownEdge(this); transform.GetWorldCorners(Corners); }
internal RelativeLayoutResults(RectTransform transform, RelativeLayoutParams other) { Transform = transform ?? throw new ArgumentNullException(nameof(transform)); if (other != null) { BottomEdge.CopyFrom(other.BottomEdge); TopEdge.CopyFrom(other.TopEdge); RightEdge.CopyFrom(other.RightEdge); LeftEdge.CopyFrom(other.LeftEdge); Insets = other.Insets ?? ZERO; OverrideSize = other.OverrideSize; } else { Insets = ZERO; } BottomParams = LeftParams = TopParams = RightParams = null; PreferredWidth = PreferredHeight = 0.0f; UseSizeDeltaX = UseSizeDeltaY = false; }
/*_________________________________________________________Обработка_событий_______________________________________________________*/ #region Event handles private void JuliaEditor_Load(object sender, EventArgs e) { LeftEdgeEdit.Text = LeftEdge.ToString(); RightEdgeEdit.Text = RightEdge.ToString(); TopEdgeEdit.Text = TopEdge.ToString(); BottomEdgeEdit.Text = BottomEdge.ToString(); RealPartEdit.Text = RealPart.ToString(); ImaginePartEdit.Text = ImaginePart.ToString(); LeftEdgeEdit.KeyPress += FormEventHandlers.OnlyNumeric; RightEdgeEdit.KeyPress += FormEventHandlers.OnlyNumeric; TopEdgeEdit.KeyPress += FormEventHandlers.OnlyNumeric; BottomEdgeEdit.KeyPress += FormEventHandlers.OnlyNumeric; RealPartEdit.KeyPress += FormEventHandlers.OnlyNumeric; ImaginePartEdit.KeyPress += FormEventHandlers.OnlyNumeric; EditDescriptor.SetToolTip(LeftEdgeLabel, FractalGlobalDescriptions.LeftEdgeOf2DFractal); EditDescriptor.SetToolTip(LeftEdgeEdit, "Здесь необходимо вводить левую границу двухмерного фрактала джулии (десятиричное представления числа).\n" + FractalGlobalDescriptions.LeftEdgeOf2DFractal); EditDescriptor.SetToolTip(RightEdgeLabel, FractalGlobalDescriptions.RightEdgeOf2DFractal); EditDescriptor.SetToolTip(RightEdgeEdit, "Здесь необходимо вводить правую границу двухмерного фрактала джулии (десятиричной представления числа, в качестве разделителей на дроную часть используйте \",\" или \".\").\n" + FractalGlobalDescriptions.RightEdgeOf2DFractal); GlobalTemplates.SetTemplate(MainPanelOfJuliaEditor, "Шрифт окна для ввода фрактала джулии"); }
private bool AreSame(long start, ref TKey key, ref TLeft payload, ref LeftEdge active) => start == active.Start && this.keyComparerEquals(key, active.Key) && this.leftComparerEquals(payload, active.Payload);
void Update() { TitleBar.sizeDelta = TitleBar.sizeDelta.YChangedTo(DefaultTitleBarHeight); BackgroundImage.color = DefaultBackgroundColor; TitleText.text = FrontPage.Title; if (!Application.isPlaying) { return; } if (WindowContainer == null) { The.WindowContainer.AddWindow(this); } if (!IsOpen) { gameObject.SetActive(false); return; } else { foreach (Window subwindow in Subwindows) { subwindow.IsOpen = true; } } if (IsSubwindow) { IsMaximized = false; IsMinimized = ParentWindow.IsMinimized; } if (InputUtility.IsMouseLeftPressed && IsTouched) { MoveToFront(); } if (!IsGrabbed) { resize_grab_type = ResizeGrabType.None; if (!IsMaximized && IsTouched) { if (LeftEdge.IsPointedAt()) { resize_grab_type = ResizeGrabType.Left; } else if (BottomLeftCorner.IsPointedAt()) { resize_grab_type = ResizeGrabType.BottomLeft; } else if (BottomEdge.IsPointedAt()) { resize_grab_type = ResizeGrabType.Bottom; } else if (BottomRightCorner.IsPointedAt()) { resize_grab_type = ResizeGrabType.BottomRight; } else if (RightEdge.IsPointedAt()) { resize_grab_type = ResizeGrabType.Right; } } } switch (resize_grab_type) { case ResizeGrabType.Left: The.Cursor.ChangeCursorImage(The.Cursor.LeftHorizontalResizeImage); break; case ResizeGrabType.Right: The.Cursor.ChangeCursorImage(The.Cursor.RightHorizontalResizeImage); break; case ResizeGrabType.BottomLeft: The.Cursor.ChangeCursorImage(The.Cursor.PositiveDiagonalResizeImage); break; case ResizeGrabType.BottomRight: The.Cursor.ChangeCursorImage(The.Cursor.NegativeDiagonalResizeImage); break; case ResizeGrabType.Bottom: The.Cursor.ChangeCursorImage(The.Cursor.VerticalResizeImage); break; } if (InputUtility.WasMouseLeftPressed && IsTouched && (resize_grab_type != ResizeGrabType.None || TitleBar.IsPointedAt())) { IsGrabbed = true; grab_offset = PixelPosition - The.Cursor.PixelPointedAt; } if (IsGrabbed && InputUtility.WasMouseLeftReleased) { IsGrabbed = false; } if (IsGrabbed) { if (resize_grab_type == ResizeGrabType.None) { Vector2Int new_position = The.Cursor.PixelPointedAt + grab_offset; if (new_position != PixelPosition) { IsMaximized = false; } natural_position = new_position; } else { Vector2Int new_position = natural_position, new_size = natural_size; int top_edge_height = natural_position.y + natural_size.y; Vector2Int displaced_position = The.Cursor.PixelPointedAt; Vector2Int displacement = displaced_position - natural_position; if ((resize_grab_type == ResizeGrabType.Left || resize_grab_type == ResizeGrabType.BottomLeft) && displaced_position.x <= (natural_position.x + natural_size.x - MinimumSize.x)) { new_position.x = displaced_position.x; new_size.x += -displacement.x; } else if (resize_grab_type == ResizeGrabType.Right || resize_grab_type == ResizeGrabType.BottomRight) { new_size.x = displaced_position.x - natural_position.x + 1; } if (resize_grab_type == ResizeGrabType.BottomLeft || resize_grab_type == ResizeGrabType.Bottom || resize_grab_type == ResizeGrabType.BottomRight) { new_size.y = (natural_position.y + natural_size.y) - displaced_position.y + 1; } natural_position = new_position; natural_size = new_size; natural_size.x = Mathf.Max(natural_size.x, MinimumSize.x); natural_size.y = Mathf.Max(natural_size.y, MinimumSize.y); natural_position.y += top_edge_height - (natural_position.y + natural_size.y); } } if (IsMaximized) { RectTransform.sizeDelta = new Vector2(The.Style.MonitorResolution.x, The.Style.MonitorResolution.y - The.Taskbar.Height); RectTransform.anchoredPosition = new Vector2(0, The.Taskbar.Height); } else { RectTransform.sizeDelta = new Vector2(natural_size.x, natural_size.y); RectTransform.anchoredPosition = new Vector2(natural_position.x, natural_position.y); } if (IsMinimized) { CanvasGroup.alpha = 0; } else { CanvasGroup.alpha = 1; } }