コード例 #1
0
ファイル: UWKActivation.cs プロジェクト: nethz/UnityGame
    void processInbound(object sender, CommandProcessEventArgs args)
    {
        Command cmd = args.Cmd;

        // activation
        if (cmd.fourcc == "ACTR")
        {
            processACTR(cmd);
        }
    }
コード例 #2
0
    /// <summary>
    /// Event handler in response to a remove request
    /// </summary>
    void processRMVW(object sender, CommandProcessEventArgs args)
    {
        if (TSet != null)
        {
            TSet.Release();
        }

        Object.DestroyObject(this);
        Object.DestroyObject(this.gameObject);
    }
コード例 #3
0
    /// <summary>
    /// Processes a resize of the UWKView, which can cause the backing textures to be
    /// released/allocated.  This is an expensive operation and should be avoided if possible
    /// </summary>
    void processResize(object sender, CommandProcessEventArgs args)
    {
        Command cmd = args.Cmd;

        if (cmd.retCode > 0)
        {
            if (cmd.retCode == 2)
            {
                TSet.Release();
                TSet = new TextureSet();
                TSet.Init(Width, Height, SmartRects);
            }
            else
            {
            }
        }
        else
        {
            Debug.Log("Error Resizing View: " + Name);
        }
    }
コード例 #4
0
    /// <summary>
    /// Event handler for view creation
    /// </summary>
    void processCRVW(object sender, CommandProcessEventArgs args)
    {
        Command cmd = args.Cmd;

        if (cmd.retCode > 0)
        {
            validate();
            if (ViewCreated != null)
            {
                ViewCreated(this);
            }
        }
        else
        {
            Debug.Log("Error Creating View: " + Name);
        }

        if (URL.Length != 0)
        {
            LoadURL(URL);
        }
    }
コード例 #5
0
ファイル: UWKCore.cs プロジェクト: nethz/UnityGame
    void processInbound(object sender, CommandProcessEventArgs args)
    {
        Command cmd = args.Cmd;

        if (cmd.fourcc == "PRUP")
        {
            Plugin.UWK_InitProcess();
        }

        // save cookies
        if (cmd.fourcc == "LDFN")
        {
            Command ncmd = Command.NewCommand("SVCK");
            ncmd.Post();
        }

        if (cmd.fourcc == "BOOT")
        {
            boot(ref cmd);
        }

        if (cmd.fourcc == "JLOG" && ShowJavascriptErrors)
        {
            string message    = Plugin.GetString(cmd.iParams [0], cmd.iParams [1]);
            int    lineNumber = cmd.iParams [2];
            string sourceId   = Plugin.GetString(cmd.iParams [3], cmd.iParams [4]);

            Debug.Log("Javascript: " + lineNumber + " : " + sourceId + " :  " + message);
        }

        // activation, we're still interested as the activation script may not be running
        if (cmd.fourcc == "ACTR")
        {
            processACTR(cmd);
        }

        if (cmd.fourcc == "POPU")
        {
            string name = Plugin.GetString(cmd.iParams [0], cmd.iParams [1]);

            int width  = cmd.iParams [2];
            int height = cmd.iParams [3];

            CreateJSPopup(name, width, height);
        }

        if (cmd.fourcc == "POPC")
        {
            string name = Plugin.GetString(cmd.iParams [0], cmd.iParams [1]);

            if (!popups.ContainsKey(name))
            {
                // this can happen if we close Unity side, we'll still get the call from the close slot
                // we could remove the slot native side to avoid this
                //Debug.LogWarning("Warning: CLoseJSPopupRequested called on missing popup");
            }
            else
            {
                CloseJSPopupRequested(popups [name]);
            }
        }
    }
コード例 #6
0
ファイル: UWKCore.cs プロジェクト: nethz/UnityGame
 void processReturn(object sender, CommandProcessEventArgs args)
 {
     //Command cmd = args.Cmd;
 }
コード例 #7
0
 /// <summary>
 /// Default handler which consumes return value, if you specify your own return value handler you much consume
 /// the return string with Plugin.GetString as below, otherwise you may run out of buffer allocations
 /// </summary>
 void defaultEvalResultHandler(object sender, CommandProcessEventArgs args)
 {
     // ensure we consume return value
     Plugin.GetString(args.Cmd.iParams [0], args.Cmd.iParams [1]);
 }
コード例 #8
0
    /// <summary>
    /// Inbound command event handler, responds to events generated by the native WebCore
    /// </summary>
    void processInbound(object sender, CommandProcessEventArgs args)
    {
        if (!Valid)
        {
            return;
        }

        Command cmd = args.Cmd;

        string name = cmd.GetSParam(0);

        if (name != Name)
        {
            return;
        }

        // Update the view
        if (cmd.fourcc == "UPVW")
        {
            UpdateView();
        }

        // Update the associated view icon
        if (cmd.fourcc == "ICNC")
        {
            processIcon(ref cmd);
        }

        // Update the ContentSize of the web view
        if (cmd.fourcc == "UPCZ")
        {
            ContentWidth  = cmd.iParams [0];
            ContentHeight = cmd.iParams [1];

            if (ResizeToContents && (Width != ContentWidth || Height != ContentHeight))
            {
                Width  = ContentWidth;
                Height = ContentHeight;

                sizeDirty = false;
            }
        }

        // Update the view's title
        if (cmd.fourcc == "TITC")
        {
            Title = cmd.GetSParam(1);

            if (TitleChanged != null)
            {
                TitleChanged(this, Title);
            }
        }

        // The progress of the page load to show progress bars, etc
        if (cmd.fourcc == "PROG")
        {
            if (LoadProgress != null)
            {
                LoadProgress(cmd.iParams [0]);
            }
        }


        // The WebView's content has finished loading
        if (cmd.fourcc == "LDFN")
        {
            if (LoadFinished != null)
            {
                LoadFinished(this);
            }
        }

        // The WebView's URL has changed either from user input or a redirect
        if (cmd.fourcc == "URLC")
        {
            string url = "";

            url = UWK.Plugin.GetString(cmd.iParams [0], cmd.iParams [1]);

            URL = url;
            if (URLChanged != null)
            {
                URLChanged(this, url);
            }
        }


        if (UWKCore.imeEnabled)
        {
            // ime out
            if (cmd.fourcc == "IMEO")
            {
                TextInputActive = false;
            }

            // ime in
            if (cmd.fourcc == "IMEI")
            {
                TextInputActive = true;

                TextInputType = cmd.GetSParam(1);

                if (cmd.iParams [1] != 0)
                {
                    _imeText = Plugin.GetString(cmd.iParams [0], cmd.iParams [1]);
                }
                else
                {
                    _imeText = "";
                }

                TextInputRect = new Rect(cmd.iParams [2], cmd.iParams [3], cmd.iParams [4], cmd.iParams [5]);
            }
        }
    }