IndieGame/client/Assets/Ether/Editor/Common/ConstName.cs

89 lines
2.3 KiB
C#

using DG.Tweening.Plugins.Core.PathCore;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEngine;
namespace Ether
{
public static class ConstName
{
static readonly string[] scenePathSplit = { "/", ".unity" };
public static List<string> SceneNameList
{
get
{
List<string> list = new List<string>();
var scenes = EditorBuildSettings.scenes;
for (int i = 0; i < scenes.Length; i++)
{
string path = scenes[i].path;
string[] splitPath = path.Split(scenePathSplit, System.StringSplitOptions.RemoveEmptyEntries);
string sceneName = "";
if (splitPath.Length > 0)
{
sceneName = splitPath[splitPath.Length - 1];
}
else
{
sceneName = "(Deleted Scene)";
}
list.Add(sceneName);
}
return list;
}
}
public static List<string> AudioNameList
{
get
{
List<string> temp = new List<string>();
FileTools.FindAllFileInDirectory(Application.dataPath + "/Resources/Audio", temp, ".mp3", ".wav", ".ogg");
for (int i = 0; i < temp.Count; i++)
{
string[] tempPath = temp[i].Split("/Resources/Audio/");
temp[i] = tempPath[1].Split(".")[0];
}
temp.Insert(0, "");
return temp;
}
}
public static List<string> AllFrameList
{
get
{
Type[] allFrameBase = CommonTools.GetChildTypes(typeof(FrameBase));
List<string> names = new List<string>();
names.Add("");
foreach (var type in allFrameBase)
{
if (type.Name.EndsWith("Base"))
{
continue;
}
names.Add(type.Name);
}
return names;
}
}
}
}