Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Commit

Permalink
Add ObservableWWW.LoadFromCacheOrDownload (for AssetBundle) #36
Browse files Browse the repository at this point in the history
  • Loading branch information
neuecc committed Dec 4, 2014
1 parent 721ac94 commit c213d8b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions Assets/UniRx/Scripts/UnityEngineBridge/ObservableWWW.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ public static IObservable<WWW> PostWWW(string url, WWWForm content, Hash headers
return Observable.FromCoroutine<WWW>((observer, cancellation) => Fetch(new WWW(url, content.data, MergeHash(contentHeaders, headers)), observer, progress, cancellation));
}

public static IObservable<WWW> LoadFromCacheOrDownload(string url, int version, IProgress<float> progress = null)
{
return Observable.FromCoroutine<WWW>((observer, cancellation) => Fetch(WWW.LoadFromCacheOrDownload(url, version), observer, progress, cancellation));
}

public static IObservable<WWW> LoadFromCacheOrDownload(string url, int version, uint crc, IProgress<float> progress = null)
{
return Observable.FromCoroutine<WWW>((observer, cancellation) => Fetch(WWW.LoadFromCacheOrDownload(url, version, crc), observer, progress, cancellation));
}

static Hash MergeHash(Hash source1, Hash source2)
{
foreach (HashEntry item in source2)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// for uGUI
#if UNITY_4_6
// for uGUI(from 4.6)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5)

using System;
using System.Collections.Generic;
Expand Down
Binary file not shown.

0 comments on commit c213d8b

Please sign in to comment.