void infoObservable_HandleNewPokemonLocation(MapPokemon mapPokemon) { Invoke(new MethodInvoker(() => { if (!_pokemonMarks.ContainsKey(mapPokemon.SpawnPointId)) { GMarkerGoogle pokemonMarker; Bitmap pokebitMap = PokeImgManager.GetPokemonMediumImage(mapPokemon.PokemonId); if (pokebitMap != null) { var ImageSize = new System.Drawing.Size(pokebitMap.Width, pokebitMap.Height); pokemonMarker = new GMarkerGoogle(new PointLatLng(mapPokemon.Latitude, mapPokemon.Longitude), pokebitMap) { Offset = new System.Drawing.Point(-ImageSize.Width / 2, -ImageSize.Height / 2) }; } else { pokemonMarker = new GMarkerGoogle(new PointLatLng(mapPokemon.Latitude, mapPokemon.Longitude), GMarkerGoogleType.green_small); } var expriationTime = StringUtils.TimeMStoString(mapPokemon.ExpirationTimestampMs, @"mm\:ss"); Logger.Debug("Expires in: " + expriationTime); var address = LocationUtils.FindAddress(mapPokemon.Latitude, mapPokemon.Longitude); pokemonMarker.ToolTipText = th.TS("{0}\nExpires in: {1}\n{2}\n{3},{4}", new object[] { mapPokemon.PokemonId, expriationTime, address, mapPokemon.Latitude, mapPokemon.Longitude }); pokemonMarker.ToolTip.Font = new Font("Arial", 12, GraphicsUnit.Pixel); pokemonMarker.ToolTipMode = MarkerTooltipMode.OnMouseOver; _pokemonMarks.Add(mapPokemon.SpawnPointId, pokemonMarker); _pokemonOverlay.Markers.Add(pokemonMarker); } })); }
private void InfoObservable_HandleUpdatePokeGym(FortData pokeGym) { Invoke(new MethodInvoker(() => { var bitmap = Properties.MapData.pokegym; var color = Color.Black; switch (pokeGym.OwnedByTeam) { case POGOProtos.Enums.TeamColor.Blue: bitmap = Properties.MapData.pokegym_blue; color = Color.Blue; break; case POGOProtos.Enums.TeamColor.Red: bitmap = Properties.MapData.pokegym_red; color = Color.Red; break; case POGOProtos.Enums.TeamColor.Yellow: bitmap = Properties.MapData.pokegym_yellow; color = Color.Yellow; break; } var level = Logic.Functions.GymsLogic.GetGymLevel(pokeGym.GymPoints); var nextLevel = Logic.Functions.GymsLogic.GetLevelPoints(level + 1); var str = string.Format("Level:{0} ({1}/{2})", level, pokeGym.GymPoints, nextLevel); var pokeGymMaker = new GMarkerGoogle(new PointLatLng(pokeGym.Latitude, pokeGym.Longitude), bitmap); pokeGymMaker.ToolTipText = string.Format("{0}\n{1}, {2}\n{3}\nID: {4}", LocationUtils.FindAddress(pokeGym.Latitude, pokeGym.Longitude), pokeGym.Latitude, pokeGym.Longitude, str, pokeGym.Id); pokeGymMaker.ToolTip.Font = new System.Drawing.Font("Arial", 12, System.Drawing.GraphicsUnit.Pixel); pokeGymMaker.ToolTipMode = MarkerTooltipMode.OnMouseOver; if (_pokeGymsMarks.ContainsKey(pokeGym.Id)) { var markerToDel = _pokeGymsMarks[pokeGym.Id]; if (_pokeGymsOverlay.Markers.Contains(markerToDel)) { _pokeGymsOverlay.Markers.Remove(markerToDel); } _pokeGymsMarks.Remove(pokeGym.Id); } _pokeGymsMarks.Add(pokeGym.Id, pokeGymMaker); _pokeGymsOverlay.Markers.Add(pokeGymMaker); #region Show Guard if (_pokeGymsMarks.ContainsKey(pokeGym.Id + "-Guard")) { var markerToDel = _pokeGymsMarks[pokeGym.Id + "-Guard"]; if (_pokeGymsOverlay.Markers.Contains(markerToDel)) { _pokeGymsOverlay.Markers.Remove(markerToDel); } _pokeGymsMarks.Remove(pokeGym.Id + "-Guard"); } GMarkerGoogle guardPokemonMarker; Bitmap pokebitMap = PokeImgManager.GetPokemonMediumImage(pokeGym.GuardPokemonId); var offsetY = 0; if (pokebitMap != null) { for (int idx = 0; idx < pokebitMap.Width; idx++) { pokebitMap.SetPixel(idx, 0, color); pokebitMap.SetPixel(idx, pokebitMap.Height - 1, color); } for (int idx = 0; idx < pokebitMap.Height; idx++) { pokebitMap.SetPixel(0, idx, color); pokebitMap.SetPixel(pokebitMap.Width - 1, idx, color); } var ImageSize = new System.Drawing.Size(pokebitMap.Width, pokebitMap.Height); guardPokemonMarker = new GMarkerGoogle(new PointLatLng(pokeGym.Latitude, pokeGym.Longitude), pokebitMap); offsetY = 5 - pokebitMap.Height / 2; guardPokemonMarker.Offset = new Point(-bitmap.Width / 2 - 8, offsetY - bitmap.Height); _pokeGymsMarks.Add(pokeGym.Id + "-Guard", guardPokemonMarker); _pokeGymsOverlay.Markers.Add(guardPokemonMarker); } #endregion Show Guard #region Show fighting if (_pokeGymsMarks.ContainsKey(pokeGym.Id + "-Fighting")) { var markerToDel = _pokeGymsMarks[pokeGym.Id + "-Fighting"]; if (_pokeGymsOverlay.Markers.Contains(markerToDel)) { _pokeGymsOverlay.Markers.Remove(markerToDel); } _pokeGymsMarks.Remove(pokeGym.Id + "-Fighting"); } GMarkerGoogle FightingMarker; if (pokeGym.IsInBattle) { for (int idx = 0; idx < pokebitMap.Width; idx++) { pokebitMap.SetPixel(idx, 0, color); pokebitMap.SetPixel(idx, pokebitMap.Height - 1, color); } for (int idx = 0; idx < pokebitMap.Height; idx++) { pokebitMap.SetPixel(0, idx, color); pokebitMap.SetPixel(pokebitMap.Width - 1, idx, color); } FightingMarker = new GMarkerGoogle(new PointLatLng(pokeGym.Latitude, pokeGym.Longitude), GMarkerGoogleType.red_small); if (pokebitMap != null) { FightingMarker.Offset = new Point(-bitmap.Width / 2, 5 - pokebitMap.Height * 2); } _pokeGymsMarks.Add(pokeGym.Id + "-Fighting", FightingMarker); _pokeGymsOverlay.Markers.Add(FightingMarker); } #endregion Show figting })); }
private void InfoObservable_HandleUpdatePokeGym(FortData pokeGym) { Invoke(new MethodInvoker(() => { var bitmap = Properties.MapData.pokegym; var color = Color.Black; switch (pokeGym.OwnedByTeam) { case POGOProtos.Enums.TeamColor.Blue: bitmap = Properties.MapData.pokegym_blue; color = Color.Blue; break; case POGOProtos.Enums.TeamColor.Red: bitmap = Properties.MapData.pokegym_red; color = Color.Red; break; case POGOProtos.Enums.TeamColor.Yellow: bitmap = Properties.MapData.pokegym_yellow; color = Color.Yellow; break; } var str = ""; var pokeGymMaker = new GMarkerGoogle(new PointLatLng(pokeGym.Latitude, pokeGym.Longitude), bitmap); if (pokeGym.RaidInfo != null) { str = string.Format("Raid Info: {0}, level: {1}, starts: {2}, ends: {3}" , pokeGym.RaidInfo.RaidPokemon?.PokemonId , pokeGym.RaidInfo.RaidLevel , StringUtils.TimeMStoString(pokeGym.RaidInfo.RaidBattleMs, @"mm\:ss") , StringUtils.TimeMStoString(pokeGym.RaidInfo.RaidEndMs, @"mm\:ss")); } pokeGymMaker.ToolTipText = string.Format("{0}\n{1}, {2}\n{3}\nID: {4}", LocationUtils.FindAddress(pokeGym.Latitude, pokeGym.Longitude), pokeGym.Latitude, pokeGym.Longitude, str, pokeGym.Id); pokeGymMaker.ToolTip.Font = new System.Drawing.Font("Arial", 12, System.Drawing.GraphicsUnit.Pixel); pokeGymMaker.ToolTipMode = MarkerTooltipMode.OnMouseOver; if (_pokeGymsMarks.ContainsKey(pokeGym.Id)) { var markerToDel = _pokeGymsMarks[pokeGym.Id]; if (_pokeGymsOverlay.Markers.Contains(markerToDel)) { _pokeGymsOverlay.Markers.Remove(markerToDel); } _pokeGymsMarks.Remove(pokeGym.Id); } _pokeGymsMarks.Add(pokeGym.Id, pokeGymMaker); _pokeGymsOverlay.Markers.Add(pokeGymMaker); #region Show Guard if (_pokeGymsMarks.ContainsKey(pokeGym.Id + "-Guard")) { var markerToDel = _pokeGymsMarks[pokeGym.Id + "-Guard"]; if (_pokeGymsOverlay.Markers.Contains(markerToDel)) { _pokeGymsOverlay.Markers.Remove(markerToDel); } _pokeGymsMarks.Remove(pokeGym.Id + "-Guard"); } GMarkerGoogle guardPokemonMarker; var pokeID = pokeGym.GuardPokemonId; if (pokeGym.RaidInfo != null && pokeGym.RaidInfo.RaidPokemon != null) { pokeID = pokeGym.RaidInfo.RaidPokemon.PokemonId; } Bitmap pokebitMap = PokeImgManager.GetPokemonMediumImage(pokeID); var offsetY = 0; if (pokebitMap != null) { for (int idx = 0; idx < pokebitMap.Width; idx++) { pokebitMap.SetPixel(idx, 0, color); pokebitMap.SetPixel(idx, pokebitMap.Height - 1, color); } for (int idx = 0; idx < pokebitMap.Height; idx++) { pokebitMap.SetPixel(0, idx, color); pokebitMap.SetPixel(pokebitMap.Width - 1, idx, color); } var ImageSize = new System.Drawing.Size(pokebitMap.Width, pokebitMap.Height); guardPokemonMarker = new GMarkerGoogle(new PointLatLng(pokeGym.Latitude, pokeGym.Longitude), pokebitMap); offsetY = 5 - pokebitMap.Height / 2; guardPokemonMarker.Offset = new Point(-bitmap.Width / 2 - 8, offsetY - bitmap.Height); _pokeGymsMarks.Add(pokeGym.Id + "-Guard", guardPokemonMarker); _pokeGymsOverlay.Markers.Add(guardPokemonMarker); } #endregion Show Guard #region Show fighting if (_pokeGymsMarks.ContainsKey(pokeGym.Id + "-Fighting")) { var markerToDel = _pokeGymsMarks[pokeGym.Id + "-Fighting"]; if (_pokeGymsOverlay.Markers.Contains(markerToDel)) { _pokeGymsOverlay.Markers.Remove(markerToDel); } _pokeGymsMarks.Remove(pokeGym.Id + "-Fighting"); } GMarkerGoogle FightingMarker; if (pokeGym.IsInBattle) { for (int idx = 0; idx < pokebitMap.Width; idx++) { pokebitMap.SetPixel(idx, 0, color); pokebitMap.SetPixel(idx, pokebitMap.Height - 1, color); } for (int idx = 0; idx < pokebitMap.Height; idx++) { pokebitMap.SetPixel(0, idx, color); pokebitMap.SetPixel(pokebitMap.Width - 1, idx, color); } FightingMarker = new GMarkerGoogle(new PointLatLng(pokeGym.Latitude, pokeGym.Longitude), GMarkerGoogleType.red_small); if (pokebitMap != null) { FightingMarker.Offset = new Point(-bitmap.Width / 2, 5 - pokebitMap.Height * 2); } _pokeGymsMarks.Add(pokeGym.Id + "-Fighting", FightingMarker); _pokeGymsOverlay.Markers.Add(FightingMarker); } #endregion Show figting #region is raid if (_pokeGymsMarks.ContainsKey(pokeGym.Id + "-Raid")) { var markerToDel = _pokeGymsMarks[pokeGym.Id + "-Raid"]; if (_pokeGymsOverlay.Markers.Contains(markerToDel)) { _pokeGymsOverlay.Markers.Remove(markerToDel); } _pokeGymsMarks.Remove(pokeGym.Id + "-Raid"); } GMarkerGoogle RaidMarker; if (pokeGym.RaidInfo != null) { for (int idx = 0; idx < pokebitMap.Width; idx++) { pokebitMap.SetPixel(idx, 0, color); pokebitMap.SetPixel(idx, pokebitMap.Height - 1, color); } for (int idx = 0; idx < pokebitMap.Height; idx++) { pokebitMap.SetPixel(0, idx, color); pokebitMap.SetPixel(pokebitMap.Width - 1, idx, color); } var raidMarkerType = GMarkerGoogleType.pink; if (((int)pokeGym.RaidInfo.RaidLevel >= 3) && ((int)pokeGym.RaidInfo.RaidLevel <= 4)) { raidMarkerType = GMarkerGoogleType.yellow; } if ((int)pokeGym.RaidInfo.RaidLevel >= 5) { raidMarkerType = GMarkerGoogleType.blue; } RaidMarker = new GMarkerGoogle(new PointLatLng(pokeGym.Latitude, pokeGym.Longitude), raidMarkerType); if (pokebitMap != null) { RaidMarker.Offset = new Point(-bitmap.Width / 2, 5 - pokebitMap.Height * 2); } _pokeGymsMarks.Add(pokeGym.Id + "-Raid", RaidMarker); _pokeGymsOverlay.Markers.Add(RaidMarker); } #endregion is raid })); }