First commit for private source control. Older commits available on Github.

This commit is contained in:
2026-03-26 12:52:52 +00:00
parent a04c602626
commit 2d449c4a17
2176 changed files with 408185 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using static AYellowpaper.SerializedCollections.Editor.SerializedDictionaryDrawer;
namespace AYellowpaper.SerializedCollections.Editor.States
{
internal class DefaultListState : ListState
{
public override int ListSize => Drawer.ListProperty.minArraySize;
public DefaultListState(SerializedDictionaryInstanceDrawer serializedDictionaryDrawer) : base(serializedDictionaryDrawer)
{
}
public override void OnEnter()
{
Drawer.ReorderableList.draggable = true;
}
public override void OnExit()
{
}
public override ListState OnUpdate()
{
if (Drawer.SearchText.Length > 0)
return Drawer.SearchState;
return this;
}
public override void DrawElement(Rect rect, SerializedProperty property, DisplayType displayType)
{
SerializedDictionaryInstanceDrawer.DrawElement(rect, property, displayType);
}
public override SerializedProperty GetPropertyAtIndex(int index)
{
return Drawer.ListProperty.GetArrayElementAtIndex(index);
}
public override void RemoveElementAt(int index)
{
Drawer.ListProperty.DeleteArrayElementAtIndex(index);
}
public override void InserElementAt(int index)
{
Drawer.ListProperty.InsertArrayElementAtIndex(index);
Drawer.ListProperty.serializedObject.ApplyModifiedProperties();
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 803188ced5ea71c41b6079f7ae375573
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 243052
packageName: Serialized Dictionary
packageVersion: 1.0.13
assetPath: Assets/Plugins/SerializedCollections/Editor/Scripts/States/DefaultListState.cs
uploadId: 632226

View File

@@ -0,0 +1,34 @@
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using static AYellowpaper.SerializedCollections.Editor.SerializedDictionaryDrawer;
namespace AYellowpaper.SerializedCollections.Editor.States
{
internal abstract class ListState
{
public abstract int ListSize { get; }
public virtual string NoElementsText => "List is Empty.";
public readonly SerializedDictionaryInstanceDrawer Drawer;
public ListState(SerializedDictionaryInstanceDrawer serializedDictionaryDrawer)
{
Drawer = serializedDictionaryDrawer;
}
public abstract SerializedProperty GetPropertyAtIndex(int index);
public abstract ListState OnUpdate();
public abstract void OnEnter();
public abstract void OnExit();
public abstract void DrawElement(Rect rect, SerializedProperty property, DisplayType displayType);
public abstract void RemoveElementAt(int index);
public abstract void InserElementAt(int index);
public virtual float GetHeightAtIndex(int index, bool drawKeyAsList, bool drawValueAsList)
{
return SerializedDictionaryInstanceDrawer.CalculateHeightOfElement(GetPropertyAtIndex(index), drawKeyAsList, drawValueAsList);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 4b4752173882f944eb16a5720a22f3e9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 243052
packageName: Serialized Dictionary
packageVersion: 1.0.13
assetPath: Assets/Plugins/SerializedCollections/Editor/Scripts/States/ListState.cs
uploadId: 632226

View File

@@ -0,0 +1,109 @@
using AYellowpaper.SerializedCollections.Editor.Search;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using System.Linq;
using System;
using static AYellowpaper.SerializedCollections.Editor.SerializedDictionaryDrawer;
namespace AYellowpaper.SerializedCollections.Editor.States
{
internal class SearchListState : ListState
{
public override int ListSize => _searchResults.Count;
public override string NoElementsText => "No Results";
public bool OnlyShowMatchingValues { get; set; }
private string _lastSearch = string.Empty;
private List<SearchResultEntry> _searchResults = new List<SearchResultEntry>();
private HashSet<string> _foundProperties;
private Color _previousColor;
public SearchListState(SerializedDictionaryInstanceDrawer serializedDictionaryDrawer) : base(serializedDictionaryDrawer)
{
}
public override void DrawElement(Rect rect, SerializedProperty property, DisplayType displayType)
{
SerializedDictionaryInstanceDrawer.DrawElement(rect, property, displayType, BeforeDrawingProperty, AfterDrawingProperty);
}
private void BeforeDrawingProperty(SerializedProperty obj)
{
_previousColor = GUI.backgroundColor;
if (_foundProperties.Contains(obj.propertyPath))
{
GUI.backgroundColor = Color.blue;
}
}
private void AfterDrawingProperty(SerializedProperty obj)
{
GUI.backgroundColor = _previousColor;
}
public override void OnEnter()
{
Drawer.ReorderableList.draggable = false;
UpdateSearch();
}
public override void OnExit()
{
}
public override ListState OnUpdate()
{
if (Drawer.SearchText.Length == 0)
return Drawer.DefaultState;
UpdateSearch();
return this;
}
private void UpdateSearch()
{
if (_lastSearch != Drawer.SearchText)
{
_lastSearch = Drawer.SearchText;
PerformSearch(Drawer.SearchText);
}
}
public void PerformSearch(string searchString)
{
var query = new SearchQuery(Matchers.RegisteredMatchers);
query.SearchString = searchString;
_searchResults.Clear();
_searchResults.AddRange(query.ApplyToArrayProperty(Drawer.ListProperty));
_foundProperties = _searchResults.SelectMany(x => x.MatchingResults, (x, y) => y.Property.propertyPath).ToHashSet();
}
public override SerializedProperty GetPropertyAtIndex(int index)
{
return _searchResults[index].Property;
}
public override float GetHeightAtIndex(int index, bool drawKeyAsList, bool drawValueAsList)
{
return base.GetHeightAtIndex(index, drawKeyAsList, drawValueAsList);
}
public override void RemoveElementAt(int index)
{
var indexToDelete = _searchResults[index].Index;
Drawer.ListProperty.DeleteArrayElementAtIndex(indexToDelete);
PerformSearch(_lastSearch);
}
public override void InserElementAt(int index)
{
var indexToAdd = _searchResults[index].Index;
Drawer.ListProperty.InsertArrayElementAtIndex(indexToAdd);
PerformSearch(_lastSearch);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 1ed2b1abf79f0c74c8224a423ec3123c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 243052
packageName: Serialized Dictionary
packageVersion: 1.0.13
assetPath: Assets/Plugins/SerializedCollections/Editor/Scripts/States/SearchListState.cs
uploadId: 632226