Skip to content

Commit

Permalink
Improve GUI of NuGet for Unity window (#617)
Browse files Browse the repository at this point in the history
* refresh the look of the editor window and bring it in line with the modern Unity editor
* Updated images in docs
* Cached GUI styles
* Improve code quality of NugetWindow.cs

---------

Co-authored-by: JoC0de <[email protected]>
  • Loading branch information
AnnulusGames and JoC0de authored Feb 9, 2024
1 parent 7388d28 commit a8ef661
Show file tree
Hide file tree
Showing 9 changed files with 715 additions and 444 deletions.
Binary file modified docs/screenshots/installed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/screenshots/online.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/screenshots/updates.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/screenshots/updates_showdowngrades.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
745 changes: 301 additions & 444 deletions src/NuGetForUnity/Editor/Ui/NugetWindow.cs

Large diffs are not rendered by default.

99 changes: 99 additions & 0 deletions src/NuGetForUnity/Editor/Ui/RectHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
using UnityEngine;

namespace NugetForUnity
{
/// <summary>
/// Extension methods for manipulating Rect objects.
/// </summary>
internal static class RectHelper
{
/// <summary>
/// Expands the boundaries of the Rect by a specified value in all directions.
/// </summary>
/// <param name="rect">The rect to update.</param>
/// <param name="value">The value to add.</param>
/// <returns>The updated Rect.</returns>
public static Rect Expand(this Rect rect, float value)
{
rect.xMin -= value;
rect.xMax += value;
rect.yMin -= value;
rect.yMax += value;
return rect;
}

/// <summary>
/// Expands the Rect horizontally by a specified value.
/// </summary>
/// <param name="rect">The rect to update.</param>
/// <param name="value">The value to add.</param>
/// <returns>The updated Rect.</returns>
public static Rect ExpandX(this Rect rect, float value)
{
rect.xMin -= value;
rect.xMax += value;
return rect;
}

/// <summary>
/// Expands the Rect vertically by a specified value.
/// </summary>
/// <param name="rect">The rect to update.</param>
/// <param name="value">The value to add.</param>
/// <returns>The updated Rect.</returns>
public static Rect ExpandY(this Rect rect, float value)
{
rect.yMin -= value;
rect.yMax += value;
return rect;
}

/// <summary>
/// Adds a specified value to the X-coordinate of the Rect.
/// </summary>
/// <param name="rect">The rect to update.</param>
/// <param name="value">The value to add.</param>
/// <returns>The updated Rect.</returns>
public static Rect AddX(this Rect rect, float value)
{
rect.x += value;
return rect;
}

/// <summary>
/// Adds a specified value to the Y-coordinate of the Rect.
/// </summary>
/// <param name="rect">The rect to update.</param>
/// <param name="value">The value to add.</param>
/// <returns>The updated Rect.</returns>
public static Rect AddY(this Rect rect, float value)
{
rect.y += value;
return rect;
}

/// <summary>
/// Sets the width of the Rect to a specified value.
/// </summary>
/// <param name="rect">The rect to update.</param>
/// <param name="value">The value to set.</param>
/// <returns>The updated Rect.</returns>
public static Rect SetWidth(this Rect rect, float value)
{
rect.width = value;
return rect;
}

/// <summary>
/// Sets the height of the Rect to a specified value.
/// </summary>
/// <param name="rect">The rect to update.</param>
/// <param name="value">The value to set.</param>
/// <returns>The updated Rect.</returns>
public static Rect SetHeight(this Rect rect, float value)
{
rect.height = value;
return rect;
}
}
}
11 changes: 11 additions & 0 deletions src/NuGetForUnity/Editor/Ui/RectHelper.cs.meta

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

Loading

0 comments on commit a8ef661

Please sign in to comment.