mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
Steam丰富状态
This commit is contained in:
parent
d9b3a7917b
commit
8629c59091
@ -2,6 +2,7 @@
|
||||
using CSCore.CoreAudioAPI;
|
||||
using LinePutScript;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using Steamworks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@ -401,6 +402,33 @@ namespace VPet_Simulator.Windows
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void Handle_Steam(Main obj)
|
||||
{
|
||||
if (Core.Save.Mode == GameSave.ModeType.Ill)
|
||||
{
|
||||
SteamFriends.SetRichPresence("steam_display", "#Status_Ill");
|
||||
}
|
||||
else
|
||||
{
|
||||
SteamFriends.SetRichPresence("mode", (Core.Save.Mode.ToString() + "ly").Translate());
|
||||
switch (obj.State)
|
||||
{
|
||||
case Main.WorkingState.Work:
|
||||
SteamFriends.SetRichPresence("work", obj.nowWork.Name.Translate());
|
||||
SteamFriends.SetRichPresence("steam_display", "#Status_Work");
|
||||
break;
|
||||
case Main.WorkingState.Sleep:
|
||||
SteamFriends.SetRichPresence("steam_display", "#Status_Sleep");
|
||||
break;
|
||||
default:
|
||||
if (obj.DisplayType.Name == "music")
|
||||
SteamFriends.SetRichPresence("steam_display", "#Status_Music");
|
||||
else
|
||||
SteamFriends.SetRichPresence("steam_display", "#Status_IDLE");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获得当前系统音乐播放音量
|
||||
/// </summary>
|
||||
|
@ -289,6 +289,10 @@ namespace VPet_Simulator.Windows
|
||||
rndtext.Add("关注 {0} 谢谢喵".Translate(SteamClient.Name));
|
||||
//Steam成就
|
||||
Set.Statistics.StatisticChanged += Statistics_StatisticChanged;
|
||||
//Steam通知
|
||||
SteamFriends.SetRichPresence("username", Core.Save.Name);
|
||||
SteamFriends.SetRichPresence("mode", (Core.Save.Mode.ToString() + "ly").Translate());
|
||||
SteamFriends.SetRichPresence("steam_display", "#Status_IDLE");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -358,6 +362,8 @@ namespace VPet_Simulator.Windows
|
||||
}
|
||||
Foods.ForEach(item => item.LoadImageSource(this));
|
||||
Main.TimeHandle += Handle_Music;
|
||||
if (IsSteamUser)
|
||||
Main.TimeHandle += Handle_Steam;
|
||||
Main.TimeHandle += (x) => DiagnosisUPLoad();
|
||||
|
||||
Main.DefaultClickAction = () =>
|
||||
|
39
VPet-Simulator.Windows/RichPresence.vdf
Normal file
39
VPet-Simulator.Windows/RichPresence.vdf
Normal file
@ -0,0 +1,39 @@
|
||||
"lang"
|
||||
{
|
||||
"schinese"
|
||||
{
|
||||
"tokens"
|
||||
{
|
||||
"#Status_IDLE" "%username%在%mode%闲逛"
|
||||
"#Status_Music" "%username%在%mode%跳舞"
|
||||
"#Status_Sleep" "%username%在%mode%睡大觉"
|
||||
"#Status_Work" "%username%在%mode%%work%"
|
||||
"#Status_DIY" "%DIY%"
|
||||
"#Status_Ill" "%username% 生病了"
|
||||
}
|
||||
}
|
||||
"tchinese"
|
||||
{
|
||||
"tokens"
|
||||
{
|
||||
"#Status_IDLE" "%username%在%mode%閒逛"
|
||||
"#Status_Music" "%username%在%mode%跳舞"
|
||||
"#Status_Sleep" "%username%在%mode%睡大覺"
|
||||
"#Status_Work" "%username%在%mode%%work%"
|
||||
"#Status_DIY" "%DIY%"
|
||||
"#Status_Ill" "%username% 生病了"
|
||||
}
|
||||
}
|
||||
"english"
|
||||
{
|
||||
"tokens"
|
||||
{
|
||||
"#Status_IDLE" "%username% is %mode% idle"
|
||||
"#Status_Music" "%username% dancing %mode%"
|
||||
"#Status_Sleep" "%username% Sleep %mode%"
|
||||
"#Status_Work" "%username% %work% %mode%"
|
||||
"#Status_DIY" "%DIY%"
|
||||
"#Status_Ill" "%username% is sick"
|
||||
}
|
||||
}
|
||||
}
|
@ -30,7 +30,7 @@
|
||||
Grid.ColumnSpan="3" />
|
||||
<ProgressBar x:Name="PrograssUsed" Grid.Row="2" Grid.ColumnSpan="3" Height="10" BorderThickness="2"
|
||||
pu:ProgressBarHelper.CornerRadius="4" Foreground="{DynamicResource ProgressBarForeground}" Visibility="Collapsed"
|
||||
Background="{DynamicResource Secondary}" Value="0.5" BorderBrush="{DynamicResource DARKPrimary}" Maximum="1" />
|
||||
Background="{DynamicResource Secondary}" Value="0.5" BorderBrush="{DynamicResource DARKPrimary}" Maximum="1" ToolTipOpening="PrograssUsed_ToolTipOpening" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
|
@ -33,6 +33,7 @@ namespace VPet_Simulator.Windows
|
||||
set = mw.Set;
|
||||
this.mw = mw;
|
||||
this.IsEnabled = false;
|
||||
lastopeningtime = DateTime.Now;
|
||||
Task.Run(TalkChatInfoDisplay);
|
||||
}
|
||||
|
||||
@ -262,5 +263,14 @@ namespace VPet_Simulator.Windows
|
||||
return new Line("Error", "Connect", ex.ToString());
|
||||
}
|
||||
}
|
||||
private DateTime lastopeningtime;
|
||||
private void PrograssUsed_ToolTipOpening(object sender, ToolTipEventArgs e)
|
||||
{
|
||||
if ((DateTime.Now - lastopeningtime).TotalMinutes < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
TalkChatInfoDisplay();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user