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

        <System:Double x:Key="A_Double_ActivationMainLineSpacing">10</System:Double>
        <System:Double x:Key="A_Double_ActivationMainLineSpacing_CHS">25</System:Double>
        <System:Double x:Key="A_Double_ActivationMainLineSpacing_CHT">25</System:Double>
        <System:Double x:Key="A_Double_ActivationMainLineSpacing_JP">25</System:Double>
        <System:Double x:Key="A_Double_ActivationMainLineSpacing_KO">25</System:Double>

        <Color x:Key="A_Color_ActivationPreNameText">#FF00FFEF</Color>
        <Color x:Key="A_Color_ActivationNameText">#FFFFFFFF</Color>
        <Style TargetType="{x:Type local:FZTextBlock}"
               x:Key="A_Style_ActivationNameTextTop" 
               BasedOn="{StaticResource A_Style_FZTextBlock_HorizonC}">
            <Setter Property="Color"
                    Value="{StaticResource A_Color_ActivationNameText}"/>
            <Setter Property="Effect"
                    Value="{StaticResource A_DropShadowEffect_DefaultHud}" />
            <Setter Property="CapHeight"
                    Value="25" />
        </Style>
        <Style TargetType="{x:Type local:FZTextBlock}"
               x:Key="A_Style_ActivationNameTextBottom" 
               BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}">
            <Setter Property="Color"
                    Value="{StaticResource A_Color_ActivationNameText}"/>
            <Setter Property="Effect"
                    Value="{StaticResource A_DropShadowEffect_DefaultHud}" />
            <Setter Property="CapHeight"
                    Value="63" />
        </Style>

        <Style BasedOn="{StaticResource A_Style_FZTextBlock_HorizonB}"
               TargetType="{x:Type local:FZTextBlock}"
               x:Key="A_Style_ActivationPreNameText">
            <Setter Property="FontSize"
                    Value="36" />
            <Setter Property="Effect"
                    Value="{StaticResource A_DropShadowEffect_DefaultHud}" />
            <Setter Property="Color"
                    Value="{StaticResource A_Color_ActivationPreNameText}" />
        </Style>

        <Style BasedOn="{StaticResource A_Style_FZTextBlock_HorizonC}"
               TargetType="{x:Type local:FZTextBlock}"
               x:Key="A_Style_ActivationInstructionText">
            <Setter Property="CapHeight"
                    Value="25" />
            <Setter Property="Effect"
                    Value="{StaticResource A_DropShadowEffect_DefaultHud}" />
            <Setter Property="Color"
                    Value="{StaticResource A_Color_ActivationNameText}" />
        </Style>

        <local:UIStoryboard x:Key="Show">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="TopValue"
                                           Storyboard.TargetProperty="Tag">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                        Value="1" />
                <DiscreteDoubleKeyFrame KeyTime="0:0:0.1"
                                        Value="1" />
                <EasingDoubleKeyFrame KeyTime="0:0:0.8"
                                      Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <QuarticEase EasingMode="EaseInOut" />
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="TopValue2"
                                           Storyboard.TargetProperty="Tag">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                        Value="1" />
                <DiscreteDoubleKeyFrame KeyTime="0:0:0.2"
                                        Value="1" />
                <EasingDoubleKeyFrame KeyTime="0:0:0.9"
                                      Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <QuarticEase EasingMode="EaseInOut" />
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="TopValue3"
                                           Storyboard.TargetProperty="Tag">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                        Value="1" />
                <DiscreteDoubleKeyFrame KeyTime="0:0:0.2"
                                        Value="1" />
                <EasingDoubleKeyFrame KeyTime="0:0:0.9"
                                      Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <QuarticEase EasingMode="EaseInOut" />
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_TopIcon"
                                           Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
                <EasingDoubleKeyFrame KeyTime="0:0:0.6"
                                      Value="1">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <QuarticEase EasingMode="EaseOut" />
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_TopIcon"
                                           Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
                <EasingDoubleKeyFrame KeyTime="0:0:0.6"
                                      Value="1">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <QuarticEase EasingMode="EaseOut" />
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_TopIcon"
                                           Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(TranslateTransform.X)">
                <EasingDoubleKeyFrame KeyTime="0:0:0.6"
                                      Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <QuarticEase EasingMode="EaseOut" />
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_TopIcon"
                                           Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(TranslateTransform.Y)">
                <EasingDoubleKeyFrame KeyTime="0:0:0.6"
                                      Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <QuarticEase EasingMode="EaseOut" />
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="OuterPanel"
                                           Storyboard.TargetProperty="(UIElement.Opacity)">
                <EasingDoubleKeyFrame KeyTime="0:0:0"
                                      Value="1" />
            </DoubleAnimationUsingKeyFrames>

            <StringAnimationUsingKeyFrames Storyboard.TargetName="ShowAudioEvent"
                                           Storyboard.TargetProperty="(local:AudioEvent.SoundName)">
                <DiscreteStringKeyFrame KeyTime="0"
                                        Value="/Master/UI/Race/HZ2_SFX_HUD_Race_SignUp_01" />
                <DiscreteStringKeyFrame KeyTime="0:0:1"
                                        Value="" />
            </StringAnimationUsingKeyFrames>
        </local:UIStoryboard>
        <local:UIStoryboard x:Key="Hide"
                            DurationOverride="0:0:0.3">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="OuterPanel"
                                           Storyboard.TargetProperty="(UIElement.Opacity)">
                <EasingDoubleKeyFrame KeyTime="0:0:1"
                                      Value="0" />
            </DoubleAnimationUsingKeyFrames>
            <!--BooleanAnimationUsingKeyFrames Storyboard.TargetName="OuterPanel"
                                            Storyboard.TargetProperty="DataContext.Complete">
                <DiscreteBooleanKeyFrame KeyTime="0:0:1"
                                         Value="True" />
            </BooleanAnimationUsingKeyFrames-->
        </local:UIStoryboard>

        <!-- Any position overrides for the spatial icons need to live in here. -->
        <local:MappingConverter x:Key="A_MappingConverter_ScaleTransform_Scale_FromDataType" Default="1">
            <local:MappingConverterEntry Key="{x:Type local:DeprecatedAugmentedRealityDataSource}" Value="1" />
        </local:MappingConverter>

        <Thickness x:Key="A_Thickness_Hud_TopValue_Space">0,0,0,0</Thickness>
        <Thickness x:Key="A_Thickness_Hud_TopValue_Space_CHS">0,0,0,4</Thickness>
        <Thickness x:Key="A_Thickness_Hud_TopValue_Space_CHT">0,0,0,4</Thickness>
        <Thickness x:Key="A_Thickness_Hud_TopValue_Space_CZ">0,0,0,12</Thickness>
        <Thickness x:Key="A_Thickness_Hud_TopValue_Space_DE">0,0,0,10</Thickness>
        <Thickness x:Key="A_Thickness_Hud_TopValue_Space_TR">0,0,0,10</Thickness>

        <Thickness x:Key="A_Thickness_Hud_TopValue2_Space">0,0,0,0</Thickness>
        <Thickness x:Key="A_Thickness_Hud_TopValue2_Space_CHS">0,0,0,8</Thickness>
        <Thickness x:Key="A_Thickness_Hud_TopValue2_Space_CHT">0,0,0,8</Thickness>
        <Thickness x:Key="A_Thickness_Hud_TopValue2_Space_CZ">0,0,0,4</Thickness>
        <Thickness x:Key="A_Thickness_Hud_TopValue2_Space_DE">0,0,0,2</Thickness>
        <Thickness x:Key="A_Thickness_Hud_TopValue2_Space_TR">0,0,0,2</Thickness>

    </UserControl.Resources>
    <local:EventFire.FzTriggers>
        <local:EventFireTrigger Event="Show"
                                Storyboard="{StaticResource Show}" />
        <local:EventFireTrigger Event="HideHUDStatusActivation"
                                Storyboard="{StaticResource Hide}" />
    </local:EventFire.FzTriggers>
    <Grid x:Name="OuterPanel">
        <StackPanel Orientation="Vertical"
                    VerticalAlignment="Bottom"
                    HorizontalAlignment="Left">
            <StackPanel.Resources>
                <Style TargetType="{x:Type local:FZRun}"
                       x:Key="A_Style_Run_ActivationPreName_0">
                    <Setter Property="Color"
                            Value="{StaticResource A_Color_ActivationNameText}" />
                </Style>
                <Style TargetType="{x:Type local:FZRun}"
                       x:Key="A_Style_Run_ActivationName_0">
                    <Setter Property="FontFamily"
                            Value="Horizon_B"/>
                </Style>

                <Style TargetType="{x:Type Run}"
                       x:Key="A_Style_Run_ActivationInstructionName_0">
                    <Setter Property="Foreground">
                        <Setter.Value>
                            <SolidColorBrush Color="{StaticResource A_Color_ActivationPreNameText}" />
                        </Setter.Value>
                    </Setter>
                </Style>
            </StackPanel.Resources>
            <Decorator HorizontalAlignment="Left" 
                       VerticalAlignment="Bottom"
                       x:Name="TopIconContainer">
                <Decorator.LayoutTransform>
                    <TransformGroup>
                        <ScaleTransform ScaleX="{Binding AugmentedRealityData.ObjectType, Converter={StaticResource A_MappingConverter_ScaleTransform_Scale_FromDataType}}" 
                                        ScaleY="{Binding AugmentedRealityData.ObjectType, Converter={StaticResource A_MappingConverter_ScaleTransform_Scale_FromDataType}}"/>
                        <SkewTransform/>
                        <TranslateTransform/>
                        <RotateTransform/>
                    </TransformGroup>
                </Decorator.LayoutTransform>
                <ContentControl x:Name="PART_TopIcon"
                            Content="{Binding AugmentedRealityData}"
                            Effect="{StaticResource A_MotionBlurEffect}"
                            Style="{StaticResource A_Style_ContentControl_SpatialIcon_ForHUD}">
                    <ContentControl.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform/>
                            <SkewTransform/>
                            <TranslateTransform/>
                            <RotateTransform/>
                        </TransformGroup>
                    </ContentControl.RenderTransform>
                </ContentControl>
            </Decorator>

            <FrameworkElement x:Name="IconToLine1Div2d" Height="16"/>

            <Viewbox HorizontalAlignment="Left"
                     VerticalAlignment="Top"
                     MaxWidth="912"
                     StretchDirection="DownOnly">
                <StackPanel Orientation="Vertical">
                    <ContentControl Style="{StaticResource A_Style_ContentControl_AnimatedTagSlideFromLeft_HUD}"
                                    x:Name="TopValue" Margin="{local:LocalizedResource A_Thickness_Hud_TopValue_Space}">
                        <Decorator LayoutTransform="{StaticResource A_SkewTransform_HUD_Italics}">
                            <local:FZTextBlock Style="{StaticResource A_Style_ActivationNameTextTop}"
                                               Text="{Binding NameLine1Text, Converter={StaticResource A_StringToUpper}}"
                                               Margin="-1,0,3,0"
                                               Visibility="{Binding NameLine1Text, Converter={StaticResource A_StringVisConverter}}"/>
                        </Decorator>
                    </ContentControl>

                    <FrameworkElement x:Name="Line1ToLine2Div2d"
                                      Height="{local:LocalizedResource A_Double_ActivationMainLineSpacing}"
                                      Visibility="{Binding NameLine2Text, Converter={StaticResource A_StringVisConverter}}"/>

                    <ContentControl Style="{StaticResource A_Style_ContentControl_AnimatedTagSlideFromLeft_HUD}"
                                    x:Name="TopValue2" Margin="{local:LocalizedResource A_Thickness_Hud_TopValue2_Space}">
                        <Decorator LayoutTransform="{StaticResource A_SkewTransform_HUD_Italics}">
                            <local:FZTextBlock Style="{StaticResource A_Style_ActivationNameTextBottom}"
                                               local:TextBlockInlineMarkup.Markup="{Binding NameLine2Text, Converter={StaticResource A_StringToUpper}}"
                                               local:TextBlockInlineMarkup.ResourceBaseName="A_Style_Run_ActivationName_"
                                               Margin="-4,0,3,0"
                                               Visibility="{Binding NameLine2Text, Converter={StaticResource A_StringVisConverter}}"/>
                        </Decorator>
                    </ContentControl>
                </StackPanel>
            </Viewbox>

            <FrameworkElement x:Name="Line2ToHeader2Div2d"
                              Visibility="{Binding HeaderText, Converter={StaticResource A_StringVisConverter}}"
                              Height="{local:LocalizedResource A_Double_ActivationMainLineSpacing}"/>

            <ContentControl Style="{StaticResource A_Style_ContentControl_AnimatedTagSlideFromLeft_HUD}"
                            x:Name="TopValue3"> 
                    <StackPanel Orientation="Vertical">
                    <Decorator LayoutTransform="{StaticResource A_SkewTransform_HUD_Italics}">
                            <local:FZTextBlock Margin="3,0,3,0"
                                               Style="{StaticResource A_Style_ActivationPreNameText}"
                                               local:TextBlockInlineMarkup.Markup="{Binding HeaderText}"
                                               local:TextBlockInlineMarkup.ResourceBaseName="A_Style_Run_ActivationPreName_"
                                               Visibility="{Binding HeaderText, Converter={StaticResource A_StringVisConverter}}"/>
                        </Decorator>

                        <FrameworkElement x:Name="ToButtonPromptDiv2d" Height="10"/>

                        <StackPanel Orientation="Horizontal">
                            <FrameworkElement x:Name="PadButtonPromptDiv2d" Width="0"/>

                            <Grid>
                                <Viewbox Height="32"
                                    MinWidth="32"
                                    Visibility="{Binding IsLocked, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}, FallbackValue=Collapsed}">
                                    <local:ControllerButtonControl Style="{StaticResource A_Style_ControllerButtonControl_ActivationButton}"
                                        Margin="0"
                                        UseLargeIcon="True"/>
                                </Viewbox>

                                <local:FZMaterial x:Name="ControllerButtonLockMaterial"
                                                  ImageSource="/ForzaUI;component/Textures/Data_Bound/UI_Symbols/Lock_Light.png"
                                                  Stretch="Uniform"
                                                  Width="32"
                                                  Height="32"
                                                  Effect="{StaticResource A_DropShadowEffect_DefaultHud}"
                                                  Visibility="{Binding IsLocked, Converter={StaticResource A_FZBooleanToVisibilityConverter}, FallbackValue=Collapsed}"/>
                            </Grid>

                            <FrameworkElement x:Name="ButtonToIntstructionDiv2d" Width="8"/>

                            <Decorator LayoutTransform="{StaticResource A_SkewTransform_HUD_Italics}"
                                       VerticalAlignment="Center">
                                <local:FZTextBlock Style="{StaticResource A_Style_ActivationInstructionText}"
                                                   local:TextBlockInlineMarkup.Markup="{Binding InstructionText, Converter={StaticResource A_StringToUpper}}"
                                                   local:TextBlockInlineMarkup.ResourceBaseName="A_Style_Run_ActivationInstructionName_"
                                                   Margin="0,0,3,0">
                                    <TextBlock.Foreground>
                                        <SolidColorBrush Color="{Binding Color, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:FZTextBlock}}}" />
                                    </TextBlock.Foreground>
                                </local:FZTextBlock>
                            </Decorator>
                        </StackPanel>
                    </StackPanel>
                </ContentControl>
        </StackPanel>

        <local:AudioEvent x:Name="ShowAudioEvent" />
    </Grid>

</UserControl>
