Skip to content
This repository was archived by the owner on Aug 17, 2020. It is now read-only.

Commit 40b4390

Browse files
authored
Merge pull request #36 from JFouts/master
Turn Pokestops Purple when used, #26
2 parents a1870f7 + 197dc71 commit 40b4390

5 files changed

Lines changed: 24 additions & 1 deletion

File tree

PokemonGo-UWP/App.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<utils:PokemonDataToVisibilityConverter x:Key="PokemonDataToVisibilityConverter" />
2727
<utils:ItemAwardToPokemonSpriteConverter x:Key="ItemAwardToPokemonSpriteConverter" />
2828
<utils:NearbyPokemonDistanceToDistanceImageConverter x:Key="NearbyPokemonDistanceToDistanceImageConverter" />
29+
<utils:PokestopToIconConverter x:Key="PokestopToIconConverter" />
2930

3031
</ResourceDictionary>
3132
</Application.Resources>
11.9 KB
Loading

PokemonGo-UWP/PokemonGo-UWP.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121
<Content Include="Assets\Icons\Footprint_Near.png" />
122122
<Content Include="Assets\Icons\FrontPortraitRing.png" />
123123
<Content Include="Assets\Icons\pokestop_near.png" />
124+
<Content Include="Assets\Icons\pokestop_near_inactive.png" />
124125
<Content Include="Assets\Icons\stardust_painted.png" />
125126
<Content Include="Assets\Icons\stardust_vector.png" />
126127
<Content Include="Assets\Items\Egg.png" />

PokemonGo-UWP/Utils/Converters.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using AllEnum;
99
using Google.Protobuf.Collections;
1010
using PokemonGo.RocketAPI.GeneratedCode;
11+
using PokemonGo.RocketAPI.Extensions;
1112

1213
namespace PokemonGo_UWP.Utils
1314
{
@@ -227,6 +228,26 @@ public object ConvertBack(object value, Type targetType, object parameter, strin
227228
#endregion
228229
}
229230

231+
public class PokestopToIconConverter : IValueConverter
232+
{
233+
#region Implementation of IValueConverter
234+
235+
public object Convert(object value, Type targetType, object parameter, string language)
236+
{
237+
var cooldown = (long)value;
238+
var inactve = "_inactive";
239+
if (cooldown < DateTime.UtcNow.ToUnixTime()) inactve = "";
240+
return new Uri($"ms-appx:///Assets/Icons/pokestop_near{inactve}.png");
241+
}
242+
243+
public object ConvertBack(object value, Type targetType, object parameter, string language)
244+
{
245+
return value;
246+
}
247+
248+
#endregion
249+
}
250+
230251
public class EmptyConverter : IValueConverter
231252
{
232253
#region Implementation of IValueConverter

PokemonGo-UWP/Views/GameMapPage.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
<Button Style="{ThemeResource ImageButtonStyle}"
140140
CommandParameter="{Binding}"
141141
Command="{Binding TrySearchPokestop, Source={Binding GameManagerViewModel, Source={StaticResource Locator}}}">
142-
<Image Source="../Assets/Icons/pokestop_near.png"
142+
<Image Source="{Binding CooldownCompleteTimestampMs, Converter={StaticResource PokestopToIconConverter}}"
143143
maps:MapControl.Location="{Binding Converter={StaticResource MapObjectToGeopointConverter}, ConverterParameter=pokestop}"
144144
maps:MapControl.NormalizedAnchorPoint="0,1"
145145
Stretch="Uniform"

0 commit comments

Comments
 (0)