예제 #1
0
 internal Enumerator(UQueryState <T> queryState)
 {
     iterationList             = VisualElementListPool.Get();
     s_EnumerationList.matches = iterationList;
     s_EnumerationList.Run(queryState.m_Element, queryState.m_Matchers);
     s_EnumerationList.Reset();
     currentIndex = -1;
 }
        public static T Q <T>(this VisualElement e, string name = null, string className = null) where T : VisualElement
        {
            bool flag = typeof(T) == typeof(VisualElement);
            T    result;

            if (flag)
            {
                result = (e.Q(name, className) as T);
            }
            else
            {
                bool flag2 = name == null;
                if (flag2)
                {
                    bool flag3 = className == null;
                    if (flag3)
                    {
                        UQueryState <VisualElement> uQueryState = UQueryExtensions.SingleElementTypeQuery.RebuildOn(e);
                        uQueryState.m_Matchers[0].complexSelector.selectors[0].parts[0] = StyleSelectorPart.CreatePredicate(UQuery.IsOfType <T> .s_Instance);
                        result = (uQueryState.First() as T);
                    }
                    else
                    {
                        UQueryState <VisualElement> uQueryState = UQueryExtensions.SingleElementTypeAndClassQuery.RebuildOn(e);
                        uQueryState.m_Matchers[0].complexSelector.selectors[0].parts[0] = StyleSelectorPart.CreatePredicate(UQuery.IsOfType <T> .s_Instance);
                        uQueryState.m_Matchers[0].complexSelector.selectors[0].parts[1] = StyleSelectorPart.CreateClass(className);
                        result = (uQueryState.First() as T);
                    }
                }
                else
                {
                    bool flag4 = className == null;
                    if (flag4)
                    {
                        UQueryState <VisualElement> uQueryState = UQueryExtensions.SingleElementTypeAndNameQuery.RebuildOn(e);
                        uQueryState.m_Matchers[0].complexSelector.selectors[0].parts[0] = StyleSelectorPart.CreatePredicate(UQuery.IsOfType <T> .s_Instance);
                        uQueryState.m_Matchers[0].complexSelector.selectors[0].parts[1] = StyleSelectorPart.CreateId(name);
                        result = (uQueryState.First() as T);
                    }
                    else
                    {
                        UQueryState <VisualElement> uQueryState = UQueryExtensions.SingleElementTypeAndNameAndClassQuery.RebuildOn(e);
                        uQueryState.m_Matchers[0].complexSelector.selectors[0].parts[0] = StyleSelectorPart.CreatePredicate(UQuery.IsOfType <T> .s_Instance);
                        uQueryState.m_Matchers[0].complexSelector.selectors[0].parts[1] = StyleSelectorPart.CreateId(name);
                        uQueryState.m_Matchers[0].complexSelector.selectors[0].parts[2] = StyleSelectorPart.CreateClass(className);
                        result = (uQueryState.First() as T);
                    }
                }
            }
            return(result);
        }
예제 #3
0
        public void ForEach(Action <T> funcCall)
        {
            UQueryState <T> .ActionQueryMatcher actionQueryMatcher = UQueryState <T> .s_Action;
            bool flag = actionQueryMatcher.callBack != null;

            if (flag)
            {
                actionQueryMatcher = new UQueryState <T> .ActionQueryMatcher();
            }
            try
            {
                actionQueryMatcher.callBack = funcCall;
                actionQueryMatcher.Run(this.m_Element, this.m_Matchers);
            }
            finally
            {
                actionQueryMatcher.callBack = null;
            }
        }
예제 #4
0
        public void ForEach <T2>(List <T2> result, Func <T, T2> funcCall)
        {
            UQueryState <T> .DelegateQueryMatcher <T2> delegateQueryMatcher = UQueryState <T> .DelegateQueryMatcher <T2> .s_Instance;
            bool flag = delegateQueryMatcher.callBack != null;

            if (flag)
            {
                delegateQueryMatcher = new UQueryState <T> .DelegateQueryMatcher <T2>();
            }
            try
            {
                delegateQueryMatcher.callBack = funcCall;
                delegateQueryMatcher.result   = result;
                delegateQueryMatcher.Run(this.m_Element, this.m_Matchers);
            }
            finally
            {
                delegateQueryMatcher.callBack = null;
                delegateQueryMatcher.result   = null;
            }
        }
        public static VisualElement Q(this VisualElement e, string name = null, string className = null)
        {
            bool          flag = name == null;
            VisualElement result;

            if (flag)
            {
                bool flag2 = className == null;
                if (flag2)
                {
                    result = UQueryExtensions.SingleElementEmptyQuery.RebuildOn(e).First();
                }
                else
                {
                    UQueryState <VisualElement> uQueryState = UQueryExtensions.SingleElementClassQuery.RebuildOn(e);
                    uQueryState.m_Matchers[0].complexSelector.selectors[0].parts[0] = StyleSelectorPart.CreateClass(className);
                    result = uQueryState.First();
                }
            }
            else
            {
                bool flag3 = className == null;
                if (flag3)
                {
                    UQueryState <VisualElement> uQueryState = UQueryExtensions.SingleElementNameQuery.RebuildOn(e);
                    uQueryState.m_Matchers[0].complexSelector.selectors[0].parts[0] = StyleSelectorPart.CreateId(name);
                    result = uQueryState.First();
                }
                else
                {
                    UQueryState <VisualElement> uQueryState = UQueryExtensions.SingleElementNameAndClassQuery.RebuildOn(e);
                    uQueryState.m_Matchers[0].complexSelector.selectors[0].parts[0] = StyleSelectorPart.CreateId(name);
                    uQueryState.m_Matchers[0].complexSelector.selectors[0].parts[1] = StyleSelectorPart.CreateClass(className);
                    result = uQueryState.First();
                }
            }
            return(result);
        }
예제 #6
0
 public bool Equals(UQueryState <T> other)
 {
     return(this.m_Element == other.m_Element && EqualityComparer <List <RuleMatcher> > .Default.Equals(this.m_Matchers, other.m_Matchers));
 }
예제 #7
0
 public bool Equals(UQueryState <T> other)
 {
     return(ReferenceEquals(m_Element, other.m_Element) &&
            EqualityComparer <List <RuleMatcher> > .Default.Equals(m_Matchers, other.m_Matchers));
 }