Beispiel #1
0
        private void PerformEntitySearch(EntityParams inEntityParams)
        {
            m_EntityRefs.Clear();

            if (m_EntityMgr == null)
            {
                Debug.LogError("No entity manager found");
                return;
            }

            switch (inEntityParams.Mode)
            {
            case EntityMode.Id:
            {
                foreach (var entity in m_EntityMgr.Lookup.AllEntities())
                {
                    if ((int)entity.Id == inEntityParams.EntityIdSearch)
                    {
                        m_EntityRefs.Add(EntityRef.FromEntity(entity).WithDescriptor(inEntityParams.EntityIdSearch.ToString()));
                    }
                }
                break;
            }

            case EntityMode.LinkId:
            {
                foreach (var entity in m_EntityMgr.Lookup.AllEntities())
                {
                    foreach (var link in entity.Links.AllLinks())
                    {
                        if (StringMatch(link.Value, inEntityParams.StringSearch))
                        {
                            m_EntityRefs.Add(EntityRef.FromEntity(entity).WithDescriptor(link.Value));
                        }
                    }
                }
                break;
            }

            case EntityMode.LinkEntity:
            {
                foreach (var entity in m_EntityMgr.Lookup.AllEntities())
                {
                    foreach (var link in entity.Links.AllLinks())
                    {
                        if (link.Key == inEntityParams.EntityRefSearch)
                        {
                            m_EntityRefs.Add(EntityRef.FromEntity(entity).WithDescriptor(link.Value));
                        }
                    }
                }
                break;
            }

            case EntityMode.Name:
            {
                foreach (var entity in m_EntityMgr.Lookup.AllEntities())
                {
                    if (StringMatch(entity.Name, inEntityParams.StringSearch))
                    {
                        m_EntityRefs.Add(EntityRef.FromEntity(entity).WithDescriptor(entity.Name));
                    }
                }
                break;
            }

            case EntityMode.PrefabName:
            {
                foreach (var entity in m_EntityMgr.Lookup.AllEntities())
                {
                    if (StringMatch(entity.Prefab, inEntityParams.StringSearch))
                    {
                        m_EntityRefs.Add(EntityRef.FromEntity(entity).WithDescriptor(entity.Prefab));
                    }
                }
                break;
            }

            case EntityMode.Table:
            {
                // TODO(Beau): Implement
                break;
            }
            }
        }