From b5271e88fadb9c52efeaf242d12f22f144ce5c03 Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 18 Jun 2024 20:24:37 +0100 Subject: [PATCH] Extracted `CreateRectangle()` from `OnGUI()` --- project/SPT.Custom/Utils/BundleUtils.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/project/SPT.Custom/Utils/BundleUtils.cs b/project/SPT.Custom/Utils/BundleUtils.cs index 3966eff..25043f7 100644 --- a/project/SPT.Custom/Utils/BundleUtils.cs +++ b/project/SPT.Custom/Utils/BundleUtils.cs @@ -46,15 +46,15 @@ namespace SPT.Custom.Utils GUI.skin.window.normal.background = bgTexture; GUI.backgroundColor = Color.black; - int nWindowWidth = 500; - int nWindowHeight = 80; - GUI.Window(0, - new Rect((Screen.width / 2) - (nWindowWidth / 2), - (Screen.height / 2) - (nWindowHeight / 2), - nWindowWidth, - nWindowHeight), - DrawWindow, - "Bundle Loading"); + GUI.Window(0, CreateRectangle(500, 80), DrawWindow, "Bundle Loading"); + } + + private Rect CreateRectangle(int width, int height) + { + return new Rect((Screen.width / 2) - (width / 2), + (Screen.height / 2) - (height / 2), + width, + height); } private void DrawWindow(int windowId)