支持多开Steam显示

This commit is contained in:
ZouJin 2023-11-17 16:08:31 +08:00
parent 68d3cf8edb
commit ae87121697
3 changed files with 128 additions and 44 deletions

View File

@ -702,7 +702,73 @@ namespace VPet_Simulator.Windows
HashCheck = HashCheck; HashCheck = HashCheck;
return true; return true;
} }
private void Handle_Steam(Main obj) private void Handle_Steam(Main obj)
{
if (App.MainWindows.Count > 1)
{
if (App.MainWindows.FirstOrDefault() != this)
{
return;
}
string str = "";
int lv = 0;
int workcount = 0;
int sleepcount = 0;
int musiccount = 0;
int allcount = App.MainWindows.Count * 2 / 3;
foreach (var item in App.MainWindows)
{
str += item.GameSavesData.GameSave.Name + ",";
if (item.HashCheck)
{
lv += item.GameSavesData.GameSave.Level;
}
else
lv = int.MinValue;
switch (item.Main.State)
{
case Main.WorkingState.Work:
workcount++;
break;
case Main.WorkingState.Sleep:
sleepcount++;
break;
case Main.WorkingState.Nomal:
if (item.Main.DisplayType.Name == "music")
musiccount++;
break;
}
}
SteamFriends.SetRichPresence("usernames", str.Trim(','));
if (lv > 0)
{
SteamFriends.SetRichPresence("lv", $" (lv{lv}/{App.MainWindows.Count})");
}
else
{
SteamFriends.SetRichPresence("lv", " ");
}
if (workcount > allcount)
{
SteamFriends.SetRichPresence("steam_display", "#Status_MUTI_Work");
}
else if (sleepcount > allcount)
{
SteamFriends.SetRichPresence("steam_display", "#Status_MUTI_Sleep");
}
else if (musiccount > allcount)
{
SteamFriends.SetRichPresence("steam_display", "#Status_MUTI_Music");
}
else
{
SteamFriends.SetRichPresence("steam_display", "#Status_MUTI_Play");
}
}
else
{ {
if (HashCheck) if (HashCheck)
{ {
@ -753,6 +819,7 @@ namespace VPet_Simulator.Windows
} }
} }
} }
}
private bool? AudioPlayingVolumeOK = null; private bool? AudioPlayingVolumeOK = null;
/// <summary> /// <summary>
/// 获得当前系统音乐播放音量 /// 获得当前系统音乐播放音量
@ -1125,6 +1192,8 @@ namespace VPet_Simulator.Windows
{ {
Path.Add(new DirectoryInfo(ws.Name)); Path.Add(new DirectoryInfo(ws.Name));
} }
Task.Run(() => GameLoad(Path)); Task.Run(() => GameLoad(Path));
} }
/// <summary> /// <summary>

View File

@ -10,6 +10,10 @@
"#Status_Work" "%username%在%mode%%work%%lv%" "#Status_Work" "%username%在%mode%%work%%lv%"
"#Status_DIY" "%DIY%" "#Status_DIY" "%DIY%"
"#Status_Ill" "%username% 生病了" "#Status_Ill" "%username% 生病了"
"#Status_MUTI_Play" "%usernames% 在一起玩%lv%"
"#Status_MUTI_Work" "%usernames% 在一起工作%lv%"
"#Status_MUTI_Sleep" "%usernames% 在一起睡觉%lv%"
"#Status_MUTI_Music" "%usernames% 在一起跳舞%lv%"
} }
} }
"tchinese" "tchinese"
@ -22,6 +26,10 @@
"#Status_Work" "%username%在%mode%%work%%lv%" "#Status_Work" "%username%在%mode%%work%%lv%"
"#Status_DIY" "%DIY%" "#Status_DIY" "%DIY%"
"#Status_Ill" "%username% 生病了" "#Status_Ill" "%username% 生病了"
"#Status_MUTI_Play" "%usernames% 在一起玩%lv%"
"#Status_MUTI_Work" "%usernames% 在一起工作%lv%"
"#Status_MUTI_Sleep" "%usernames% 在一起睡覺%lv%"
"#Status_MUTI_Music" "%usernames% 在一起跳舞%lv%"
} }
} }
"english" "english"
@ -30,10 +38,14 @@
{ {
"#Status_IDLE" "%username% is %mode% %idel%%lv%" "#Status_IDLE" "%username% is %mode% %idel%%lv%"
"#Status_Music" "%username% dancing %mode%%lv%" "#Status_Music" "%username% dancing %mode%%lv%"
"#Status_Sleep" "%username% Sleep %mode%%lv%" "#Status_Sleep" "%username% sleep %mode%%lv%"
"#Status_Work" "%username% %work% %mode%%lv%" "#Status_Work" "%username% %work% %mode%%lv%"
"#Status_DIY" "%DIY%" "#Status_DIY" "%DIY%"
"#Status_Ill" "%username% is sick" "#Status_Ill" "%username% is sick"
"#Status_MUTI_Play" "%usernames% play together%lv%"
"#Status_MUTI_Work" "%usernames% working together%lv%"
"#Status_MUTI_Sleep" "%usernames% sleeping together%lv%"
"#Status_MUTI_Music" "%usernames% dancing together%lv%"
} }
} }
} }

View File

@ -345,7 +345,10 @@ namespace VPet_Simulator.Windows
runMODAuthor.Text = mod.Author; runMODAuthor.Text = mod.Author;
runMODGameVer.Text = CoreMOD.INTtoVER(mod.GameVer); runMODGameVer.Text = CoreMOD.INTtoVER(mod.GameVer);
runMODGameVer.Foreground = Function.ResourcesBrush(Function.BrushType.PrimaryText); runMODGameVer.Foreground = Function.ResourcesBrush(Function.BrushType.PrimaryText);
if (File.Exists(mod.Path.FullName + @"\icon.png"))
ImageMOD.Source = ImageResources.NewSafeBitmapImage(mod.Path.FullName + @"\icon.png"); ImageMOD.Source = ImageResources.NewSafeBitmapImage(mod.Path.FullName + @"\icon.png");
else
ImageMOD.Source = ImageResources.NewSafeBitmapImage(@"pack://application:,,,/Res/TopLogo2019.PNG");
if (mod.GameVer < mw.version) if (mod.GameVer < mw.version)
{ {
if (mod.GameVer / 10 == mw.version / 10) if (mod.GameVer / 10 == mw.version / 10)