blob: f0146c3366f7f3b8e76aee051077e277f946a2c3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#ifndef WWWCACHED_H
#define WWWCACHED_H
#define kWWWCachedAccessError "WWWCached data can only be accessed using the assetBundle property!"
#if ENABLE_CACHING && ENABLE_WWW
#include "Runtime/Export/WWW.h"
class WWWCached : public WWW
{
char* m_URL;
bool m_DidDownload;
bool m_Abort;
WWW* m_WWW;
string m_Error;
AsyncCachedUnityWebStream* m_CacheRequest;
bool m_AssetBundleRetrieved;
void StartDownload(bool cached);
public:
WWWCached (const char* url, int version, UInt32 crc);
~WWWCached ();
AssetBundle* GetAssetBundle ();
virtual const UInt8* GetData();
virtual const UInt8* GetPartialData() const;
virtual size_t GetSize();
virtual size_t GetPartialSize() const;
virtual double GetETA() const;
virtual void LockPartialData() {}
virtual void UnlockPartialData() {}
// Returns true when the download is complete or failed.
virtual void Cancel();
virtual bool IsDownloadingDone() const;
virtual float GetProgress() const;
virtual float GetUploadProgress() const { return 0.0f; }
virtual const char* GetError();
virtual const char* GetUrl() const { return m_URL; }
virtual bool HasDownloadedOrMayBlock ();
virtual void BlockUntilDone ();
virtual void SetThreadPriority( ThreadPriority priority );
virtual WWWType GetType () const { return kWWWTypeCached; }
private:
bool IsDoneImpl();
};
#endif //ENABLE_CACHING
#endif
|