Ejemplo n.º 1
0
        public void Update()
        {
            if (mSearchClassText == mPreviousClassText && mSearchMemberText == mPreviousMemberText)
            {
                return;
            }
            mPreviousClassText  = mSearchClassText;
            mPreviousMemberText = mSearchMemberText;

            if (mAllTypes.IsNullOrEmpty() || mSearchClassText.IsNullOrEmpty())
            {
                mMembers.Clear();
                return;
            }

            var tSearchChars = mSearchClassText.Distinct(' ');
            var tMatchTypes  = new HashSet <Type>();

            foreach (var tTypeName in mAllTypes.Keys)
            {
                var tContains = true;
                foreach (var tSearchChar in tSearchChars)
                {
                    if (!tTypeName.Contains(tSearchChar))
                    {
                        tContains = false;
                        break;
                    }
                }
                if (!tContains || mAllTypes[tTypeName] == null)
                {
                    continue;
                }
                tMatchTypes.Add(mAllTypes[tTypeName]);
                if (tMatchTypes.Count >= ConstHelper.cStaticViewMaxShowCount)
                {
                    break;
                }
            }

            if (tMatchTypes.IsNullOrEmpty())
            {
                mMembers.Clear();
                return;
            }
            mMembers.Clear();
            foreach (var tType in tMatchTypes)
            {
                var tMember = new MemberItem(null, null, tType, ConstHelper.cStaticPropertyFlags, mSearchMemberText.Distinct(' '));
                if (tMember.IsNullOrEmpty())
                {
                    continue;
                }
                mMembers.Add(tMember);
            }
        }
Ejemplo n.º 2
0
        public void Update()
        {
            if (mTarget == null)
            {
                mMembers.Clear();
                mPreviousTarget = null;
                mSerachText     = string.Empty;
                mPreviousText   = string.Empty;
                return;
            }

            if (mPreviousTarget && mTarget == mPreviousTarget && mSerachText == mPreviousText)
            {
                return;
            }
            mPreviousTarget = mTarget;
            mPreviousText   = mSerachText;
            mTargetName     = mTarget.name;

            var tComponents = mTarget.GetComponents <Component>();

            mMembers.Clear();
            if (tComponents == null)
            {
                return;
            }
            foreach (var tComponent in tComponents)
            {
                if (tComponent == null || mTarget == null)
                {
                    continue;
                }
                var tMember = new MemberItem(tComponent, mTarget, tComponent.GetType(), ConstHelper.cEntityPropertyFlags, mSerachText.Distinct(' '));
                if (tMember.IsNullOrEmpty())
                {
                    continue;
                }
                mMembers.Add(tMember);
            }
        }