<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:ForzaUI"
    xmlns:System="clr-namespace:System;assembly=mscorlib"
    mc:Ignorable="d"
    x:Class="ForzaUI.HUDMajorNotificationControl"
    x:Name="UserControl"
    Margin="0,257,0,0"
    VerticalAlignment="Top">

    <UserControl.Resources>
        <ResourceDictionary>
            <System:Double x:Key="A_HUDMajorNotifcation_MaxWidth">1000</System:Double>
            <CircleEase x:Key="A_CircleEase" EasingMode="EaseIn" />
            <CircleEase x:Key="A_CircleEase_Out" EasingMode="EaseOut" />
            <CircleEase x:Key="A_CircleEase_InOut" EasingMode="EaseInOut" />
            <BitmapImage x:Key="A_ImageSource_RivalsElipseGlow" UriSource="/ForzaUI;component/Textures/Data_Bound/Anthem/Rivals/ElipseGlow.png" />

            <System:Double x:Key="A_Double_MajorNotificationLineHeight">51</System:Double>
            <System:Double x:Key="A_Double_MajorNotificationLineHeight_CHS">65</System:Double>
            <System:Double x:Key="A_Double_MajorNotificationLineHeight_CHT">65</System:Double>
            <System:Double x:Key="A_Double_MajorNotificationLineHeight_JP">65</System:Double>
            <System:Double x:Key="A_Double_MajorNotificationLineHeight_KO">65</System:Double>

            <Style x:Key="A_Style_FZRun_Markup_MajorNotification_FLAGRUSHCOLOR0"
                   TargetType="local:FZRun">
                <Setter Property="Color"
                        Value="{StaticResource A_Color_FlagRush_Flag0}"/>
            </Style>
            <Style x:Key="A_Style_FZRun_Markup_MajorNotification_FLAGRUSHCOLOR1"
                   TargetType="local:FZRun">
                <Setter Property="Color"
                        Value="{StaticResource A_Color_FlagRush_Flag1}" />
            </Style>
            <Style x:Key="A_Style_FZRun_Markup_MajorNotification_FLAGRUSHCOLOR2"
                   TargetType="local:FZRun">
                <Setter Property="Color"
                        Value="{StaticResource A_Color_FlagRush_Flag2}" />
            </Style>
            <Style x:Key="A_Style_FZRun_Markup_MajorNotification_FLAGRUSHCOLOR3"
                   TargetType="local:FZRun">
                <Setter Property="Color"
                        Value="{StaticResource A_Color_FlagRush_Flag3}" />
            </Style>
            <Style x:Key="A_Style_FZRun_Markup_MajorNotification_FLAGRUSHCOLOR4"
                   TargetType="local:FZRun">
                <Setter Property="Color"
                        Value="{StaticResource A_Color_FlagRush_Flag4}" />
            </Style>
            <Style x:Key="A_Style_FZRun_Markup_MajorNotification_HIGHLIGHT"
                   TargetType="local:FZRun">
                <Setter Property="Color"
                        Value="{StaticResource A_Color_HUD_AlternateText}"/>
            </Style>
            <Style x:Key="A_Style_FZRun_Markup_MajorNotification_DLU"
                   TargetType="local:FZRun">
                <Setter Property="Color"
                        Value="#FFFFEA29"/>
            </Style>
            <Style x:Key="A_Style_FZRun_Markup_MajorNotification_ZOMBIE"
                   TargetType="local:FZRun">
                <Setter Property="Color"
                        Value="#79af4a"/>
            </Style>
            <Style x:Key="A_Style_FZRun_Markup_MajorNotification_INFECTED"
                   TargetType="local:FZRun">
                <Setter Property="Color"
                        Value="#ff8500"/>
            </Style>
            <Style x:Key="A_Style_FZRun_Markup_MajorNotification_SURVIVOR"
                   TargetType="local:FZRun">
                <Setter Property="Color"
                        Value="#ac6de8"/>
            </Style>
            <Style x:Key="A_Style_FZRun_Markup_MajorNotification_KING"
                   TargetType="local:FZRun">
                <Setter Property="Color"
                        Value="{StaticResource A_Color_King_Text}"/>
            </Style>
            <Style x:Key="A_Style_FZRun_Markup_MajorNotification_TEAMA"
                   TargetType="local:FZRun">
                <Setter Property="Color"
                        Value="{StaticResource A_Color_HUD_Team_A_NotificationText}"/>
            </Style>
            <Style x:Key="A_Style_FZRun_Markup_MajorNotification_TEAMB"
                   TargetType="local:FZRun">
                <Setter Property="Color"
                        Value="{StaticResource A_Color_HUD_Team_B_NotificationText}"/>
            </Style>

            <!-- Override the shadow depth because our text is larger -->
            <DropShadowEffect x:Key="A_DropShadowEffect_DefaultHud"
                              Color="{StaticResource A_Color_HUDDropShadow}"
                              BlurRadius="0"
                              ShadowDepth="3" />
        </ResourceDictionary>
    </UserControl.Resources>

    <StackPanel x:Name="LayoutRoot" HorizontalAlignment="Center" RenderTransformOrigin="0.5,0.5" >

        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="VisualStateGroup">
                <VisualState x:Name="Hidden">
                    <Storyboard>
                        <DoubleAnimationUsingKeyFrames Duration="0:0:0.9" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="BottomLine">
                            <EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="1"/>
                            <EasingDoubleKeyFrame KeyTime="0:0:0.7" Value="0" EasingFunction="{StaticResource A_CircleEase}"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Duration="0:0:1.0" 
                                                       Storyboard.TargetName="TopLineScrollOff"
                                                       Storyboard.TargetProperty="Tag">
                            <EasingDoubleKeyFrame KeyTime="0:0:0.0"
                                                  Value="0" />
                            <EasingDoubleKeyFrame KeyTime="0:0:0.55"
                                                  Value="0" />
                            <EasingDoubleKeyFrame KeyTime="0:0:0.9"
                                                  Value="1"
                                                  EasingFunction="{StaticResource A_CircleEase}"/>
                        </DoubleAnimationUsingKeyFrames>
                        <StringAnimationUsingKeyFrames Storyboard.TargetProperty="(local:EventFire.EventName)" Storyboard.TargetName="EventFire">
                            <DiscreteStringKeyFrame KeyTime="0:0:0.85" Value=""/>
                            <DiscreteStringKeyFrame KeyTime="0:0:0.9" Value="HiddenComplete"/>
                        </StringAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="Shown">
                    <Storyboard>
                        <DoubleAnimationUsingKeyFrames Duration="0:0:1.0" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="TopLine">
                            <EasingDoubleKeyFrame KeyTime="0" Value="0" />
                            <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="5" EasingFunction="{StaticResource A_CircleEase}" />
                            <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0" />
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Duration="0:0:1.0" 
                                                       Storyboard.TargetName="TopLineScrollOn"
                                                       Storyboard.TargetProperty="Tag">
                            <EasingDoubleKeyFrame KeyTime="0:0:0.0"
                                                  Value="1.3" />
                            <EasingDoubleKeyFrame KeyTime="0:0:0.4"
                                                  Value="0" 
                                                  EasingFunction="{StaticResource A_CircleEase}"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Duration="0:0:0.5" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="BottomLine">
                            <EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="0"/>
                            <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Duration="0:0:1.0" Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="GlowSlide">
                            <DiscreteDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
                            <EasingDoubleKeyFrame KeyTime="0:0:1.0" Value="1" EasingFunction="{StaticResource A_CircleEase_InOut}"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Duration="0:0:1.0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Glow">
                            <DiscreteDoubleKeyFrame KeyTime="0:0:0.5" Value="0" />
                            <LinearDoubleKeyFrame KeyTime="0:0:0.7" Value="0.5" />
                            <LinearDoubleKeyFrame KeyTime="0:0:0.8" Value="0.5" />
                            <LinearDoubleKeyFrame KeyTime="0:0:1.0" Value="0" />
                        </DoubleAnimationUsingKeyFrames>
                        <StringAnimationUsingKeyFrames Storyboard.TargetProperty="(local:AudioEvent.SoundName)" Storyboard.TargetName="MajorScrollAudioEvent">
                            <DiscreteStringKeyFrame KeyTime="0:0:0.0" Value="" />
                            <DiscreteStringKeyFrame KeyTime="0:0:0.01" Value="/Master/UI/Notification/HZ2_SFX_HUD_Notification_SpeedStatsMajorScroll_01" />
                            <DiscreteStringKeyFrame KeyTime="0:0:1.494" Value="/Master/UI/Notification/HZ2_SFX_HUD_Notification_SpeedStatsMajorScroll_01" />
                        </StringAnimationUsingKeyFrames>
                        <StringAnimationUsingKeyFrames Storyboard.TargetProperty="(local:EventFire.EventName)" Storyboard.TargetName="EventFire">
                            <DiscreteStringKeyFrame KeyTime="0:0:3.9" Value=""/>
                            <DiscreteStringKeyFrame KeyTime="0:0:4.0" Value="ShownComplete"/>
                        </StringAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>

        <Grid x:Name="ClipGrid">
            <ContentControl Style="{StaticResource A_Style_ContentControl_AnimatedTagSlideFromBottom}" x:Name="TopLineScrollOff">
                <ContentControl Style="{StaticResource A_Style_ContentControl_AnimatedTagSlideFromTop}" x:Name="TopLineScrollOn">
                    <StackPanel x:Name="TopLine" Orientation="Vertical" RenderTransformOrigin="0.5, 0.5" Margin="10,8,10,15">
                        <StackPanel.RenderTransform>
                            <TransformGroup>
                                <ScaleTransform />
                                <SkewTransform />
                                <RotateTransform />
                                <TranslateTransform />
                            </TransformGroup>
                        </StackPanel.RenderTransform>
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" RenderTransform="{StaticResource A_SkewTransform_HUD_Italics}" RenderTransformOrigin="0.5,0.5">
                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_HudLarge_Tight}"
                                                   local:TextBlockInlineMarkup.Markup="{Binding Maintext, Converter={StaticResource A_StringToUpper}}"
                                                   local:TextBlockInlineMarkup.ResourceBaseName="A_Style_FZRun_Markup_MajorNotification_" 
                                                   Effect="{StaticResource A_DropShadowEffect_DefaultHud}" 
                                                   MaxWidth="{StaticResource A_HUDMajorNotifcation_MaxWidth}" 
                                                   TextWrapping="Wrap" TextAlignment="Center" 
                                                   LineStackingStrategy="BlockLineHeight" LineHeight="{local:LocalizedResource A_Double_MajorNotificationLineHeight}"/>
                        </StackPanel>

                        <Decorator HorizontalAlignment="Center" Margin="0,8,0,0" Visibility="{Binding IsCountdown, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" RenderTransform="{StaticResource A_SkewTransform_HUD_Italics}" RenderTransformOrigin="0.5,0.5">
                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_HudLarge_Tight}" Text="{Binding Countdown}" Effect="{StaticResource A_DropShadowEffect_DefaultHud}" MaxWidth="{StaticResource A_HUDMajorNotifcation_MaxWidth}" TextWrapping="Wrap" TextAlignment="Center" Color="{StaticResource A_Color_HUD_AlternateText}" />
                        </Decorator>
                    </StackPanel>
                </ContentControl>
            </ContentControl>

            <StackPanel Orientation="Horizontal">
                <Grid x:Name="GlowSlide" Width="{Binding ActualWidth, ElementName=TopLine}">
                    <Grid.LayoutTransform>
                        <TransformGroup>
                            <ScaleTransform ScaleX="0"/>
                            <SkewTransform />
                            <RotateTransform />
                            <TranslateTransform />
                        </TransformGroup>
                    </Grid.LayoutTransform>
                </Grid>
                <local:FZMaterial x:Name="Glow" ImageSource="{StaticResource A_ImageSource_RivalsElipseGlow}" Preset="{StaticResource A_FZMaterialPresetAdditive}" Height="{Binding ActualHeight, ElementName=TopLine}" Width="700" RenderTransformOrigin="0.5,0.5" Opacity="0" Tag="0" Margin="-350,-75,-350,-75">
                    <local:FZMaterial.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform ScaleY="2.5"/>
                            <SkewTransform />
                            <RotateTransform />
                            <TranslateTransform />
                        </TransformGroup>
                    </local:FZMaterial.RenderTransform>
                </local:FZMaterial>
            </StackPanel>
        </Grid>
        <StackPanel x:Name="BottomLine" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,2,0,0" Visibility="{Binding Subtext, Converter={StaticResource A_StringVisConverter}}">
            <local:ControllerButtonControl Height="30"
                                               Margin="0,-10,6,-10"
                                               Visibility="{Binding IsActivatable, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"
                                               Style="{StaticResource A_Style_ControllerButtonControl_ActivationButton}" 
                                               UseLargeIcon="True"/>
            <Decorator RenderTransform="{StaticResource A_SkewTransform_HUD_Italics}" RenderTransformOrigin="0.5,0.5">
                <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_HudMedium_Tight}"
                                   FontFamily="Horizon_C"
                                   CapHeight="18"
                                   MaxWidth="{StaticResource A_HUDMajorNotifcation_MaxWidth}"
                                   TextWrapping="Wrap"
                                   TextAlignment="Center"
                                   Text="{Binding Subtext}"/>
            </Decorator>
        </StackPanel>

        <local:AudioEvent x:Name="MajorScrollAudioEvent" />
        <local:EventFire x:Name="EventFire" />
    </StackPanel>
</UserControl>
