示例#1
0
        public WorldMapLocation(
            MobileReference reference,
            float radius,
            string name,
            string properName,
            string alternateName,
            bool visited,
            bool markedForTriangulation,
            string iconName,
            Color32 iconColor,
            MapIconStyle iconStyle,
            MapLabelStyle labelStyle,
            Vector3 iconOffset,
            Vector3 chunkPosition,
            bool isNew,
            bool isMarked,
            List <string> typesToDisplay)
        {
            Reference              = reference;
            Radius                 = radius;
            Name                   = name;
            mLowerName             = Name.ToLower();
            ProperName             = properName;
            AlternateName          = alternateName;
            Visited                = visited;
            MarkedForTriangulation = markedForTriangulation;
            IconName               = iconName;
            IconColor              = iconColor;
            IconStyle              = iconStyle;
            LabelStyle             = labelStyle;
            ChunkPosition          = chunkPosition;
            if (LabelStyle == MapLabelStyle.Descriptive)
            {
                LabelColor = Colors.Get.WorldMapLabelDescriptiveColor;
            }
            else
            {
                LabelColor = Colors.Get.WorldMapLabelColor;
            }

            //Debug.Log ("Icon name: " + IconName);

            Label          = null;
            Icon           = null;
            LabelTransform = null;
            IconTransform  = null;
            LabelPosition  = Vector3.zero;
            IconPosition   = Vector3.zero;
            IconOffset     = iconOffset;
            LabelScale     = 1f;
            IconScale      = 1f;
            IconAlpha      = 1f;
            IsNew          = isNew;
            IsMarked       = isMarked;
            Display        = typesToDisplay.Contains(IconName) || (reference == null);

            switch (IconStyle)
            {
            case MapIconStyle.AlwaysVisible:
                IconScale  = 250f;
                LabelScale = 1.1f;
                break;

            case MapIconStyle.Large:
            case MapIconStyle.Medium:
            case MapIconStyle.Small:
            case MapIconStyle.None:
            default:
                IconScale  = 75f;
                LabelScale = 1f;
                break;
            }
            //LabelPosition = Vector3.up * IconScale;
        }
示例#2
0
        //searches chunks and loads location data into the locationData list
        //only searches for locations added using the SetMapData function
        public IEnumerator LocationsForChunks(string chunkName, int chunkID, Queue <WorldMapLocation> locationData, List <MapMarker> activeMapMarkers)
        {               //Debug.Log ("WorldMap: LocationsForChunks");
            List <MobileReference> locationList = null;

            if (!mRevealableToShow.TryGetValue(chunkName, out locationList))
            {
                //Debug.Log ("WorldMap: We have no locations for this chunk from SetMapData, returning immediately");
                yield break;
            }
            Vector3 chunkPosition;

            //add markers
            for (int i = 0; i < activeMapMarkers.Count; i++)
            {
                if (activeMapMarkers [i].ChunkID == chunkID)
                {
                    chunkPosition = activeMapMarkers [i].ChunkPosition;
                    WorldMapLocation wml = new WorldMapLocation(
                        null,
                        1,
                        "Marker",
                        string.Empty,
                        string.Empty,
                        true,
                        false,
                        "MapIconMapMarker",
                        Color.white,
                        MapIconStyle.Medium,
                        MapLabelStyle.None,
                        Vector3.zero,
                        chunkPosition,
                        false,
                        false,
                        LocationTypesToDisplay);
                    locationData.Enqueue(wml);
                }
            }

            MobileReference currentLocation = null;

            for (int i = 0; i < locationList.Count; i++)
            {
                if (!LoadData)
                {
                    //Debug.Log ("WorldMap: Load data is false, returning");
                    yield break;
                }
                currentLocation = locationList [i];
                StackItem stackItem = null;
                if (WIGroups.LoadStackItem(currentLocation, out stackItem))
                {
                    chunkPosition = stackItem.ChunkPosition;
                    //Debug.Log ("WorldMap: found stack item " + stackItem.DisplayName);
                    //next we need to get the location state from the stack item
                    LocationState   ls            = null;
                    RevealableState rs            = null;
                    VisitableState  vs            = null;
                    bool            isNewLocation = false;
                    bool            isMarked      = false;
                    if (NewLocations.Count > 0)
                    {
                        for (int j = NewLocations.LastIndex(); j >= 0; j--)
                        {
                            if (NewLocations [j] == currentLocation)
                            {
                                NewLocations.RemoveAt(j);
                                isNewLocation = true;
                                break;
                            }
                        }
                    }
                    //Debug.Log ("current location " + currentLocation.FullPath + " is marked? " + isMarked.ToString ( ));
                    isMarked = MarkedLocations.Contains(currentLocation);

                    if (stackItem.GetStateData <RevealableState> (out rs))
                    {
                        stackItem.GetStateData <LocationState> (out ls);
                        stackItem.GetStateData <VisitableState> (out vs);
                        //now convert it into a world map location
                        WorldMapLocation wml = null;
                        if (rs.CustomMapSettings || ls == null)
                        {
                            //non-custom settings come from the location
                            //so we can only use custom settings if ls is not null
                            //Debug.Log ("Custom settings for revealable with " + rs.IconName + " icon name");
                            wml = new WorldMapLocation(
                                currentLocation,
                                stackItem.Props.Local.ActiveRadius,
                                ls != null ? ls.Name.CommonName : string.Empty,
                                ls != null ? ls.Name.ProperName : string.Empty,
                                ls != null ? ls.Name.NickName : string.Empty,
                                vs != null ? vs.HasBeenVisited : true,
                                rs.MarkedForTriangulation,
                                rs.IconName,
                                rs.IconColor,
                                rs.IconStyle,
                                rs.LabelStyle,
                                rs.IconOffset,
                                chunkPosition,
                                isNewLocation,
                                isMarked,
                                LocationTypesToDisplay);
                            locationData.Enqueue(wml);
                        }
                        else
                        {
                            string        iconName   = "Outpost";
                            MapIconStyle  iconStyle  = MapIconStyle.None;
                            MapLabelStyle labelStyle = MapLabelStyle.None;
                            Color32       iconColor  = Color.gray;
                            Vector3       iconOffset = Vector3.zero;

                            GetIconProperties(stackItem, ls, rs, vs, ref iconName, ref iconStyle, ref labelStyle, ref iconColor, ref iconOffset);

                            wml = new WorldMapLocation(
                                currentLocation,
                                stackItem.Props.Local.ActiveRadius,
                                ls != null ? ls.Name.CommonName : string.Empty,
                                ls != null ? ls.Name.ProperName : string.Empty,
                                ls != null ? ls.Name.NickName : string.Empty,
                                vs != null ? vs.HasBeenVisited : true,
                                rs.MarkedForTriangulation,
                                iconName,
                                iconColor,
                                iconStyle,
                                labelStyle,
                                iconOffset,
                                chunkPosition,
                                isNewLocation,
                                isMarked,
                                LocationTypesToDisplay);
                            locationData.Enqueue(wml);
                        }
                    }
                    else
                    {
                        //Debug.Log ("Didn't get revealable state data in " + currentLocation.FileName);
                    }
                }
                else
                {
                    //Debug.Log ("Didin't get stack item for location " + currentLocation.FullPath);
                }
                //clear the stack item, we don't need it any more
                if (stackItem != null)
                {
                    stackItem.Clear();
                }
                yield return(null);
            }
            locationList.Clear();
            yield break;
        }
示例#3
0
        public static string GetIconProperties(
            StackItem stackitem,
            LocationState ls,
            RevealableState rs,
            VisitableState vs,
            ref string iconName,
            ref MapIconStyle iconStyle,
            ref MapLabelStyle labelStyle,
            ref Color32 iconColor,
            ref Vector3 iconOffset)
        {
            iconName   = "MapIconOutpost";
            iconStyle  = MapIconStyle.Small;
            labelStyle = MapLabelStyle.None;
            iconColor  = Color.grey;
            bool checkShingleState   = false;
            bool checkStructureState = false;

            switch (ls.Type)
            {
            case "City":
                if (stackitem.Props.Local.ActiveRadius > Globals.CityMinimumRadius)
                {
                    iconName   = "MapIconCity";
                    iconStyle  = MapIconStyle.Large;
                    labelStyle = MapLabelStyle.MouseOver;
                }
                else if (stackitem.Props.Local.ActiveRadius > Globals.TownMinimumRadius)
                {
                    iconStyle  = MapIconStyle.Medium;
                    iconName   = "MapIconTown";
                    labelStyle = MapLabelStyle.MouseOver;
                }
                else
                {
                    iconName   = "MapIconOutpost";
                    iconStyle  = MapIconStyle.Small;
                    labelStyle = MapLabelStyle.MouseOver;
                }
                break;

            case "CapitalCity":
                iconName   = "MapIconCapitalCity";
                iconStyle  = MapIconStyle.AlwaysVisible;
                labelStyle = MapLabelStyle.AlwaysVisible;
                break;

            case "Woods":
                iconName   = "MapIconWoods";
                iconStyle  = MapIconStyle.Large;
                labelStyle = MapLabelStyle.MouseOver;
                break;

            case "Den":
                iconName   = "MapIconAnimalDen";
                iconStyle  = MapIconStyle.Medium;
                labelStyle = MapLabelStyle.MouseOver;
                break;

            case "CrossRoads":
                iconName   = "MapIconCrossRoads";
                iconStyle  = MapIconStyle.AlwaysVisible;
                labelStyle = MapLabelStyle.MouseOver;
                break;

            case "WayStone":
                iconName   = "MapIconWayStone";
                iconStyle  = MapIconStyle.Small;
                labelStyle = MapLabelStyle.MouseOver;
                break;

            case "Shingle":
            case "Residence":
                iconName            = "MapIconStructure";
                iconStyle           = MapIconStyle.Small;
                labelStyle          = MapLabelStyle.MouseOver;
                checkShingleState   = true;
                checkStructureState = true;
                break;

            case "Shop":
                iconName            = "MapIconShop";
                iconStyle           = MapIconStyle.Small;
                labelStyle          = MapLabelStyle.MouseOver;
                checkShingleState   = true;
                checkStructureState = true;
                break;

            case "Tavern":
            case "Bar":
                iconName            = "MapIconTavern";
                iconStyle           = MapIconStyle.Small;
                labelStyle          = MapLabelStyle.MouseOver;
                checkShingleState   = true;
                checkStructureState = true;
                break;

            case "Inn":
                iconName            = "MapIconInn";
                iconStyle           = MapIconStyle.Small;
                labelStyle          = MapLabelStyle.MouseOver;
                checkShingleState   = true;
                checkStructureState = true;
                break;

            case "Landmark":
                iconName   = "MapIconLandmark";
                iconStyle  = MapIconStyle.AlwaysVisible;
                labelStyle = MapLabelStyle.MouseOver;
                break;

            case "HouseOfHealing":
                iconName   = "MapIconHouseOfHealing";
                iconStyle  = MapIconStyle.Large;
                labelStyle = MapLabelStyle.MouseOver;
                break;

            case "Gateway":
                iconName   = "MapIconGateway";
                iconStyle  = MapIconStyle.Large;
                labelStyle = MapLabelStyle.MouseOver;
                break;

            case "Cemetary":
                iconName   = "MapIconCemetary";
                iconStyle  = MapIconStyle.Medium;
                labelStyle = MapLabelStyle.MouseOver;
                break;

            case "Dungeon":
                iconName   = "MapIconCave";
                iconStyle  = MapIconStyle.Medium;
                labelStyle = MapLabelStyle.MouseOver;
                break;

            case "Campsite":
                iconName   = "MapIconCampsite";
                iconStyle  = MapIconStyle.Medium;
                labelStyle = MapLabelStyle.MouseOver;
                break;

            case "District":
            case "CrossStreet":
            default:
                iconStyle  = MapIconStyle.None;
                labelStyle = MapLabelStyle.Descriptive;
                break;
            }

            if (checkStructureState)
            {
                StructureState ss = null;
                if (stackitem.GetStateData <StructureState> (out ss))
                {
                    iconOffset.x      = -ss.PrimaryBuilderOffset.Position.x;
                    iconOffset.y      = -ss.PrimaryBuilderOffset.Position.z;
                    checkShingleState = true;
                }
            }

            if (checkShingleState)
            {
                ShingleState sh = null;
                if (stackitem.GetStateData <ShingleState> (out sh))
                {
                    switch (sh.PropertyStatus)
                    {
                    case PropertyStatusType.OwnedByPlayer:
                        labelStyle = MapLabelStyle.AlwaysVisible;
                        iconColor  = Colors.Get.MessageSuccessColor;
                        break;

                    case PropertyStatusType.ForSale:
                        iconColor = Colors.Get.MessageInfoColor;
                        break;

                    case PropertyStatusType.Destroyed:
                        iconColor = Colors.Get.MessageDangerColor;
                        break;

                    case PropertyStatusType.Abandoned:
                        iconColor = Colors.Get.MessageWarningColor;
                        break;

                    default:
                        break;
                    }
                }
            }

            if (rs.UnknownUntilVisited)
            {
                if (vs == null || vs.NumTimesVisited <= 0)
                {
                    iconName = "MapIconUnknown";
                }
            }
            return(iconName);
        }