void OnGUI() { GUI.Box(superRect, "super"); { GUI.Box(subRect, "sub"); } GUI.Box(rectToMake, "GivenRect"); GUI.Box(rectToPlace, "PlacedRect"); GUILayout.BeginArea(UStrap.GiveRect(300f, 50f, VerticalAnchor.Bottom, HorizontalAnchor.Center)); { GUILayout.BeginHorizontal(); { if (GUILayout.Button("MakeSubRect")) { createSubRect(); } if (GUILayout.Button("PlaceRect")) { placeRect(); } if (GUILayout.Button("CreateRect")) { createRect(); } } GUILayout.EndHorizontal(); } GUILayout.EndArea(); }
void Start() { superRect = UStrap.GiveRect(200, 200, VerticalAnchor.Center, HorizontalAnchor.Center); rectToMake = UStrap.GiveRect(makeWidth, makeHeight, verticalAlignment, horizontalAlignment); rectToPlace = new Rect(0, 0, 50f, 50f); rectToPlace.Place(placeVert, placeHoriz); placeRect(); createSubRect(); }
private static void GetRects(out Rect inpRect, out Rect inpLabelRect, out Rect inpButRect, out Rect inpStringRect, out Rect intelliRect, out Rect layoutRect) { #region Rect initialization var scrn = UStrap.ScreenRect; inpRect = UStrap.GiveRect(scrn.width, 50f, VerticalAnchor.Top, HorizontalAnchor.Center); inpLabelRect = new Rect(0, 0, 70f, inpRect.height / 3f).Place(inpRect, VerticalAnchor.Center, HorizontalAnchor.Left).SetMargin(left: 20f); inpStringRect = new Rect(inpLabelRect.xMax + 10f, inpLabelRect.y, inpRect.width - inpLabelRect.xMax - 100f, inpLabelRect.height); inpButRect = new Rect(inpStringRect.xMax + 5f, inpLabelRect.y, 70, inpLabelRect.height); intelliRect = new Rect(inpStringRect.xMin, inpStringRect.yMax, inpStringRect.width, 150f); layoutRect = UStrap.GiveRect(inpRect.width, scrn.height - inpRect.height, VerticalAnchor.Bottom, HorizontalAnchor.Center); #endregion }
private void createRect() { rectToMake = UStrap.GiveRect(makeWidth, makeHeight, verticalAlignment, horizontalAlignment); }