Compare commits
3 Commits
da89d7a7fc
...
46d192ea27
| Author | SHA1 | Date | |
|---|---|---|---|
| 46d192ea27 | |||
| b7dfa7bffa | |||
| f3f386d4c0 |
@ -10,6 +10,8 @@ namespace NegUtils.Editor
|
||||
[InitializeOnLoad]
|
||||
public class ToolsWindowBase : EditorWindow
|
||||
{
|
||||
private const int UnitySceneExtensionLength = 6;
|
||||
|
||||
static ToolsWindowBase()
|
||||
{
|
||||
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
|
||||
@ -57,17 +59,31 @@ namespace NegUtils.Editor
|
||||
var menu = new GenericMenu();
|
||||
|
||||
string path = Application.dataPath + "/Scenes/Production";
|
||||
string[] fileInfo = Directory.GetFiles(path, "*.unity");
|
||||
|
||||
foreach (string item in fileInfo)
|
||||
AddFiles(path, path, menu);
|
||||
|
||||
menu.DropDown(position);
|
||||
}
|
||||
|
||||
private static void AddFiles(string path, string basePath, GenericMenu menu)
|
||||
{
|
||||
string s = item;
|
||||
menu.AddItem(new GUIContent(s.Remove(0, path.Length + 1).Remove(s.Length - path.Length - 7 ,6)), false, () => {
|
||||
string[] fileInfo = Directory.GetFiles(path, "*.unity");
|
||||
for (int i = 0; i < fileInfo.Length; i++)
|
||||
{
|
||||
string s = fileInfo[i];
|
||||
menu.AddItem(new GUIContent(s.Remove(0, basePath.Length + 1).Remove(s.Length - basePath.Length - UnitySceneExtensionLength - 1 ,UnitySceneExtensionLength).Replace('\\', '/')), false, () => {
|
||||
LoadScene(s);
|
||||
});
|
||||
|
||||
if(i == fileInfo.Length) continue;
|
||||
menu.AddSeparator("");
|
||||
}
|
||||
menu.DropDown(position);
|
||||
|
||||
string[] dirInfo = Directory.GetDirectories(path);
|
||||
foreach (string dir in dirInfo)
|
||||
{
|
||||
AddFiles(dir, basePath, menu);
|
||||
}
|
||||
}
|
||||
|
||||
private static void LoadScene(string path)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user