Skip to content

Commit f06e681

Browse files
committed
Initial commit
0 parents  commit f06e681

File tree

64 files changed

+6049
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+6049
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.gitignore

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# This .gitignore file should be placed at the root of your Unity project directory
2+
#
3+
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
4+
#
5+
/[Ll]ibrary/
6+
/[Tt]emp/
7+
/[Oo]bj/
8+
/[Bb]uild/
9+
/[Bb]uilds/
10+
/[Ll]ogs/
11+
/[Uu]ser[Ss]ettings/
12+
13+
# MemoryCaptures can get excessive in size.
14+
# They also could contain extremely sensitive data
15+
/[Mm]emoryCaptures/
16+
17+
# Asset meta data should only be ignored when the corresponding asset is also ignored
18+
!/[Aa]ssets/**/*.meta
19+
20+
# Uncomment this line if you wish to ignore the asset store tools plugin
21+
# /[Aa]ssets/AssetStoreTools*
22+
23+
# Autogenerated Jetbrains Rider plugin
24+
/[Aa]ssets/Plugins/Editor/JetBrains*
25+
26+
# Visual Studio cache directory
27+
.vs/
28+
29+
# Gradle cache directory
30+
.gradle/
31+
32+
# Autogenerated VS/MD/Consulo solution and project files
33+
ExportedObj/
34+
.consulo/
35+
*.unityproj
36+
*.suo
37+
*.tmp
38+
*.user
39+
*.userprefs
40+
*.pidb
41+
*.booproj
42+
*.svd
43+
*.pdb
44+
*.mdb
45+
*.opendb
46+
*.VC.db
47+
48+
# Unity3D generated meta files
49+
*.pidb.meta
50+
*.pdb.meta
51+
*.mdb.meta
52+
53+
# Unity3D generated file on crash reports
54+
sysinfo.txt
55+
56+
# Builds
57+
*.apk
58+
*.unitypackage
59+
60+
# Crashlytics generated file
61+
crashlytics-build.properties
62+
63+
# Packed Addressables
64+
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
65+
66+
# Temporary auto-generated Android Assets
67+
/[Aa]ssets/[Ss]treamingAssets/aa.meta
68+
/[Aa]ssets/[Ss]treamingAssets/aa/*
69+
70+
# Asset Store Tools
71+
/[Aa]ssets/[Aa]ssetStoreTools.meta
72+
/[Aa]ssets/[Aa]ssetStoreTools/
73+
74+
# Plugins
75+
/[Aa]ssets/[Pp]lugins.meta
76+
/[Aa]ssets/[Pp]lugins/
77+
78+
# Documentation
79+
Documentation/api/
80+
Documentation/index.*
81+
_site/
82+
Assets/**/obj*

.vsconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"version": "1.0",
3+
"components": [
4+
"Microsoft.VisualStudio.Workload.ManagedGame"
5+
]
6+
}

Assembly-CSharp.csproj

Lines changed: 676 additions & 0 deletions
Large diffs are not rendered by default.

Assets/MackySoft.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/MackySoft/MackySoft.SerializeReferenceExtensions.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/MackySoft/MackySoft.SerializeReferenceExtensions/Editor.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
#if UNITY_2019_3_OR_NEWER
2+
using System;
3+
using System.Linq;
4+
using System.Collections.Generic;
5+
using UnityEngine;
6+
using UnityEditor;
7+
using UnityEditor.IMGUI.Controls;
8+
9+
namespace MackySoft.SerializeReferenceExtensions.Editor {
10+
11+
public class AdvancedTypePopupItem : AdvancedDropdownItem {
12+
13+
public Type Type { get; }
14+
15+
public AdvancedTypePopupItem (Type type,string name) : base(name) {
16+
Type = type;
17+
}
18+
19+
}
20+
21+
/// <summary>
22+
/// A type popup with a fuzzy finder.
23+
/// </summary>
24+
public class AdvancedTypePopup : AdvancedDropdown {
25+
26+
public static void AddTo (AdvancedDropdownItem root,IEnumerable<Type> types) {
27+
int itemCount = 0;
28+
29+
// Add null item.
30+
var nullItem = new AdvancedTypePopupItem(null,TypeMenuUtility.k_NullDisplayName) {
31+
id = itemCount++
32+
};
33+
root.AddChild(nullItem);
34+
35+
// Add type items.
36+
foreach (Type type in types.OrderByType()) {
37+
string[] splittedTypePath = TypeMenuUtility.GetSplittedTypePath(type);
38+
if (splittedTypePath.Length == 0) {
39+
continue;
40+
}
41+
42+
AdvancedDropdownItem parent = root;
43+
44+
// Add namespace items.
45+
for (int k = 0;(splittedTypePath.Length - 1) > k;k++) {
46+
AdvancedDropdownItem foundItem = GetItem(parent,splittedTypePath[k]);
47+
if (foundItem != null) {
48+
parent = foundItem;
49+
} else {
50+
var newItem = new AdvancedDropdownItem(splittedTypePath[k]) {
51+
id = itemCount++,
52+
};
53+
parent.AddChild(newItem);
54+
parent = newItem;
55+
}
56+
}
57+
58+
// Add type item.
59+
var item = new AdvancedTypePopupItem(type,ObjectNames.NicifyVariableName(splittedTypePath[splittedTypePath.Length - 1])) {
60+
id = itemCount++
61+
};
62+
parent.AddChild(item);
63+
}
64+
}
65+
66+
static AdvancedDropdownItem GetItem (AdvancedDropdownItem parent,string name) {
67+
foreach (AdvancedDropdownItem item in parent.children) {
68+
if (item.name == name) {
69+
return item;
70+
}
71+
}
72+
return null;
73+
}
74+
75+
static readonly float k_HeaderHeight = EditorGUIUtility.singleLineHeight * 2f;
76+
77+
Type[] m_Types;
78+
79+
public event Action<AdvancedTypePopupItem> OnItemSelected;
80+
81+
public AdvancedTypePopup (IEnumerable<Type> types,int maxLineCount,AdvancedDropdownState state) : base(state) {
82+
SetTypes(types);
83+
minimumSize = new Vector2(minimumSize.x,EditorGUIUtility.singleLineHeight * maxLineCount + k_HeaderHeight);
84+
}
85+
86+
public void SetTypes (IEnumerable<Type> types) {
87+
m_Types = types.ToArray();
88+
}
89+
90+
protected override AdvancedDropdownItem BuildRoot () {
91+
var root = new AdvancedDropdownItem("Select Type");
92+
AddTo(root,m_Types);
93+
return root;
94+
}
95+
96+
protected override void ItemSelected (AdvancedDropdownItem item) {
97+
base.ItemSelected(item);
98+
if (item is AdvancedTypePopupItem typePopupItem) {
99+
OnItemSelected?.Invoke(typePopupItem);
100+
}
101+
}
102+
103+
}
104+
}
105+
#endif

Assets/MackySoft/MackySoft.SerializeReferenceExtensions/Editor/AdvancedTypePopup.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "MackySoft.SerializeReferenceExtensions.Editor",
3+
"rootNamespace": "",
4+
"references": [
5+
"GUID:49b49c76ee64f6b41bf28ef951cb0e50"
6+
],
7+
"includePlatforms": [
8+
"Editor"
9+
],
10+
"excludePlatforms": [],
11+
"allowUnsafeCode": false,
12+
"overrideReferences": false,
13+
"precompiledReferences": [],
14+
"autoReferenced": true,
15+
"defineConstraints": [
16+
"UNITY_2019_3_OR_NEWER"
17+
],
18+
"versionDefines": [],
19+
"noEngineReferences": false
20+
}

0 commit comments

Comments
 (0)