Beispiel #1
0
        public static AsyncLoadAssetRequest Create()
        {
            AsyncLoadAssetRequest asyncLoadAssetRequest = new AsyncLoadAssetRequest
            {
                LoadAssetState = LoadAssetState.Loading
            };

            return(asyncLoadAssetRequest);
        }
Beispiel #2
0
        public static AsyncLoadAssetRequest LoadAssetAsync3(this ResourceComponent resourceComponent, string assetName)
        {
            AsyncLoadAssetRequest asyncLoadAssetRequest = AsyncLoadAssetRequest.Create();

            LoadAssetCallbacks loadAssetCallbacks = new LoadAssetCallbacks((string _assetName, object asset, float duration, object userData) =>
            {
                asyncLoadAssetRequest.Asset          = asset;
                asyncLoadAssetRequest.LoadAssetState = LoadAssetState.Success;
            }, (string _assetName, LoadResourceStatus status, string errorMessage, object userData) =>
            {
                asyncLoadAssetRequest.Asset          = null;
                asyncLoadAssetRequest.LoadAssetState = LoadAssetState.Failure;
            });

            resourceComponent.LoadAsset(assetName, null, 0, loadAssetCallbacks, null);

            return(asyncLoadAssetRequest);
        }