add multiplayer player type to window titles
This commit is contained in:
parent
445370b75b
commit
342b91ff80
|
@ -9,6 +9,7 @@
|
|||
|
||||
## Upcoming release
|
||||
* For players:
|
||||
* In multiplayer, the game/SMAPI window titles now show whether you're the main player or a farmhand.
|
||||
* Fixed logged SMAPI errors not having line numbers on Linux/macOS.
|
||||
|
||||
## 3.18.3
|
||||
|
|
|
@ -852,6 +852,9 @@ namespace StardewModdingAPI.Framework
|
|||
|
||||
this.Monitor.Log(context);
|
||||
|
||||
// add context to window titles
|
||||
this.UpdateWindowTitles();
|
||||
|
||||
// raise events
|
||||
this.OnLoadStageChanged(LoadStage.Ready);
|
||||
events.SaveLoaded.RaiseEmpty();
|
||||
|
@ -1203,6 +1206,7 @@ namespace StardewModdingAPI.Framework
|
|||
|
||||
case LoadStage.None:
|
||||
this.JustReturnedToTitle = true;
|
||||
this.UpdateWindowTitles();
|
||||
break;
|
||||
|
||||
case LoadStage.Loaded:
|
||||
|
@ -1450,15 +1454,14 @@ namespace StardewModdingAPI.Framework
|
|||
string consoleTitle = $"SMAPI {Constants.ApiVersion} - running Stardew Valley {Constants.GameVersion}";
|
||||
string gameTitle = $"Stardew Valley {Constants.GameVersion} - running SMAPI {Constants.ApiVersion}";
|
||||
|
||||
string suffix = "";
|
||||
if (this.ModRegistry.AreAllModsLoaded)
|
||||
{
|
||||
int modsLoaded = this.ModRegistry.GetAll().Count();
|
||||
consoleTitle += $" with {modsLoaded} mods";
|
||||
gameTitle += $" with {modsLoaded} mods";
|
||||
}
|
||||
suffix += $" with {this.ModRegistry.GetAll().Count()} mods";
|
||||
if (Context.IsMultiplayer)
|
||||
suffix += $" [{(Context.IsMainPlayer ? "main player" : "farmhand")}]";
|
||||
|
||||
this.Game.Window.Title = gameTitle;
|
||||
this.LogManager.SetConsoleTitle(consoleTitle);
|
||||
this.Game.Window.Title = gameTitle + suffix;
|
||||
this.LogManager.SetConsoleTitle(consoleTitle + suffix);
|
||||
}
|
||||
|
||||
/// <summary>Log a warning if software known to cause issues is installed.</summary>
|
||||
|
|
Loading…
Reference in New Issue