<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:System="clr-namespace:System;assembly=mscorlib"
                    xmlns:local="clr-namespace:ForzaUI">

    <local:FZBooleanToVisibilityConverter x:Key="A_Converter_BoolToVis"
                                          InvertResult="false" />

    <Color x:Key="A_Color_VoiceChatIcon_Inactive">#FFD9D9D9</Color>
    <Color x:Key="A_Color_VoiceChatIcon_Active">#FFB4B4B4</Color>

    <!--Images intentionally always loaded as the control could be used in multiple location and the images need to be loaded so they can change rapidly -->
    <ImageSource x:Key="A_BitmapImage_Lobby_Mic">/ForzaUI;component/Textures/Anthem/Icons/Lobby/mic_active.png</ImageSource>
    <ImageSource x:Key="A_BitmapImage_Lobby_Mic_Speaking">/ForzaUI;component/Textures/Anthem/Icons/Lobby/mic_active_speak.png</ImageSource>
    <ImageSource x:Key="A_BitmapImage_Lobby_Mic_Off">/ForzaUI;component/Textures/Anthem/Icons/Lobby/mic_off.png</ImageSource>
    <ImageSource x:Key="A_BitmapImage_Lobby_Mic_Muted">/ForzaUI;component/Textures/Anthem/Icons/Lobby/mic_muted.png</ImageSource>
    <ImageSource x:Key="A_BitmapImage_Lobby_Drivatar">/ForzaUI;component/Textures/Anthem/Icons/Lobby/drivatar.png</ImageSource>

    <ControlTemplate x:Key="A_ControlTemplate_VoiceChatIcon"
                     TargetType="Control">
        <local:FZMaterial x:Name="VoiceIcon"
                          ImageSource="{StaticResource A_BitmapImage_Lobby_Mic}"
                          Color="{StaticResource A_Color_VoiceChatIcon_Inactive}"
                          Height="{TemplateBinding ActualHeight}"
                          Width="{TemplateBinding ActualWidth}"
                          local:ManualPassthroughProperty.Input="{local:Loc Lobby.IDS_ScreenReader_Voice_Status_Available}"
                          local:ManualPassthroughProperty.Allowed="{StaticResource A_Boolean_False}"
                          local:ScreenReader.Line="{Binding (local:ManualPassthroughProperty.Output), RelativeSource={RelativeSource Self}}"
                          local:ScreenReader.Event="OnChange"
                          local:ScreenReader.LineType="ItemState"/>
        <ControlTemplate.Triggers>
            <DataTrigger Binding="{Binding IsTalking}"
                         Value="False">
                <Setter TargetName="VoiceIcon"
                        Property="ImageSource"
                        Value="{StaticResource A_BitmapImage_Lobby_Mic}" />
                <Setter TargetName="VoiceIcon"
                        Property="Color"
                        Value="{StaticResource A_Color_VoiceChatIcon_Inactive}" />
                <Setter TargetName="VoiceIcon"
                        Property="local:ManualPassthroughProperty.Input"
                        Value="{local:Loc Lobby.IDS_ScreenReader_Voice_Status_Available}" />
            </DataTrigger>
            <DataTrigger Binding="{Binding IsTalking}"
                         Value="True">
                <Setter TargetName="VoiceIcon"
                        Property="ImageSource"
                        Value="{StaticResource A_BitmapImage_Lobby_Mic_Speaking}" />
                <Setter TargetName="VoiceIcon"
                        Property="Color"
                        Value="{StaticResource A_Color_VoiceChatIcon_Active}" />
                <Setter TargetName="VoiceIcon"
                        Property="local:ManualPassthroughProperty.Input"
                        Value="{local:Loc Lobby.IDS_ScreenReader_Voice_Status_Available}" />
            </DataTrigger>
            <DataTrigger Binding="{Binding HasVoiceAbility}"
                         Value="False">
                <Setter TargetName="VoiceIcon"
                        Property="ImageSource"
                        Value="{StaticResource A_BitmapImage_Lobby_Mic_Off}" />
                <Setter TargetName="VoiceIcon"
                        Property="Color"
                        Value="{StaticResource A_Color_VoiceChatIcon_Inactive}" />
                <Setter TargetName="VoiceIcon"
                        Property="local:ManualPassthroughProperty.Input"
                        Value="{local:Loc Lobby.IDS_ScreenReader_Voice_Status_Unavailable}" />
            </DataTrigger>
            <DataTrigger Binding="{Binding IsMuted}"
                         Value="True">
                <Setter TargetName="VoiceIcon"
                        Property="ImageSource"
                        Value="{StaticResource A_BitmapImage_Lobby_Mic_Muted}" />
                <Setter TargetName="VoiceIcon"
                        Property="Color"
                        Value="{StaticResource A_Color_VoiceChatIcon_Inactive}" />
                <Setter TargetName="VoiceIcon"
                        Property="local:ManualPassthroughProperty.Input"
                        Value="{local:Loc Lobby.IDS_ScreenReader_Voice_Status_Muted}" />
            </DataTrigger>
            <DataTrigger Binding="{Binding IsDrivatar}"
                         Value="True">
                <Setter TargetName="VoiceIcon"
                        Property="ImageSource"
                        Value="{StaticResource A_BitmapImage_Lobby_Drivatar}" />
                <Setter TargetName="VoiceIcon"
                        Property="Color"
                        Value="{StaticResource A_Color_VoiceChatIcon_Inactive}" />
                <Setter TargetName="VoiceIcon"
                        Property="local:ManualPassthroughProperty.Input"
                        Value="{local:Loc Lobby.IDS_ScreenReader_Voice_Status_Drivatar}" />
            </DataTrigger>
            <DataTrigger Binding="{Binding IsKeyboardFocusWithin, RelativeSource={RelativeSource FindAncestor, AncestorType=ListBoxItem}}" Value="True">
                <Setter TargetName="VoiceIcon"
                        Property="Color"
                        Value="{StaticResource A_Color_HighlightText}" />
                <Setter TargetName="VoiceIcon"
                        Property="local:ManualPassthroughProperty.Allowed"
                        Value="{Binding ShowVoice, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:PlayerListControl}}, FallbackValue={StaticResource A_Boolean_False}}" />
            </DataTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ImageSource x:Key="A_BitmapImage_Lobby_PartyMember">/ForzaUI;component/Textures/Anthem/Icons/ConvoyMember.png</ImageSource>

    <Style x:Key="A_Style_FZMaterial_PartyIcon"
           TargetType="{x:Type local:FZMaterial}">
        <Setter Property="ImageSource"
                Value="{StaticResource A_BitmapImage_Lobby_PartyMember}" />
        <Setter Property="Width"
                Value="26" />
        <Setter Property="Height"
                Value="26" />
        <Setter Property="Visibility"
                Value="{Binding InPartyWithLocalPlayer, Converter={StaticResource A_Converter_BoolToVis}}" />
        <Setter Property="Margin"
                Value="-2,0,0,0" />
        <Setter Property="Color" Value="{StaticResource A_Color_DriverListRowText}" />
        <Setter Property="Margin" Value="0" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsLocalPlayer}" Value="True">
                <Setter Property="Color"
                        Value="{StaticResource A_Color_LocalPlayer_Text}" />
            </DataTrigger>
            <DataTrigger Binding="{Binding IsKeyboardFocusWithin, RelativeSource={RelativeSource FindAncestor, AncestorType=ListBoxItem}}" Value="True">
                <Setter Property="Color"
                        Value="{StaticResource A_Color_HighlightText}" />
            </DataTrigger>

            <DataTrigger Binding="{Binding IsPartyLeader}"
                         Value="True">
                <Setter Property="Visibility"
                        Value="Collapsed" />
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="A_Style_DockPanel_MultiplayerGrid_InstructionalPanel"
           TargetType="{x:Type DockPanel}">
        <Setter Property="Margin"
                Value="5,0,0,0" />
        <Setter Property="Width"
                Value="356" />
    </Style>

    <Style x:Key="A_Style_FrameworkElement_MultiplayerGrid_InstructionalPanel"
           TargetType="FrameworkElement">
        <Setter Property="Visibility"
                Value="Collapsed" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding Instruction1, Converter={StaticResource A_StringVisConverter}}"
                         Value="{x:Static Visibility.Visible}">
                <Setter Property="Visibility"
                        Value="Visible" />
            </DataTrigger>
            <DataTrigger Binding="{Binding Instruction2, Converter={StaticResource A_StringVisConverter}}"
                         Value="{x:Static Visibility.Visible}">
                <Setter Property="Visibility"
                        Value="Visible" />
            </DataTrigger>
            <DataTrigger Binding="{Binding Instruction3, Converter={StaticResource A_StringVisConverter}}"
                         Value="{x:Static Visibility.Visible}">
                <Setter Property="Visibility"
                        Value="Visible" />
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <ControlTemplate x:Key="A_ControlTemplate_MultiplayerCountdown" TargetType="Control" >
        <DockPanel>
            <local:FZMaterial DockPanel.Dock="Left" Style="{StaticResource A_Style_FZMaterial_FlatPanel_LeftHeaderPanel}">
                <local:FZMaterial Width="54" Height="54" ImageSource="/ForzaUI;component/Textures/Anthem/Icons/Timer_Countdown.png"/>
            </local:FZMaterial>
            <local:FZMaterial x:Name="WhitePill" Style="{StaticResource A_Style_FZMaterial_FlatPanel_TileRight}">
                <Viewbox MaxHeight="{Binding ActualHeight, ElementName=WhitePill}"
                         HorizontalAlignment="Left" VerticalAlignment="Center">
                    <StackPanel Margin="12" Orientation="Horizontal">
                        <local:FZTextBlock Color="{StaticResource A_Color_Tile_Text}"
                               CapHeight="22"
                               FontFamily="Horizon_B"
                               VerticalAlignment="Center"
                               HorizontalAlignment="Left"
                               Text="{Binding TimerDisplayName, RelativeSource={RelativeSource AncestorType={x:Type local:NetworkCountdownControl}}}"
                               Margin="0,0,10,0" />
                        <local:FZTextBlock Text="{Binding TimeRemaining, RelativeSource={RelativeSource AncestorType={x:Type local:NetworkCountdownControl}}}"
                                Style="{StaticResource A_Style_FZTextBlock_Heading_Large}"
                                CapHeight="22"
                                MinWidth="34"
                                VerticalAlignment="Center" HorizontalAlignment="Left"
                                Color="{StaticResource A_Color_Network_CountdownText}" />
                    </StackPanel>
                </Viewbox>
            </local:FZMaterial>
        </DockPanel>
    </ControlTemplate>

    <ControlTemplate x:Key="A_ControlTemplate_MultiplayerCountdown_Absolute"
                     TargetType="{x:Type local:NetworkCountdownControl}">
        <Grid RenderTransformOrigin="0.5,1.0" VerticalAlignment="Bottom" Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}">
            <Decorator Margin="{StaticResource A_Thickness_Margin_ButtonBar}" MaxWidth="360" MaxHeight="54" VerticalAlignment="Bottom" HorizontalAlignment="Right">
                <Control Template="{StaticResource A_ControlTemplate_MultiplayerCountdown}"/>
            </Decorator>
        </Grid>
    </ControlTemplate>

    <Style x:Key="A_Style_NetworkCountdownControl_Base"
           TargetType="{x:Type local:NetworkCountdownControl}"
           BasedOn="{StaticResource A_Style_FrameworkElement_FadeOnlyTransition_0}">
        <Setter Property="Template"
                Value="{StaticResource A_ControlTemplate_MultiplayerCountdown_Absolute}" />
        <Setter Property="HorizontalAlignment"
                Value="Right" />
        <Setter Property="VerticalAlignment"
                Value="Bottom" />
        <Setter Property="Visibility"
                Value="Collapsed" />
        <Setter Property="local:DialogueControl.DialoguePosition"
                Value="{x:Static local:DialogueSubtitlePosition.NetworkCountdown}"/>
        <Setter Property="local:UIPageTransitionManager.TransitionTags"
                Value="NetworkCountdown" />
        <Style.Triggers>
            <Trigger Property="Visibility" Value="{x:Static Visibility.Collapsed}">
                <Setter Property="local:DialogueControl.DialoguePosition" Value="{x:Static local:DialogueSubtitlePosition.Normal}"/>
            </Trigger>
            <Trigger Property="Opacity" Value="0">
                <Setter Property="local:DialogueControl.DialoguePosition" Value="{x:Static local:DialogueSubtitlePosition.Normal}"/>
            </Trigger>

            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding IsNetworkConnected, RelativeSource={RelativeSource Self}}" Value="True"/>
                    <Condition Binding="{Binding SecondsRemaining, RelativeSource={RelativeSource Self}, Converter={StaticResource A_CompareConverter}, ConverterParameter=0}" Value="1"/>
                </MultiDataTrigger.Conditions>
                <Setter Property="Visibility" Value="Visible"/>
            </MultiDataTrigger>
        </Style.Triggers>
    </Style>
    
    <Style x:Key="A_Style_NetworkCountdownControl_BucketListSetup"
           TargetType="{x:Type local:NetworkCountdownControl}"
           BasedOn="{StaticResource A_Style_NetworkCountdownControl_Base}">
        <Setter Property="TimerDisplayName"
                Value="{local:Loc Lobby.IDS_Bucket_List_Options_Countdown}" />
    </Style>

    <Style x:Key="A_Style_NetworkCountdownControl_EventSetup"
           TargetType="{x:Type local:NetworkCountdownControl}"
           BasedOn="{StaticResource A_Style_NetworkCountdownControl_Base}">
        <Setter Property="TimerDisplayName"
                Value="{local:Loc Lobby.IDS_Event_Options_Countdown}" />
    </Style>

    <Style x:Key="A_Style_NetworkCountdownControl_RaceEnds"
           TargetType="{x:Type local:NetworkCountdownControl}"
           BasedOn="{StaticResource A_Style_NetworkCountdownControl_Base}">
        <Setter Property="TimerDisplayName"
                Value="{local:Loc Scoreboard.IDS_RaceEndsIn}" />
    </Style>

    <Style x:Key="A_Style_NetworkCountdownControl_TimeRemaining"
       TargetType="{x:Type local:NetworkCountdownControl}"
       BasedOn="{StaticResource A_Style_NetworkCountdownControl_Base}">
        <Setter Property="TimerDisplayName"
                Value="{local:Loc Scoreboard.IDS_TimeRemaining}" />
    </Style>

    <Style x:Key="A_Style_NetworkCountdownControl_EventStarting"
           TargetType="{x:Type local:NetworkCountdownControl}"
           BasedOn="{StaticResource A_Style_NetworkCountdownControl_Base}">
        <Setter Property="TimerDisplayName"
                Value="{local:Loc Lobby.IDS_EventStart_Countdown}" />
    </Style>

    <Style x:Key="A_Style_NetworkCountdownControl_VoteEnds"
           TargetType="{x:Type local:NetworkCountdownControl}"
           BasedOn="{StaticResource A_Style_NetworkCountdownControl_Base}">
        <Setter Property="TimerDisplayName"
                Value="{local:Loc Lobby.IDS_Destination_Voting_Ends_In}" />
    </Style>

</ResourceDictionary>