<UserControl
    DataContext="{Binding (HUDData.Data), RelativeSource={RelativeSource Self}}" 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"
    mc:Ignorable="d"
    xmlns:local="clr-namespace:ForzaUI" 
    xmlns:System="clr-namespace:System;assembly=mscorlib"
    x:Class="ForzaUI.HUDHideSeekCompassControl"
    HorizontalAlignment="Center"
    VerticalAlignment="Bottom"
    x:Name="UserControl">

    <UserControl.Resources>
        <Color x:Key="A_RadialBar_Background_Color">#FF1E1E1E</Color>

        <local:FZMaterialPresetRadialBar x:Key="A_FZMaterialPresetRadialBar_Base"
                                        TargetRatio="1.0"
                                        TipGlowFade="0.0"
                                        ShadowIntensity="0"
                                        AngleAmount="0" />

        <CornerRadius x:Key="H_CornerRadius_All_6px">6,6,6,6</CornerRadius>
        <FZMaterialPresetRoundtangle CornerRadius="{StaticResource H_CornerRadius_All_6px}"
                                         x:Key="H_Roundtangle_Outer_6px" />

        <local:MappingConverter x:Key="A_Converter_IsTargetZoneLocked_To_DimOpacity">
            <local:MappingConverterEntry Key="True" Value="0.5" />
            <local:MappingConverterEntry Key="False" Value="1" />
        </local:MappingConverter>

        <local:MappingConverter x:Key="A_Converter_IsTargetZoneLocked_To_Visible">
            <local:MappingConverterEntry Key="True" Value="{Static Visibility.Visible}" />
            <local:MappingConverterEntry Key="False" Value="{Static Visibility.Collapsed}" />
        </local:MappingConverter>

        <local:MappingConverter x:Key="A_Converter_IsTargetZoneLocked_To_Visible_Inverse">
            <local:MappingConverterEntry Key="True" Value="{Static Visibility.Collapsed}" />
            <local:MappingConverterEntry Key="False" Value="{Static Visibility.Visible}" />
        </local:MappingConverter>

        <Style x:Key="A_Style_FZTextBlock_HideSeekDesc"
               TargetType="local:FZTextBlock"
               BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}">
            <Setter Property="CapHeight" Value="16" />
            <Setter Property="Color" Value="{StaticResource H_Color_Primary_White}" />
            <Setter Property="Effect" Value="{StaticResource A_DropShadowEffect_DefaultHud}" />
            <Setter Property="RenderTransform" Value="{StaticResource A_Transform_Italic}" />
        </Style>

        <Style x:Key="A_Style_FZTextBlock_HideSeekDesc_LockedRemainingTime"
               TargetType="local:FZTextBlock"
               BasedOn="{StaticResource A_Style_FZTextBlock_HideSeekDesc}">
            <Setter Property="CapHeight" Value="22" />
        </Style>

        <Double x:Key="A_Double_Minus360">-360</Double>
        <Double x:Key="A_Double_Two">2</Double>

        <MultiConverter x:Key="H_CompassRatio_To_BarAngle">
            <MultiConverterEntry Converter="{MathOperationConverter Operation=Multiply}"
                                 Parameter="{StaticResource A_Double_Minus360}"
                                 TargetType="float" />
            <MultiConverterEntry Converter="{MathOperationConverter Operation=Divide}"
                                 Parameter="{StaticResource A_Double_Two}"
                                 TargetType="float" />
        </MultiConverter>

        <KeyTime x:Key="A_KeyTime_Fill_Start">0:0:0</KeyTime>
        <local:OffsetKeyTime x:Key="A_KeyTime_Fill_End"
                             KeyTime="{StaticResource A_KeyTime_Fill_Start}"
                             Offset="0:0:0.45"/>
        <local:OffsetKeyTime x:Key="A_KeyTime_Pulse_Start"
                             KeyTime="{StaticResource A_KeyTime_Fill_End}" />
        <local:OffsetKeyTime x:Key="A_KeyTime_Pulse_Opacity_Start"
                             KeyTime="{StaticResource A_KeyTime_Pulse_Start}"
                             Offset="0:0:0.20" />
        <local:OffsetKeyTime x:Key="A_KeyTime_Pulse_End"
                             KeyTime="{StaticResource A_KeyTime_Pulse_Start}"
                             Offset="0:0:0.50" />

        <CubicEase x:Key="A_EasingFunction_EaseIn" EasingMode="EaseIn"/>
        <CubicEase x:Key="A_EasingFunction_EaseOut" EasingMode="EaseOut"/>

        <local:UIStoryboard x:Key="A_Storyboard_Compass_CloseIn" FillBehavior="Stop">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Preset.Ratio" Storyboard.TargetName="{x:Null}">
                <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Fill_Start}" Value="0.5"/>
                <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Fill_End}" Value="1" EasingFunction="{local:ExponentialEasing EasingMode=EaseIn}"/>
            </DoubleAnimationUsingKeyFrames>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Preset.BackgroundColor" Storyboard.TargetName="{x:Null}">
                <DiscreteObjectKeyFrame KeyTime="{StaticResource A_KeyTime_Fill_Start}" Value="{StaticResource A_Color_ClearGlass}"/>
                <DiscreteObjectKeyFrame KeyTime="{StaticResource A_KeyTime_Fill_End}" Value="{StaticResource H_Color_Primary_White}"/>
            </ObjectAnimationUsingKeyFrames>
        </local:UIStoryboard>

        <local:UIStoryboard x:Key="A_Storyboard_Compass_CloseOut" FillBehavior="Stop">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Preset.Ratio" Storyboard.TargetName="{x:Null}">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0.0" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.45" Value="0.5" EasingFunction="{local:ExponentialEasing EasingMode=EaseOut}"/>
            </DoubleAnimationUsingKeyFrames>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Preset.BackgroundColor" Storyboard.TargetName="{x:Null}">
                <DiscreteObjectKeyFrame KeyTime="0:0:0.0" Value="{StaticResource A_Color_ClearGlass}"/>
            </ObjectAnimationUsingKeyFrames>
        </local:UIStoryboard>

        <ExponentialEase x:Key="A_EasingFunction_EaseOutExpo" EasingMode="EaseOut" />

        <local:UIStoryboard x:Key="A_Storyboard_Compass_CloseIn_Glow" FillBehavior="Stop">
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="{x:Null}">
                <DiscreteObjectKeyFrame KeyTime="{StaticResource A_KeyTime_Pulse_Start}" Value="{x:Static Visibility.Visible}" />
                <DiscreteObjectKeyFrame KeyTime="{StaticResource A_KeyTime_Pulse_End}" Value="{x:Static Visibility.Collapsed}" />
            </ObjectAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="{x:Null}">
                <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Pulse_Opacity_Start}" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Pulse_End}" Value="0" EasingFunction="{StaticResource A_EasingFunction_EaseOutExpo}"/>
            </DoubleAnimationUsingKeyFrames>

            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="{x:Null}">
                <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Pulse_Start}" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Pulse_End}" Value="1.30" EasingFunction="{StaticResource A_EasingFunction_EaseOutExpo}" />
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="{x:Null}">
                <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Pulse_Start}" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Pulse_End}" Value="1.30" EasingFunction="{StaticResource A_EasingFunction_EaseOutExpo}" />
            </DoubleAnimationUsingKeyFrames>

            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Preset.Softness" Storyboard.TargetName="{x:Null}">
                <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Pulse_Start}" Value="1"/>
                <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Pulse_End}" Value="20" EasingFunction="{StaticResource A_EasingFunction_EaseOutExpo}" />
            </DoubleAnimationUsingKeyFrames>
        </local:UIStoryboard>

        <Style x:Key="A_Style_FZMaterial_CompassIndicator"
               TargetType="local:FZMaterial">
            <Setter Property="Preset">
                <Setter.Value>
                    <local:FZMaterialPresetRadialBar BasedOn="{StaticResource A_FZMaterialPresetRadialBar_Base}"
                                                     InnerRingPosition="0.575"
                                                     BarWidth="0.35"
                                                     BackgroundColor="#00FFFFFF"
                                                     Ratio="{Binding CompassRatio}"/>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <DataTrigger Binding="{Binding CompassState}" Value="{x:Static local:CompassStateEnum.Close}">
                    <DataTrigger.EnterActions>
                        <BeginStoryboard Storyboard="{StaticResource A_Storyboard_Compass_CloseIn}"/>
                    </DataTrigger.EnterActions>
                    <DataTrigger.ExitActions>
                        <BeginStoryboard Storyboard="{StaticResource A_Storyboard_Compass_CloseOut}"/>
                    </DataTrigger.ExitActions>
                    <Setter Property="Preset">
                        <Setter.Value>
                            <local:FZMaterialPresetRadialBar BasedOn="{StaticResource A_FZMaterialPresetRadialBar_Base}"
                                 InnerRingPosition="0.575"
                                 BarWidth="0.35"
                                 BackgroundColor="{StaticResource H_Color_Primary_White}"
                                 Ratio="1"/>
                        </Setter.Value>
                    </Setter>
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="A_Style_FZMaterial_CompassGlow"
               TargetType="local:FZMaterial">
            <Setter Property="Width" Value="170" />
            <Setter Property="Height" Value="170" />
            <Setter Property="HorizontalAlignment" Value="Center" />
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="Preset">
                <Setter.Value>
                    <FZMaterialPresetRoundtangleStroke Thickness="35" CornerRadius="85" AlphaMode="Additive"/>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <DataTrigger Binding="{Binding CompassState}" Value="{x:Static local:CompassStateEnum.Close}">
                    <DataTrigger.EnterActions>
                        <BeginStoryboard Storyboard="{StaticResource A_Storyboard_Compass_CloseIn_Glow}"/>
                    </DataTrigger.EnterActions>
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <KeyTime x:Key="A_KeyTime_Flashing_Start">0:0:0</KeyTime>
        <local:OffsetKeyTime x:Key="A_KeyTime_Flashing_MidPoint"
                     KeyTime="{StaticResource A_KeyTime_Flashing_Start}"
                     Offset="0:0:0.200"/>
        <local:OffsetKeyTime x:Key="A_KeyTime_Flashing_End"
                     KeyTime="{StaticResource A_KeyTime_Flashing_MidPoint}"
                     Offset="0:0:0.600" />

        <ControlTemplate x:Key="A_ControlTemplate_SeekerDetection_ProgressBar_Template"
                          TargetType="{Type ProgressBar}">
            <Grid x:Name="PART_Track"
                  Height="10"
                  Width="250">
                    <local:FZMaterial ImageSource="/ForzaUI;component/Textures/Data_Bound/Hide_Seek/Compass/progress_bars/blank_bar.png" />
                    <Decorator x:Name="HiderDetectionIndicator">
                        <Decorator x:Name="PART_Indicator" ClipToBounds="True" HorizontalAlignment="Left">
                            <local:FZMaterial ImageSource="/ForzaUI;component/Textures/Data_Bound/Hide_Seek/Compass/progress_bars/seeker_fill.png"
                                                          Color="{StaticResource H_Color_Primary_White}"
                                                          Preset="{StaticResource H_Roundtangle_Outer_6px}"
                                                          Width="250" />
                        </Decorator>
                    </Decorator>
                </Grid>
                <ControlTemplate.Triggers>
                    <DataTrigger Binding="{Binding HiderDetectionAnimationState}" Value="{x:Static local:HiderDetectionAnimationState.Animating}">
                        <DataTrigger.EnterActions>
                            <BeginUIStoryboard x:Name="BeginStoryboard_AnimateFlashing">
                                <BeginUIStoryboard.Storyboard>
                                    <local:UIStoryboard RepeatBehavior="Forever">
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HiderDetectionIndicator">
                                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Flashing_Start}" Value="0" />
                                            <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Flashing_MidPoint}" Value="1"/>
                                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Flashing_MidPoint}" Value="1" />
                                            <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Flashing_End}"  Value="0" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </local:UIStoryboard>
                                </BeginUIStoryboard.Storyboard>
                            </BeginUIStoryboard>
                        </DataTrigger.EnterActions>
                        <DataTrigger.ExitActions>
                            <StopStoryboard BeginStoryboardName="BeginStoryboard_AnimateFlashing" />
                        </DataTrigger.ExitActions>
                    </DataTrigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>

        <ControlTemplate x:Key="A_ControlTemplate_SeekerDetection_ProgressBar">
            <DockPanel>
                <local:FZMaterial DockPanel.Dock="Right"
                                  ImageSource="/ForzaUI;component/Textures/Data_Bound/Hide_Seek/Compass/progress_bars/detection_icon.png" 
                                  Height="10"
                                  Width="19"
                                  Margin="-20,-3,0,0"/>
                <FZTextBlock DockPanel.Dock="Top"
                             Style="{StaticResource A_Style_FZTextBlock_HideSeekDesc}"
                             Text="{Loc HideSeek.IDS_ProgressStatus_SeekerProgress}" 
                             TextAlignment="Left"/>
                <Decorator DockPanel.Dock="Top"
                           Height="10" />
                <ProgressBar DockPanel.Dock="Top"
                             Value="{Binding HiderDetection}"
                             Minimum="0"
                             Maximum="{StaticResource H_Double_One}"
                             Template="{StaticResource A_ControlTemplate_SeekerDetection_ProgressBar_Template}">
                </ProgressBar>
            </DockPanel>
        </ControlTemplate>

        <ControlTemplate x:Key="A_ControlTemplate_HidersProgress_ProgressBar">
            <DockPanel>
                <local:FZMaterial DockPanel.Dock="Right"
                                  ImageSource="/ForzaUI;component/Textures/Data_Bound/Hide_Seek/Compass/progress_bars/progress_icon.png" 
                                  Opacity="{Binding IsTargetZoneLocked, Converter={StaticResource A_Converter_IsTargetZoneLocked_To_DimOpacity}}"
                                  Height="10"
                                  Width="15"
                                  Margin="-20,-3,0,0"/>
                <FZTextBlock DockPanel.Dock="Top"
                             Style="{StaticResource A_Style_FZTextBlock_HideSeekDesc}"
                             Opacity="{Binding IsTargetZoneLocked, Converter={StaticResource A_Converter_IsTargetZoneLocked_To_DimOpacity}}"
                             Text="{Loc HideSeek.IDS_ProgressStatus_HiderProgress}" />
                <Decorator DockPanel.Dock="Top"
                           Height="10" />
                <ProgressBar DockPanel.Dock="Top"
                             Value="{Binding HiderProgressToGoal}"
                             Minimum="0"
                             Maximum="{StaticResource H_Double_One}">
                    <ProgressBar.Template>
                        <ControlTemplate TargetType="{Type ProgressBar}">
                            <Grid x:Name="PART_Track" 
                                  Height="10"
                                  Width="250">
                                <local:FZMaterial Visibility="{Binding IsTargetZoneLocked, Converter={StaticResource A_Converter_IsTargetZoneLocked_To_Visible}}"
                                                  Preset="{StaticResource H_Roundtangle_Outer_6px}"
                                                  Color="{StaticResource H_Color_Glass_Purple_20pc}"
                                                  Opacity="0.5"/>
                                <Grid Visibility="{Binding IsTargetZoneLocked, Converter={StaticResource A_Converter_IsTargetZoneLocked_To_Visible_Inverse}}">
                                    <local:FZMaterial ImageSource="/ForzaUI;component/Textures/Data_Bound/Hide_Seek/Compass/progress_bars/blank_bar.png" />
                                    <Decorator x:Name="PART_Indicator" ClipToBounds="True" HorizontalAlignment="Left">
                                        <local:FZMaterial ImageSource="/ForzaUI;component/Textures/Data_Bound/Hide_Seek/Compass/progress_bars/hider_fill.png"
                                                          Color="{StaticResource H_Color_Primary_White}"
                                                          Preset="{StaticResource H_Roundtangle_Outer_6px}"
                                                          Width="250" />
                                    </Decorator>
                                </Grid>
                            </Grid>
                        </ControlTemplate>
                    </ProgressBar.Template>
                </ProgressBar>
            </DockPanel>
        </ControlTemplate>

        <local:MappingConverter x:Key="A_MappingConverter_DisabledStateToVisible" Default="{Static Visibility.Collapsed}">
            <local:MappingConverterEntry Key="{x:Static local:CompassStateEnum.Disabled}" Value="{Static Visibility.Visible}" />
        </local:MappingConverter>

        <local:MappingConverter x:Key="A_MappingConverter_DisabledStateToVisible_Inverse" Default="{Static Visibility.Visible}">
            <local:MappingConverterEntry Key="{x:Static local:CompassStateEnum.Disabled}" Value="{Static Visibility.Collapsed}" />
        </local:MappingConverter>

        <local:MappingConverter x:Key="A_MappingConverter_IsHider_To_Visible" Default="{Static Visibility.Hidden}">
            <local:MappingConverterEntry Key="True" Value="{Static Visibility.Visible}" />
        </local:MappingConverter>

        <local:MappingConverter x:Key="A_MappingConverter_IsHider_To_Visible_Inverse" Default="{Static Visibility.Visible}">
            <local:MappingConverterEntry Key="True" Value="{Static Visibility.Hidden}" />
        </local:MappingConverter>

        <local:MappingConverter x:Key="A_MappingConverter_IsHider_To_SeekerDetectionBarMargin">
            <local:MappingConverterEntry Key="True" Value="58,20,0,0" />
            <local:MappingConverterEntry Key="False" Value="30,20,0,0" />
        </local:MappingConverter>

        <local:MappingConverter x:Key="A_MappingConverter_IsHider_To_HidersProgressBarMargin">
            <local:MappingConverterEntry Key="True" Value="0,20,58,0" />
            <local:MappingConverterEntry Key="False" Value="0,20,30,0" />
        </local:MappingConverter>

        <Style x:Key="A_Style_FZMaterial_BackgroundBacking"
               TargetType="local:FZMaterial">
            <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Data_Bound/Hide_Seek/Compass/backing/seeker_backing.png" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding IsLocalPlayerHider}" Value="True">
                    <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Data_Bound/Hide_Seek/Compass/backing/hider_backing.png" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
        
        <!--
            The infrastructure below is needed to adapt the rotation angle for the zpanel to the subtitles that go to occupy the same space in the screen.
            The main problem is that the rotation, by not being an ortographic translation, has a different appearance based on the position on the screen.
            With this, we can compensate the angle using the subtitle height. It is also a bit more complex becuse the subtitle position is also animated, 
            so it increases with time. This is why we need to use the BlendValue.
        -->

        <Double x:Key="A_Double_AngleDifferenceDoubleLineSub">3.5</Double>
        <Double x:Key="A_Double_HeightDoubleLineSub">136.5</Double>
        <Double x:Key="A_Double_MinusSeventyTwo">-72</Double>

        <MultiConverter x:Key="H_SubtitleHeight_To_AngleDifference">
            <MultiConverterEntry Converter="{MathOperationConverter Operation=Multiply}"
                         Parameter="{StaticResource A_Double_AngleDifferenceDoubleLineSub}"
                         TargetType="float" />
            <MultiConverterEntry Converter="{MathOperationConverter Operation=Divide}"
                                 Parameter="{StaticResource A_Double_HeightDoubleLineSub}"
                                 TargetType="float" />
        </MultiConverter>

        <MultiConverter x:Key="H_SubtitleHeight_To_CompassXTilt">
            <MultiConverterEntry Converter="{MathOperationConverter Operation=Multiply}"
                                 Parameter="{Binding A, Source={StaticResource A_GlobalStorageValue_SubtitlesHeight_BlendValue}, Converter={StaticResource H_SubtitleHeight_To_AngleDifference}}"
                                 TargetType="float" />
            <MultiConverterEntry Converter="{MathOperationConverter Operation=Add}"
                                 Parameter="{StaticResource A_Double_MinusSeventyTwo}"
                                 TargetType="float" />  
        </MultiConverter>

        <Style x:Key="A_Style_Grid_CompassElement"
               TargetType="Grid">
            <Setter Property="local:ZPanel.Transform">
                <Setter.Value>
                    <XRotation Angle="{StaticResource A_Double_MinusSeventyTwo}"/>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <DataTrigger Binding="{Binding A, Source={StaticResource A_GlobalStorageValue_SubtitlesHeight_BlendValue}, Converter={StaticResource A_CompareConverter}, ConverterParameter=0}"
                             Value="{x:Static local:CompareResult.GreaterThan}">
                    <Setter Property="local:ZPanel.Transform">
                        <Setter.Value>
                            <XRotation Angle="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:HUDHideSeekCompassControl}}, Converter={StaticResource H_SubtitleHeight_To_CompassXTilt}}"/>
                        </Setter.Value>
                    </Setter>
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </UserControl.Resources>

    <Grid x:Name="PART_LayoutRoot">
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="VisualStateGroup">
                <VisualStateGroup.Transitions>
                    <VisualTransition GeneratedDuration="0:0:0.0"/>
                </VisualStateGroup.Transitions>
                <VisualState x:Name="Hidden">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="PART_LayoutRoot">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="Shown"/>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Grid HorizontalAlignment="Center"
              VerticalAlignment="Center">
            <local:FZMaterial Width="760"
                              Height="150"
                              Style="{StaticResource A_Style_FZMaterial_BackgroundBacking}" />
            <Grid Width="170"
                  Height="170"
                  Margin="0,0,0,12"
                  Visibility="{Binding IsLocalPlayerHider, Converter={StaticResource A_MappingConverter_IsHider_To_Visible_Inverse}}"
                  Style="{StaticResource A_Style_Grid_CompassElement}"
                  ZPanel.TransformOrigin="0.5,0.5">
                <Grid RenderTransformOrigin="0.5, 0.5">
                    <Grid.RenderTransform>
                        <TransformGroup>
                            <RotateTransform Angle="{Binding Preset.Ratio, ElementName=CompassIndicator, Converter={StaticResource H_CompassRatio_To_BarAngle}}"/>
                        </TransformGroup>
                    </Grid.RenderTransform>
                    <local:FZMaterial>
                        <local:FZMaterial.Preset>
                            <local:FZMaterialPresetRadialBar BasedOn="{StaticResource A_FZMaterialPresetRadialBar_Base}"
                            InnerRingPosition="0.5"
                            BarWidth="0.5"
                            BackgroundColor="{StaticResource H_Color_Primary_White}"
                            Ratio="0"/>
                        </local:FZMaterial.Preset>
                    </local:FZMaterial>
                    <local:FZMaterial>
                        <local:FZMaterial.Preset>
                            <local:FZMaterialPresetRadialBar BasedOn="{StaticResource A_FZMaterialPresetRadialBar_Base}"
                            InnerRingPosition="0.55"
                            BarWidth="0.4"
                            BackgroundColor="{StaticResource A_RadialBar_Background_Color}"
                            Ratio="0"/>
                        </local:FZMaterial.Preset>
                    </local:FZMaterial>
                    <local:FZMaterial Color="{StaticResource H_Color_Primary_White}"
                                      Style="{StaticResource A_Style_FZMaterial_CompassIndicator}"
                                      RenderTransformOrigin="0.5,0.5"
                                      x:Name="CompassIndicator"
                                      Visibility="{Binding CompassState, Converter={StaticResource A_MappingConverter_DisabledStateToVisible_Inverse}}">
                        <local:FZMaterial.RenderTransform>
                            <RotateTransform Angle="{Binding Angle}" />
                        </local:FZMaterial.RenderTransform>
                    </local:FZMaterial>
                </Grid>
                <local:FZMaterial Color="{StaticResource H_Color_Primary_White}"
                                  Style="{StaticResource A_Style_FZMaterial_CompassGlow}"
                                  Visibility="Collapsed"
                                  RenderTransformOrigin="0.5,0.5">
                    <FZMaterial.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform/>
                        </TransformGroup>
                    </FZMaterial.RenderTransform>
                </local:FZMaterial>
                <local:FZMaterial ImageSource="/ForzaUI;component/Textures/Data_Bound/Hide_Seek/Compass/compass_blocked.png"
                                      Width="180"
                                      Height="180"
                                      Margin="-5"
                                      Color="{StaticResource H_Color_Primary_White}"
                                      Visibility="{Binding CompassState, Converter={StaticResource A_MappingConverter_DisabledStateToVisible}}" />
            </Grid>
            <DockPanel HorizontalAlignment="Stretch"
                       Margin="0,0,0,0">
                <Control DockPanel.Dock="Left"
                         VerticalAlignment="Center"
                         Margin="{Binding IsLocalPlayerHider, Converter={StaticResource A_MappingConverter_IsHider_To_SeekerDetectionBarMargin}}"
                         Template="{StaticResource A_ControlTemplate_SeekerDetection_ProgressBar}" />
                <Control DockPanel.Dock="Right"
                         VerticalAlignment="Center"
                         HorizontalAlignment="Right"
                         Margin="{Binding IsLocalPlayerHider, Converter={StaticResource A_MappingConverter_IsHider_To_HidersProgressBarMargin}}"
                         Template="{StaticResource A_ControlTemplate_HidersProgress_ProgressBar}" />
            </DockPanel>
            <Decorator Visibility="{Binding IsLocalPlayerHider, Converter={StaticResource A_MappingConverter_IsHider_To_Visible_Inverse}}">
                <FZTextBlock HorizontalAlignment="Center"
                             VerticalAlignment="Center"
                             Margin="0,0,0,14"
                             Style="{StaticResource A_Style_FZTextBlock_HideSeekDesc_LockedRemainingTime}"
                             Text="{Binding CompassBlockedRemainingTime}"
                             Visibility="{Binding CompassState, Converter={StaticResource A_MappingConverter_DisabledStateToVisible}}" />
            </Decorator>
        </Grid>
    </Grid>
</UserControl>