Skip to content

Feature options #1

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

Merged
merged 8 commits into from
May 23, 2025
Merged
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
63 changes: 63 additions & 0 deletions Assets/Editor/Editor Windows/ConfigTypeSelectionPopup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;

namespace ScriptableObjectManager
{

// Custom Popup Window for Config Type Selection
internal class ConfigTypeSelectionPopup : PopupWindowContent
{
private readonly List<Type> SelectedTypes;
private readonly List<Type> AvailableTypes;
private readonly Action OnSelectionChanged;
private Vector2 ScrollPos = new();

public ConfigTypeSelectionPopup(List<Type> selectedTypes, Action onSelectionChanged, List<Type> availableTypes)
{
this.SelectedTypes = selectedTypes;
this.OnSelectionChanged = onSelectionChanged;
this.AvailableTypes = availableTypes;
}

public override Vector2 GetWindowSize()
{
return new Vector2(200, 400); // Define the dimensions of the popup window
}

public override void OnGUI(Rect rect)
{
GUILayout.Label("Select Config Types", EditorStyles.boldLabel);

if (AvailableTypes.Count > 0)
{
ScrollPos = EditorGUILayout.BeginScrollView(ScrollPos);

// Display each available type with a toggle to enable or disable it
foreach (var type in AvailableTypes)
{
bool isSelected = SelectedTypes.Contains(type);
bool toggle = EditorGUILayout.Toggle(type.Name, isSelected);

if (toggle && !isSelected)
{
SelectedTypes.Add(type); // Add the type to the selection list
OnSelectionChanged.Invoke();
ScriptableObjectEditorWindow.BasicFilters = SelectedTypes.Select(t => t.Name).ToArray();
}
else if (!toggle && isSelected)
{
SelectedTypes.Remove(type); // Remove the type from the selection list
OnSelectionChanged.Invoke();
ScriptableObjectEditorWindow.BasicFilters = SelectedTypes.Select(t => t.Name).ToArray();
}
}
// Close the scrollable area within the popup
EditorGUILayout.EndScrollView();
}
}
}

}
11 changes: 11 additions & 0 deletions Assets/Editor/Editor Windows/ConfigTypeSelectionPopup.cs.meta

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

Binary file added Assets/Editor/Editor Windows/Icons/check.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
127 changes: 127 additions & 0 deletions Assets/Editor/Editor Windows/Icons/check.png.meta

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

Binary file added Assets/Editor/Editor Windows/Icons/options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
127 changes: 127 additions & 0 deletions Assets/Editor/Editor Windows/Icons/options.png.meta

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

Loading