/* Scales and positions all controls. */ public void Reposition() { Rect2 screen = this.GetViewportRect(); float width = screen.Size.x; float height = screen.Size.y; float w = width / 10; float h = height / 10; Vector2 size; if (mainMenuButton != null) { size = new Vector2(w, h); mainMenuButton.SetSize(size); mainMenuButton.SetPosition(new Vector2(0f, size.y * 9)); } if (sendButton != null) { size = new Vector2(w, h); sendButton.SetSize(size); sendButton.SetPosition(new Vector2(size.x * 9, size.y * 9)); } if (hostButton != null) { size = new Vector2(w, h); hostButton.SetSize(size); hostButton.SetPosition(new Vector2(size.x * 4, 0)); } if (joinButton != null) { size = new Vector2(w, h); joinButton.SetSize(size); joinButton.SetPosition(new Vector2(size.x * 5, 0)); } if (composeBox != null) { size = new Vector2(4 * w, 1 * h); composeBox.SetSize(size); composeBox.SetPosition(new Vector2(w * 5, h * 9)); } if (messageBox != null) { size = new Vector2(8 * w, 2 * h); messageBox.SetSize(size); messageBox.SetPosition(new Vector2(w, 7 * h)); } if (nameBox != null) { size = new Vector2(3 * w, h); nameBox.SetSize(size); nameBox.SetPosition(new Vector2(2 * w, 9 * h)); } if (addressBox != null) { size = new Vector2(4 * w, h); addressBox.SetSize(size); addressBox.SetPosition(new Vector2(0, 0)); } }