blob: 6e85d8d61552c794a15c9e4eb425c7e9b1d5aad4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
#if UNITY_EDITOR
using System;
using UnityEditor;
namespace XEditor
{
public class XEditorPath
{
public static readonly string Sce = "Assets/XScene/";
public static readonly string Cts = "Assets/Resources/CutScene/";
public static readonly string Skp = "Assets/Resources/SkillPackage/";
public static readonly string Crv = "Assets/Editor/EditorResources/Curve/";
public static readonly string Cfg = "Assets/Editor/EditorResources/SkillPackage/";
public static readonly string Scb = "Assets/Resources/Table/SceneBlock/";
public static readonly string Lev = "Assets/Resources/Table/Level/";
private static readonly string _root = "Assets/Resources";
private static readonly string _editor_root = "Assets/Editor";
private static readonly string _editor_res_root = "Assets/Editor/EditorResources";
public static string GetCfgFromSkp(string skp, string suffix = ".config")
{
skp = skp.Replace("/Resources/", "/Editor/EditorResources/");
int m = skp.LastIndexOf('.');
return skp.Substring(0, m) + suffix;
}
private static void RootPath()
{
if (!System.IO.Directory.Exists(_root))
{
AssetDatabase.CreateFolder("Assets", "Resources");
}
}
private static void EditorRootPath()
{
if (!System.IO.Directory.Exists(_editor_root))
{
AssetDatabase.CreateFolder("Assets", "Editor");
}
if (!System.IO.Directory.Exists(_editor_res_root))
{
AssetDatabase.CreateFolder("Assets/Editor", "EditorResources");
}
}
public static string BuildPath(string dictionary, string root)
{
string[] splits = dictionary.Split('/');
string _base = root;
foreach (string s in splits)
{
string path = _base + "/" + s + "/";
if (!System.IO.Directory.Exists(path))
{
AssetDatabase.CreateFolder(_base, s);
}
_base = path.Substring(0, path.Length - 1);
}
return _base + "/";
}
public static string GetEditorBasedPath(string dictionary)
{
EditorRootPath();
return BuildPath(dictionary, _editor_res_root);
}
public static string GetPath(string dictionary)
{
RootPath();
return BuildPath(dictionary, _root);
}
}
}
#endif
|