Пример #1
0
    void boot(ref Command cmd)
    {
        //Debug.Log("WebKit version: " + cmd.GetSParam (0));
        //Debug.Log("Qt version: " + cmd.GetSParam (1));

        ProductKey = cmd.GetSParam(2);

        int error = cmd.iParams [0];

        ProductTrial = cmd.iParams [3] == 1 ? true : false;

        if (error != 0)
        {
            Debug.Log("Error starting uWebKit");
        }

        if (cmd.iParams [2] == 2)
        {
            //need to activate
                        #if UNITY_EDITOR
            if (!EditorApplication.currentScene.Contains("UWKActivationScene"))
            {
                EditorUtility.DisplayDialog("uWebKit Activation Required", "Please select uWebKit/Activate from the Editor menu", "Ok");
                EditorApplication.ExecuteMenuItem("Edit/Play");
            }
                        #endif
        }

        if (cmd.iParams [1] == 0)
        {
            StandardVersion = true;
        }

        processUp = true;

        if (restarting)
        {
            restarting = false;
            UWKView.RestartAllViews();
        }

        booted = true;

                #if UNITY_EDITOR
        if (StandardVersion)
        {
            if (GetNumViews() > 1)
            {
                EditorUtility.DisplayDialog("uWebKit Standard Version", "uWebKit Pro required for multiple web views", "Ok");
            }
        }
                #endif


        // enable all views created before boot
        foreach (UWKView view in viewLookup.Values)
        {
            view.enabled = true;
        }

        cmd = Command.NewCommand("ALWP", AllowJavascriptPopups ? 1 : 0);
        cmd.Post();

        // set proxy if any
        if (UWKConfig.ProxyEnabled)
        {
            if (UWKConfig.ProxyHostname.Length > 0)
            {
                cmd            = Command.NewCommand("PRXY");
                cmd.numSParams = 1;
                cmd.SetSParam(0, UWKConfig.ProxyHostname);

                cmd.numIParams  = 1;
                cmd.iParams [0] = UWKConfig.ProxyPort;

                if (UWKConfig.ProxyUsername.Length > 0)
                {
                    cmd.SetSParam(cmd.numSParams++, UWKConfig.ProxyUsername);

                    if (UWKConfig.ProxyPassword.Length > 0)
                    {
                        cmd.SetSParam(cmd.numSParams++, UWKConfig.ProxyPassword);
                    }
                }

                // post proxy info
                cmd.Post();
            }
        }

        // set auth if any
        if (UWKConfig.AuthEnabled && UWKConfig.AuthUsername.Length > 0 && UWKConfig.AuthPassword.Length > 0)
        {
            cmd            = Command.NewCommand("AUTH");
            cmd.numSParams = 2;
            cmd.SetSParam(0, UWKConfig.AuthUsername);
            cmd.SetSParam(1, UWKConfig.AuthPassword);
            cmd.Post();
        }
    }