예제 #1
0
        //static ProductsWindow()
        //{
        //    if (!EditorApplication.isPlayingOrWillChangePlaymode)
        //    {
        //        EditorApplication.delayCall += CheckAutoShow;
        //    }
        //}

        //private static void CheckAutoShow()
        //{
        //    EditorApplication.delayCall -= CheckAutoShow;
        //    if (EditorApplication.isPlaying)
        //    {
        //        return;
        //    }

        //    ApexSettings settings;
        //    if (!ApexSettings.TryGetSettings(out settings))
        //    {
        //        if (settings == null)
        //        {
        //            EditorUtility.DisplayDialog("Apex Error", "Apex Product was unable to create its settings file, please report this to the Apex Team.", "Ok");
        //            return;
        //        }

        //        settings.allowAutomaticUpdateCheck = EditorUtility.DisplayDialog("Apex Update", "Apex Products can check for availability of new versions.\n\nThese checks will not install anything new, nor will they send any information whatsoever.\n\nDo you wish to enable automatic version checks?", "Yes", "No");
        //        settings.SaveChanges();
        //    }

        //    if (settings.timeToUpdate)
        //    {
        //        ProductManager.GetProductsInfoAsync(settings, true, ShowIfUdates);
        //    }
        //}

        //private static void ShowIfUdates(IEnumerable<ProductInfo> products)
        //{
        //    if (products.Any(p => p.newUpdateAvailable))
        //    {
        //        EditorUtility.DisplayDialog("Apex Update", "An Apex product update is available.", "Ok");

        //        _productsPreloaded = products;
        //        SharedMenuExtentions.ProductsWindow();
        //    }
        //}

        private void OnEnable()
        {
            this.minSize = new Vector2(490f, 350f);

            if (!ApexSettings.TryGetSettings(out _settings) && _settings == null)
            {
                return;
            }

            //Get the products list
            if (_productsPreloaded != null)
            {
                _products          = _productsPreloaded;
                _productsPreloaded = null;
            }
            else
            {
                ProductManager.GetProductsInfoAsync(
                    _settings,
                    false,
                    prods =>
                {
                    _products = prods;
                });
            }

            _styles = new Styles();
        }
예제 #2
0
        private void OnEnable()
        {
            if (!ApexSettings.TryGetSettings(out _settings) && _settings == null)
            {
                return;
            }

            //Get the products list
            if (_productsPreloaded != null)
            {
                _products          = _productsPreloaded;
                _productsPreloaded = null;
            }
            else
            {
                ProductManager.GetProductsInfoAsync(_settings, false, prods => _products = prods);
            }

            _styles = new Styles();
        }
예제 #3
0
        private static void CheckAutoShow()
        {
            EditorApplication.delayCall -= CheckAutoShow;

            ApexSettings settings;

            if (!ApexSettings.TryGetSettings(out settings))
            {
                if (settings == null)
                {
                    EditorUtility.DisplayDialog("Apex Error", "Apex Path was unable to create its settings file, please report this to the Apex Team.", "Ok");
                    return;
                }

                settings.allowAutomaticUpdateCheck = EditorUtility.DisplayDialog("Apex Update", "Apex Products can check for availability of new versions.\n\nThese checks will not install anything new, nor will they send any information whatsoever.\n\nDo you wish to enable automatic version checks?", "Yes", "No");
                settings.SaveChanges();
            }

            if (settings.timeToUpdate)
            {
                ProductManager.GetProductsInfoAsync(settings, true, ShowIfUdates);
            }
        }
        public override void OnInspectorGUI()
        {
            ApexSettings settings;

            if (ApexSettings.TryGetSettings(out settings))
            {
                var info = new IconInfo
                {
                    key  = "ApexPath",
                    path = string.Concat(settings.relativeDataFolder, "/ApexPath.png")
                };

                var icon = ProductManager.GetIcon(info);

                EditorGUILayout.LabelField(new GUIContent(" Apex Components", icon));
            }
            else
            {
                EditorGUILayout.LabelField("Apex Components");
            }

            EditorGUI.indentLevel++;

            var master = this.target as ApexComponentMaster;

            foreach (var category in master.componentCategories)
            {
                EditorGUILayout.BeginVertical("Box");
                EditorGUILayout.GetControlRect(true, 16f, EditorStyles.foldout);
                Rect foldRect = GUILayoutUtility.GetLastRect();

                category.isOpen = EditorGUI.Foldout(foldRect, category.isOpen, category.name, true);
                if (!category.isOpen)
                {
                    EditorGUILayout.EndVertical();
                    continue;
                }

                bool requiresCleanup = false;
                foreach (ApexComponentMaster.ComponentInfo c in category)
                {
                    if (c.component == null || c.component.Equals(null))
                    {
                        requiresCleanup = true;
                        continue;
                    }

                    var lblStyle = c.component.enabled ? EditorStyles.label : disabledLabel;

                    var visible = EditorGUILayout.ToggleLeft(c.name, c.isVisible, lblStyle);
                    if (visible != c.isVisible)
                    {
                        if (this.targets.Length > 1)
                        {
                            foreach (var t in this.targets)
                            {
                                ((ApexComponentMaster)t).Toggle(c.name, visible);
                            }
                        }
                        else
                        {
                            master.Toggle(c);
                        }

                        EditorUtility.SetDirty(master);
                    }
                }

                EditorGUILayout.EndVertical();

                if (requiresCleanup)
                {
                    foreach (var t in this.targets)
                    {
                        ((ApexComponentMaster)t).Cleanup();
                    }
                }
            }

            EditorGUI.indentLevel--;
            if (GUILayout.Button("Toggle All"))
            {
                foreach (var t in this.targets)
                {
                    var tmp = t as ApexComponentMaster;
                    tmp.ToggleAll();
                    EditorUtility.SetDirty(tmp);
                }
            }
        }