Exemplo n.º 1
0
        /// <summary>
        /// Update override method called by Unity editor. The update cycle looks
        /// for any action events that were generated in the OnGUI method by the
        /// user and takes action on those events.
        /// </summary>
        void Update()
        {
            if (pluginDataDirty)
            {
                pluginDataDirty = false;
                RefreshPluginDataForWindow();
            }

            while (installPlugins.Count > 0)
            {
                var          pluginKey = installPlugins.Pop();
                ResponseCode rc        = ProjectManagerController.InstallPlugin(pluginKey);
                if (ResponseCode.PLUGIN_NOT_INSTALLED == rc)
                {
                    EditorUtility.DisplayDialog("Plugin Install Error",
                                                "There was a problem installing the selected plugin.",
                                                "Ok");
                    LoggingController.LogError(
                        string.Format("Could not install plugin with key {0}." +
                                      "Got {1} response code.", pluginKey, rc));
                }
                else
                {
                    pluginDataDirty = true;
                }
                installingPlugins.Remove(pluginKey);
            }

            while (moreInfoPlugins.Count > 0)
            {
                var pluginKey = moreInfoPlugins.Pop();
                var plugin    = PluginManagerController.GetPluginForVersionlessKey(
                    PluginManagerController.VersionedPluginKeyToVersionless(pluginKey));
                // popup with full description
                EditorUtility.DisplayDialog(
                    string.Format("{0}", plugin.MetaData.artifactId),
                    plugin.Description.languages[0].fullDesc,
                    "Ok");
            }

            while (uninstallPlugins.Count > 0)
            {
                var          pluginKey = uninstallPlugins.Pop();
                ResponseCode rc        = ProjectManagerController.UninstallPlugin(pluginKey);
                if (ResponseCode.PLUGIN_NOT_REMOVED == rc)
                {
                    EditorUtility.DisplayDialog("Plugin Uninstall Error",
                                                "There was a problem removing the selected plugin.",
                                                "Ok");
                    LoggingController.LogError(
                        string.Format("Could not uninstall plugin with key {0}." +
                                      "Got {1} response code.", pluginKey, rc));
                }
                else
                {
                    pluginDataDirty = true;
                }
                uninstallingPlugins.Remove(pluginKey);
            }
        }