Support fast build mode.

支持快速构建模式,真实的实现EditorPlayMode的运行时环境。
This commit is contained in:
hevinci
2022-05-02 23:15:09 +08:00
parent 8d02406211
commit 665a16fe60
39 changed files with 492 additions and 383 deletions
@@ -9,34 +9,19 @@ namespace YooAsset
{
if (string.IsNullOrEmpty(resourceRoot) == false)
_resourceRoot = PathHelper.GetRegularPath(resourceRoot);
}
#if UNITY_EDITOR
LocationServicesHelper.InitEditorPlayMode(false);
#endif
}
public string ConvertLocationToAssetPath(YooAssets.EPlayMode playMode, string location)
public string ConvertLocationToAssetPath(string location)
{
location = CombineAssetPath(_resourceRoot, location);
if (playMode == YooAssets.EPlayMode.EditorPlayMode)
if (string.IsNullOrEmpty(_resourceRoot))
{
#if UNITY_EDITOR
return LocationServicesHelper.ConvertLocationToAssetPath(location);
#else
throw new System.NotImplementedException();
#endif
return YooAssets.MappingToAssetPath(location);
}
else
{
return location;
string tempLocation = $"{_resourceRoot}/{location}";
return YooAssets.MappingToAssetPath(tempLocation);
}
}
private string CombineAssetPath(string root, string location)
{
if (string.IsNullOrEmpty(root))
return location;
else
return $"{root}/{location}";
}
}
}