mirror of https://github.com/tuyoogame/YooAsset
update space shooter
parent
06a5c90b23
commit
b2c9cb3a7e
|
@ -377,6 +377,7 @@ GameObject:
|
||||||
- component: {fileID: 4142826567245113225}
|
- component: {fileID: 4142826567245113225}
|
||||||
- component: {fileID: 446002385128238495}
|
- component: {fileID: 446002385128238495}
|
||||||
- component: {fileID: 3593489457066976788}
|
- component: {fileID: 3593489457066976788}
|
||||||
|
- component: {fileID: 6254029933122384597}
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: UIBattle
|
m_Name: UIBattle
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
|
@ -457,6 +458,20 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 9776c197a7f86e94c9484946495616bb, type: 3}
|
m_Script: {fileID: 11500000, guid: 9776c197a7f86e94c9484946495616bb, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
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
|
--- !u!1 &5051316305113654670
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
@ -286,6 +286,7 @@ GameObject:
|
||||||
- component: {fileID: 4142826567245113225}
|
- component: {fileID: 4142826567245113225}
|
||||||
- component: {fileID: 446002385128238495}
|
- component: {fileID: 446002385128238495}
|
||||||
- component: {fileID: 761597478329303380}
|
- component: {fileID: 761597478329303380}
|
||||||
|
- component: {fileID: 314988873648655327}
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: UIHome
|
m_Name: UIHome
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
|
@ -370,6 +371,19 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 4792d7c57be85c845bc50d7215160853, type: 3}
|
m_Script: {fileID: 11500000, guid: 4792d7c57be85c845bc50d7215160853, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
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
|
--- !u!1 &4243341538011618776
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
@ -166,6 +166,7 @@ GameObject:
|
||||||
- component: {fileID: 4142826567245113225}
|
- component: {fileID: 4142826567245113225}
|
||||||
- component: {fileID: 446002385128238495}
|
- component: {fileID: 446002385128238495}
|
||||||
- component: {fileID: 6653013303473587574}
|
- component: {fileID: 6653013303473587574}
|
||||||
|
- component: {fileID: 5570311910315361439}
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: UILoading
|
m_Name: UILoading
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
|
@ -246,3 +247,16 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: f2bfcc4f450a0b94bb7748fb4788630e, type: 3}
|
m_Script: {fileID: 11500000, guid: f2bfcc4f450a0b94bb7748fb4788630e, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
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: []
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5fac54b722786ad4ead1a636d5057b7e
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Before Width: | Height: | Size: 111 KiB After Width: | Height: | Size: 111 KiB |
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 104 KiB |
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 106 KiB |
|
@ -32,7 +32,7 @@ SpriteAtlas:
|
||||||
secondaryTextureSettings: {}
|
secondaryTextureSettings: {}
|
||||||
variantMultiplier: 1
|
variantMultiplier: 1
|
||||||
packables:
|
packables:
|
||||||
- {fileID: 102900000, guid: 935d7f20c085cc141a3daf9cacfabfae, type: 3}
|
- {fileID: 102900000, guid: 5fac54b722786ad4ead1a636d5057b7e, type: 3}
|
||||||
bindAsDefault: 1
|
bindAsDefault: 1
|
||||||
isAtlasV2: 0
|
isAtlasV2: 0
|
||||||
cachedData: {fileID: 0}
|
cachedData: {fileID: 0}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 93fb052359d809247bd6669f2b989ddd
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,70 @@
|
||||||
|
using System.IO;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
using UnityEngine.U2D;
|
||||||
|
|
||||||
|
public static class UIPanelModifier
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 刷新面板清单
|
||||||
|
/// </summary>
|
||||||
|
public static void Refresh(PanelManifest manifest)
|
||||||
|
{
|
||||||
|
CacheReferenceAtals(manifest);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新组件
|
||||||
|
/// </summary>
|
||||||
|
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<Image>(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<SpriteAtlas>(atlasAssetPath);
|
||||||
|
if (spriteAtlas == null)
|
||||||
|
{
|
||||||
|
throw new System.Exception($"Not found SpriteAtlas : {atlasAssetPath}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (manifest.ReferencesAtlas.Contains(spriteAtlas) == false)
|
||||||
|
manifest.ReferencesAtlas.Add(spriteAtlas);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取精灵所属图集
|
||||||
|
/// </summary>
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6076577ae87253845a16ec633f38704c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,29 @@
|
||||||
|
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<PanelManifest>();
|
||||||
|
if (manifest == null)
|
||||||
|
manifest = go.AddComponent<PanelManifest>();
|
||||||
|
|
||||||
|
UIPanelModifier.Refresh(manifest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6bed3b2eaa555ec4e9aaa22a888b504c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,49 @@
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEditor;
|
||||||
|
|
||||||
|
public static class UIPanelSettings
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 面板文件夹GUID
|
||||||
|
/// </summary>
|
||||||
|
private const string UIPanelDirectoryGUID = "12d33f33f3a55224c9c747d7bffa1c68";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 精灵文件夹GUID
|
||||||
|
/// </summary>
|
||||||
|
private const string UISpriteDirectoryGUID = "935d7f20c085cc141a3daf9cacfabfae";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 图集文件夹GUID
|
||||||
|
/// </summary>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 603a8486cd52506408bf1eb6a80588b6
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,12 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.U2D;
|
||||||
|
|
||||||
|
public class PanelManifest : MonoBehaviour
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 面板自动引用的图集
|
||||||
|
/// </summary>
|
||||||
|
public List<SpriteAtlas> ReferencesAtlas = new List<SpriteAtlas>();
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e2537124b11b52a458e01629f6b18f55
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue