Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GUI] Fix for the missing close icon and warnings under Unity 2023 #398

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Plugins/Editor/Resources/GUI/WinBtnClose.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
115 changes: 115 additions & 0 deletions Plugins/Editor/Resources/GUI/WinBtnClose.png.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ static void OnEditModeSelectionSceneGUI()
buttonArea.y = 2;
buttonArea.height = 13;
buttonArea.width = 13;
if (GUI.Button(buttonArea, GUIContent.none, "WinBtnClose"))
if (GUI.Button(buttonArea, GUIContent.none, CSG_GUIStyleUtility.winBtnClose))
EditModeToolWindowSceneGUI.GetWindow();
TooltipUtility.SetToolTip(CSG_GUIStyleUtility.PopOutTooltip, buttonArea);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static void OnSceneGUI(Rect windowRect, EditModeClip tool)
buttonArea.y += 2;
buttonArea.height = 13;
buttonArea.width = 13;
if (GUI.Button(buttonArea, GUIContent.none, "WinBtnClose"))
if (GUI.Button(buttonArea, GUIContent.none, CSG_GUIStyleUtility.winBtnClose))
EditModeToolWindowSceneGUI.GetWindow();
TooltipUtility.SetToolTip(CSG_GUIStyleUtility.PopOutTooltip, buttonArea);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static void OnSceneGUI(Rect windowRect, EditModeMeshEdit tool)
buttonArea.y += 2;
buttonArea.height = 13;
buttonArea.width = 13;
if (GUI.Button(buttonArea, GUIContent.none, "WinBtnClose"))
if (GUI.Button(buttonArea, GUIContent.none, CSG_GUIStyleUtility.winBtnClose))
EditModeToolWindowSceneGUI.GetWindow();
TooltipUtility.SetToolTip(CSG_GUIStyleUtility.PopOutTooltip, buttonArea);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static bool OnSceneGUI(Rect windowRect, EditModeGenerate tool)
buttonArea.y += 2;
buttonArea.height = 13;
buttonArea.width = 13;
if (GUI.Button(buttonArea, GUIContent.none, "WinBtnClose"))
if (GUI.Button(buttonArea, GUIContent.none, CSG_GUIStyleUtility.winBtnClose))
EditModeToolWindowSceneGUI.GetWindow();
TooltipUtility.SetToolTip(CSG_GUIStyleUtility.PopOutTooltip, buttonArea);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static void OnSceneGUI(Rect windowRect, EditModePlace tool)
buttonArea.y += 2;
buttonArea.height = 13;
buttonArea.width = 13;
if (GUI.Button(buttonArea, GUIContent.none, "WinBtnClose"))
if (GUI.Button(buttonArea, GUIContent.none, CSG_GUIStyleUtility.winBtnClose))
EditModeToolWindowSceneGUI.GetWindow();
TooltipUtility.SetToolTip(CSG_GUIStyleUtility.PopOutTooltip, buttonArea);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ public static void OnSceneGUI(Rect windowRect, EditModeSurface tool)
buttonArea.y += 2;
buttonArea.height = 13;
buttonArea.width = 13;
if (GUI.Button(buttonArea, GUIContent.none, "WinBtnClose"))
if (GUI.Button(buttonArea, GUIContent.none, CSG_GUIStyleUtility.winBtnClose))
EditModeToolWindowSceneGUI.GetWindow();

TooltipUtility.SetToolTip(CSG_GUIStyleUtility.PopOutTooltip, buttonArea);
Expand Down
17 changes: 17 additions & 0 deletions Plugins/Editor/Scripts/View/GUI/Utility/CSG_GUIStyleUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ internal static class CSG_GUIStyleUtility

public static GUIStyle unpaddedWindow;

public static GUIStyle winBtnClose;

public static GUILayoutOption[] ContentEmpty = new GUILayoutOption[0];


Expand Down Expand Up @@ -364,6 +366,21 @@ public static void InitStyles()

selectionRectStyle = GetStyle("selectionRect");

winBtnClose = new GUIStyle(GUI.skin.verticalScrollbarUpButton);
winBtnClose.normal.background = Resources.Load<Texture2D>("GUI/WinBtnClose");
winBtnClose.onActive.background =
winBtnClose.onFocused.background =
winBtnClose.onNormal.background =
winBtnClose.onHover.background =
winBtnClose.hover.background =
winBtnClose.focused.background =
winBtnClose.active.background = null;
winBtnClose.fixedHeight = 16f;
winBtnClose.fixedWidth = 16f;
winBtnClose.overflow.bottom = 0;
winBtnClose.overflow.top = 0;
winBtnClose.overflow.right = 0;
winBtnClose.overflow.left = 0;

var redToolbarDropDown = GetStyle("toolbarDropDown");

Expand Down