Example #1
0
        private bool ShowApplyOrCancelBtn()
        {
            if (EditorApplication.isCompiling)
            {
                return(false);
            }

            var symbols = ScriptingDefineSymbolUtility.GetDefineSymbol();

            if (!bridges.IsNullOrEmpty())
            {
                foreach (var bridge in bridges)
                {
                    if (bridge.isEnable && !symbols.Contains(bridge.symbol))
                    {
                        return(true);
                    }

                    if (!bridge.isEnable && symbols.Contains(bridge.symbol))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Example #2
0
        public void Refresh()
        {
            _isEnable = ScriptingDefineSymbolUtility.ContainSymbol(_symbol);

            if (!_reference.IsNull())
            {
                (_reference as iRefresh)?.Refresh();
            }
        }
Example #3
0
        public void Apply()
        {
            var symbols            = ScriptingDefineSymbolUtility.GetDefineSymbol();
            var pluginNotInstalled = default(IList <Bridge>);

            foreach (var bridge in bridges)
            {
                if (!bridge.symbol.IsNullOrEmpty())
                {
                    if (bridge.isEnable)
                    {
                        if (!bridge.isInstalled)
                        {
                            if (pluginNotInstalled.IsNull())
                            {
                                pluginNotInstalled = new List <Bridge>();
                            }

                            pluginNotInstalled.Add(bridge);
                        }
                        else if (!symbols.Contains(bridge.symbol))
                        {
                            symbols.Add(bridge.symbol);
                        }
                    }
                    else if (!bridge.isEnable)
                    {
                        symbols.Remove(bridge.symbol);
                    }
                }
            }

            if (pluginNotInstalled.IsNullOrEmpty())
            {
                ScriptingDefineSymbolUtility.SaveDefineSymbol(symbols);
            }
            else
            {
                var message = "Please install plugin first before using bridge : ";

                for (int i = 0; i < pluginNotInstalled.Count; i++)
                {
                    var name      = pluginNotInstalled[i].name;
                    var separator = i < pluginNotInstalled.Count - 1?",":"";
                    message += string.Format("{0}{1}", name, separator);
                }

                EditorUtility.DisplayDialog("Required", message, "ok");
                Refresh();
            }
        }