-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose serializer, add more tests, update docs, add more async capabi…
…lities, add streaming assets loaidng, rename args
- Loading branch information
Showing
36 changed files
with
831 additions
and
480 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 19 additions & 4 deletions
23
Packages/com.chark.game-management/Runtime/Assets/IResourceLoader.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,33 @@ | ||
using System.Collections.Generic; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using UnityEngine; | ||
|
||
namespace CHARK.GameManagement.Assets | ||
{ | ||
public interface IResourceLoader | ||
{ | ||
/// <returns> | ||
/// Resources loaded from given <paramref name="path"/>. | ||
/// Enumerable of resources retrieved from given <paramref name="path"/>. | ||
/// </returns> | ||
public IEnumerable<TResource> LoadResources<TResource>(string path = null) where TResource : Object; | ||
public IEnumerable<TResource> GetResources<TResource>(string path = null) | ||
where TResource : Object; | ||
|
||
/// <returns> | ||
/// Resource loaded from given <paramref name="path"/>. | ||
/// <c>true</c> if <paramref name="resource"/> is retrieved from given | ||
/// <paramref name="path"/> or <c>false</c> otherwise. | ||
/// </returns> | ||
public TResource LoadResource<TResource>(string path) where TResource : Object; | ||
public bool TryGetResource<TResource>(string path, out TResource resource) | ||
where TResource : Object; | ||
|
||
/// <returns> | ||
/// Asset loaded asynchronously from given <paramref name="path"/>. | ||
/// <p/> | ||
/// <b>Note</b>, <paramref name="path"/> is relative to StreamingAssets directory. | ||
/// </returns> | ||
public Task<TResource> GetResourceAsync<TResource>( | ||
string path, | ||
CancellationToken cancellationToken = default | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.