mirror of https://github.com/tuyoogame/YooAsset
parent
7683746032
commit
e6422445a6
|
@ -114,7 +114,7 @@ namespace YooAsset.Editor
|
||||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
label.style.marginLeft = 3f;
|
label.style.marginLeft = 3f;
|
||||||
//label.style.flexGrow = 1f;
|
//label.style.flexGrow = 1f;
|
||||||
label.style.width = 100;
|
label.style.width = 150;
|
||||||
element.Add(label);
|
element.Add(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,6 +124,26 @@ namespace YooAsset.Editor
|
||||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
label.style.marginLeft = 3f;
|
label.style.marginLeft = 3f;
|
||||||
//label.style.flexGrow = 1f;
|
//label.style.flexGrow = 1f;
|
||||||
|
label.style.width = 150;
|
||||||
|
element.Add(label);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
var label = new Label();
|
||||||
|
label.name = "Label4";
|
||||||
|
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
|
label.style.marginLeft = 3f;
|
||||||
|
//label.style.flexGrow = 1f;
|
||||||
|
label.style.width = 100;
|
||||||
|
element.Add(label);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
var label = new Label();
|
||||||
|
label.name = "Label5";
|
||||||
|
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
|
label.style.marginLeft = 3f;
|
||||||
|
//label.style.flexGrow = 1f;
|
||||||
label.style.width = 120;
|
label.style.width = 120;
|
||||||
element.Add(label);
|
element.Add(label);
|
||||||
}
|
}
|
||||||
|
@ -139,9 +159,17 @@ namespace YooAsset.Editor
|
||||||
var label1 = element.Q<Label>("Label1");
|
var label1 = element.Q<Label>("Label1");
|
||||||
label1.text = providerInfo.AssetPath;
|
label1.text = providerInfo.AssetPath;
|
||||||
|
|
||||||
// Ref Count
|
// Spawn Scene
|
||||||
var label2 = element.Q<Label>("Label2");
|
var label2 = element.Q<Label>("Label2");
|
||||||
label2.text = providerInfo.RefCount.ToString();
|
label2.text = providerInfo.SpawnScene;
|
||||||
|
|
||||||
|
// Spawn Time
|
||||||
|
var label3 = element.Q<Label>("Label3");
|
||||||
|
label3.text = providerInfo.SpawnTime;
|
||||||
|
|
||||||
|
// Ref Count
|
||||||
|
var label4 = element.Q<Label>("Label4");
|
||||||
|
label4.text = providerInfo.RefCount.ToString();
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
StyleColor textColor;
|
StyleColor textColor;
|
||||||
|
@ -149,9 +177,9 @@ namespace YooAsset.Editor
|
||||||
textColor = new StyleColor(Color.yellow);
|
textColor = new StyleColor(Color.yellow);
|
||||||
else
|
else
|
||||||
textColor = label1.style.color;
|
textColor = label1.style.color;
|
||||||
var label3 = element.Q<Label>("Label3");
|
var label5 = element.Q<Label>("Label5");
|
||||||
label3.text = providerInfo.Status.ToString();
|
label5.text = providerInfo.Status.ToString();
|
||||||
label3.style.color = textColor;
|
label5.style.color = textColor;
|
||||||
}
|
}
|
||||||
private void AssetListView_onSelectionChange(IEnumerable<object> objs)
|
private void AssetListView_onSelectionChange(IEnumerable<object> objs)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,8 +2,10 @@
|
||||||
<ui:VisualElement name="TopGroup" style="flex-grow: 1; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 2px; margin-bottom: 1px; display: flex;">
|
<ui:VisualElement name="TopGroup" style="flex-grow: 1; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 2px; margin-bottom: 1px; display: flex;">
|
||||||
<uie:Toolbar name="TopBar" style="height: 25px; margin-left: 1px; margin-right: 1px;">
|
<uie:Toolbar name="TopBar" style="height: 25px; margin-left: 1px; margin-right: 1px;">
|
||||||
<uie:ToolbarButton text="Asset Path" display-tooltip-when-elided="true" name="TopBar1" style="width: 280px; -unity-text-align: middle-left; flex-grow: 1;" />
|
<uie:ToolbarButton text="Asset Path" display-tooltip-when-elided="true" name="TopBar1" style="width: 280px; -unity-text-align: middle-left; flex-grow: 1;" />
|
||||||
<uie:ToolbarButton text="Ref Count" display-tooltip-when-elided="true" name="TopBar2" style="width: 100px; -unity-text-align: middle-left; flex-grow: 0;" />
|
<uie:ToolbarButton text="Spawn Scene" display-tooltip-when-elided="true" name="TopBar2" style="width: 150px; -unity-text-align: middle-left; flex-grow: 0;" />
|
||||||
<uie:ToolbarButton text="Status" display-tooltip-when-elided="true" name="TopBar3" style="width: 120px; -unity-text-align: middle-left;" />
|
<uie:ToolbarButton text="Spawn Time" display-tooltip-when-elided="true" name="TopBar3" style="width: 150px; -unity-text-align: middle-left; flex-grow: 0;" />
|
||||||
|
<uie:ToolbarButton text="Ref Count" display-tooltip-when-elided="true" name="TopBar4" style="width: 100px; -unity-text-align: middle-left; flex-grow: 0;" />
|
||||||
|
<uie:ToolbarButton text="Status" display-tooltip-when-elided="true" name="TopBar5" style="width: 120px; -unity-text-align: middle-left;" />
|
||||||
</uie:Toolbar>
|
</uie:Toolbar>
|
||||||
<ui:ListView focusable="true" name="TopListView" item-height="18" style="flex-grow: 1;" />
|
<ui:ListView focusable="true" name="TopListView" item-height="18" style="flex-grow: 1;" />
|
||||||
</ui:VisualElement>
|
</ui:VisualElement>
|
||||||
|
|
|
@ -188,7 +188,7 @@ namespace YooAsset.Editor
|
||||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
label.style.marginLeft = 3f;
|
label.style.marginLeft = 3f;
|
||||||
//label.style.flexGrow = 1f;
|
//label.style.flexGrow = 1f;
|
||||||
label.style.width = 100;
|
label.style.width = 150;
|
||||||
element.Add(label);
|
element.Add(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,10 +198,30 @@ namespace YooAsset.Editor
|
||||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
label.style.marginLeft = 3f;
|
label.style.marginLeft = 3f;
|
||||||
//label.style.flexGrow = 1f;
|
//label.style.flexGrow = 1f;
|
||||||
|
label.style.width = 150;
|
||||||
|
element.Add(label);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
var label = new Label();
|
||||||
|
label.name = "Label4";
|
||||||
|
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
|
label.style.marginLeft = 3f;
|
||||||
|
//label.style.flexGrow = 1f;
|
||||||
label.style.width = 100;
|
label.style.width = 100;
|
||||||
element.Add(label);
|
element.Add(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
var label = new Label();
|
||||||
|
label.name = "Label5";
|
||||||
|
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||||
|
label.style.marginLeft = 3f;
|
||||||
|
//label.style.flexGrow = 1f;
|
||||||
|
label.style.width = 120;
|
||||||
|
element.Add(label);
|
||||||
|
}
|
||||||
|
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
private void BindIncludeListViewItem(VisualElement element, int index)
|
private void BindIncludeListViewItem(VisualElement element, int index)
|
||||||
|
@ -213,13 +233,21 @@ namespace YooAsset.Editor
|
||||||
var label1 = element.Q<Label>("Label1");
|
var label1 = element.Q<Label>("Label1");
|
||||||
label1.text = providerInfo.AssetPath;
|
label1.text = providerInfo.AssetPath;
|
||||||
|
|
||||||
// Ref Count
|
// Spawn Scene
|
||||||
var label2 = element.Q<Label>("Label2");
|
var label2 = element.Q<Label>("Label2");
|
||||||
label2.text = providerInfo.RefCount.ToString();
|
label2.text = providerInfo.SpawnScene;
|
||||||
|
|
||||||
|
// Spawn Time
|
||||||
|
var label3 = element.Q<Label>("Label3");
|
||||||
|
label3.text = providerInfo.SpawnTime;
|
||||||
|
|
||||||
|
// Ref Count
|
||||||
|
var label4 = element.Q<Label>("Label4");
|
||||||
|
label4.text = providerInfo.RefCount.ToString();
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
var label3 = element.Q<Label>("Label3");
|
var label5 = element.Q<Label>("Label5");
|
||||||
label3.text = providerInfo.Status.ToString();
|
label5.text = providerInfo.Status.ToString();
|
||||||
}
|
}
|
||||||
private void FillUsingListView(string bundleName)
|
private void FillUsingListView(string bundleName)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,8 +10,10 @@
|
||||||
<ui:VisualElement name="BottomGroup" style="height: 200px; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 1px; margin-bottom: 1px; display: flex;">
|
<ui:VisualElement name="BottomGroup" style="height: 200px; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 1px; border-left-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-top-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); margin-left: 0; margin-right: 0; margin-top: 1px; margin-bottom: 1px; display: flex;">
|
||||||
<uie:Toolbar name="BottomBar" style="height: 25px; margin-left: 1px; margin-right: 1px;">
|
<uie:Toolbar name="BottomBar" style="height: 25px; margin-left: 1px; margin-right: 1px;">
|
||||||
<uie:ToolbarButton text="Using Assets" display-tooltip-when-elided="true" name="BottomBar1" style="width: 280px; -unity-text-align: middle-left; flex-grow: 1;" />
|
<uie:ToolbarButton text="Using Assets" display-tooltip-when-elided="true" name="BottomBar1" style="width: 280px; -unity-text-align: middle-left; flex-grow: 1;" />
|
||||||
<uie:ToolbarButton text="Ref Count" display-tooltip-when-elided="true" name="BottomBar3" style="width: 100px; -unity-text-align: middle-left;" />
|
<uie:ToolbarButton text="Spawn Scene" display-tooltip-when-elided="true" name="BottomBar2" style="width: 150px; -unity-text-align: middle-left;" />
|
||||||
<uie:ToolbarButton text="Status" display-tooltip-when-elided="true" name="BottomBar4" style="width: 120px; -unity-text-align: middle-left;" />
|
<uie:ToolbarButton text="Spawn Time" display-tooltip-when-elided="true" name="BottomBar3" style="width: 150px; -unity-text-align: middle-left;" />
|
||||||
|
<uie:ToolbarButton text="Ref Count" display-tooltip-when-elided="true" name="BottomBar4" style="width: 100px; -unity-text-align: middle-left;" />
|
||||||
|
<uie:ToolbarButton text="Status" display-tooltip-when-elided="true" name="BottomBar5" style="width: 120px; -unity-text-align: middle-left;" />
|
||||||
</uie:Toolbar>
|
</uie:Toolbar>
|
||||||
<ui:ListView focusable="true" name="BottomListView" item-height="18" style="flex-grow: 1;" />
|
<ui:ListView focusable="true" name="BottomListView" item-height="18" style="flex-grow: 1;" />
|
||||||
</ui:VisualElement>
|
</ui:VisualElement>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
|
@ -11,6 +12,7 @@ namespace YooAsset
|
||||||
private static readonly List<AssetBundleLoaderBase> _loaders = new List<AssetBundleLoaderBase>(1000);
|
private static readonly List<AssetBundleLoaderBase> _loaders = new List<AssetBundleLoaderBase>(1000);
|
||||||
private static readonly List<ProviderBase> _providers = new List<ProviderBase>(1000);
|
private static readonly List<ProviderBase> _providers = new List<ProviderBase>(1000);
|
||||||
private static readonly Dictionary<string, SceneOperationHandle> _sceneHandles = new Dictionary<string, SceneOperationHandle>(100);
|
private static readonly Dictionary<string, SceneOperationHandle> _sceneHandles = new Dictionary<string, SceneOperationHandle>(100);
|
||||||
|
private static string _mainSceneName = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 在编辑器下模拟运行
|
/// 在编辑器下模拟运行
|
||||||
|
@ -36,6 +38,7 @@ namespace YooAsset
|
||||||
AssetLoadingMaxNumber = assetLoadingMaxNumber;
|
AssetLoadingMaxNumber = assetLoadingMaxNumber;
|
||||||
DecryptionServices = decryptionServices;
|
DecryptionServices = decryptionServices;
|
||||||
BundleServices = bundleServices;
|
BundleServices = bundleServices;
|
||||||
|
_mainSceneName = SceneManager.GetActiveScene().name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -139,7 +142,10 @@ namespace YooAsset
|
||||||
|
|
||||||
// 如果加载的是主场景,则卸载所有缓存的场景
|
// 如果加载的是主场景,则卸载所有缓存的场景
|
||||||
if (sceneMode == LoadSceneMode.Single)
|
if (sceneMode == LoadSceneMode.Single)
|
||||||
|
{
|
||||||
UnloadAllScene();
|
UnloadAllScene();
|
||||||
|
_mainSceneName = Path.GetFileName(scenePath);
|
||||||
|
}
|
||||||
|
|
||||||
ProviderBase provider = TryGetProvider(scenePath);
|
ProviderBase provider = TryGetProvider(scenePath);
|
||||||
if (provider == null)
|
if (provider == null)
|
||||||
|
@ -148,8 +154,10 @@ namespace YooAsset
|
||||||
provider = new DatabaseSceneProvider(scenePath, sceneMode, activateOnLoad, priority);
|
provider = new DatabaseSceneProvider(scenePath, sceneMode, activateOnLoad, priority);
|
||||||
else
|
else
|
||||||
provider = new BundledSceneProvider(scenePath, sceneMode, activateOnLoad, priority);
|
provider = new BundledSceneProvider(scenePath, sceneMode, activateOnLoad, priority);
|
||||||
|
provider.SetSpawnDebugInfo(_mainSceneName);
|
||||||
_providers.Add(provider);
|
_providers.Add(provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
var handle = provider.CreateHandle() as SceneOperationHandle;
|
var handle = provider.CreateHandle() as SceneOperationHandle;
|
||||||
_sceneHandles.Add(scenePath, handle);
|
_sceneHandles.Add(scenePath, handle);
|
||||||
return handle;
|
return handle;
|
||||||
|
@ -167,6 +175,7 @@ namespace YooAsset
|
||||||
provider = new DatabaseAssetProvider(assetPath, assetType);
|
provider = new DatabaseAssetProvider(assetPath, assetType);
|
||||||
else
|
else
|
||||||
provider = new BundledAssetProvider(assetPath, assetType);
|
provider = new BundledAssetProvider(assetPath, assetType);
|
||||||
|
provider.SetSpawnDebugInfo(_mainSceneName);
|
||||||
_providers.Add(provider);
|
_providers.Add(provider);
|
||||||
}
|
}
|
||||||
return provider.CreateHandle() as AssetOperationHandle;
|
return provider.CreateHandle() as AssetOperationHandle;
|
||||||
|
@ -184,6 +193,7 @@ namespace YooAsset
|
||||||
provider = new DatabaseSubAssetsProvider(assetPath, assetType);
|
provider = new DatabaseSubAssetsProvider(assetPath, assetType);
|
||||||
else
|
else
|
||||||
provider = new BundledSubAssetsProvider(assetPath, assetType);
|
provider = new BundledSubAssetsProvider(assetPath, assetType);
|
||||||
|
provider.SetSpawnDebugInfo(_mainSceneName);
|
||||||
_providers.Add(provider);
|
_providers.Add(provider);
|
||||||
}
|
}
|
||||||
return provider.CreateHandle() as SubAssetsOperationHandle;
|
return provider.CreateHandle() as SubAssetsOperationHandle;
|
||||||
|
@ -319,6 +329,8 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
DebugProviderInfo providerInfo = new DebugProviderInfo();
|
DebugProviderInfo providerInfo = new DebugProviderInfo();
|
||||||
providerInfo.AssetPath = provider.AssetPath;
|
providerInfo.AssetPath = provider.AssetPath;
|
||||||
|
providerInfo.SpawnScene = provider.SpawnScene;
|
||||||
|
providerInfo.SpawnTime = provider.SpawnTime;
|
||||||
providerInfo.RefCount = provider.RefCount;
|
providerInfo.RefCount = provider.RefCount;
|
||||||
providerInfo.Status = provider.Status;
|
providerInfo.Status = provider.Status;
|
||||||
providerInfo.BundleInfos.Clear();
|
providerInfo.BundleInfos.Clear();
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
|
@ -230,5 +231,31 @@ namespace YooAsset
|
||||||
_taskCompletionSource.TrySetResult(null);
|
_taskCompletionSource.TrySetResult(null);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region 调试信息相关
|
||||||
|
/// <summary>
|
||||||
|
/// 出生的场景
|
||||||
|
/// </summary>
|
||||||
|
public string SpawnScene = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 出生的时间
|
||||||
|
/// </summary>
|
||||||
|
public string SpawnTime = string.Empty;
|
||||||
|
|
||||||
|
[Conditional("DEBUG")]
|
||||||
|
public void SetSpawnDebugInfo(string spawnScene)
|
||||||
|
{
|
||||||
|
SpawnScene = spawnScene;
|
||||||
|
SpawnTime = SpawnTimeToString(UnityEngine.Time.realtimeSinceStartup);
|
||||||
|
}
|
||||||
|
private string SpawnTimeToString(float spawnTime)
|
||||||
|
{
|
||||||
|
float h = UnityEngine.Mathf.FloorToInt(spawnTime / 3600f);
|
||||||
|
float m = UnityEngine.Mathf.FloorToInt(spawnTime / 60f - h * 60f);
|
||||||
|
float s = UnityEngine.Mathf.FloorToInt(spawnTime - m * 60f - h * 3600f);
|
||||||
|
return h.ToString("00") + ":" + m.ToString("00") + ":" + s.ToString("00");
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,6 +11,16 @@ namespace YooAsset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string AssetPath { set; get; }
|
public string AssetPath { set; get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 资源出生的场景
|
||||||
|
/// </summary>
|
||||||
|
public string SpawnScene { set; get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 资源出生的时间
|
||||||
|
/// </summary>
|
||||||
|
public string SpawnTime { set; get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 引用计数
|
/// 引用计数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue