Detailed Description

Handles the http:// protocol. Downloads files and text from the web and also handles web links. Note that this protocol (and many others) have been designed to be removeable - just delete the file.

Inheritance diagram for PowerUI.HttpProtocol:
PowerUI.FileProtocol

Public Member Functions

 HttpProtocol ()
 
override string[] GetNames ()
 Returns all protocol names:// that can be used for this protocol. e.g. new string[]{"cdn","net"}; => cdn://file.png or net://file.png More...
 
override void OnGetGraphic (ImagePackage package, FilePath path)
 Get the file at the given path as a MovieTexture (Unity Pro only!), Texture2D, SPA Animation or DynamicTexture using this protocol. Once it's been retrieved, this must call package.GotGraphic(theObject) internally. More...
 
override void OnGetText (TextPackage package, FilePath path)
 Get the file at the given path as some html text using this protocol. Once it's been retrieved, this must call package.GotText(theText) internally. More...
 
override void OnFollowLink (Element linkElement, FilePath path)
 The user clicked on the given link which points to the given path. More...
 
Document ResolveTarget (Element linkElement)
 Resolves the target in the given element (if any) to a document. More...
 
override void OnPostForm (FormData form, Element formElement, FilePath path)
 Submits the given form to the given path using this protocol. More...
 
override void OnGetData (DataPackage package, FilePath path)
 Get generic binary at the given path using this protocol. Used for e.g. fonts. Once it's been retrieved, this must call package.GotData(theText) internally. More...
 
- Public Member Functions inherited from PowerUI.FileProtocol
virtual bool FullAccess (FilePath path)
 Does the item at the given location have full access to the code security domain? Used by Nitro. If it does not have full access, the Nitro security domain is asked about the path instead. If you're unsure, leave this false! If your game uses simple web browsing, this essentially stops somebody writing dangerous Nitro on a remote webpage and directing your game at it. More...
 

Static Public Member Functions

static ImagePackage GetFromCache (string url)
 Gets a previous result from the cache if one can be found. More...
 
static void AddToCache (string url, ImagePackage result)
 Adds the given result to the cache for future request use. More...
 

Static Public Attributes

static Dictionary< string,
ImagePackage
Cache =new Dictionary<string,ImagePackage>()
 A temporary cache. This is used to briefly provide a previous result in the event of innerHTML being reloaded. The source file may still be requested though, depending on Unities WWW. More...
 

Private Member Functions

void LoadIntoDocument (FilePath path, Document document)
 Loads a link into the given document. More...
 
void GotLinkText (TextPackage package)
 
void OnFormSent (HttpRequest request)
 
void GotDataResult (HttpRequest request)
 
void GotTextResult (HttpRequest request)
 
void GotGraphicResult (HttpRequest request)
 

Additional Inherited Members

- Public Attributes inherited from PowerUI.FileProtocol
bool UseResolution =true
 Should images delivered with this protocol append resolution based names? More...
 

Constructor & Destructor Documentation

PowerUI.HttpProtocol.HttpProtocol ( )
inline

Member Function Documentation

static void PowerUI.HttpProtocol.AddToCache ( string  url,
ImagePackage  result 
)
inlinestatic

Adds the given result to the cache for future request use.

Parameters
urlThe url that will be requested.
resultThe previous result to add to the cache.
static ImagePackage PowerUI.HttpProtocol.GetFromCache ( string  url)
inlinestatic

Gets a previous result from the cache if one can be found.

Parameters
urlThe url that will be requested.
override string [] PowerUI.HttpProtocol.GetNames ( )
inlinevirtual

Returns all protocol names:// that can be used for this protocol. e.g. new string[]{"cdn","net"}; => cdn://file.png or net://file.png

Reimplemented from PowerUI.FileProtocol.

void PowerUI.HttpProtocol.GotDataResult ( HttpRequest  request)
inlineprivate
void PowerUI.HttpProtocol.GotGraphicResult ( HttpRequest  request)
inlineprivate
void PowerUI.HttpProtocol.GotLinkText ( TextPackage  package)
inlineprivate
void PowerUI.HttpProtocol.GotTextResult ( HttpRequest  request)
inlineprivate
void PowerUI.HttpProtocol.LoadIntoDocument ( FilePath  path,
Document  document 
)
inlineprivate

Loads a link into the given document.

Parameters
pathThe path the link was pointing at.
documentThe document the link will load into.
override void PowerUI.HttpProtocol.OnFollowLink ( Element  linkElement,
FilePath  path 
)
inlinevirtual

The user clicked on the given link which points to the given path.

Reimplemented from PowerUI.FileProtocol.

void PowerUI.HttpProtocol.OnFormSent ( HttpRequest  request)
inlineprivate
override void PowerUI.HttpProtocol.OnGetData ( DataPackage  package,
FilePath  path 
)
inlinevirtual

Get generic binary at the given path using this protocol. Used for e.g. fonts. Once it's been retrieved, this must call package.GotData(theText) internally.

Reimplemented from PowerUI.FileProtocol.

override void PowerUI.HttpProtocol.OnGetGraphic ( ImagePackage  package,
FilePath  path 
)
inlinevirtual

Get the file at the given path as a MovieTexture (Unity Pro only!), Texture2D, SPA Animation or DynamicTexture using this protocol. Once it's been retrieved, this must call package.GotGraphic(theObject) internally.

Reimplemented from PowerUI.FileProtocol.

override void PowerUI.HttpProtocol.OnGetText ( TextPackage  package,
FilePath  path 
)
inlinevirtual

Get the file at the given path as some html text using this protocol. Once it's been retrieved, this must call package.GotText(theText) internally.

Reimplemented from PowerUI.FileProtocol.

override void PowerUI.HttpProtocol.OnPostForm ( FormData  form,
Element  formElement,
FilePath  path 
)
inlinevirtual

Submits the given form to the given path using this protocol.

Reimplemented from PowerUI.FileProtocol.

Document PowerUI.HttpProtocol.ResolveTarget ( Element  linkElement)
inline

Resolves the target in the given element (if any) to a document.

Returns
The targeted document. Null if there is no document at all and the target is essentially outside of Unity.

Member Data Documentation

Dictionary<string,ImagePackage> PowerUI.HttpProtocol.Cache =new Dictionary<string,ImagePackage>()
static

A temporary cache. This is used to briefly provide a previous result in the event of innerHTML being reloaded. The source file may still be requested though, depending on Unities WWW.