コード例 #1
0
        protected void Awake()
        {
            EnableRendering = true;
            EnableInput     = true;
            CookieManager   = new CookieManager(this);

            browserInput = new BrowserInput(this);

            onNativeReady += id => {
                if (!uiHandlerAssigned)
                {
                    var meshCollider = GetComponent <MeshCollider>();
                    if (meshCollider)
                    {
                        UIHandler = ClickMeshBrowserUI.Create(meshCollider);
                    }
                }

                Resize(_width, _height);

                Zoom = _zoom;

                if (!string.IsNullOrEmpty(_url))
                {
                    Url = _url;
                }
            };

            onConsoleMessage += (message, source) => {
                var text = source + ": " + message;
                Debug.Log(text, this);
            };

            onFetchError += err => {
                //don't show anything if the error is a load abort
                if (err["error"] == "ERR_ABORTED")
                {
                    return;
                }

                QueuePageReplacer(() => {
                    LoadHTML(Resources.Load <TextAsset>("Browser/Errors").text, Url);
                    CallFunction("setErrorInfo", err);
                }, -1000);
            };

            onCertError += err => {
                QueuePageReplacer(() => {
                    LoadHTML(Resources.Load <TextAsset>("Browser/Errors").text, Url);
                    CallFunction("setErrorInfo", err);
                }, -900);
            };

            onSadTab += () => {
                QueuePageReplacer(() => {
                    LoadHTML(Resources.Load <TextAsset>("Browser/Errors").text, Url);
                    CallFunction("showCrash");
                }, -1000);
            };
        }
コード例 #2
0
ファイル: Browser.cs プロジェクト: smdx24/CPI-Source-Code
 protected void Awake()
 {
     EnableRendering = true;
     EnableInput     = true;
     CookieManager   = new CookieManager(this);
     browserInput    = new BrowserInput(this);
     onNativeReady  += delegate
     {
         if (!uiHandlerAssigned)
         {
             MeshCollider component = GetComponent <MeshCollider>();
             if ((bool)component)
             {
                 UIHandler = ClickMeshBrowserUI.Create(component);
             }
         }
         Resize(_width, _height);
         Zoom = _zoom;
         if (!string.IsNullOrEmpty(_url))
         {
             Url = _url;
         }
     };
     onConsoleMessage += delegate(string message, string source)
     {
         string message2 = source + ": " + message;
         Debug.Log(message2, this);
     };
     onFetchError += delegate(JSONNode err)
     {
         if (!((string)err["error"] == "ERR_ABORTED"))
         {
             QueuePageReplacer(delegate
             {
                 LoadHTML(Resources.Load <TextAsset>("Browser/Errors").text, Url);
                 CallFunction("setErrorInfo", err);
             }, -1000f);
         }
     };
     onCertError += delegate(JSONNode err)
     {
         QueuePageReplacer(delegate
         {
             LoadHTML(Resources.Load <TextAsset>("Browser/Errors").text, Url);
             CallFunction("setErrorInfo", err);
         }, -900f);
     };
     onSadTab += delegate
     {
         QueuePageReplacer(delegate
         {
             LoadHTML(Resources.Load <TextAsset>("Browser/Errors").text, Url);
             CallFunction("showCrash");
         }, -1000f);
     };
 }