private void createImageList() { const int imageSize = 50; var imageList = new ImageList { ImageSize = new Size(imageSize, imageSize) }; foreach (PokemonId pokemon in Enum.GetValues(typeof(PokemonId))) { Bitmap pokemonImage = PokeImgManager.GetPokemonLargeImage(pokemon); if (pokemonImage != null) { imageList.Images.Add(pokemon.ToString(), pokemonImage); } } imageList.Images.Add(PokemonId.Magikarp + "s", PokeImgManager.GetPokemonLargeImage(PokemonId.Magikarp, "s")); imageList.Images.Add(PokemonId.Gyarados + "s", PokeImgManager.GetPokemonLargeImage(PokemonId.Gyarados, "s")); foreach (var element in "abcdefghijklmnopqrstuvwxyz") { imageList.Images.Add(PokemonId.Unown.ToString() + element, PokeImgManager.GetPokemonLargeImage(PokemonId.Unown, "" + element)); } imageList.Images.Add(PokemonId.Pikachu + Costume.Anniversary.ToString().ToLower(), PokeImgManager.GetPokemonLargeImage(PokemonId.Pikachu, Costume.Anniversary.ToString().ToLower())); imageList.Images.Add(PokemonId.Pikachu + Costume.Holiday2016.ToString().ToLower(), PokeImgManager.GetPokemonLargeImage(PokemonId.Pikachu, Costume.Holiday2016.ToString().ToLower())); imageList.Images.Add(PokemonId.Pikachu + Costume.OneYearAnniversary.ToString().ToLower(), PokeImgManager.GetPokemonLargeImage(PokemonId.Pikachu, Costume.OneYearAnniversary.ToString().ToLower())); imageList.Images.Add(PokemonId.Raichu + Costume.Anniversary.ToString().ToLower(), PokeImgManager.GetPokemonLargeImage(PokemonId.Raichu, Costume.Anniversary.ToString().ToLower())); imageList.Images.Add(PokemonId.Raichu + Costume.Holiday2016.ToString().ToLower(), PokeImgManager.GetPokemonLargeImage(PokemonId.Raichu, Costume.Holiday2016.ToString().ToLower())); imageList.Images.Add(PokemonId.Raichu + Costume.OneYearAnniversary.ToString().ToLower(), PokeImgManager.GetPokemonLargeImage(PokemonId.Raichu, Costume.OneYearAnniversary.ToString().ToLower())); PokemonListView.SmallImageList = imageList; PokemonListView.LargeImageList = imageList; }
void comboBox1_SelectedValueChanged(object sender, EventArgs e) { var pokeId = PokemonId.Missingno; Enum.TryParse <PokemonId>(comboBox1.SelectedValue.ToString(), out pokeId); var pokemonImage = PokeImgManager.GetPokemonLargeImage(pokeId); PokemonImage.Image = pokemonImage; }
/// <summary> /// Gets the image for buddy. /// </summary> /// <param name="buddyPokemon">The buddy pokemon.</param> /// <returns></returns> private Image getImageForBuddy(BuddyPokemon buddyPokemon) { if (pokemons == null) { return(null); } if (buddyPokemon == null || buddyPokemon.ToString() == "{ }") { return(null); } else { var buddyPoke = pokemons.FirstOrDefault(x => x.Id == buddyPokemon.Id); return(buddyPoke != null?PokeImgManager.GetPokemonImagefromResource(buddyPoke.PokemonId, "200") : null); } }
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 })); }