diff --git a/WatchFace.Parser/Elements/WeatherElements/CustomWeatherIcon.cs b/WatchFace.Parser/Elements/WeatherElements/CustomWeatherIcon.cs new file mode 100644 index 0000000..21552bf --- /dev/null +++ b/WatchFace.Parser/Elements/WeatherElements/CustomWeatherIcon.cs @@ -0,0 +1,21 @@ +using WatchFace.Parser.Attributes; + +namespace WatchFace.Parser.Elements.WeatherElements +{ + public class CustomWeatherIcon + { + [ParameterId(1)] + public long X { get; set; } + + [ParameterId(2)] + public long Y { get; set; } + + [ParameterId(3)] + [ParameterImageIndex] + public long ImageIndex { get; set; } + + [ParameterId(4)] + [ParameterImagesCount] + public long ImagesCount { get; set; } + } +} \ No newline at end of file diff --git a/WatchFace.Parser/Elements/WeatherElements/WeatherIcon.cs b/WatchFace.Parser/Elements/WeatherElements/WeatherIcon.cs index e9bb096..9f8ad36 100644 --- a/WatchFace.Parser/Elements/WeatherElements/WeatherIcon.cs +++ b/WatchFace.Parser/Elements/WeatherElements/WeatherIcon.cs @@ -10,7 +10,8 @@ namespace WatchFace.Parser.Elements.WeatherElements [ParameterId(1)] public Coordinates Coordinates { get; set; } - // TODO: Looks like here should be Id 2 also + [ParameterId(2)] + public CustomWeatherIcon CustomIcon { get; set; } [ParameterId(3)] public Coordinates CoordinatesAlt { get; set; } diff --git a/WatchFace.Parser/Models/Elements/Weather/WeatherIconsElement.cs b/WatchFace.Parser/Models/Elements/Weather/WeatherIconsElement.cs index 649c407..697c1a3 100644 --- a/WatchFace.Parser/Models/Elements/Weather/WeatherIconsElement.cs +++ b/WatchFace.Parser/Models/Elements/Weather/WeatherIconsElement.cs @@ -10,6 +10,7 @@ namespace WatchFace.Parser.Models.Elements base(parameter, parent, name) { } public CoordinatesElement Current { get; set; } + public ImageSetElement CustomIcon { get; set; } public CoordinatesElement CurrentAlt { get; set; } public CoordinatesElement Unknown4 { get; set; } @@ -18,7 +19,11 @@ namespace WatchFace.Parser.Models.Elements var useAltCoordinates = CurrentAlt != null && state.CurrentTemperature == null; var iconCoordinates = useAltCoordinates ? CurrentAlt : Current; - drawer.DrawImage(LoadWeatherImage(state.CurrentWeather), iconCoordinates.X, iconCoordinates.Y); + if (iconCoordinates != null) + drawer.DrawImage(LoadWeatherImage(state.CurrentWeather), iconCoordinates.X, iconCoordinates.Y); + + if (CustomIcon != null) + drawer.DrawImage(resources[CustomIcon.ImageIndex + 1], CustomIcon.X, CustomIcon.Y); } private static Bitmap LoadWeatherImage(WeatherCondition weather) @@ -35,6 +40,9 @@ namespace WatchFace.Parser.Models.Elements case 1: Current = new CoordinatesElement(parameter, this); return Current; + case 2: + CustomIcon = new ImageSetElement(parameter, this); + return CustomIcon; case 3: CurrentAlt = new CoordinatesElement(parameter, this); return CurrentAlt; diff --git a/WatchFace.Parser/WatchFace.Parser.csproj b/WatchFace.Parser/WatchFace.Parser.csproj index 7dd4efe..91ff268 100644 --- a/WatchFace.Parser/WatchFace.Parser.csproj +++ b/WatchFace.Parser/WatchFace.Parser.csproj @@ -73,6 +73,7 @@ +