| | |
| | | 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(".prefab", ""); |
| | | 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(); |
| | | } |
| | | } |
| | | 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";
|
| | |
|
| | | public static void SetRechargeSkin(int pattern)
|
| | | {
|
| | | var toDirectory = Application.dataPath + "/ResourcesOut/UI/Sprite/Recharge";
|
| | | var oldFiles = new DirectoryInfo(toDirectory).GetFiles("*.png", SearchOption.AllDirectories);
|
| | | foreach (var item in oldFiles)
|
| | | {
|
| | | File.Delete(item.FullName);
|
| | | }
|
| | |
|
| | | var fromDirectory = Application.dataPath + "/Editor/RechargeSprites/Pattern_" + pattern;
|
| | | FileExtersion.DirectoryCopy(fromDirectory, toDirectory);
|
| | | }
|
| | |
|
| | | [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";
|
| | | static string zsMaterialPath_Origin = Application.dataPath + "/Art/Role/A_Zs/Materials";
|
| | | static string fsMaterialPath_Origin = Application.dataPath + "/Art/Role/A_Fs/Materials";
|
| | |
|
| | | static string zsMaterialPath_OutPut = Application.dataPath + "/ResourcesOut/Mob/A_Zs/Materials";
|
| | | static string fsMaterialPath_OutPut = Application.dataPath + "/ResourcesOut/Mob/A_Fs/Materials";
|
| | |
|
| | | [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);
|
| | | }
|
| | |
|
| | | //var zsMaterialFiles = new DirectoryInfo(zsMaterialPath_Origin).GetFiles("*.mat", SearchOption.TopDirectoryOnly);
|
| | | //if (!Directory.Exists(zsMaterialPath_OutPut))
|
| | | //{
|
| | | // Directory.CreateDirectory(zsMaterialPath_OutPut);
|
| | | //}
|
| | |
|
| | | //foreach (var file in zsMaterialFiles)
|
| | | //{
|
| | | // var fileName = Path.GetFileName(file.FullName);
|
| | | // File.Copy(file.FullName, StringUtility.Contact(zsMaterialPath_OutPut, "/", fileName), true);
|
| | | //}
|
| | |
|
| | | //var fsMaterialFiles = new DirectoryInfo(fsMaterialPath_Origin).GetFiles("*.mat", SearchOption.TopDirectoryOnly);
|
| | | //if (!Directory.Exists(fsMaterialPath_OutPut))
|
| | | //{
|
| | | // Directory.CreateDirectory(fsMaterialPath_OutPut);
|
| | | //}
|
| | |
|
| | | //foreach (var file in fsMaterialFiles)
|
| | | //{
|
| | | // var fileName = Path.GetFileName(file.FullName);
|
| | | // File.Copy(file.FullName, StringUtility.Contact(fsMaterialPath_OutPut, "/", fileName), true);
|
| | | //}
|
| | |
|
| | | AssetDatabase.SaveAssets();
|
| | | AssetDatabase.Refresh();
|
| | |
|
| | | //foreach (var file in zsMaterialFiles)
|
| | | //{
|
| | | // var fileName = Path.GetFileName(file.FullName);
|
| | | // var importerPath = assetPath + "/A_Zs/Materials/" + file.Name;
|
| | | // var importer = AssetImporter.GetAtPath(importerPath);
|
| | |
|
| | | // importer.assetBundleName = "mob/a_zs_materials";
|
| | | // EditorUtility.SetDirty(importer);
|
| | | //}
|
| | |
|
| | | //foreach (var file in fsMaterialFiles)
|
| | | //{
|
| | | // var fileName = Path.GetFileName(file.FullName);
|
| | | // var importerPath = assetPath + "/A_Fs/Materials/" + file.Name;
|
| | | // var importer = AssetImporter.GetAtPath(importerPath);
|
| | |
|
| | | // importer.assetBundleName = "mob/a_fs_materials";
|
| | | // 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","SoDemonDungeon" };
|
| | |
|
| | | [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";
|
| | |
|
| | | public static void SetCreateRoleLevel(string pattern)
|
| | | {
|
| | | var root = Application.dataPath + "/Art/Maps/Scenes/Map_CreateRole";
|
| | | var from = Application.dataPath + "/Art/Maps/Scenes/Map_CreateRole/" + "CreateRole_" + pattern + ".unity";
|
| | | var to = Application.dataPath + "/Art/Maps/Scenes/" + "CreateRole_001.unity";
|
| | |
|
| | | if (File.Exists(from))
|
| | | {
|
| | | if (File.Exists(to))
|
| | | {
|
| | | File.Delete(to);
|
| | | }
|
| | | File.Copy(from, to);
|
| | | }
|
| | | }
|
| | |
|
| | | [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);
|
| | | }
|
| | |
|
| | | var textures = AssetDatabase.FindAssets("t:Texture2D", new string[] { "Assets/ResourcesOut/Scene/Textures" });
|
| | | foreach (var item in textures)
|
| | | {
|
| | | var importer = AssetImporter.GetAtPath(AssetDatabase.GUIDToAssetPath(item));
|
| | | importer.assetBundleName = "maps/textures";
|
| | | 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();
|
| | | }
|
| | | }
|
| | |
|
| | | public class UpdateLuaSetting
|
| | | {
|
| | | static string rootPath = Application.dataPath + "/ResourcesOut/Lua/";
|
| | | static string assetPath = "Assets/ResourcesOut/Lua/";
|
| | |
|
| | | [MenuItem("程序/设置资源包名/更新Lua(All) AssetBundleName")]
|
| | | public static void SetAllLuaAssetBundleName()
|
| | | {
|
| | | var allFiles = new DirectoryInfo(rootPath).GetFiles("*.txt", SearchOption.AllDirectories);
|
| | |
|
| | | var amendRootPath = rootPath.Replace("\\", "/");
|
| | | foreach (var file in allFiles)
|
| | | {
|
| | | var directoryName = file.DirectoryName.Replace("\\", "/");
|
| | | var relativeDirectory = directoryName.Replace(amendRootPath, "");
|
| | |
|
| | | var importerPath = assetPath + relativeDirectory + Path.DirectorySeparatorChar + file.Name;
|
| | | var importer = AssetImporter.GetAtPath(importerPath);
|
| | | importer.assetBundleName = "lua/" + relativeDirectory.ToLower();
|
| | | EditorUtility.SetDirty(importer);
|
| | | }
|
| | |
|
| | | AssetDatabase.SaveAssets();
|
| | | AssetDatabase.Refresh();
|
| | | }
|
| | | }
|
| | |
|
| | | public class UpdateBuiltInSetting
|
| | | {
|
| | | static string rootPath = Application.dataPath + "/ResourcesOut/BuiltIn/";
|
| | | static string assetPath = "Assets/ResourcesOut/BuiltIn/";
|
| | |
|
| | | [MenuItem("程序/设置资源包名/更新BuiltIn(All) AssetBundleName")]
|
| | | public static void SetAllLuaAssetBundleName()
|
| | | {
|
| | | var allFiles = new List<FileInfo>();
|
| | | FileExtersion.GetAllDirectoryFileInfos(rootPath, allFiles);
|
| | |
|
| | | var amendRootPath = rootPath.Replace("\\", "/");
|
| | | foreach (var file in allFiles)
|
| | | {
|
| | | var extension = Path.GetExtension(file.FullName);
|
| | | if (extension == ".meta")
|
| | | {
|
| | | continue;
|
| | | }
|
| | |
|
| | | var directoryName = file.DirectoryName.Replace("\\", "/");
|
| | | var relativeDirectory = directoryName.Replace(amendRootPath, "");
|
| | |
|
| | | var importerPath = assetPath + relativeDirectory + Path.DirectorySeparatorChar + file.Name;
|
| | | var importer = AssetImporter.GetAtPath(importerPath);
|
| | | importer.assetBundleName = "builtin/" + relativeDirectory.ToLower();
|
| | | EditorUtility.SetDirty(importer);
|
| | | }
|
| | |
|
| | | AssetDatabase.SaveAssets();
|
| | | AssetDatabase.Refresh();
|
| | | }
|
| | | } |