少年修仙传客户端基础资源
client_Wu Xijin
2018-10-27 58f8d2063b9cf02ff293be7a40cdfe8994da99b5
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.IO;
 
public class UpdateSpriteSetting
{
 
    static string rootPath = Application.dataPath + "/ResourcesOut/UI/Sprite";
    static string spriteRelativePath = "Assets/ResourcesOut/UI/Sprite";
 
    [MenuItem("程序/设置资源包名/更新Sprite(All) AssetBundleName")]
    public static void SetAllSpriteAssetBundleName()
    {
        var allFiles = new DirectoryInfo(rootPath).GetFiles("*.png", SearchOption.AllDirectories);
 
        foreach (var file in allFiles)
        {
            var pathStringArray = file.DirectoryName.Split(Path.DirectorySeparatorChar);
            var importerPath = spriteRelativePath + Path.DirectorySeparatorChar + pathStringArray[pathStringArray.Length - 1] + Path.DirectorySeparatorChar + file.Name;
            var importer = AssetImporter.GetAtPath(importerPath);
            importer.assetBundleName = "ui/sprite/" + pathStringArray[pathStringArray.Length - 1].ToLower();
            EditorUtility.SetDirty(importer);
        }
 
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
    }
 
}
 
 
public class UpdateUIWindowSetting
{
    static string rootPath = Application.dataPath + "/ResourcesOut/UI/Window";
    static string assetRelativePath = "Assets/ResourcesOut/UI/Window";
 
    static string rootPath2 = Application.dataPath + "/ResourcesOut/UI/PriorityWindow";
    static string assetRelativePath2 = "Assets/ResourcesOut/UI/PriorityWindow";
 
    [MenuItem("程序/设置资源包名/更新Window(All) AssetBundleName")]
    public static void SetAllUIWindowAssetBundleName()
    {
        var allFiles = new DirectoryInfo(rootPath).GetFiles("*.prefab", SearchOption.TopDirectoryOnly);
        foreach (var file in allFiles)
        {
            var importerPath = assetRelativePath + Path.DirectorySeparatorChar + file.Name;
            var importer = AssetImporter.GetAtPath(importerPath);
            importer.assetBundleName = "ui/window";
 
            EditorUtility.SetDirty(importer);
        }
 
        allFiles = new DirectoryInfo(rootPath2).GetFiles("*.prefab", SearchOption.TopDirectoryOnly);
        foreach (var file in allFiles)
        {
            var importerPath = assetRelativePath2 + Path.DirectorySeparatorChar + file.Name;
            var importer = AssetImporter.GetAtPath(importerPath);
            importer.assetBundleName = "ui/prioritywindow";
 
            EditorUtility.SetDirty(importer);
        }
 
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
    }
}
 
public class UpdateUIPrefabSetting
{
    static string rootPath = Application.dataPath + "/ResourcesOut/UI/Prefab";
    static string assetRelativePath = "Assets/ResourcesOut/UI/Prefab";
 
    [MenuItem("程序/设置资源包名/更新Prefab(All) AssetBundleName")]
    public static void SetAllUIPrefabAssetBundleName()
    {
        var allFiles = new DirectoryInfo(rootPath).GetFiles("*.prefab", SearchOption.TopDirectoryOnly);
 
        foreach (var file in allFiles)
        {
            var importerPath = assetRelativePath + Path.DirectorySeparatorChar + file.Name;
            var importer = AssetImporter.GetAtPath(importerPath);
            importer.assetBundleName = "ui/prefab";
            EditorUtility.SetDirty(importer);
        }
 
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
    }
}
 
public class UpdateEffectPrefabSetting
{
    static string rootPath = Application.dataPath + "/ResourcesOut/Effect/";
    static string assetPath = "Assets/ResourcesOut/Effect/";
 
    [MenuItem("程序/设置资源包名/更新Effect(All) AssetBundleName")]
    public static void SetAllEffectPrefabAssetBundleName()
    {
        var allFiles = new DirectoryInfo(rootPath).GetFiles("*.prefab", SearchOption.AllDirectories);
 
        foreach (var file in allFiles)
        {
            var pathStringArray = file.DirectoryName.Split(Path.DirectorySeparatorChar);
            var importerPath = assetPath + pathStringArray[pathStringArray.Length - 1] + Path.DirectorySeparatorChar + file.Name;
            var importer = AssetImporter.GetAtPath(importerPath);
            importer.assetBundleName = "effect/" + pathStringArray[pathStringArray.Length - 1].ToLower();
            EditorUtility.SetDirty(importer);
        }
 
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
    }
}
 
public class UpdateMobSetting
{
    static string rootPath = Application.dataPath + "/ResourcesOut/Mob";
    static string assetPath = "Assets/ResourcesOut/Mob";
 
    [MenuItem("程序/设置资源包名/更新Mob(All) AssetBundleName")]
    public static void SetAllMobAssetBundleName()
    {
        var allFiles = new DirectoryInfo(rootPath).GetFiles("*.prefab", SearchOption.TopDirectoryOnly);
        foreach (var file in allFiles)
        {
            var importerPath = assetPath + Path.DirectorySeparatorChar + file.Name;
            var extersion = Path.GetExtension(file.FullName);
            var importer = AssetImporter.GetAtPath(importerPath);
            var hostfix = file.Name.Replace("Prefab_Secondary", "")
                                                 .Replace("Prefab_Weapon", "")
                                                 .Replace("Prefab_Wing", "")
                                                 .Replace("Prefab_Race", "")
                                                 .Replace("Prefab_Horse", "")
                                                 .Replace("_UI", "")
                                                 .Replace(".prefab", "")
                                                 .Replace("Prefab_Hand", "");
 
            importer.assetBundleName = StringUtility.Contact("mob/prefab_race", hostfix);
            EditorUtility.SetDirty(importer);
        }
 
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
    }
}
 
public class UpdateShaderSetting
{
    static string rootPath = Application.dataPath + "/ResourcesOut/Shader";
    static string assetPath = "Assets/ResourcesOut/Shader";
 
    [MenuItem("程序/设置资源包名/更新Shader(All) AssetBundleName")]
    public static void SetAllShaderAssetBundleName()
    {
        var allFiles = new DirectoryInfo(rootPath).GetFiles("*.shader", SearchOption.TopDirectoryOnly);
        foreach (var file in allFiles)
        {
            var importerPath = assetPath + Path.DirectorySeparatorChar + file.Name;
            var importer = AssetImporter.GetAtPath(importerPath);
            importer.assetBundleName = "graphic/shader";
            EditorUtility.SetDirty(importer);
        }
 
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
    }
}
 
public class UpdateScriptableObjectsSetting
{
    static string rootPath = Application.dataPath + "/ResourcesOut/Refdata/ScriptableObject/";
    static string assetPath = "Assets/ResourcesOut/Refdata/ScriptableObject/";
    static string[] relativePaths = new string[] { "SoTreasure3D", "SoTreasureMeridian", "SoActor", "SoDeadFly", "SoBodyControl",
        "SoCameraSFX", "SoFlyObject", "SoSkill", "SoSweepHit", "SoGhostShadow", "SoNewBieGuide", "SoMapObjectGenerate" };
 
    [MenuItem("程序/设置资源包名/更新ScriptableObject(All) AssetBundleName")]
    public static void SetAllScriptableObjectAssetBundleName()
    {
        for (int i = 0; i < relativePaths.Length; i++)
        {
            var relativePath = relativePaths[i];
            var allFiles = new DirectoryInfo(rootPath + relativePath).GetFiles("*.asset", SearchOption.TopDirectoryOnly);
 
            foreach (var file in allFiles)
            {
                var importerPath = assetPath + relativePath + Path.DirectorySeparatorChar + file.Name;
                var importer = AssetImporter.GetAtPath(importerPath);
                importer.assetBundleName = "config/scriptableobjects";
                EditorUtility.SetDirty(importer);
            }
        }
 
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
    }
}
 
public class UpdateLevelSetting
{
    static string rootPath = Application.dataPath + "/Art/Maps/Scenes";
    static string assetPath = "Assets/Art/Maps/Scenes";
 
    [MenuItem("程序/设置资源包名/更新Level(All) AssetBundleName")]
    public static void SetAllLevelAssetBundleName()
    {
        var allFiles = new DirectoryInfo(rootPath).GetFiles("*.unity", SearchOption.TopDirectoryOnly);
        foreach (var file in allFiles)
        {
            var importerPath = assetPath + Path.DirectorySeparatorChar + file.Name;
            var importer = AssetImporter.GetAtPath(importerPath);
            importer.assetBundleName = "maps/" + Path.GetFileNameWithoutExtension(file.FullName).ToLower();
            EditorUtility.SetDirty(importer);
        }
 
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
    }
}
 
public class UpdateAudioSetting
{
    static string rootPath = Application.dataPath + "/ResourcesOut/Audio/";
    static string assetPath = "Assets/ResourcesOut/Audio/";
 
    [MenuItem("程序/设置资源包名/更新Audio(All) AssetBundleName")]
    public static void SetAllAudioAssetBundleName()
    {
        var allFiles = new DirectoryInfo(rootPath).GetFiles("*.wav", SearchOption.AllDirectories);
 
        foreach (var file in allFiles)
        {
            var pathStringArray = file.DirectoryName.Split(Path.DirectorySeparatorChar);
            var importerPath = assetPath + pathStringArray[pathStringArray.Length - 1] + Path.DirectorySeparatorChar + file.Name;
            var importer = AssetImporter.GetAtPath(importerPath);
            importer.assetBundleName = "audio/" + pathStringArray[pathStringArray.Length - 1].ToLower();
            EditorUtility.SetDirty(importer);
        }
 
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
    }
}