Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show winter related background for Wintersday #479

Merged
merged 2 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions Daybreak/Controls/SnowfallOverlay.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Daybreak.Controls"
xmlns:effects="clr-namespace:System.Windows.Media.Extensions.Effects;assembly=WpfExtended"
xmlns:converters="clr-namespace:Daybreak.Converters"
mc:Ignorable="d"
Loaded="UserControl_Loaded"
Unloaded="UserControl_Unloaded"
x:Name="_this"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<converters:DoubleMultiplierConverter x:Key="FallMultiplier1" Multiplier="0.2"/>
<converters:DoubleMultiplierConverter x:Key="FallMultiplier2" Multiplier="0.18"/>
<converters:DoubleMultiplierConverter x:Key="FallMultiplier3" Multiplier="0.15"/>
<converters:DoubleMultiplierConverter x:Key="FallMultiplier4" Multiplier="0.13"/>
<converters:DoubleMultiplierConverter x:Key="FallMultiplier5" Multiplier="0.1"/>
</UserControl.Resources>
<UserControl.Effect>
<BlurEffect
KernelType="Box"
Expand All @@ -22,7 +30,7 @@
<DoubleAnimation Storyboard.TargetName="_this"
Storyboard.TargetProperty="Time"
From="0"
To="200"
To="1000"
Duration="0:30:0"
RepeatBehavior="Forever"/>
</Storyboard>
Expand All @@ -39,7 +47,9 @@
<ImageBrush.RelativeTransform>
<TransformGroup>
<ScaleTransform ScaleX="{Binding ElementName=_this, Path=FlakeSize1, Mode=OneWay}" ScaleY="{Binding ElementName=_this, Path=FlakeSize1, Mode=OneWay}" />
<TranslateTransform x:Name="SnowfallTransform1" X="0" Y="{Binding ElementName=_this, Path=Time, Mode=OneWay}" />
<TranslateTransform x:Name="SnowfallTransform1"
X="0"
Y="{Binding ElementName=_this, Path=Time, Mode=OneWay, Converter={StaticResource FallMultiplier1}}" />
</TransformGroup>
</ImageBrush.RelativeTransform>
</ImageBrush>
Expand All @@ -54,7 +64,9 @@
<ImageBrush.RelativeTransform>
<TransformGroup>
<ScaleTransform ScaleX="{Binding ElementName=_this, Path=FlakeSize2, Mode=OneWay}" ScaleY="{Binding ElementName=_this, Path=FlakeSize2, Mode=OneWay}" />
<TranslateTransform x:Name="SnowfallTransform2" X="0" Y="{Binding ElementName=_this, Path=Time, Mode=OneWay}" />
<TranslateTransform x:Name="SnowfallTransform2"
X="0"
Y="{Binding ElementName=_this, Path=Time, Mode=OneWay, Converter={StaticResource FallMultiplier2}}" />
</TransformGroup>
</ImageBrush.RelativeTransform>
</ImageBrush>
Expand All @@ -69,7 +81,9 @@
<ImageBrush.RelativeTransform>
<TransformGroup>
<ScaleTransform ScaleX="{Binding ElementName=_this, Path=FlakeSize3, Mode=OneWay}" ScaleY="{Binding ElementName=_this, Path=FlakeSize3, Mode=OneWay}" />
<TranslateTransform x:Name="SnowfallTransform3" X="0" Y="{Binding ElementName=_this, Path=Time, Mode=OneWay}" />
<TranslateTransform x:Name="SnowfallTransform3"
X="0"
Y="{Binding ElementName=_this, Path=Time, Mode=OneWay, Converter={StaticResource FallMultiplier3}}" />
</TransformGroup>
</ImageBrush.RelativeTransform>
</ImageBrush>
Expand All @@ -84,7 +98,9 @@
<ImageBrush.RelativeTransform>
<TransformGroup>
<ScaleTransform ScaleX="{Binding ElementName=_this, Path=FlakeSize4, Mode=OneWay}" ScaleY="{Binding ElementName=_this, Path=FlakeSize4, Mode=OneWay}" />
<TranslateTransform x:Name="SnowfallTransform4" X="0" Y="{Binding ElementName=_this, Path=Time, Mode=OneWay}" />
<TranslateTransform x:Name="SnowfallTransform4"
X="0"
Y="{Binding ElementName=_this, Path=Time, Mode=OneWay, Converter={StaticResource FallMultiplier4}}" />
</TransformGroup>
</ImageBrush.RelativeTransform>
</ImageBrush>
Expand All @@ -99,7 +115,9 @@
<ImageBrush.RelativeTransform>
<TransformGroup>
<ScaleTransform ScaleX="{Binding ElementName=_this, Path=FlakeSize5, Mode=OneWay}" ScaleY="{Binding ElementName=_this, Path=FlakeSize5, Mode=OneWay}" />
<TranslateTransform x:Name="SnowfallTransform5" X="0" Y="{Binding ElementName=_this, Path=Time, Mode=OneWay}" />
<TranslateTransform x:Name="SnowfallTransform5"
X="0"
Y="{Binding ElementName=_this, Path=Time, Mode=OneWay, Converter={StaticResource FallMultiplier5}}" />
</TransformGroup>
</ImageBrush.RelativeTransform>
</ImageBrush>
Expand Down
3 changes: 2 additions & 1 deletion Daybreak/Controls/SnowfallOverlay.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public partial class SnowfallOverlay : UserControl
private double flakeSize4;
[GenerateDependencyProperty]
private double flakeSize5;

[GenerateDependencyProperty]
private double time;

Expand Down Expand Up @@ -111,7 +112,7 @@ private double GetNoise(double source)
{
var f = Frequencies[i];
var a = Amplitudes[i];
returnValue += a * Math.Sin(f * source * Math.PI * 2);
returnValue += a * Math.Sin(f * source * Math.PI);
}

return returnValue / Divisor;
Expand Down
24 changes: 24 additions & 0 deletions Daybreak/Converters/DoubleMultiplierConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Globalization;
using System.Windows.Data;

namespace Daybreak.Converters;
public sealed class DoubleMultiplierConverter : IValueConverter
{
public double Multiplier { get; set; }

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is not double d)
{
return value;
}

return d * this.Multiplier;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
2 changes: 1 addition & 1 deletion Daybreak/Daybreak.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<LangVersion>preview</LangVersion>
<ApplicationIcon>Daybreak.ico</ApplicationIcon>
<IncludePackageReferencesDuringMarkupCompilation>true</IncludePackageReferencesDuringMarkupCompilation>
<Version>0.9.8.146</Version>
<Version>0.9.8.147</Version>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<UserSecretsId>cfb2a489-db80-448d-a969-80270f314c46</UserSecretsId>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
Expand Down
20 changes: 10 additions & 10 deletions Daybreak/Launch/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@
<controls:SnowfallOverlay
Visibility="{Binding ElementName=_this, Path=WintersdayMode, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}"
Opacity="0.4"
BaseWind1="0.00247"
BaseWind2="0.000427"
BaseWind3="0.000443"
BaseWind4="0.000405"
BaseWind5="0.000362"
WindStrength1="0.06"
WindStrength2="0.01"
WindStrength3="0.0096"
WindStrength4="0.0098"
WindStrength5="0.009"
BaseWind1="0.0247"
BaseWind2="0.00427"
BaseWind3="0.00443"
BaseWind4="0.00405"
BaseWind5="0.00362"
WindStrength1="0.006"
WindStrength2="0.001"
WindStrength3="0.00096"
WindStrength4="0.00098"
WindStrength5="0.0009"
FlakeSize1="14"
FlakeSize2="6"
FlakeSize3="4.6"
Expand Down
1 change: 0 additions & 1 deletion Daybreak/Services/Screenshots/BackgroundProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Configuration;
using System.Core.Extensions;
using System.Threading.Tasks;
using System.Windows.Documents;
using System.Windows.Media;

namespace Daybreak.Services.Screenshots;
Expand Down
65 changes: 65 additions & 0 deletions Daybreak/Services/Screenshots/Models/Event.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using Daybreak.Models.Guildwars;
using System.Collections.Generic;

namespace Daybreak.Services.Screenshots.Models;
internal sealed class Event
{
public string? Name { get; init; }
public List<Map>? ValidLocations { get; init; }

private Event()
{
}

public static readonly Event Wintersday = new()
{
Name = "Wintersday",
ValidLocations = new List<Map>
{
Map.AscalonCityWintersdayOutpost,
Map.DroknarsForgeWintersdayOutpost,
Map.EyeOfTheNorthOutpostWintersdayOutpost,
Map.KamadanJewelOfIstanWintersdayOutpost,
Map.TheGreatSnowballFightoftheGodsFightinginaWinterWonderland,
Map.TravelersVale,
Map.BorlisPass,
Map.IronHorseMine,
Map.TheFrostGate,
Map.AnvilRock,
Map.IceToothCaveOutpost,
Map.DeldrimorBowl,
Map.BeaconsPerchOutpost,
Map.GriffonsMouth,
Map.DroknarsForgeOutpost,
Map.WitmansFolly,
Map.PortSledgeOutpost,
Map.TalusChute,
Map.IceCavesofSorrow,
Map.CampRankorOutpost,
Map.SnakeDance,
Map.DreadnoughtsDrift,
Map.LornarsPass,
Map.GrenthsFootprint,
Map.SpearheadPeak,
Map.TheGraniteCitadelOutpost,
Map.TascasDemise,
Map.MineralSprings,
Map.Icedome,
Map.CopperhammerMinesOutpost,
Map.FrozenForest,
Map.IronMinesofMoladune,
Map.IceFloe,
Map.MarhansGrottoOutpost,
Map.ThunderheadKeep,
Map.IceCliffChasms,
Map.GunnarsHoldOutpost,
Map.NorrhartDomains,
Map.OlafsteadOutpost,
Map.VarajarFells,
Map.SifhallaOutpost,
Map.DrakkarLake,
Map.JagaMoraine,
Map.BjoraMarches
}
};
}
73 changes: 73 additions & 0 deletions Daybreak/Services/Screenshots/Models/Location.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Daybreak.Models.Guildwars;
using LiveChartsCore.Geo;
using System.Collections.Generic;

namespace Daybreak.Services.Screenshots.Models;
Expand Down Expand Up @@ -591,6 +592,15 @@ internal sealed class Location
StartIndex = 1,
Count = 21
},
new Entry
{
Map = Map.SanctumCay,
Url = "https://i.imgur.com/9jrmIAM.jpeg",
Credit = "https://imgur.com/a/PzYch4c",
IdFormat = "D2",
StartIndex = 1,
Count = 1
}
});
public static readonly Location MaguumaJungle = new(
Region.MaguumaJungle,
Expand Down Expand Up @@ -740,6 +750,15 @@ internal sealed class Location
StartIndex = 1,
Count = 12
},
new Entry
{
Map = Map.MamnoonLagoon,
Url = "https://i.imgur.com/d78EuZt.jpeg",
Credit = "https://imgur.com/a/PzYch4c",
IdFormat = "D2",
StartIndex = 1,
Count = 1
}
});
public static readonly Location CrystalDesert = new(
Region.CrystalDesert,
Expand Down Expand Up @@ -1129,6 +1148,15 @@ internal sealed class Location
StartIndex = 1,
Count = 57
},
new Entry
{
Map = Map.MineralSprings,
Url = "https://i.imgur.com/CFP4AmT.jpeg",
Credit = "https://imgur.com/a/PzYch4c",
IdFormat = "D2",
StartIndex = 1,
Count = 1
}
});
public static readonly Location RingOfFireIslandChain = new(
Region.RingOfFireIslands,
Expand Down Expand Up @@ -1179,6 +1207,24 @@ internal sealed class Location
StartIndex = 1,
Count = 38
},
new Entry
{
Map = Map.RingOfFire,
Url = "https://i.imgur.com/srejpIP.jpeg",
Credit = "https://imgur.com/a/PzYch4c",
IdFormat = "D2",
StartIndex = 1,
Count = 1
},
new Entry
{
Map = Map.RingOfFire,
Url = "https://i.imgur.com/70Oc160.jpeg",
Credit = "https://imgur.com/a/PzYch4c",
IdFormat = "D2",
StartIndex = 1,
Count = 1
}
});
public static readonly Location FarShiverpeaks = new(
Region.FarShiverpeaks,
Expand Down Expand Up @@ -1351,6 +1397,15 @@ internal sealed class Location
StartIndex = 1,
Count = 60
},
new Entry
{
Map = Map.GrothmarWardowns,
Url = "https://i.imgur.com/aECgPky.jpeg",
Credit = "https://imgur.com/a/PzYch4c",
IdFormat = "D2",
StartIndex = 1,
Count = 1
}
});
public static readonly Location TarnishedCoast = new(
Region.TarnishedCoast,
Expand Down Expand Up @@ -3586,6 +3641,15 @@ internal sealed class Location
StartIndex = 1,
Count = 35
},
new Entry
{
Map = Map.SunwardMarches,
Url = "https://i.imgur.com/8pSyjun.jpeg",
Credit = "https://imgur.com/a/PzYch4c",
IdFormat = "D2",
StartIndex = 1,
Count = 1
}
});
public static readonly Location Vabbi = new(
Region.Vabbi,
Expand Down Expand Up @@ -4096,6 +4160,15 @@ internal sealed class Location
StartIndex = 1,
Count = 4
},
new Entry
{
Map = Map.NightfallenJahai,
Url = "https://i.imgur.com/2tKgyv4.jpeg",
Credit = "https://imgur.com/a/PzYch4c",
IdFormat = "D2",
StartIndex = 1,
Count = 1
}
});
public static readonly Location BattleIsles = new(
Region.TheBattleIsles,
Expand Down
Loading
Loading