支持多开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;
return true;
}
private void Handle_Steam(Main obj)
{
if (HashCheck)
if (App.MainWindows.Count > 1)
{
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)
if (App.MainWindows.FirstOrDefault() != this)
{
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
{
switch (obj.DisplayType.Type)
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)
{
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:
SteamFriends.SetRichPresence("idel", "乱爬".Translate());
break;
case GraphType.Idel:
case GraphType.StateONE:
case GraphType.StateTWO:
SteamFriends.SetRichPresence("idel", "发呆".Translate());
break;
default:
SteamFriends.SetRichPresence("idel", "闲逛".Translate());
break;
switch (obj.DisplayType.Type)
{
case GraphType.Move:
SteamFriends.SetRichPresence("idel", "乱爬".Translate());
break;
case GraphType.Idel:
case GraphType.StateONE:
case GraphType.StateTWO:
SteamFriends.SetRichPresence("idel", "发呆".Translate());
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));
}
Task.Run(() => GameLoad(Path));
}
/// <summary>

View File

@ -10,6 +10,10 @@
"#Status_Work" "%username%在%mode%%work%%lv%"
"#Status_DIY" "%DIY%"
"#Status_Ill" "%username% 生病了"
"#Status_MUTI_Play" "%usernames% 在一起玩%lv%"
"#Status_MUTI_Work" "%usernames% 在一起工作%lv%"
"#Status_MUTI_Sleep" "%usernames% 在一起睡觉%lv%"
"#Status_MUTI_Music" "%usernames% 在一起跳舞%lv%"
}
}
"tchinese"
@ -22,6 +26,10 @@
"#Status_Work" "%username%在%mode%%work%%lv%"
"#Status_DIY" "%DIY%"
"#Status_Ill" "%username% 生病了"
"#Status_MUTI_Play" "%usernames% 在一起玩%lv%"
"#Status_MUTI_Work" "%usernames% 在一起工作%lv%"
"#Status_MUTI_Sleep" "%usernames% 在一起睡覺%lv%"
"#Status_MUTI_Music" "%usernames% 在一起跳舞%lv%"
}
}
"english"
@ -30,10 +38,14 @@
{
"#Status_IDLE" "%username% is %mode% %idel%%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_DIY" "%DIY%"
"#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;
runMODGameVer.Text = CoreMOD.INTtoVER(mod.GameVer);
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 / 10 == mw.version / 10)