Exemplo n.º 1
0
        public static void ShowFilterKeyTypeMenu(string current, Action <string> Selected)
        {
            var menu = new GenericMenu();

            menu.AddDisabledItem(new GUIContent(current));

            menu.AddSeparator(string.Empty);

            var guiNames = FilterTypeUtility.GetFilterGUINames();

            for (var i = 0; i < guiNames.Count; i++)
            {
                var name = guiNames[i];
                if (name == current)
                {
                    continue;
                }

                menu.AddItem(
                    new GUIContent(name),
                    false,
                    () => {
                    Selected(name);
                }
                    );
            }
            menu.ShowAsContext();
        }
        private void CheckVersionAndUpgrade()
        {
            if (kVERSION < m_version)
            {
                throw new AssetGraphException("Graph Asset is created with newer version of AssetGraph. Please upgrade your project with newer version.");
            }

            if (kVERSION > m_version)
            {
                if (m_filterKeytype != Model.Settings.DEFAULT_FILTER_KEYTYPE)
                {
                    Type t = Type.GetType(m_filterKeytype);
                    m_filterKeytype = FilterTypeUtility.FindGUINameFromType(t);
                }
                m_version = kVERSION;
            }
        }
        public bool FilterAsset(AssetReference a)
        {
            CheckVersionAndUpgrade();

            bool keywordMatch = Regex.IsMatch(a.importFrom, m_filterKeyword,
                                              RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);

            bool match = keywordMatch;

            if (keywordMatch && m_filterKeytype != Model.Settings.DEFAULT_FILTER_KEYTYPE)
            {
                var incomingType = a.filterType;

                var filterType = FilterTypeUtility.FindFilterTypeFromGUIName(m_filterKeytype);

                match = incomingType != null && filterType == incomingType;
            }

            return(match);
        }