mirror of
https://github.com/4sval/FModel.git
synced 2026-09-07 00:56:29 -05:00
more discord rpc
This commit is contained in:
Submodule CUE4Parse updated: af4b6353b1...462298018f
@@ -38,7 +38,7 @@ namespace FModel.Services
|
||||
Assets = _staticAssets,
|
||||
Timestamps = _timestamps,
|
||||
Buttons = _buttons,
|
||||
State = $"{game.GetDescription()} - Idling"
|
||||
Details = $"{game.GetDescription()} - Idling"
|
||||
};
|
||||
|
||||
_client.OnReady += (_, args) => Log.Information("{Username}#{Discriminator} ({UserId}) is now ready", args.User.Username, args.User.Discriminator, args.User.ID);
|
||||
@@ -60,7 +60,7 @@ namespace FModel.Services
|
||||
_client.Invoke();
|
||||
}
|
||||
|
||||
public void UpdateButDontSavePresence(string details, string state)
|
||||
public void UpdateButDontSavePresence(string details = null, string state = null)
|
||||
{
|
||||
if (!_client.IsInitialized) return;
|
||||
_client.SetPresence(new RichPresence
|
||||
@@ -68,8 +68,8 @@ namespace FModel.Services
|
||||
Assets = _staticAssets,
|
||||
Timestamps = _timestamps,
|
||||
Buttons = _buttons,
|
||||
Details = details,
|
||||
State = state
|
||||
Details = details ?? _currentPresence.Details,
|
||||
State = state ?? _currentPresence.State
|
||||
});
|
||||
_client.Invoke();
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ using System.Windows.Data;
|
||||
using CSCore.CoreAudioAPI;
|
||||
using FModel.Extensions;
|
||||
using FModel.Framework;
|
||||
using FModel.Services;
|
||||
using FModel.Settings;
|
||||
using FModel.ViewModels.Commands;
|
||||
using FModel.Views.Resources.Controls;
|
||||
@@ -154,6 +155,7 @@ namespace FModel.ViewModels
|
||||
|
||||
public class AudioPlayerViewModel : ViewModel, ISource, IDisposable
|
||||
{
|
||||
private DiscordHandler _discordHandler => DiscordService.DiscordHandler;
|
||||
private static IWaveSource _waveSource;
|
||||
private static ISoundOut _soundOut;
|
||||
private Timer _sourceTimer;
|
||||
@@ -385,6 +387,7 @@ namespace FModel.ViewModels
|
||||
public void Play()
|
||||
{
|
||||
if (_soundOut == null || IsPlaying) return;
|
||||
_discordHandler.UpdateButDontSavePresence(null, $"Audio Player: {PlayedFile.FileName} ({PlayedFile.Duration:g})");
|
||||
_soundOut.Play();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media.Imaging;
|
||||
using CUE4Parse.UE4.Assets.Exports;
|
||||
@@ -34,6 +35,7 @@ namespace FModel.ViewModels
|
||||
public class MapViewerViewModel : ViewModel
|
||||
{
|
||||
private ThreadWorkerViewModel _threadWorkerView => ApplicationService.ThreadWorkerView;
|
||||
private DiscordHandler _discordHandler => DiscordService.DiscordHandler;
|
||||
|
||||
#region BINDINGS
|
||||
|
||||
@@ -267,13 +269,17 @@ namespace FModel.ViewModels
|
||||
|
||||
private void TriggerChange()
|
||||
{
|
||||
var layerCount = _bitmaps[_mapIndex].Count(x => x.Value.IsEnabled);
|
||||
var layerString = $"{layerCount} Layer{(layerCount > 1 ? "s" : "")}";
|
||||
switch (_mapIndex)
|
||||
{
|
||||
case 0:
|
||||
_discordHandler.UpdateButDontSavePresence(null, $"Map Viewer: Battle Royale ({layerString})");
|
||||
_mapImage = _brMiniMapImage;
|
||||
_layerImage = _brLayerImage;
|
||||
break;
|
||||
case 1:
|
||||
_discordHandler.UpdateButDontSavePresence(null, $"Map Viewer: Party Royale ({layerString})");
|
||||
_mapImage = _prMiniMapImage;
|
||||
_layerImage = _prLayerImage;
|
||||
break;
|
||||
@@ -569,6 +575,7 @@ namespace FModel.ViewModels
|
||||
}
|
||||
else if (uObject.TryGetValue(out bool endsTrial, "EndsTrial") && endsTrial)
|
||||
{
|
||||
path.LineTo(vector.X, vector.Y);
|
||||
c.DrawPath(path, _pathPaint);
|
||||
path = new SKPath();
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace FModel.Views
|
||||
{
|
||||
_applicationView.AudioPlayer.Stop();
|
||||
_applicationView.AudioPlayer.Dispose();
|
||||
DiscordService.DiscordHandler.UpdateToSavedPresence();
|
||||
}
|
||||
|
||||
private void OnDeviceSwap(object sender, SelectionChangedEventArgs e)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
xmlns:converters="clr-namespace:FModel.Views.Resources.Converters"
|
||||
xmlns:adonisUi="clr-namespace:AdonisUI;assembly=AdonisUI"
|
||||
xmlns:adonisControls="clr-namespace:AdonisUI.Controls;assembly=AdonisUI"
|
||||
WindowStartupLocation="CenterScreen" IconVisibility="Collapsed" SizeToContent="Width" ResizeMode="CanMinimize"
|
||||
WindowStartupLocation="CenterScreen" IconVisibility="Collapsed" SizeToContent="Width" ResizeMode="CanMinimize" Closing="OnClosing"
|
||||
Height="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenHeight}, Converter={converters:RatioConverter}, ConverterParameter='0.75'}"
|
||||
MinWidth="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenWidth}, Converter={converters:RatioConverter}, ConverterParameter='0.50'}">
|
||||
<adonisControls:AdonisWindow.Style>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.IO;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media.Imaging;
|
||||
@@ -24,6 +25,8 @@ namespace FModel.Views
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OnClosing(object sender, CancelEventArgs e) => DiscordService.DiscordHandler.UpdateToSavedPresence();
|
||||
|
||||
private void OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_applicationView.MapViewer.MapImage == null) return;
|
||||
|
||||
Reference in New Issue
Block a user