private void DrawScrub() { AppearanceInfo dimensions = CurrentAppearanceInfo(); Rect group = new Rect(x + dimensions.leftSideWidth, y + dimensions.topSideHeight, dimensions.centerWidth, dimensions.centerHeight); GUI.BeginGroup(group); float xPos = 0, yPos = 0, drawWidth = dimensions.centerWidth, drawHeight = dimensions.centerHeight; float progressToPixelDistance = progress; if (horizontal) { drawWidth *= scrubPercentSize; progressToPixelDistance *= (dimensions.centerWidth - drawWidth); xPos += progressToPixelDistance; } else { drawHeight *= scrubPercentSize; progressToPixelDistance *= (dimensions.centerHeight - drawHeight); yPos += progressToPixelDistance; } scrubButton.parentInfo.group = group; scrubButton.x = Mathf.RoundToInt(xPos); scrubButton.y = Mathf.RoundToInt(yPos); scrubButton.width = Mathf.RoundToInt(drawWidth); scrubButton.height = Mathf.RoundToInt(drawHeight); //scrubButton.text = progress.ToString(); scrubButton.Draw(); GUI.EndGroup(); }
public override void Draw() { if (visible) { float buttonsSize = percentPromptButtonsSize * size.y; #region ListFileSelector if (horizontalPromptButtons) { buttonsSize = percentPromptButtonsSize * size.x; } Vector2 origPos = position, origSize = size; if (horizontalPromptButtons) { if (switchPromptButtonsSide) { x += Mathf.RoundToInt(buttonsSize); } width -= Mathf.FloorToInt(buttonsSize); } else { if (switchPromptButtonsSide) { y += Mathf.RoundToInt(buttonsSize); } height -= Mathf.FloorToInt(buttonsSize); } base.Draw(); x = Mathf.RoundToInt(origPos.x); y = Mathf.RoundToInt(origPos.y); width = Mathf.RoundToInt(origSize.x); height = Mathf.RoundToInt(origSize.y); #endregion #region Prompt Buttons if (horizontalPromptButtons) { if (switchPromptButtonsSide) { acceptButton.x = 0; cancelButton.x = 0; } else { acceptButton.x = Mathf.RoundToInt(width * (1 - percentPromptButtonsSize)) + buttonCushion; cancelButton.x = Mathf.RoundToInt(width * (1 - percentPromptButtonsSize)) + buttonCushion; } acceptButton.y = 0; cancelButton.y = (height / 2) + Mathf.RoundToInt(buttonCushion / 2f); acceptButton.width = Mathf.FloorToInt(buttonsSize) - buttonCushion; cancelButton.width = Mathf.FloorToInt(buttonsSize) - buttonCushion; if (hideCancelButton) { acceptButton.height = height; } else { acceptButton.height = (height / 2) - Mathf.RoundToInt(buttonCushion / 2f); } cancelButton.height = (height / 2) - Mathf.RoundToInt(buttonCushion / 2f); } else { if (switchPromptButtonsSide) { acceptButton.y = 0; cancelButton.y = 0; } else { acceptButton.y = Mathf.RoundToInt(height * (1 - percentPromptButtonsSize)) + buttonCushion; cancelButton.y = Mathf.RoundToInt(height * (1 - percentPromptButtonsSize)) + buttonCushion; } acceptButton.x = 0; cancelButton.x = (width / 2) + Mathf.RoundToInt(buttonCushion / 2f); acceptButton.height = Mathf.FloorToInt(buttonsSize) - buttonCushion; cancelButton.height = Mathf.FloorToInt(buttonsSize) - buttonCushion; if (hideCancelButton) { acceptButton.width = width; } else { acceptButton.width = (width / 2) - Mathf.RoundToInt(buttonCushion / 2f); } cancelButton.width = (width / 2) - Mathf.RoundToInt(buttonCushion / 2f); } Rect group = new Rect(x, y, width, height); acceptButton.parentInfo.group = group; cancelButton.parentInfo.group = group; GUI.BeginGroup(group); acceptButton.Draw(); if (!hideCancelButton) { cancelButton.Draw(); } GUI.EndGroup(); #endregion } }