diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UIBattle.prefab b/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UIBattle.prefab index 686c9394..ee02a682 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UIBattle.prefab +++ b/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UIBattle.prefab @@ -377,7 +377,6 @@ GameObject: - component: {fileID: 4142826567245113225} - component: {fileID: 446002385128238495} - component: {fileID: 3593489457066976788} - - component: {fileID: 6254029933122384597} m_Layer: 5 m_Name: UIBattle m_TagString: Untagged @@ -458,20 +457,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 9776c197a7f86e94c9484946495616bb, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &6254029933122384597 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4142826567245113227} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: e2537124b11b52a458e01629f6b18f55, type: 3} - m_Name: - m_EditorClassIdentifier: - ReferencesAtlas: - - {fileID: 4343727234628468602, guid: 2a1b1891e0f61ff498a73d9ff86c26d7, type: 2} --- !u!1 &5051316305113654670 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UIHome.prefab b/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UIHome.prefab index 67fe2a2e..6bde1866 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UIHome.prefab +++ b/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UIHome.prefab @@ -286,7 +286,6 @@ GameObject: - component: {fileID: 4142826567245113225} - component: {fileID: 446002385128238495} - component: {fileID: 761597478329303380} - - component: {fileID: 314988873648655327} m_Layer: 5 m_Name: UIHome m_TagString: Untagged @@ -371,19 +370,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 4792d7c57be85c845bc50d7215160853, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &314988873648655327 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4142826567245113227} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: e2537124b11b52a458e01629f6b18f55, type: 3} - m_Name: - m_EditorClassIdentifier: - ReferencesAtlas: [] --- !u!1 &4243341538011618776 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UILoading.prefab b/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UILoading.prefab index f4f71055..2fe1c444 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UILoading.prefab +++ b/Assets/YooAsset/Samples~/Space Shooter/GameRes/UIPanel/UILoading.prefab @@ -166,7 +166,6 @@ GameObject: - component: {fileID: 4142826567245113225} - component: {fileID: 446002385128238495} - component: {fileID: 6653013303473587574} - - component: {fileID: 5570311910315361439} m_Layer: 5 m_Name: UILoading m_TagString: Untagged @@ -247,16 +246,3 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: f2bfcc4f450a0b94bb7748fb4788630e, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &5570311910315361439 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4142826567245113227} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: e2537124b11b52a458e01629f6b18f55, type: 3} - m_Name: - m_EditorClassIdentifier: - ReferencesAtlas: [] diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/PanelMonitor.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/PanelMonitor.meta deleted file mode 100644 index fab23070..00000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/PanelMonitor.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 93fb052359d809247bd6669f2b989ddd -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/PanelMonitor/UIPanelModifier.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/PanelMonitor/UIPanelModifier.cs deleted file mode 100644 index 8235140c..00000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/PanelMonitor/UIPanelModifier.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System.IO; -using UnityEngine; -using UnityEngine.UI; -using UnityEngine.U2D; - -public static class UIPanelModifier -{ - /// - /// 刷新面板清单 - /// - public static void Refresh(PanelManifest manifest) - { - CacheReferenceAtals(manifest); - } - - /// - /// 更新组件 - /// - private static void CacheReferenceAtals(PanelManifest manifest) - { - manifest.ReferencesAtlas.Clear(); - - string spriteDirectory = UIPanelSettings.GetSpriteDirecotry(); - string altasDirectory = UIPanelSettings.GetAtlasDirecotry(); - - // 获取依赖的图集名称 - Transform root = manifest.transform; - Image[] allImage = root.GetComponentsInChildren(true); - for (int i = 0; i < allImage.Length; i++) - { - Image image = allImage[i]; - if (image.sprite == null) - continue; - - // 文件路径 - string spriteAssetPath = UnityEditor.AssetDatabase.GetAssetPath(image.sprite); - - // 跳过系统内置资源 - if (spriteAssetPath.Contains("_builtin_")) - continue; - - // 跳过非图集精灵 - if (spriteAssetPath.StartsWith(spriteDirectory) == false) - continue; - - string atlasAssetPath = GetAtlasPath(altasDirectory, spriteAssetPath); - SpriteAtlas spriteAtlas = UnityEditor.AssetDatabase.LoadAssetAtPath(atlasAssetPath); - if (spriteAtlas == null) - { - throw new System.Exception($"Not found SpriteAtlas : {atlasAssetPath}"); - } - else - { - if (manifest.ReferencesAtlas.Contains(spriteAtlas) == false) - manifest.ReferencesAtlas.Add(spriteAtlas); - } - } - } - - /// - /// 获取精灵所属图集 - /// - private static string GetAtlasPath(string atlasDirectory, string assetPath) - { - string directory = Path.GetDirectoryName(assetPath); - DirectoryInfo directoryInfo = new DirectoryInfo(directory); - string atlasName = directoryInfo.Name; - return $"{atlasDirectory}/{atlasName}.spriteatlas"; - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/PanelMonitor/UIPanelModifier.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/PanelMonitor/UIPanelModifier.cs.meta deleted file mode 100644 index e7db53ab..00000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/PanelMonitor/UIPanelModifier.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6076577ae87253845a16ec633f38704c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/PanelMonitor/UIPanelMonitor.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/PanelMonitor/UIPanelMonitor.cs deleted file mode 100644 index e933e266..00000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/PanelMonitor/UIPanelMonitor.cs +++ /dev/null @@ -1,29 +0,0 @@ -using UnityEngine; -using UnityEditor; -using UnityEditor.SceneManagement; - -public class UIPanelMonitor : UnityEditor.Editor -{ - [InitializeOnLoadMethod] - static void StartInitializeOnLoadMethod() - { - PrefabStage.prefabSaving += OnPrefabSaving; - } - - static void OnPrefabSaving(GameObject go) - { - PrefabStage stage = PrefabStageUtility.GetCurrentPrefabStage(); - if (stage != null) - { - string panelDirectory = UIPanelSettings.GetPanelDirecotry(); - if (stage.assetPath.StartsWith(panelDirectory)) - { - PanelManifest manifest = go.GetComponent(); - if (manifest == null) - manifest = go.AddComponent(); - - UIPanelModifier.Refresh(manifest); - } - } - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/PanelMonitor/UIPanelMonitor.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/PanelMonitor/UIPanelMonitor.cs.meta deleted file mode 100644 index 716a4d98..00000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/PanelMonitor/UIPanelMonitor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6bed3b2eaa555ec4e9aaa22a888b504c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/PanelMonitor/UIPanelSettings.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/PanelMonitor/UIPanelSettings.cs deleted file mode 100644 index e7783625..00000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/PanelMonitor/UIPanelSettings.cs +++ /dev/null @@ -1,49 +0,0 @@ -using UnityEngine; -using UnityEditor; - -public static class UIPanelSettings -{ - /// - /// 面板文件夹GUID - /// - private const string UIPanelDirectoryGUID = "12d33f33f3a55224c9c747d7bffa1c68"; - - /// - /// 精灵文件夹GUID - /// - private const string UISpriteDirectoryGUID = "935d7f20c085cc141a3daf9cacfabfae"; - - /// - /// 图集文件夹GUID - /// - private const string UIAtlasDirectoryGUID = "c355c783476322b4cacac98c5e1b46d8"; - - - public static string GetPanelDirecotry() - { - string result = AssetDatabase.GUIDToAssetPath(UIPanelDirectoryGUID); - if (string.IsNullOrEmpty(result)) - { - throw new System.Exception($"Can not found panel direcotry : {UIPanelDirectoryGUID}"); - } - return result; - } - public static string GetSpriteDirecotry() - { - string result = AssetDatabase.GUIDToAssetPath(UISpriteDirectoryGUID); - if (string.IsNullOrEmpty(result)) - { - throw new System.Exception($"Can not found sprite direcotry : {UISpriteDirectoryGUID}"); - } - return result; - } - public static string GetAtlasDirecotry() - { - string result = AssetDatabase.GUIDToAssetPath(UIAtlasDirectoryGUID); - if (string.IsNullOrEmpty(result)) - { - throw new System.Exception($"Can not found atlas direcotry : {UIAtlasDirectoryGUID}"); - } - return result; - } -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/PanelMonitor/UIPanelSettings.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/PanelMonitor/UIPanelSettings.cs.meta deleted file mode 100644 index aaa94072..00000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Editor/PanelMonitor/UIPanelSettings.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 603a8486cd52506408bf1eb6a80588b6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/PanelManifest.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/PanelManifest.cs deleted file mode 100644 index 517cb07e..00000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/PanelManifest.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.U2D; - -public class PanelManifest : MonoBehaviour -{ - /// - /// 面板自动引用的图集 - /// - public List ReferencesAtlas = new List(); -} \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/PanelManifest.cs.meta b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/PanelManifest.cs.meta deleted file mode 100644 index 4f86ead2..00000000 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/Behaviour/PanelManifest.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e2537124b11b52a458e01629f6b18f55 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: