C# Класс UWKWebView, html-ui-unity

WebView component used to render and interact with web content
Наследование: MonoBehaviour
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
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

Открытые методы

Метод Описание
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

Описание методов

AddToGameObject() публичный статический Метод

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
Результат UWKWebView,

Awake() публичный Метод

Initializes the UWKWebView, registers default delagates, and creates textures for the page and icon to lack of constructor parameters
public Awake ( ) : void
Результат void

Back() публичный Метод

Moves back in the page history
public Back ( ) : void
Результат void

ClearCookies() публичный статический Метод

Clears all user cookies
public static ClearCookies ( ) : void
Результат void

CloseInspector() публичный Метод

Closes the Web Inspector window Associated with this View
public CloseInspector ( ) : void
Результат void

DisableInput() публичный статический Метод

Globally enables mouse and keyboard input from webviews
public static DisableInput ( ) : void
Результат void

DrawTextIME() публичный Метод

Draws the text IME for Chinese, Japanese, Korean languages
public DrawTextIME ( int x, int y ) : void
x int
y int
Результат void

DrawTexture() публичный Метод

public DrawTexture ( Rect position, bool alphaBlend = true ) : void
position Rect
alphaBlend bool
Результат void

EnableInput() публичный статический Метод

Globally disabled mouse and keyboard input from webviews
public static EnableInput ( ) : void
Результат void

EvaluateJavascript() публичный Метод

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
Результат void

Forward() публичный Метод

Moves forward in the page history
public Forward ( ) : void
Результат void

GetApplicationDataURL() публичный статический Метод

public static GetApplicationDataURL ( ) : string
Результат string

Hide() публичный Метод

Hide the page, the page will no longer be rendered by the web rendering process saving CPU time
public Hide ( ) : void
Результат void

IMEFocusIn() публичный Метод

Page is focusing a text entry area in IME mode
public IMEFocusIn ( UWKMessage, &msg ) : void
msg UWKMessage,
Результат void

IMEFocusOut() публичный Метод

Page is removing focus for text area in IME mode
public IMEFocusOut ( ) : void
Результат void

IconChanged() публичный Метод

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
Результат void

LoadHTML() публичный Метод

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
Результат void

LoadURL() публичный Метод

Navigate the view to the specified URL (http://, file://, etc)
public LoadURL ( string url ) : void
url string
Результат void

Navigate() публичный Метод

Navigates forward or back in the page history
public Navigate ( Navigation, n ) : void
n Navigation,
Результат void

OnDestroy() публичный Метод

public OnDestroy ( ) : void
Результат void

ProcessKeyboard() публичный Метод

Process a Unity keyboard event
public ProcessKeyboard ( Event keyEvent ) : void
keyEvent Event
Результат void

ProcessMouse() публичный Метод

Process the mouse given mousePos coordinates
public ProcessMouse ( Vector3 mousePos ) : void
mousePos Vector3
Результат void

Reload() публичный Метод

Reloads the current page contents
public Reload ( ) : void
Результат void

SendJSMessage() публичный Метод

Sends a Javascript message to the page
public SendJSMessage ( string msgName ) : void
msgName string
Результат void

SendJSMessage() публичный Метод

Sends a Javascript message to the page
public SendJSMessage ( string msgName, object>.Dictionary msgValues ) : void
msgName string
msgValues object>.Dictionary
Результат void

SendJSMessage() публичный Метод

Sends a Javascript message to the page
public SendJSMessage ( string msgName, object value ) : void
msgName string
value object
Результат void

SendJSMessage() публичный Метод

Sends a Javascript message to the page
public SendJSMessage ( string msgName, string key, object value ) : void
msgName string
key string
value object
Результат void

SetAlphaMask() публичный Метод

Enabled or disables alpha mask rendering of view
public SetAlphaMask ( bool enabled ) : void
enabled bool
Результат void

SetCurrentSize() публичный Метод

Sets the current width and height of the UWKWebView
public SetCurrentSize ( int width, int height ) : void
width int
height int
Результат void

SetFrameRate() публичный Метод

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
Результат void

SetScrollPosition() публичный Метод

Sets the page's sceoll positon
public SetScrollPosition ( int x, int y ) : void
x int
y int
Результат void

SetTextCaretColor() публичный Метод

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
Результат void

SetUserAgent() публичный Метод

Sets the user agent the browser reports, setting the agent to "" will use the default uWebKit agent
public SetUserAgent ( string agent = "" ) : void
agent string
Результат void

SetZoomFactor() публичный Метод

Sets the zoom factor of the page
public SetZoomFactor ( float zoom ) : void
zoom float
Результат void

Show() публичный Метод

Makes the page visible, the page will be updated and refreshed by the Wweb rendering process
public Show ( ) : void
Результат void

ShowInspector() публичный Метод

Opens a platform Web Inspector Window
public ShowInspector ( ) : void
Результат void

Start() публичный Метод

public Start ( ) : void
Результат void

Stop() публичный Метод

Stops the current page load
public Stop ( ) : void
Результат void

Update() публичный Метод

public Update ( ) : void
Результат void

Visible() публичный Метод

Gets whether the page is visible or not
public Visible ( ) : bool
Результат bool

contentSizeChanged() публичный Метод

public contentSizeChanged ( UWKWebView, view, int width, int height ) : void
view UWKWebView,
width int
height int
Результат void

jsConsole() публичный Метод

public jsConsole ( UWKWebView, view, string message, int line, string source ) : void
view UWKWebView,
message string
line int
source string
Результат void

jsMessageReceived() публичный Метод

public jsMessageReceived ( UWKWebView, view, string message, string json, object>.Dictionary values ) : void
view UWKWebView,
message string
json string
values object>.Dictionary
Результат void

loadFinished() публичный Метод

public loadFinished ( UWKWebView, view ) : void
view UWKWebView,
Результат void

loadProgress() публичный Метод

public loadProgress ( UWKWebView, view, int progress ) : void
view UWKWebView,
progress int
Результат void

newViewRequested() публичный Метод

public newViewRequested ( UWKWebView, view, string url ) : void
view UWKWebView,
url string
Результат void

titleChanged() публичный Метод

public titleChanged ( UWKWebView, view, string title ) : void
view UWKWebView,
title string
Результат void

urlChanged() публичный Метод

public urlChanged ( UWKWebView, view, string url ) : void
view UWKWebView,
url string
Результат void

Описание свойств

ContentSizeChanged публичное свойство

Delegate fired when the content size of the page has changed
public ContentSizeChangedDelegate ContentSizeChanged
Результат ContentSizeChangedDelegate

CurrentHeight публичное свойство

Gets the current height of the UWKWebView
public int CurrentHeight
Результат int

CurrentWidth публичное свойство

Gets the current width of the UWKWebView
public int CurrentWidth
Результат int

JSConsole публичное свойство

Delegate fired when the page has output something to console.log
public JSConsoleDelegate JSConsole
Результат JSConsoleDelegate

JSMessageReceived публичное свойство

Delegate fired when the page has received a Javascript message
public JSMessageReceivedDelegate JSMessageReceived
Результат JSMessageReceivedDelegate

LoadFinished публичное свойство

Delegate fired when the page has finished loaded
public LoadFinishedDelegate LoadFinished
Результат LoadFinishedDelegate

LoadProgress публичное свойство

Delegate fired when the page has updated the loading progress 0-100
public LoadProgressDelegate LoadProgress
Результат LoadProgressDelegate

MaxHeight публичное свойство

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
Результат int

MaxWidth публичное свойство

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
Результат int

NewViewRequested публичное свойство

Delegate fired when the page has requested a popup window be created
public RequestNewViewDelegate NewViewRequested
Результат RequestNewViewDelegate

ScrollSensitivity публичное свойство

Used to make the scroll wheel/trackpad more sensitive
public float ScrollSensitivity
Результат float

TitleChanged публичное свойство

Delegate fired when the Title of the page has changed
public TitleChangedDelegate TitleChanged
Результат TitleChangedDelegate

URL публичное свойство

The initial URL to load
public string URL
Результат string

URLChanged публичное свойство

Delegate fired when the URL of the page has changed
public URLChangedDelegate URLChanged
Результат URLChangedDelegate