<Page
	xmlns:local="clr-namespace:ForzaUI"
    xmlns:System="clr-namespace:System;assembly=mscorlib"
    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"
	x:Class="ForzaUI.A_PreRaceCutsceneTrackName2Panel"
	Style="{StaticResource A_Style_Page_Generic}"
    mc:Ignorable="d"
    DataContext="{Binding RelativeSource={RelativeSource Self}}"
    >

    <Page.Resources>
        <Style x:Key="A_Style_PreRace_AnimatedControl" TargetType="{x:Type Control}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Control}">
                        <ControlTemplate.Resources>
                            <Storyboard x:Key="Hide" TargetName="MainGrid" Duration="0:0:0.25">
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)">
                                    <EasingDoubleKeyFrame KeyTime="0:0:0" Value="0">
                                        <EasingDoubleKeyFrame.EasingFunction>
                                            <QuinticEase EasingMode="EaseIn" />
                                        </EasingDoubleKeyFrame.EasingFunction>
                                    </EasingDoubleKeyFrame>
                                    <EasingDoubleKeyFrame KeyTime="0:0:0.25" Value="575">
                                        <EasingDoubleKeyFrame.EasingFunction>
                                            <QuinticEase EasingMode="EaseIn" />
                                        </EasingDoubleKeyFrame.EasingFunction>
                                    </EasingDoubleKeyFrame>
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)">
                                    <EasingDoubleKeyFrame KeyTime="0:0:0" Value="1" />
                                    <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0" />
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>

                            <Storyboard x:Key="Show" TargetName="MainGrid" TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" Duration="0:0:0.333">
                                <DoubleAnimationUsingKeyFrames>
                                    <SplineDoubleKeyFrame KeyTime="0" Value="-250" />
                                    <SplineDoubleKeyFrame KeyTime="0:0:0.273" Value="15" KeySpline="{StaticResource A_Spline_PostRace_AnimateIn_ControlPointA}" />
                                    <SplineDoubleKeyFrame KeyTime="0:0:0.333" Value="0" KeySpline="{StaticResource A_Spline_PostRace_AnimateIn_ControlPointB}" />
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>

                            <Storyboard x:Key="InstantShow" TargetName="MainGrid" TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" Duration="0:0:0">
                                <DoubleAnimationUsingKeyFrames>
                                    <SplineDoubleKeyFrame KeyTime="0:0:0" Value="0" KeySpline="{StaticResource A_Spline_PostRace_AnimateIn_ControlPointB}" />
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>

                            <Storyboard x:Key="StartOff" TargetName="MainGrid" TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" Duration="0:0:0.4">
                                <DoubleAnimationUsingKeyFrames Duration="0:0:0">
                                    <LinearDoubleKeyFrame KeyTime="0:0:0" Value="-650" />
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </ControlTemplate.Resources>

                        <Grid ClipToBounds="True">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <Grid x:Name="MainGrid"
                              Style="{StaticResource A_Style_Grid_ARUIMotionBlur}">
                                <Grid.RenderTransform>
                                    <TranslateTransform />
                                </Grid.RenderTransform>

                                <local:EventFire.FzTriggers>
                                    <local:EventFireTrigger Event="showevent" Storyboard="{StaticResource Show}" />
                                    <local:EventFireTrigger Event="instantshowevent" Storyboard="{StaticResource InstantShow}" />
                                    <local:EventFireTrigger Event="hideevent" Storyboard="{StaticResource Hide}" />
                                    <local:EventFireTrigger Event="startoffevent" Storyboard="{StaticResource StartOff}" />
                                </local:EventFire.FzTriggers>

                                <ContentControl Template="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" />
                            </Grid>
                        </Grid>

                        <ControlTemplate.Triggers>
                            <EventTrigger RoutedEvent="Loaded" SourceName="MainGrid">
                                <BeginStoryboard Storyboard="{StaticResource InstantShow}" />
                            </EventTrigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="A_Style_PreRace_AnimatedControl2" TargetType="{x:Type Control}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Control}">
                        <ControlTemplate.Resources>
                            <Storyboard x:Key="Hide" TargetName="MainGrid" Duration="0:0:0.25">
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)">
                                    <EasingDoubleKeyFrame KeyTime="0:0:0" Value="0">
                                        <EasingDoubleKeyFrame.EasingFunction>
                                            <QuinticEase EasingMode="EaseIn" />
                                        </EasingDoubleKeyFrame.EasingFunction>
                                    </EasingDoubleKeyFrame>
                                    <EasingDoubleKeyFrame KeyTime="0:0:0.25" Value="500">
                                        <EasingDoubleKeyFrame.EasingFunction>
                                            <QuinticEase EasingMode="EaseIn" />
                                        </EasingDoubleKeyFrame.EasingFunction>
                                    </EasingDoubleKeyFrame>
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)">
                                    <EasingDoubleKeyFrame KeyTime="0:0:0" Value="1" />
                                    <EasingDoubleKeyFrame KeyTime="0:0:0.25" Value="0" />
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>

                            <Storyboard x:Key="Show" TargetName="MainGrid" TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" Duration="0:0:0.333">
                                <DoubleAnimationUsingKeyFrames>
                                    <SplineDoubleKeyFrame KeyTime="0" Value="-650" />
                                    <SplineDoubleKeyFrame KeyTime="0:0:0.173" Value="15" KeySpline="{StaticResource A_Spline_PostRace_AnimateIn_ControlPointA}" />
                                    <SplineDoubleKeyFrame KeyTime="0:0:0.333" Value="0" KeySpline="{StaticResource A_Spline_PostRace_AnimateIn_ControlPointB}" />
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>

                            <Storyboard x:Key="InstantShow" TargetName="MainGrid" TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" Duration="0:0:0">
                                <DoubleAnimationUsingKeyFrames>
                                    <SplineDoubleKeyFrame KeyTime="0:0:0" Value="0" KeySpline="{StaticResource A_Spline_PostRace_AnimateIn_ControlPointB}" />
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>

                            <Storyboard x:Key="StartOff" TargetName="MainGrid" TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" Duration="0:0:0.4">
                                <DoubleAnimationUsingKeyFrames Duration="0:0:0">
                                    <LinearDoubleKeyFrame KeyTime="0:0:0" Value="-650" />
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </ControlTemplate.Resources>

                        <Grid ClipToBounds="True">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <Grid x:Name="MainGrid" Style="{StaticResource A_Style_Grid_ARUIMotionBlur}">
                                <Grid.RenderTransform>
                                    <TranslateTransform />
                                </Grid.RenderTransform>

                                <local:EventFire.FzTriggers>
                                    <local:EventFireTrigger Event="showevent" Storyboard="{StaticResource Show}" />
                                    <local:EventFireTrigger Event="instantshowevent" Storyboard="{StaticResource InstantShow}" />
                                    <local:EventFireTrigger Event="hideevent" Storyboard="{StaticResource Hide}" />
                                    <local:EventFireTrigger Event="startoffevent" Storyboard="{StaticResource StartOff}" />
                                </local:EventFire.FzTriggers>

                                <ContentControl Template="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" />
                            </Grid>
                        </Grid>

                        <ControlTemplate.Triggers>
                            <EventTrigger RoutedEvent="Loaded" SourceName="MainGrid">
                                <BeginStoryboard Storyboard="{StaticResource StartOff}" />
                            </EventTrigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="A_Style_Title_PreRaceCutscene" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_Title}" >
            <Setter Property="FontSize" Value="130"/>
        </Style>
        <Style x:Key="A_Style_Content_PreRaceCutscene" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_Title}" >
            <Setter Property="FontSize" Value="250"/>
        </Style>

        <ControlTemplate x:Key="A_Template_Section1" TargetType="ContentControl">
            <StackPanel>
                <local:FZTextBlock Text="{Binding Panel1Title}" Style="{StaticResource A_Style_Title_PreRaceCutscene}" Color="{StaticResource A_Color_PostRace_ARUI_Title}" Visibility="{Binding Panel1Title, Converter={StaticResource A_StringVisConverter}}" />
                <local:FZTextBlock Text="{Binding Panel1Content1}" Style="{StaticResource A_Style_Content_PreRaceCutscene}" Color="{StaticResource A_Color_PostRace_ARUI_Content}" Margin="0, -70, 0, 0" Visibility="{Binding Panel1Content1, Converter={StaticResource A_StringVisConverter}}" />
                <local:FZTextBlock Text="{Binding Panel1Content2}" Style="{StaticResource A_Style_Content_PreRaceCutscene}" Color="{StaticResource A_Color_PostRace_ARUI_Content}" Margin="0, -100, 0, 0" Visibility="{Binding Panel1Content2, Converter={StaticResource A_StringVisConverter}}" />
            </StackPanel>
        </ControlTemplate>

        <ControlTemplate x:Key="A_Template_Section2" TargetType="ContentControl">
            <StackPanel>
                <local:FZTextBlock Text="{Binding Panel2Title}" Style="{StaticResource A_Style_Title_PreRaceCutscene}" Color="{StaticResource A_Color_PostRace_ARUI_Title}" VerticalAlignment="Bottom" Visibility="{Binding Panel2Title, Converter={StaticResource A_StringVisConverter}}" />
                <local:FZTextBlock Text="{Binding Panel2Content1}" Style="{StaticResource A_Style_Content_PreRaceCutscene}" Color="{StaticResource A_Color_PostRace_ARUI_Content}" VerticalAlignment="Bottom" Margin="0, -70, 0, 0" Visibility="{Binding Panel2Content1, Converter={StaticResource A_StringVisConverter}}" />
                <local:FZTextBlock Text="{Binding Panel2Content2}" Style="{StaticResource A_Style_Content_PreRaceCutscene}" Color="{StaticResource A_Color_PostRace_ARUI_Content}" VerticalAlignment="Bottom" Margin="0, -100, 0, 0" Visibility="{Binding Panel2Content2, Converter={StaticResource A_StringVisConverter}}" />
            </StackPanel>
        </ControlTemplate>

        <Storyboard x:Key="ShowStoryboard">
            <StringAnimationUsingKeyFrames Storyboard.TargetName="Section2EventFire" Storyboard.TargetProperty="(local:EventFire.EventName)">
                <DiscreteStringKeyFrame KeyTime="0:0:0" Value="startoffevent" />
            </StringAnimationUsingKeyFrames>
            
            <StringAnimationUsingKeyFrames Storyboard.TargetName="Section1EventFire" Storyboard.TargetProperty="(local:EventFire.EventName)">
                <DiscreteStringKeyFrame KeyTime="0:0:3" Value="hideevent" />
            </StringAnimationUsingKeyFrames>

            <StringAnimationUsingKeyFrames Storyboard.TargetName="Section2EventFire" Storyboard.TargetProperty="(local:EventFire.EventName)">
                <DiscreteStringKeyFrame KeyTime="0:0:0" Value="startoffevent" />
                <DiscreteStringKeyFrame KeyTime="0:0:3.25" Value="showevent" />
            </StringAnimationUsingKeyFrames>

            <StringAnimationUsingKeyFrames Storyboard.TargetName="Section2AudioEvent" Storyboard.TargetProperty="(local:AudioEvent.SoundName)">
                <DiscreteStringKeyFrame KeyTime="0:0:3.25" Value="/Master/UI/PostRace/HZ2_SFX_HUD_Post Race_XPRewardsTitleOn_01" />
            </StringAnimationUsingKeyFrames>
        </Storyboard>

        <Storyboard x:Key="HideStoryboard">
            <StringAnimationUsingKeyFrames Storyboard.TargetName="Section1EventFire" Storyboard.TargetProperty="(local:EventFire.EventName)">
                <DiscreteStringKeyFrame KeyTime="0:0:0" Value="startoffevent" />
            </StringAnimationUsingKeyFrames>
            <StringAnimationUsingKeyFrames Storyboard.TargetName="Section2EventFire" Storyboard.TargetProperty="(local:EventFire.EventName)">
                <DiscreteStringKeyFrame KeyTime="0:0:0" Value="startoffevent" />
            </StringAnimationUsingKeyFrames>
        </Storyboard>
    </Page.Resources>

    <local:EventFire.FzTriggers>
        <local:EventFireTrigger Event="show" Storyboard="{StaticResource ShowStoryboard}" />
        <local:EventFireTrigger Event="hide" Storyboard="{StaticResource HideStoryboard}" />
    </local:EventFire.FzTriggers>

    <Grid>
        <Grid Margin="300, 200, 0, 0">
            <Grid ClipToBounds="True">
                <Viewbox VerticalAlignment="Center" StretchDirection="DownOnly" HorizontalAlignment="Left">
                    <ContentControl HorizontalAlignment="Center" x:Name="Section1" Style="{StaticResource A_Style_PreRace_AnimatedControl}" Content="{StaticResource A_Template_Section1}" />
                </Viewbox>
                <local:EventFire x:Name="Section1EventFire" TargetName="Section1"/>
            </Grid>

            <Grid ClipToBounds="True">
                <Viewbox VerticalAlignment="Center" StretchDirection="DownOnly" HorizontalAlignment="Left">
                    <ContentControl HorizontalAlignment="Center" x:Name="Section2" Style="{StaticResource A_Style_PreRace_AnimatedControl2}" Content="{StaticResource A_Template_Section2}" />
                </Viewbox>
                <local:EventFire x:Name="Section2EventFire" TargetName="Section2"/>
				<local:AudioEvent x:Name="Section2AudioEvent" />
            </Grid>
        </Grid>
    </Grid>
</Page>