Skip to content

Commit

Permalink
fix: sizing window and layout off all assets buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLLspectre committed Jun 3, 2024
1 parent 5436062 commit 60b7ad6
Showing 1 changed file with 51 additions and 1 deletion.
52 changes: 51 additions & 1 deletion package/Editor/Isometric Workflow/IsometricWorkflowUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ public void DrawStartGUI(Rect _dimension)
{
DrawImageBackground(_dimension);

isometricWorkflow.maxSize = isometricWorkflow.minSize;

GUILayout.FlexibleSpace();
//Bottom
GUILayout.BeginHorizontal();
Expand All @@ -150,6 +152,8 @@ public void DrawStartGUI(Rect _dimension)
/// <param name="_dimension">The dimensions of the UI element.</param>
public void DrawBaseGUI(Rect _dimension)
{
isometricWorkflow.maxSize = new Vector2(1680, 920);

DrawBackground(_dimension);
CustomStyle.Space();
CustomStyle.Label("Step 1. Choose a Base", 18, TextAnchor.UpperLeft, bold: true);
Expand Down Expand Up @@ -555,7 +559,7 @@ public void DrawAssetsGUI(Rect _dimension)
}
GUILayout.EndHorizontal();
CustomStyle.Space();

int averageSize = 0;
switch (isometricWorkflow.selectedTheme)
{
case Theme.Medieval:
Expand All @@ -567,6 +571,17 @@ public void DrawAssetsGUI(Rect _dimension)
GUILayout.FlexibleSpace();
foreach (string sample in isometricWorkflow.medievalSample)
{
averageSize += (sample.Length * 7) + 25;

if (averageSize >= _dimension.width - 75)
{
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
averageSize = 0;
}

CustomStyle.ButtonPrimary(sample, 30, 0, () =>
{
isometricWorkflow.FillAssetSample(sample);
Expand All @@ -588,6 +603,17 @@ public void DrawAssetsGUI(Rect _dimension)
GUILayout.FlexibleSpace();
foreach (string sample in isometricWorkflow.contemporarySample)
{
averageSize += (sample.Length * 7) + 25;

if (averageSize >= _dimension.width - 75)
{
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
averageSize = 0;
}

CustomStyle.ButtonPrimary(sample, 30, 0, () =>
{
isometricWorkflow.FillAssetSample(sample);
Expand All @@ -604,11 +630,24 @@ public void DrawAssetsGUI(Rect _dimension)
if (isometricWorkflow.postApoSample != null && isometricWorkflow.postApoSample.Count > 0)
{
CustomStyle.Space();

GUILayout.BeginHorizontal();
{
GUILayout.FlexibleSpace();

foreach (string sample in isometricWorkflow.postApoSample)
{
averageSize += (sample.Length * 7) + 25;

if (averageSize >= _dimension.width - 75)
{
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
averageSize = 0;
}

CustomStyle.ButtonPrimary(sample, 30, 0, () =>
{
isometricWorkflow.FillAssetSample(sample);
Expand All @@ -630,6 +669,17 @@ public void DrawAssetsGUI(Rect _dimension)
GUILayout.FlexibleSpace();
foreach (string sample in isometricWorkflow.sampleList)
{
averageSize += (sample.Length * 7) + 25;

if (averageSize >= _dimension.width - 75)
{
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
averageSize = 0;
}

CustomStyle.ButtonPrimary(sample, 30, 0, () =>
{
isometricWorkflow.FillAssetSample(sample);
Expand Down

0 comments on commit 60b7ad6

Please sign in to comment.