资源模块优化-使用资源缓存表以及资源淘汰算法,缓存常用资源,利于获取、淘汰不常用资源。

资源模块优化-使用资源缓存表以及资源淘汰算法,缓存常用资源,利于获取、淘汰不常用资源。
This commit is contained in:
ALEXTANG
2023-10-13 15:53:16 +08:00
parent 99d2afdbd7
commit b983e85416
15 changed files with 523 additions and 262 deletions

View File

@@ -34,6 +34,7 @@ namespace TEngine.Editor.Inspector
private SerializedProperty m_MaxUnloadUnusedAssetsInterval = null;
private SerializedProperty m_DownloadingMaxNum = null;
private SerializedProperty m_FailedTryAgain = null;
private SerializedProperty m_adaptiveReplacementCacheCapacity = null;
private int m_ResourceModeIndex = 0;
private int m_PackageIndex = 0;
@@ -54,6 +55,7 @@ namespace TEngine.Editor.Inspector
m_MaxUnloadUnusedAssetsInterval = serializedObject.FindProperty("maxUnloadUnusedAssetsInterval");
m_DownloadingMaxNum = serializedObject.FindProperty("downloadingMaxNum");
m_FailedTryAgain = serializedObject.FindProperty("failedTryAgain");
m_adaptiveReplacementCacheCapacity = serializedObject.FindProperty("adaptiveReplacementCacheCapacity");
RefreshModes();
RefreshTypeNames();
@@ -199,6 +201,19 @@ namespace TEngine.Editor.Inspector
m_FailedTryAgain.intValue = (int)failedTryAgain;
}
}
int adaptiveReplacementCacheCapacity = (int)EditorGUILayout.Slider("ARC Table Capacity", m_adaptiveReplacementCacheCapacity.intValue, 8f, 128f);
if (adaptiveReplacementCacheCapacity != m_adaptiveReplacementCacheCapacity.intValue)
{
if (EditorApplication.isPlaying)
{
t.adaptiveReplacementCacheCapacity = adaptiveReplacementCacheCapacity;
}
else
{
m_adaptiveReplacementCacheCapacity.intValue = adaptiveReplacementCacheCapacity;
}
}
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))