Exemple #1
0
        private void CreateMarkers()
        {
            for (int i = 0; i < LocationDatabase.pointsOfInterestCount; i++)
            {
                PointOfInterestGroup pointOfInterestGroup = LocationDatabase.GetPointOfInterestGroup(i);

                for (int j = 0; j < pointOfInterestGroup.placeCollectionCount; j++)
                {
                    PlaceCollection placeCollection = pointOfInterestGroup.GetPlaceCollection(j);
                    if (placeCollection == null)
                    {
                        continue;
                    }

                    bool hasRooms = placeCollection.hasRooms;

                    Place place = placeCollection.GetPlace();
                    CreateMarker(place.thumbnail, place.displayedName, place.mapName, place.displayPosition, (hasRooms ? placeViewingBounds : ViewingBounds.Default), true, 1, 0);
                    // CreateMarker(place.thumbnail, place.displayedName, place.mapName, place.displayPosition, ViewingBounds.Default, 0);

                    if (!hasRooms)
                    {
                        continue;
                    }

                    int highestFloor = placeCollection.highestFloorLevel;

                    for (int k = 0; k < placeCollection.roomCount; k++)
                    {
                        Room room = placeCollection.GetRoom(k);
                        CreateMarker(null, room.displayedName, room.mapName, room.displayPosition, roomViewingBounds, true, highestFloor, room.floor);
                    }
                }
            }
        }
        private void ShallowSearch(string keyword, SearchCategory category, int primaryIndex, List <SearchKey> searchKeys)
        {
            if (category == SearchCategory.MainTag)
            {
                if ((' ' + m_pointOfInterest.tags.ToLower()).Contains(' ' + keyword + ';'))
                {
                    AddAllKeys(primaryIndex, searchKeys);
                }
            }
            else
            {
                if (category == SearchCategory.Name && !m_names.Contains(keyword))
                {
                    return;
                }
                else if (category == SearchCategory.SubTag && !m_tags.Contains(' ' + keyword + ';'))
                {
                    return;
                }

                string target = "";
                string key    = "";

                for (int secondaryIndex = 0; secondaryIndex < places.Count; secondaryIndex++)
                {
                    PlaceCollection place = places[secondaryIndex];
                    for (int tertiaryIndex = 0; tertiaryIndex < place.count; tertiaryIndex++)
                    {
                        Location location = place.GetLocation(tertiaryIndex);

                        if (location.isHidden)
                        {
                            continue;
                        }

                        GetTargetAndKeyFromLocationByCategory(location, category, keyword, ref target, ref key);

                        if (target.Contains(key))
                        {
                            SearchKey item = StrengthenSearchKey(primaryIndex, secondaryIndex, tertiaryIndex, searchKeys);
                            if (category == SearchCategory.Name)
                            {
                                char        firstLetter = keyword.ToCharArray()[0];
                                List <char> characters  = new List <char>(target.ToCharArray());
                                int         index       = characters.IndexOf(firstLetter) - 1;

                                if (index > item.nearestPoint)
                                {
                                    item.nearestPoint = index;
                                }
                            }
                        }
                    }
                }
            }
        }
        private void AddAllKeys(int primaryIndex, List <SearchKey> searchKeys)
        {
            for (int secondaryIndex = 0; secondaryIndex < places.Count; secondaryIndex++)
            {
                PlaceCollection place = places[secondaryIndex];

                for (int tertiaryIndex = 0; tertiaryIndex < place.count; tertiaryIndex++)
                {
                    StrengthenSearchKey(primaryIndex, secondaryIndex, tertiaryIndex, searchKeys);
                }
            }
        }