支持多开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,54 +702,121 @@ 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 (HashCheck) if (App.MainWindows.Count > 1)
{ {
SteamFriends.SetRichPresence("lv", $" (lv{GameSavesData.GameSave.Level})"); if (App.MainWindows.FirstOrDefault() != this)
}
else
{
SteamFriends.SetRichPresence("lv", " ");
}
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: return;
SteamFriends.SetRichPresence("work", obj.nowWork.Name.Translate()); }
SteamFriends.SetRichPresence("steam_display", "#Status_Work"); string str = "";
break; int lv = 0;
case Main.WorkingState.Sleep: int workcount = 0;
SteamFriends.SetRichPresence("steam_display", "#Status_Sleep"); int sleepcount = 0;
break; int musiccount = 0;
default: int allcount = App.MainWindows.Count * 2 / 3;
if (obj.DisplayType.Name == "music") foreach (var item in App.MainWindows)
SteamFriends.SetRichPresence("steam_display", "#Status_Music"); {
else str += item.GameSavesData.GameSave.Name + ",";
{ if (item.HashCheck)
switch (obj.DisplayType.Type) {
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)
{
SteamFriends.SetRichPresence("lv", $" (lv{GameSavesData.GameSave.Level})");
}
else
{
SteamFriends.SetRichPresence("lv", " ");
}
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
{ {
case GraphType.Move: switch (obj.DisplayType.Type)
SteamFriends.SetRichPresence("idel", "乱爬".Translate()); {
break; case GraphType.Move:
case GraphType.Idel: SteamFriends.SetRichPresence("idel", "乱爬".Translate());
case GraphType.StateONE: break;
case GraphType.StateTWO: case GraphType.Idel:
SteamFriends.SetRichPresence("idel", "发呆".Translate()); case GraphType.StateONE:
break; case GraphType.StateTWO:
default: SteamFriends.SetRichPresence("idel", "发呆".Translate());
SteamFriends.SetRichPresence("idel", "闲逛".Translate()); break;
break; default:
SteamFriends.SetRichPresence("idel", "闲逛".Translate());
break;
}
SteamFriends.SetRichPresence("steam_display", "#Status_IDLE");
} }
SteamFriends.SetRichPresence("steam_display", "#Status_IDLE"); break;
} }
break;
} }
} }
} }
@ -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);
ImageMOD.Source = ImageResources.NewSafeBitmapImage(mod.Path.FullName + @"\icon.png"); if (File.Exists(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)