Skip to content

Commit fe9a967

Browse files
committed
[Bot] Automated dotnet-format update
1 parent 5cbb403 commit fe9a967

File tree

1 file changed

+138
-138
lines changed

1 file changed

+138
-138
lines changed

UOP1_Project/Assets/Scripts/Editor/SOsQuickAccessToolWindow.cs

Lines changed: 138 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -3,141 +3,141 @@
33
using UnityEngine;
44
using UnityEditor;
55

6-
class SOsQuickAccessToolWindow : EditorWindow
7-
{
8-
[Header("Editor Window Related")]
9-
Vector2 scroll;
10-
int selected;
11-
12-
[Header("SOs related")]
13-
string[] assetSearchFolders;
14-
15-
List<string> SOTypes;
16-
string[] objectsGUIDs;
17-
string[] objectsPaths;
18-
ScriptableObject[] objects;
19-
20-
string[] displayObjectsGUIDs;
21-
List<string> displayObjectsPaths;
22-
List<ScriptableObject> displayObjects;
23-
24-
private void OnEnable()
25-
{
26-
assetSearchFolders = new string[1];
27-
assetSearchFolders[0] = "Assets/ScriptableObjects";
28-
29-
FindAllSOs();
30-
FindDisplaySOs();
31-
}
32-
33-
void OnFocus()
34-
{
35-
FindAllSOs();
36-
FindDisplaySOs();
37-
}
38-
39-
[MenuItem("Tools/SOs Quick Access Tool")]
40-
private static void ShowWindow()
41-
{
42-
GetWindow<SOsQuickAccessToolWindow>("SOs Quick Access Tool");
43-
}
44-
45-
void OnGUI()
46-
{
47-
GUILayout.Space(EditorGUIUtility.singleLineHeight * 0.5f);
48-
49-
GUILayout.BeginHorizontal();
50-
51-
DrawSOsPicker();
52-
if (GUILayout.Button("Refresh All"))
53-
{
54-
FindAllSOs();
55-
FindDisplaySOs();
56-
}
57-
58-
GUILayout.EndHorizontal();
59-
60-
DrawSOsList();
61-
}
62-
63-
void DrawSOsPicker()
64-
{
65-
EditorGUI.BeginChangeCheck();
66-
selected = EditorGUILayout.Popup(GUIContent.none, selected, SOTypes.ToArray());
67-
if (EditorGUI.EndChangeCheck())
68-
{
69-
FindDisplaySOs();
70-
}
71-
}
72-
73-
void DrawSOsList()
74-
{
75-
scroll = GUILayout.BeginScrollView(scroll);
76-
77-
for (int i=0; i< displayObjectsGUIDs.Length; i++)
78-
{
79-
GUILayout.Label(i+1 + ". " + displayObjects[i].name);
80-
81-
if (GUILayout.Button("Locate Quickly"))
82-
{
83-
EditorUtility.FocusProjectWindow();
84-
EditorGUIUtility.PingObject(displayObjects[i]);
85-
}
86-
87-
GUILayout.Space(EditorGUIUtility.singleLineHeight);
88-
}
89-
90-
GUILayout.EndScrollView();
91-
}
92-
93-
void FindAllSOs()
94-
{
95-
objectsGUIDs = AssetDatabase.FindAssets("t:ScriptableObject", assetSearchFolders) as string[];
96-
97-
objectsPaths = new string[objectsGUIDs.Length];
98-
objects = new ScriptableObject[objectsGUIDs.Length];
99-
100-
SOTypes = new List<string>();
101-
102-
for (int i=0; i< objectsGUIDs.Length; i++)
103-
{
104-
objectsPaths[i] = AssetDatabase.GUIDToAssetPath(objectsGUIDs[i]);
105-
objects[i] = (ScriptableObject) AssetDatabase.LoadAssetAtPath(objectsPaths[i], typeof(ScriptableObject));
106-
//Debug.Log(objectsGUIDs[i] + ": " + objectsPaths[i] + " - " + i);
107-
}
108-
109-
for (int i=0; i<objects.Length; i++)
110-
{
111-
if (SOTypes.IndexOf(objects[i].GetType().ToString()) == -1)
112-
{
113-
SOTypes.Add(objects[i].GetType().ToString());
114-
}
115-
}
116-
}
117-
118-
void FindDisplaySOs()
119-
{
120-
if (displayObjects != null)
121-
{
122-
displayObjects.Clear();
123-
}
124-
if (displayObjectsPaths != null)
125-
{
126-
displayObjectsPaths.Clear();
127-
}
128-
129-
string type = SOTypes[selected];
130-
string queryString = "t:"+ type;
131-
132-
displayObjectsGUIDs = AssetDatabase.FindAssets(queryString);
133-
134-
displayObjectsPaths = new List<string>(displayObjectsGUIDs.Length);
135-
displayObjects = new List<ScriptableObject>(displayObjectsGUIDs.Length);
136-
137-
for (int i=0; i < displayObjectsGUIDs.Length; i++)
138-
{
139-
displayObjectsPaths.Add(AssetDatabase.GUIDToAssetPath(displayObjectsGUIDs[i]));
140-
displayObjects.Add(AssetDatabase.LoadAssetAtPath(displayObjectsPaths[i], typeof(ScriptableObject)) as ScriptableObject);
141-
}
142-
}
143-
}
6+
class SOsQuickAccessToolWindow : EditorWindow
7+
{
8+
[Header("Editor Window Related")]
9+
Vector2 scroll;
10+
int selected;
11+
12+
[Header("SOs related")]
13+
string[] assetSearchFolders;
14+
15+
List<string> SOTypes;
16+
string[] objectsGUIDs;
17+
string[] objectsPaths;
18+
ScriptableObject[] objects;
19+
20+
string[] displayObjectsGUIDs;
21+
List<string> displayObjectsPaths;
22+
List<ScriptableObject> displayObjects;
23+
24+
private void OnEnable()
25+
{
26+
assetSearchFolders = new string[1];
27+
assetSearchFolders[0] = "Assets/ScriptableObjects";
28+
29+
FindAllSOs();
30+
FindDisplaySOs();
31+
}
32+
33+
void OnFocus()
34+
{
35+
FindAllSOs();
36+
FindDisplaySOs();
37+
}
38+
39+
[MenuItem("Tools/SOs Quick Access Tool")]
40+
private static void ShowWindow()
41+
{
42+
GetWindow<SOsQuickAccessToolWindow>("SOs Quick Access Tool");
43+
}
44+
45+
void OnGUI()
46+
{
47+
GUILayout.Space(EditorGUIUtility.singleLineHeight * 0.5f);
48+
49+
GUILayout.BeginHorizontal();
50+
51+
DrawSOsPicker();
52+
if (GUILayout.Button("Refresh All"))
53+
{
54+
FindAllSOs();
55+
FindDisplaySOs();
56+
}
57+
58+
GUILayout.EndHorizontal();
59+
60+
DrawSOsList();
61+
}
62+
63+
void DrawSOsPicker()
64+
{
65+
EditorGUI.BeginChangeCheck();
66+
selected = EditorGUILayout.Popup(GUIContent.none, selected, SOTypes.ToArray());
67+
if (EditorGUI.EndChangeCheck())
68+
{
69+
FindDisplaySOs();
70+
}
71+
}
72+
73+
void DrawSOsList()
74+
{
75+
scroll = GUILayout.BeginScrollView(scroll);
76+
77+
for (int i = 0; i < displayObjectsGUIDs.Length; i++)
78+
{
79+
GUILayout.Label(i + 1 + ". " + displayObjects[i].name);
80+
81+
if (GUILayout.Button("Locate Quickly"))
82+
{
83+
EditorUtility.FocusProjectWindow();
84+
EditorGUIUtility.PingObject(displayObjects[i]);
85+
}
86+
87+
GUILayout.Space(EditorGUIUtility.singleLineHeight);
88+
}
89+
90+
GUILayout.EndScrollView();
91+
}
92+
93+
void FindAllSOs()
94+
{
95+
objectsGUIDs = AssetDatabase.FindAssets("t:ScriptableObject", assetSearchFolders) as string[];
96+
97+
objectsPaths = new string[objectsGUIDs.Length];
98+
objects = new ScriptableObject[objectsGUIDs.Length];
99+
100+
SOTypes = new List<string>();
101+
102+
for (int i = 0; i < objectsGUIDs.Length; i++)
103+
{
104+
objectsPaths[i] = AssetDatabase.GUIDToAssetPath(objectsGUIDs[i]);
105+
objects[i] = (ScriptableObject)AssetDatabase.LoadAssetAtPath(objectsPaths[i], typeof(ScriptableObject));
106+
//Debug.Log(objectsGUIDs[i] + ": " + objectsPaths[i] + " - " + i);
107+
}
108+
109+
for (int i = 0; i < objects.Length; i++)
110+
{
111+
if (SOTypes.IndexOf(objects[i].GetType().ToString()) == -1)
112+
{
113+
SOTypes.Add(objects[i].GetType().ToString());
114+
}
115+
}
116+
}
117+
118+
void FindDisplaySOs()
119+
{
120+
if (displayObjects != null)
121+
{
122+
displayObjects.Clear();
123+
}
124+
if (displayObjectsPaths != null)
125+
{
126+
displayObjectsPaths.Clear();
127+
}
128+
129+
string type = SOTypes[selected];
130+
string queryString = "t:" + type;
131+
132+
displayObjectsGUIDs = AssetDatabase.FindAssets(queryString);
133+
134+
displayObjectsPaths = new List<string>(displayObjectsGUIDs.Length);
135+
displayObjects = new List<ScriptableObject>(displayObjectsGUIDs.Length);
136+
137+
for (int i = 0; i < displayObjectsGUIDs.Length; i++)
138+
{
139+
displayObjectsPaths.Add(AssetDatabase.GUIDToAssetPath(displayObjectsGUIDs[i]));
140+
displayObjects.Add(AssetDatabase.LoadAssetAtPath(displayObjectsPaths[i], typeof(ScriptableObject)) as ScriptableObject);
141+
}
142+
}
143+
}

0 commit comments

Comments
 (0)