C# Class UWKWebView, html-ui-unity

WebView component used to render and interact with web content
Inheritance: MonoBehaviour
Afficher le fichier Open project: ufz-vislab/html-ui-unity Class Usage Examples

Méthodes publiques

Свойство Type Description
ContentSizeChanged ContentSizeChangedDelegate
CurrentHeight int
CurrentWidth int
JSConsole JSConsoleDelegate
JSMessageReceived JSMessageReceivedDelegate
LoadFinished LoadFinishedDelegate
LoadProgress LoadProgressDelegate
MaxHeight int
MaxWidth int
NewViewRequested RequestNewViewDelegate
ScrollSensitivity float
TitleChanged TitleChangedDelegate
URL string
URLChanged URLChangedDelegate

Méthodes publiques

Méthode Description
AddToGameObject ( GameObject gameObject, string url = "", int maxWidth = 1024, int maxHeight = 1024 ) : UWKWebView,

Dynamically adds a UWKWebView component to a GameObject with initialization that isn't possible using GameObject.AddComponent due to lack of constructor parameters

Awake ( ) : void

Initializes the UWKWebView, registers default delagates, and creates textures for the page and icon to lack of constructor parameters

Back ( ) : void

Moves back in the page history

ClearCookies ( ) : void

Clears all user cookies

CloseInspector ( ) : void

Closes the Web Inspector window Associated with this View

DisableInput ( ) : void

Globally enables mouse and keyboard input from webviews

DrawTextIME ( int x, int y ) : void

Draws the text IME for Chinese, Japanese, Korean languages

DrawTexture ( Rect position, bool alphaBlend = true ) : void
EnableInput ( ) : void

Globally disabled mouse and keyboard input from webviews

EvaluateJavascript ( string javascript, JSEvalDelegate callback = null ) : void

Evaluates Javascript on the page Example with return value: EvaluateJavascript("document.title", (value) => { Debug.Log(value); });

Forward ( ) : void

Moves forward in the page history

GetApplicationDataURL ( ) : string
Hide ( ) : void

Hide the page, the page will no longer be rendered by the web rendering process saving CPU time

IMEFocusIn ( UWKMessage, &msg ) : void

Page is focusing a text entry area in IME mode

IMEFocusOut ( ) : void

Page is removing focus for text area in IME mode

IconChanged ( int width, int height, byte bytes ) : void

Sets the icon texture to the given width/height and image bytes

LoadHTML ( string HTML, string baseURL = "" ) : void

Loads the specified HTML string directly in the view, can be used for generating web content on the fly

LoadURL ( string url ) : void

Navigate the view to the specified URL (http://, file://, etc)

Navigate ( Navigation, n ) : void

Navigates forward or back in the page history

OnDestroy ( ) : void
ProcessKeyboard ( Event keyEvent ) : void

Process a Unity keyboard event

ProcessMouse ( Vector3 mousePos ) : void

Process the mouse given mousePos coordinates

Reload ( ) : void

Reloads the current page contents

SendJSMessage ( string msgName ) : void

Sends a Javascript message to the page

SendJSMessage ( string msgName, object>.Dictionary msgValues ) : void

Sends a Javascript message to the page

SendJSMessage ( string msgName, object value ) : void

Sends a Javascript message to the page

SendJSMessage ( string msgName, string key, object value ) : void

Sends a Javascript message to the page

SetAlphaMask ( bool enabled ) : void

Enabled or disables alpha mask rendering of view

SetCurrentSize ( int width, int height ) : void

Sets the current width and height of the UWKWebView

SetFrameRate ( int framerate ) : void

Sets the framerate that the view is rendered at in the web rendering process Default is 30fps, to set 60fps you would call view.SetFrameRate(60); Please note that higher fps settings will increase CPU load

SetScrollPosition ( int x, int y ) : void

Sets the page's sceoll positon

SetTextCaretColor ( uint color ) : void

Sets the color of the text input caret in the form of 0xAARRGGBB Default is opaque black 0xFF000000

SetUserAgent ( string agent = "" ) : void

Sets the user agent the browser reports, setting the agent to "" will use the default uWebKit agent

SetZoomFactor ( float zoom ) : void

Sets the zoom factor of the page

Show ( ) : void

Makes the page visible, the page will be updated and refreshed by the Wweb rendering process

ShowInspector ( ) : void

Opens a platform Web Inspector Window

Start ( ) : void
Stop ( ) : void

Stops the current page load

Update ( ) : void
Visible ( ) : bool

Gets whether the page is visible or not

contentSizeChanged ( UWKWebView, view, int width, int height ) : void
jsConsole ( UWKWebView, view, string message, int line, string source ) : void
jsMessageReceived ( UWKWebView, view, string message, string json, object>.Dictionary values ) : void
loadFinished ( UWKWebView, view ) : void
loadProgress ( UWKWebView, view, int progress ) : void
newViewRequested ( UWKWebView, view, string url ) : void
titleChanged ( UWKWebView, view, string title ) : void
urlChanged ( UWKWebView, view, string url ) : void

Method Details

AddToGameObject() public static méthode

Dynamically adds a UWKWebView component to a GameObject with initialization that isn't possible using GameObject.AddComponent due to lack of constructor parameters
public static AddToGameObject ( GameObject gameObject, string url = "", int maxWidth = 1024, int maxHeight = 1024 ) : UWKWebView,
gameObject GameObject
url string
maxWidth int
maxHeight int
Résultat UWKWebView,

Awake() public méthode

Initializes the UWKWebView, registers default delagates, and creates textures for the page and icon to lack of constructor parameters
public Awake ( ) : void
Résultat void

Back() public méthode

Moves back in the page history
public Back ( ) : void
Résultat void

ClearCookies() public static méthode

Clears all user cookies
public static ClearCookies ( ) : void
Résultat void

CloseInspector() public méthode

Closes the Web Inspector window Associated with this View
public CloseInspector ( ) : void
Résultat void

DisableInput() public static méthode

Globally enables mouse and keyboard input from webviews
public static DisableInput ( ) : void
Résultat void

DrawTextIME() public méthode

Draws the text IME for Chinese, Japanese, Korean languages
public DrawTextIME ( int x, int y ) : void
x int
y int
Résultat void

DrawTexture() public méthode

public DrawTexture ( Rect position, bool alphaBlend = true ) : void
position Rect
alphaBlend bool
Résultat void

EnableInput() public static méthode

Globally disabled mouse and keyboard input from webviews
public static EnableInput ( ) : void
Résultat void

EvaluateJavascript() public méthode

Evaluates Javascript on the page Example with return value: EvaluateJavascript("document.title", (value) => { Debug.Log(value); });
public EvaluateJavascript ( string javascript, JSEvalDelegate callback = null ) : void
javascript string
callback JSEvalDelegate
Résultat void

Forward() public méthode

Moves forward in the page history
public Forward ( ) : void
Résultat void

GetApplicationDataURL() public static méthode

public static GetApplicationDataURL ( ) : string
Résultat string

Hide() public méthode

Hide the page, the page will no longer be rendered by the web rendering process saving CPU time
public Hide ( ) : void
Résultat void

IMEFocusIn() public méthode

Page is focusing a text entry area in IME mode
public IMEFocusIn ( UWKMessage, &msg ) : void
msg UWKMessage,
Résultat void

IMEFocusOut() public méthode

Page is removing focus for text area in IME mode
public IMEFocusOut ( ) : void
Résultat void

IconChanged() public méthode

Sets the icon texture to the given width/height and image bytes
public IconChanged ( int width, int height, byte bytes ) : void
width int
height int
bytes byte
Résultat void

LoadHTML() public méthode

Loads the specified HTML string directly in the view, can be used for generating web content on the fly
public LoadHTML ( string HTML, string baseURL = "" ) : void
HTML string
baseURL string
Résultat void

LoadURL() public méthode

Navigate the view to the specified URL (http://, file://, etc)
public LoadURL ( string url ) : void
url string
Résultat void

Navigate() public méthode

Navigates forward or back in the page history
public Navigate ( Navigation, n ) : void
n Navigation,
Résultat void

OnDestroy() public méthode

public OnDestroy ( ) : void
Résultat void

ProcessKeyboard() public méthode

Process a Unity keyboard event
public ProcessKeyboard ( Event keyEvent ) : void
keyEvent Event
Résultat void

ProcessMouse() public méthode

Process the mouse given mousePos coordinates
public ProcessMouse ( Vector3 mousePos ) : void
mousePos Vector3
Résultat void

Reload() public méthode

Reloads the current page contents
public Reload ( ) : void
Résultat void

SendJSMessage() public méthode

Sends a Javascript message to the page
public SendJSMessage ( string msgName ) : void
msgName string
Résultat void

SendJSMessage() public méthode

Sends a Javascript message to the page
public SendJSMessage ( string msgName, object>.Dictionary msgValues ) : void
msgName string
msgValues object>.Dictionary
Résultat void

SendJSMessage() public méthode

Sends a Javascript message to the page
public SendJSMessage ( string msgName, object value ) : void
msgName string
value object
Résultat void

SendJSMessage() public méthode

Sends a Javascript message to the page
public SendJSMessage ( string msgName, string key, object value ) : void
msgName string
key string
value object
Résultat void

SetAlphaMask() public méthode

Enabled or disables alpha mask rendering of view
public SetAlphaMask ( bool enabled ) : void
enabled bool
Résultat void

SetCurrentSize() public méthode

Sets the current width and height of the UWKWebView
public SetCurrentSize ( int width, int height ) : void
width int
height int
Résultat void

SetFrameRate() public méthode

Sets the framerate that the view is rendered at in the web rendering process Default is 30fps, to set 60fps you would call view.SetFrameRate(60); Please note that higher fps settings will increase CPU load
public SetFrameRate ( int framerate ) : void
framerate int
Résultat void

SetScrollPosition() public méthode

Sets the page's sceoll positon
public SetScrollPosition ( int x, int y ) : void
x int
y int
Résultat void

SetTextCaretColor() public méthode

Sets the color of the text input caret in the form of 0xAARRGGBB Default is opaque black 0xFF000000
public SetTextCaretColor ( uint color ) : void
color uint
Résultat void

SetUserAgent() public méthode

Sets the user agent the browser reports, setting the agent to "" will use the default uWebKit agent
public SetUserAgent ( string agent = "" ) : void
agent string
Résultat void

SetZoomFactor() public méthode

Sets the zoom factor of the page
public SetZoomFactor ( float zoom ) : void
zoom float
Résultat void

Show() public méthode

Makes the page visible, the page will be updated and refreshed by the Wweb rendering process
public Show ( ) : void
Résultat void

ShowInspector() public méthode

Opens a platform Web Inspector Window
public ShowInspector ( ) : void
Résultat void

Start() public méthode

public Start ( ) : void
Résultat void

Stop() public méthode

Stops the current page load
public Stop ( ) : void
Résultat void

Update() public méthode

public Update ( ) : void
Résultat void

Visible() public méthode

Gets whether the page is visible or not
public Visible ( ) : bool
Résultat bool

contentSizeChanged() public méthode

public contentSizeChanged ( UWKWebView, view, int width, int height ) : void
view UWKWebView,
width int
height int
Résultat void

jsConsole() public méthode

public jsConsole ( UWKWebView, view, string message, int line, string source ) : void
view UWKWebView,
message string
line int
source string
Résultat void

jsMessageReceived() public méthode

public jsMessageReceived ( UWKWebView, view, string message, string json, object>.Dictionary values ) : void
view UWKWebView,
message string
json string
values object>.Dictionary
Résultat void

loadFinished() public méthode

public loadFinished ( UWKWebView, view ) : void
view UWKWebView,
Résultat void

loadProgress() public méthode

public loadProgress ( UWKWebView, view, int progress ) : void
view UWKWebView,
progress int
Résultat void

newViewRequested() public méthode

public newViewRequested ( UWKWebView, view, string url ) : void
view UWKWebView,
url string
Résultat void

titleChanged() public méthode

public titleChanged ( UWKWebView, view, string title ) : void
view UWKWebView,
title string
Résultat void

urlChanged() public méthode

public urlChanged ( UWKWebView, view, string url ) : void
view UWKWebView,
url string
Résultat void

Property Details

ContentSizeChanged public_oe property

Delegate fired when the content size of the page has changed
public ContentSizeChangedDelegate ContentSizeChanged
Résultat ContentSizeChangedDelegate

CurrentHeight public_oe property

Gets the current height of the UWKWebView
public int CurrentHeight
Résultat int

CurrentWidth public_oe property

Gets the current width of the UWKWebView
public int CurrentWidth
Résultat int

JSConsole public_oe property

Delegate fired when the page has output something to console.log
public JSConsoleDelegate JSConsole
Résultat JSConsoleDelegate

JSMessageReceived public_oe property

Delegate fired when the page has received a Javascript message
public JSMessageReceivedDelegate JSMessageReceived
Résultat JSMessageReceivedDelegate

LoadFinished public_oe property

Delegate fired when the page has finished loaded
public LoadFinishedDelegate LoadFinished
Résultat LoadFinishedDelegate

LoadProgress public_oe property

Delegate fired when the page has updated the loading progress 0-100
public LoadProgressDelegate LoadProgress
Résultat LoadProgressDelegate

MaxHeight public_oe property

Max height of the UWKWebView, defined at creation time. It is possible to set the view's current height to be equal or smaller than this value
public int MaxHeight
Résultat int

MaxWidth public_oe property

Max width of the UWKWebView, defined at creation time. It is possible to set the view's current width to be equal or smaller than this value
public int MaxWidth
Résultat int

NewViewRequested public_oe property

Delegate fired when the page has requested a popup window be created
public RequestNewViewDelegate NewViewRequested
Résultat RequestNewViewDelegate

ScrollSensitivity public_oe property

Used to make the scroll wheel/trackpad more sensitive
public float ScrollSensitivity
Résultat float

TitleChanged public_oe property

Delegate fired when the Title of the page has changed
public TitleChangedDelegate TitleChanged
Résultat TitleChangedDelegate

URL public_oe property

The initial URL to load
public string URL
Résultat string

URLChanged public_oe property

Delegate fired when the URL of the page has changed
public URLChangedDelegate URLChanged
Résultat URLChangedDelegate