// ~~ private // INDEXERS ~~~~~~~~~~ // ~ Static // ~~ public // ~~ private // ~ Non-Static // ~~ public // ~~ private // METHODS ~~~~~~~~~ // ~ Static // ~~ public public static ResizeHandleRect GetRect(CardinalDirections resizeDirection, ViewData windowData) { GameObject result = new GameObject(resizeDirection + " Resize Handle"); ResizeHandleRect resultMono = result.AddComponent <ResizeHandleRect>(); resultMono.ResizeDirection = resizeDirection; resultMono.ViewData = windowData; return(resultMono); }
protected void Initialize(Canvas canvas) { transform.SetParent(canvas.transform, false); RectTransform.anchorMin = new Vector2(0f, 0f); RectTransform.anchorMax = RectTransform.anchorMin; ViewData = new ViewData(); _moveHandle = MoveHandleRect.GetRect(ViewData); _contentRect = ContentRect.GetRect(ViewData); _contentRect.transform.SetParent(transform, false); ResizeHandleRect northResizeObj = ResizeHandleRect.GetRect(CardinalDirections.North, ViewData); ResizeHandleRect northeastResizeObj = ResizeHandleRect.GetRect(CardinalDirections.Northeast, ViewData); ResizeHandleRect eastResizeObj = ResizeHandleRect.GetRect(CardinalDirections.East, ViewData); ResizeHandleRect southeastResizeObj = ResizeHandleRect.GetRect(CardinalDirections.Southeast, ViewData); ResizeHandleRect southResizeObj = ResizeHandleRect.GetRect(CardinalDirections.South, ViewData); ResizeHandleRect southwestResizeObj = ResizeHandleRect.GetRect(CardinalDirections.Southwest, ViewData); ResizeHandleRect westResizeObj = ResizeHandleRect.GetRect(CardinalDirections.West, ViewData); ResizeHandleRect northwestResizeObj = ResizeHandleRect.GetRect(CardinalDirections.Northwest, ViewData); _resizeHandles.Add(CardinalDirections.North, northResizeObj); _resizeHandles.Add(CardinalDirections.Northeast, northeastResizeObj); _resizeHandles.Add(CardinalDirections.East, eastResizeObj); _resizeHandles.Add(CardinalDirections.Southeast, southeastResizeObj); _resizeHandles.Add(CardinalDirections.South, southResizeObj); _resizeHandles.Add(CardinalDirections.Southwest, southwestResizeObj); _resizeHandles.Add(CardinalDirections.West, westResizeObj); _resizeHandles.Add(CardinalDirections.Northwest, northwestResizeObj); foreach (KeyValuePair <CardinalDirections, ResizeHandleRect> pair in _resizeHandles) { pair.Value.transform.SetParent(transform, false); } _moveHandle.transform.SetParent(transform, false); }