| | |
| | | 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";
|
| | |
|
| | | [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();
|
| | | }
|
| | | }
|