Skip to content

Commit

Permalink
Updated Discord Rich Presence
Browse files Browse the repository at this point in the history
  • Loading branch information
CPKreu committed Dec 6, 2021
1 parent 9c933b0 commit 136a7ed
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 45 deletions.
9 changes: 2 additions & 7 deletions PixiEditor/ViewModels/SubViewModels/Main/DiscordViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public bool Enabled
}
}

private bool showDocumentName = IPreferences.Current.GetPreference(nameof(ShowDocumentName), true);
private bool showDocumentName = IPreferences.Current.GetPreference(nameof(ShowDocumentName), false);

public bool ShowDocumentName
{
Expand Down Expand Up @@ -117,7 +117,7 @@ public void UpdatePresence(Document document)
{
richPresence.WithTimestamps(new Timestamps(document.OpenedUTC));

richPresence.Details = ShowDocumentName ? $"Editing {document.Name}".Limit(128) : "Editing something (incognito)";
richPresence.Details = ShowDocumentName ? $"Editing {document.Name}".Limit(128) : "Editing an image";

string state = string.Empty;

Expand Down Expand Up @@ -154,11 +154,6 @@ private static RichPresence NewDefaultRP()
{
Details = "Staring at absolutely",
State = "nothing",
Buttons = new Button[]
{
new Button() { Label = "Download PixiEditor", Url = "https://www.github.com/PixiEditor/PixiEditor/releases/latest" },
new Button() { Label = "Watch trailer", Url = "https://youtu.be/QKnXBUY0Pqk" }
},

Assets = new Assets
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public bool EnableRichPresence
}
}

private bool showDocumentName = GetPreference(nameof(ShowDocumentName), true);
private bool showDocumentName = GetPreference(nameof(ShowDocumentName), false);

public bool ShowDocumentName
{
Expand Down Expand Up @@ -57,7 +57,7 @@ public string DetailPreview
{
get
{
return ShowDocumentName ? $"Editing coolPixelArt.pixi" : "Editing something (incognito)";
return ShowDocumentName ? $"Editing coolPixelArt.pixi" : "Editing an image";
}
}

Expand Down
67 changes: 31 additions & 36 deletions PixiEditor/Views/UserControls/DiscordRPPreview.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,61 +7,56 @@
mc:Ignorable="d"
d:DesignHeight="280" d:DesignWidth="300"
x:Name="uc">
<UserControl.Resources>
<BoolToVisibilityConverter x:Key="BoolToVisibility"/>
<converters:BrushTuple FirstBrush="#7289da" SecondBrush="#202225" x:Key="BackgroundBrushTuple"/>
<converters:BrushTuple FirstBrush="White" SecondBrush="#7289da" x:Key="BotLabelTuple"/>
<converters:BrushTuple FirstBrush="#7289da" SecondBrush="White" x:Key="BotTextTuple"/>
<converters:BrushTuple FirstBrush="White" SecondBrush="#b9bbbe" x:Key="DiscriminatorTuple"/>
</UserControl.Resources>
<Grid>
<Grid.OpacityMask>
<VisualBrush Visual="{Binding ElementName=OutsideBorder}"/>
</Grid.OpacityMask>
<Border CornerRadius="5" Background="{Binding ElementName=uc, Path=IsPlaying, Converter={converters:BoolToBrushConverter}, ConverterParameter={StaticResource BackgroundBrushTuple}}" x:Name="OutsideBorder"/>
<Grid x:Name="background">
<Grid.RowDefinitions>
<Border CornerRadius="5" Background="#18191C" x:Name="OutsideBorder">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>

<Grid VerticalAlignment="Center">
<Grid>
<Border CornerRadius="5,5,0,0" Background="#e3042c" Height="60" VerticalAlignment="Top"/>
<StackPanel>
<Grid Width="80" Height="80" Margin="20">
<Image Source="{Binding ElementName=uc, Path=UserSource}"/>
<Border Height="30" Width="30" Background="#FF43B581" CornerRadius="90" BorderThickness="5"
BorderBrush="{Binding ElementName=uc, Path=IsPlaying, Converter={converters:BoolToBrushConverter}, ConverterParameter={StaticResource BackgroundBrushTuple}}">
<Border.RenderTransform>
<TransformGroup>
<TranslateTransform X="27" Y="27"></TranslateTransform>
</TransformGroup>
</Border.RenderTransform>
</Border>
</Grid>
<Border HorizontalAlignment="Left" Width="85" Height="85" Margin="15" BorderThickness="6" BorderBrush="#18191C" CornerRadius="90">
<Grid>
<Image Source="{Binding ElementName=uc, Path=UserSource}"/>
<Border Height="30" Width="30" Background="#FF43B581" CornerRadius="90" BorderThickness="6"
BorderBrush="#18191C">
<Border.RenderTransform>
<TransformGroup>
<TranslateTransform X="27" Y="27"></TranslateTransform>
</TransformGroup>
</Border.RenderTransform>
</Border>
</Grid>
</Border>

<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,0,0,15">
<TextBlock Foreground="White" FontSize="16" FontWeight="SemiBold">PixiBot</TextBlock>
<TextBlock Foreground="{Binding ElementName=uc, Path=IsPlaying, Converter={converters:BoolToBrushConverter}, ConverterParameter={StaticResource DiscriminatorTuple}}" FontSize="16">#8523</TextBlock>
<Border CornerRadius="3" BorderThickness="1" Background="{Binding ElementName=uc, Path=IsPlaying, Converter={converters:BoolToBrushConverter}, ConverterParameter={StaticResource BotLabelTuple}}" Margin="5,0,0,0" VerticalAlignment="Center">
<TextBlock Foreground="{Binding ElementName=uc, Path=IsPlaying, Converter={converters:BoolToBrushConverter}, ConverterParameter={StaticResource BotTextTuple}}" FontSize="12" Margin="4,2,4,2" FontWeight="Medium">BOT</TextBlock>
<StackPanel Orientation="Horizontal" Margin="15,0">
<TextBlock Foreground="White" FontSize="22" FontWeight="SemiBold">PixiBot</TextBlock>
<TextBlock Foreground="#b9bbbe" FontSize="22" FontWeight="SemiBold">#8523</TextBlock>
<Border CornerRadius="3" BorderThickness="1" Background="#5865f2" Margin="5,0,0,0" VerticalAlignment="Center">
<TextBlock Foreground="White" FontSize="12" Margin="4,2,4,2" FontWeight="Medium">BOT</TextBlock>
</Border>
</StackPanel>
</StackPanel>
</Grid>
<Grid Grid.Row="1" Background="#0D000000" Visibility="{Binding ElementName=uc, Path=IsPlaying, Converter={StaticResource BoolToVisibility}}">
<StackPanel Orientation="Vertical" Margin="15">
<Grid Grid.Row="1" Visibility="{Binding ElementName=uc, Path=IsPlaying, Converter={BoolToVisibilityConverter}}">
<StackPanel Orientation="Vertical" Margin="15,0,15,15">
<Grid Margin="0,15" Background="#262729" Height="1"/>
<TextBlock FontWeight="Bold" FontSize="12" Foreground="White" Margin="0,0,0,10">PLAYING A "GAME"</TextBlock>
<StackPanel Orientation="Horizontal">
<Image Source="../../Images/PixiEditorLogo.png" Height="70"/>
<StackPanel Margin="15,0,0,0" VerticalAlignment="Center">
<TextBlock Foreground="White" FontSize="12" FontWeight="SemiBold">PixiEditor</TextBlock>
<TextBlock Foreground="White" FontSize="12" Text="{Binding ElementName=uc, Path=Detail}" Visibility="{Binding ElementName=uc, Path=Detail, Converter={converters:EmptyStringToVisibilityConverter}}"/>
<TextBlock Foreground="White" FontSize="12" Text="{Binding ElementName=uc, Path=State}" Visibility="{Binding ElementName=uc, Path=State, Converter={converters:EmptyStringToVisibilityConverter}}"/>
<TextBlock Foreground="White" FontSize="12">00:00 elapsed</TextBlock>
<TextBlock Foreground="White" FontSize="12" Text="{Binding ElementName=uc, Path=Detail}" Visibility="{Binding ElementName=uc, Path=Detail, Converter={converters:EmptyStringToVisibilityConverter}}"/>
<TextBlock Foreground="White" FontSize="12" Text="{Binding ElementName=uc, Path=State}" Visibility="{Binding ElementName=uc, Path=State, Converter={converters:EmptyStringToVisibilityConverter}}"/>
<TextBlock Foreground="White" FontSize="12">00:00 elapsed</TextBlock>
</StackPanel>
</StackPanel>
</StackPanel>
</Grid>
</Grid>
</Grid>
</Border>
</Grid>
</UserControl>

0 comments on commit 136a7ed

Please sign in to comment.