public EventPushpin(EventDetails ev) : base() { if (!string.IsNullOrWhiteSpace(ev.Name)) { ToolTip = string.Format("{0}{1} ({2})", ((ev.FlagsEnum & EventFlagType.GroupEvent) == EventFlagType.GroupEvent ? "[Group Event] " : string.Empty), ev.Name, ev.Level); PopupContent = new PopupContentFactory() .AppendWikiLink(ev.Name) .Content; } if (ev.FlagsEnum == EventFlagType.None) { m_PreparationImage = IMAGES[EventFlagType.None][0]; m_ActiveImage = IMAGES[EventFlagType.None][1]; } else if ((ev.FlagsEnum & EventFlagType.GroupEvent) == EventFlagType.GroupEvent) { m_PreparationImage = IMAGES[EventFlagType.GroupEvent][0]; m_ActiveImage = IMAGES[EventFlagType.GroupEvent][1]; } SetEventState(EventStateType.Invalid); }
public EventMapPolygon(EventDetails ev, bool hasChampion = false) { Locations = new LocationCollection(); Opacity = 0.5; StrokeThickness = 2; if (hasChampion) { Fill = Brushes.Blue; Stroke = Brushes.DarkBlue; } else { Fill = Brushes.Red; Stroke = Brushes.Maroon; } SetEventState(EventStateType.Invalid); }
public void LoadEvent(Guid eid, EventDetails ev, FloorMapDetails map, bool isChampion) { int mid = ev.MapId; if (!m_MapLayers.ContainsKey(mid)) { m_MapLayers.Add(mid, new MapLayer()); } if (!m_MapEvents.ContainsKey(mid)) { m_MapEvents.Add(mid, new MapLayer()); // we insert instead of add so events always show up under other pushpins m_MapLayers[mid].Children.Insert(0, m_MapEvents[mid]); } if (!m_MapEventPolygons.ContainsKey(mid)) { m_MapEventPolygons.Add(mid, new MapLayer()); // we insert instead of add so events always show up under other pushpins m_MapLayers[mid].Children.Insert(0, m_MapEventPolygons[mid]); } // clean up if (m_EventMapPolygons.ContainsKey(eid)) { m_MapEvents[mid].Children.Remove(m_EventMapPolygons[eid]); m_EventMapPolygons.Remove(eid); } if (m_EventPushpins.ContainsKey(eid)) { m_MapEvents[mid].Children.Remove(m_EventPushpins[eid]); m_EventPushpins.Remove(eid); } Point center = new Point(ArenaNetMap.TranslateX(ev.Location.Center[0], map.MapRect, map.ContinentRect), ArenaNetMap.TranslateZ(ev.Location.Center[1], map.MapRect, map.ContinentRect)); switch (ev.Location.TypeEnum) { case LocationType.Poly: EventMapPolygon evPoly = new EventMapPolygon(ev, isChampion); foreach (List<double> pt in ev.Location.Points) { evPoly.Locations.Add( ArenaNetMap.Unproject( new Point( ArenaNetMap.TranslateX(pt[0], map.MapRect, map.ContinentRect), ArenaNetMap.TranslateZ(pt[1], map.MapRect, map.ContinentRect)), ArenaNetMap.MaxZoomLevel)); } m_EventMapPolygons[eid] = evPoly; // insert so polys are below all pushpins m_MapEventPolygons[mid].Children.Insert(0, evPoly); break; case LocationType.Sphere: case LocationType.Cylinder: EventMapPolygon evCircle = new EventMapPolygon(ev, isChampion); double radius = ArenaNetMap.TranslateX(ev.Location.Center[0] + ev.Location.Radius, map.MapRect, map.ContinentRect) - center.X; for (int i = 0; i < 360; i += 10) { evCircle.Locations.Add( ArenaNetMap.Unproject( new Point( center.X + radius * Math.Cos(i * (Math.PI / 180)), center.Y + radius * Math.Sin(i * (Math.PI / 180))), ArenaNetMap.MaxZoomLevel)); } m_EventMapPolygons[eid] = evCircle; // insert so polys are below all pushpins m_MapEventPolygons[ev.MapId].Children.Insert(0, evCircle); break; default: break; } EventPushpin evPin = new EventPushpin(ev); evPin.Location = ArenaNetMap.Unproject(center, ArenaNetMap.MaxZoomLevel); m_EventPushpins[eid] = evPin; m_MapEvents[ev.MapId].Children.Add(evPin); }