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

    <Page.Resources>
        <ResourceDictionary>
            <BitmapImage x:Key="A_ImageSource_Logo_Vert" UriSource="/Textures/Data_Bound/Anthem/Icons/Anthem-Logo-Vert.png" />
            <BitmapImage x:Key="A_ImageSource_Logo_Vert_CHS" UriSource="/Textures/Data_Bound/Anthem/Icons/Anthem-Logo-Vert-zhCN.png" />

            <Style x:Key="A_Style_FZTextBlock_WelcomeBase" BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}" TargetType="local:FZTextBlock">
                <Setter Property="FontSize" Value="24"/>
            </Style>

            <Style x:Key="A_Style_FZTextBlock_Welcome" BasedOn="{StaticResource A_Style_FZTextBlock_WelcomeBase}" TargetType="local:FZTextBlock">
                <Setter Property="Color" Value="#FFFFFFFF" />
            </Style>

            <Style x:Key="A_Style_FZTextBlock_WelcomeGamertag" BasedOn="{StaticResource A_Style_FZTextBlock_WelcomeBase}" TargetType="local:FZTextBlock">
                <Setter Property="Color" Value="#FFFFFFFF" />
            </Style>

            <Storyboard x:Key="A_Storyboard_IdleState">
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="HelpButton">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="1"/>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="LoadingControl">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="0"/>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Welcome">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="1"/>
                </DoubleAnimationUsingKeyFrames>
            </Storyboard>

            <Storyboard x:Key="A_Storyboard_LoadingState">
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="HelpButton">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="0"/>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="LoadingControl">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="1"/>
                </DoubleAnimationUsingKeyFrames>
                                
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Welcome">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="0"/>
                    <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="1"/>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)" Storyboard.TargetName="Welcome">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="-20.0"/>
                    <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="0.0">
                        <EasingDoubleKeyFrame.EasingFunction>
                            <PowerEase EasingMode="EaseOut" Power="2" />
                        </EasingDoubleKeyFrame.EasingFunction>
                    </EasingDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
            </Storyboard>

            <Storyboard x:Key="A_Storyboard_PopupShowingState">
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="HelpButton">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="0"/>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="LoadingControl">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="0"/>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Welcome">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="0"/>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="TitleLogo">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="0" />
                </DoubleAnimationUsingKeyFrames>
            </Storyboard>

            <Storyboard x:Key="A_Storyboard_TransitionToLoadingState">
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="HelpButton">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="0"/>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="LoadingControl">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="1"/>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Welcome">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="1"/>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="PART_List">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="0" />
                </DoubleAnimationUsingKeyFrames>

                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                               Storyboard.TargetName="TitleLogo">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.5"
                                          Value="0" />
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Fader">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="0" />
                    <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1" />
                </DoubleAnimationUsingKeyFrames>

                <StringAnimationUsingKeyFrames Storyboard.TargetName="EventFire" Storyboard.TargetProperty="(local:EventFire.EventName)">
                    <DiscreteStringKeyFrame KeyTime="0:0:0.5" Value="TransitionToLoadingComplete"/>
                </StringAnimationUsingKeyFrames>
            </Storyboard>

            <Storyboard x:Key="A_Storyboard_TransitionToLoadingWithPopupShowingState">
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="HelpButton">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="0"/>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="LoadingControl">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="0"/>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Welcome">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="0"/>
                </DoubleAnimationUsingKeyFrames>

                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                               Storyboard.TargetName="TitleLogo">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.5"
                                          Value="0" />
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Fader">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="0" />
                    <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1" />
                </DoubleAnimationUsingKeyFrames>

                <StringAnimationUsingKeyFrames Storyboard.TargetName="EventFire" Storyboard.TargetProperty="(local:EventFire.EventName)">
                    <DiscreteStringKeyFrame KeyTime="0:0:0.5" Value="TransitionToLoadingComplete"/>
                </StringAnimationUsingKeyFrames>
            </Storyboard>

            <Storyboard x:Key="A_Storyboard_MainMenuState">
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                               Storyboard.TargetName="HelpButton">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.0"
                                          Value="0" />
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                               Storyboard.TargetName="LoadingControl">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.0"
                                          Value="0" />
                </DoubleAnimationUsingKeyFrames>

                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                               Storyboard.TargetName="TitleLogo">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.0"
                                          Value="0" />
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                               Storyboard.TargetName="PART_List">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.0"
                                          Value="1" />
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                               Storyboard.TargetName="Welcome">
                    <EasingDoubleKeyFrame KeyTime="0:0:0.0"
                                          Value="1" />
                </DoubleAnimationUsingKeyFrames>
            </Storyboard>

            <System:Double x:Key="A_Double_LogoWidth">348</System:Double>
            <System:Double x:Key="A_Double_LogoHeight">268</System:Double>
            <System:Double x:Key="A_Double_LogoHeight_CHS">300</System:Double>

            <Style x:Key="A_Style_FZMaterial_Logo"
                   TargetType="local:FZMaterial">
                <Setter Property="ImageSource"
                        Value="{local:LocalizedResource A_ImageSource_Logo_Vert}" />
                <Setter Property="Height"
                        Value="{local:LocalizedResource A_Double_LogoHeight}" />
                <Setter Property="Width" Value="{StaticResource A_Double_LogoWidth}"/>
            </Style>

            <Style x:Key="A_Style_FrameworkElement_SplashFadeOnlyTransition" 
                    TargetType="{x:Type FrameworkElement}" 
                    BasedOn="{StaticResource A_Style_FrameworkElement_FadeOnlyTransition_0}">
                <Style.Resources>
                    <local:UIStoryboard x:Key="transition_out_forward">
                    </local:UIStoryboard>
                    <local:UIStoryboard x:Key="transition_out_back">
                    </local:UIStoryboard>
                </Style.Resources>
            </Style>

            <local:MappingConverter x:Key="A_Converter_Splash_Description_For_Platform" Default="{local:Loc Main.IDS_Press_To_Start_With_Accessibility_ScreenReader}">
                <local:MappingConverterEntry Key="True" Value="{local:Loc Main.IDS_Press_To_Start_ScreenReader}"/>
            </local:MappingConverter>

            <local:MappingConverter x:Key="A_Converter_ButtonOffset_For_Platform" Default="0">
                <local:MappingConverterEntry Key="False" Value="56"/>
            </local:MappingConverter>
        </ResourceDictionary>
    </Page.Resources>

    <local:UIPageTransitionManager.TransitionManager>
        <local:UIPageTransitionManager Preset="{StaticResource A_UIPageTransitionManagerPreset_NoAudio}"/>
    </local:UIPageTransitionManager.TransitionManager>

    <Grid x:Name="LayoutRoot">
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="States">
                <VisualState x:Name="IdleState"
                             Storyboard="{StaticResource A_Storyboard_IdleState}" />
                <VisualState x:Name="LoadingState"
                             Storyboard="{StaticResource A_Storyboard_LoadingState}" />
                <VisualState x:Name="PopupShowingState"
                             Storyboard="{StaticResource A_Storyboard_PopupShowingState}" />
                <VisualState x:Name="TransitionToLoadingState"
                             Storyboard="{StaticResource A_Storyboard_TransitionToLoadingState}" />
                <VisualState x:Name="TransitionToLoadingWithPopupShowingState"
                             Storyboard="{StaticResource A_Storyboard_TransitionToLoadingWithPopupShowingState}" />
                <VisualState x:Name="MainMenuState"
                             Storyboard="{StaticResource A_Storyboard_MainMenuState}" />
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>

        <local:FZMaterial x:Name="BlackBG" Color="Black" />
        <Grid Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}">
            <MediaElement x:Name="Video" Style="{StaticResource A_Style_ScreenSize}" />
        </Grid>

        <Grid Style="{StaticResource A_Style_FrameworkElement_SplashFadeOnlyTransition}">
            <Grid Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}">
                <Decorator x:Name="Welcome" Margin="94, 0, 0, 83" Opacity="0" VerticalAlignment="Bottom">
                    <Decorator.RenderTransform>
                        <TransformGroup>
                            <TranslateTransform />
                        </TransformGroup>
                    </Decorator.RenderTransform>
                    <local:FZMaterial Color="{StaticResource A_Color_SplashTextBacking}"
                                      Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterAll}"
                                      HorizontalAlignment="Left">
                        <StackPanel Orientation="Horizontal" Margin="16" RenderTransformOrigin="0.5, 0.5" RenderTransform="{StaticResource A_Transform_Italic}">
                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_Welcome}"
                                               Text="{local:Loc Main.IDS_Welcome}"
                                               Visibility="{Binding Gamertag, Converter={StaticResource A_StringVisConverter}}"
                                               HorizontalAlignment="Left"
                                               VerticalAlignment="Center"
                                               Margin="0,0,8,0" />
                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_WelcomeGamertag}"
                                               Text="{Binding Gamertag, Converter={StaticResource A_StringToUpper}}"
                                               HorizontalAlignment="Left"
                                               VerticalAlignment="Center" />
                        </StackPanel>
                    </local:FZMaterial>
                </Decorator>


                <local:FZMaterialGlassCapture />

                <ContentControl Style="{StaticResource A_Style_ContentControl_BottomRight}" Margin="0, 0, 67, 77">
                    <DockPanel HorizontalAlignment="Right">
                        <local:FZMaterial x:Name="TitleLogo" Style="{StaticResource A_Style_FZMaterial_Logo}" DockPanel.Dock="Top"
                              local:ScreenReader.Line="{local:Loc Main.IDS_GameTitle_ScreenReader}"
                              local:ScreenReader.Event="OnLoad" Margin="6,0,0,0"
                              local:ScreenReader.LineType="ScreenTitle" />
                        <Grid Width="326" HorizontalAlignment="Right"  Margin="0, 15, 0, 0" DockPanel.Dock="Bottom">
                            <Decorator HorizontalAlignment="Center">
                                <StackPanel x:Name="HelpButton" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom" 
                                        local:MultiStringFormatter.Format="{Binding IsPC, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}, Converter={StaticResource A_Converter_Splash_Description_For_Platform}}"
                                        local:MultiStringFormatter.Param0="{Binding ScreenReaderName, ElementName=ControllerButton}"
                                        local:MultiStringFormatter.Param1="{Binding ScreenReaderName, ElementName=ControllerButton2}"
                                        local:ScreenReader.Line="{Binding (local:MultiStringFormatter.Output), RelativeSource={RelativeSource Self}}"
                                        local:ScreenReader.Event="OnLoad"
                                        local:ScreenReader.LineType="ScreenDescription">
                                    <local:FZMaterial Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterAll}"
                                                      Color="{StaticResource A_Color_SplashTextBacking}"
                                                      Margin="4">
                                        <StackPanel Orientation="Horizontal"
                                                    Margin="16">
                                            <!-- press A to start-->
                                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                                <local:ControllerButtonControl x:Name="ControllerButton" Button="A" Style="{StaticResource A_Style_ControllerButtonControl_Default_ShowAlways}" MinWidth="26" Height="26" Margin="0,-4,0,-4"/>
                                                <Decorator RenderTransformOrigin="0.5,0.5" RenderTransform="{StaticResource A_Transform_Italic}">
                                                    <local:FZTextBlock Text="{Binding PressStartRightText}" Style="{StaticResource A_Style_Text_LoadingSmall}" Margin="8,0,0,0" />
                                                </Decorator>
                                            </StackPanel>
                                            <Decorator Width="24"/>
                                            <!-- press X for Accessibility-->
                                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                                <local:ControllerButtonControl x:Name="ControllerButton2" Button="X" Style="{StaticResource A_Style_ControllerButtonControl_Default_ShowAlways}" MinWidth="26" Height="26" Margin="9,-4,0,-4"/>
                                                <Decorator RenderTransformOrigin="0.5,0.5" RenderTransform="{StaticResource A_Transform_Italic}">
                                                    <local:FZTextBlock Text="{Binding PressAccessibilityRightText}" Style="{StaticResource A_Style_Text_LoadingSmall}" Margin="8,0,0,0" />
                                                </Decorator>
                                            </StackPanel>
                                        </StackPanel>
                                    </local:FZMaterial>
                                </StackPanel>
                            </Decorator>
                            <local:FZMaterial x:Name="LoadingControl" Opacity="0"
                                              Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterAll}"
                                              Color="{StaticResource A_Color_SplashTextBacking}"
                                              Margin="-16,4,8,4">
                                <Decorator Margin="16,0">
                                    <Control Style="{StaticResource A_Style_Control_LoadingMini}" Margin="0"/>
                                </Decorator>
                            </local:FZMaterial>
                        </Grid>
                    </DockPanel>
                </ContentControl>

                <local:CommonListBox Style="{StaticResource A_Style_ListBox_TextMenu_Default}"
                                     x:Name="PART_List"
                                     Width="396"
                                     VerticalAlignment="Bottom"
                                     HorizontalAlignment="Right"
                                     ItemContainerStyle="{StaticResource A_Style_ListBoxItem_TextMenu_Default}"
                                     ItemsSource="{Binding BootOptions}"
                                     Margin="75,82"
                                     SelectedIndex="{Binding SelectedIndex, Mode=OneWayToSource}"/>

                <!-- Only appears on PC Splash -->
                <local:FZTextBlock Text="{Binding Version}"
                                   Visibility="{Binding Version, Converter={StaticResource A_StringVisConverter}}"
                                   Color="#AAFFFFFF"
                                   HorizontalAlignment="Left"
                                   VerticalAlignment="Bottom"
                                   Margin="10,10"
                                   FontSize="18" />

                <local:FZMaterial x:Name="Fader" Color="Black" Opacity="0" IsHitTestVisible="False"/>
                <local:EventFire x:Name="EventFire" />
            </Grid>
        </Grid>
    </Grid>
</Page>
