Nez.Portable/Utils/NezContentManager.cs
/// <summary>
/// loads a group of assets on a background thread with optional callback for when it is loaded
/// </summary>
/// <param name="assetName">Asset name.</param>
/// <param name="onLoaded">On loaded.</param>
/// <typeparam name="T">The 1st type parameter.</typeparam>
loads a group of assets on a background thread with optional callback for when it is loaded
loads a group of assets on a background thread with optional callback for when it is loaded
public void loadAsync<T>(string[] assetNames, Action onLoaded = null)
        {
            var syncContext = SynchronizationContext.Current;
            Task.Run(
                () =>
                    {
                        for (var i = 0; i < assetNames.Length; i++)
                            Load<T>(assetNames[i]);
                        if (onLoaded != null)
                        {
                            syncContext.Post(d => { onLoaded(); }, null);
                        }
                    });
        }
public void loadAsync < T > ( string [ ] assetNames , Action onLoaded = null ) { var syncContext = SynchronizationContext . Current ; Task . Run ( ( ) => { for ( var i = 0 ; i < assetNames . Length ; i ++ ) Load < T > ( assetNames [ i ] ) ; if ( onLoaded != null ) { syncContext . Post ( d => { onLoaded ( ) ; } , null ) ; } } ) ; }
loads a group of assets on a background thread with optional callback for when it is loaded
loads a group of assets on a background thread with optional callback for when it is loaded
// if we have a callback do it on the main thread
assetNames
string[]
onLoaded
Action
None
assetName
None
typeparam
The 1st type parameter.
The 1st type parameter .