Add foundation for Round End Summary Screen.

Adjust GamePreset class, added title alongside description.
This commit is contained in:
scuffedjays
2020-04-08 06:07:54 -05:00
parent 45e9be43ef
commit 02f9c5259c
7 changed files with 120 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
namespace Content.Server.GameTicking
namespace Content.Server.GameTicking
{
/// <summary>
/// A round-start setup preset, such as which antagonists to spawn.
@@ -6,6 +6,7 @@ namespace Content.Server.GameTicking
public abstract class GamePreset
{
public abstract void Start();
public virtual string ModeTitle => "Sandbox";
public virtual string Description => "Secret!";
}
}

View File

@@ -1,4 +1,4 @@
using Content.Server.GameTicking.GameRules;
using Content.Server.GameTicking.GameRules;
using Content.Server.Interfaces.GameTicking;
using Robust.Shared.IoC;
@@ -15,6 +15,7 @@ namespace Content.Server.GameTicking.GamePresets
_gameTicker.AddGameRule<RuleDeathMatch>();
}
public override string Description => "Deathmatch, go and kill everybody else to win!";
public override string ModeTitle => "Deathmatch";
public override string Description => "Kill anything that moves!";
}
}

View File

@@ -1,4 +1,4 @@
using Content.Server.Sandbox;
using Content.Server.Sandbox;
using Robust.Shared.IoC;
namespace Content.Server.GameTicking.GamePresets
@@ -14,6 +14,7 @@ namespace Content.Server.GameTicking.GamePresets
_sandboxManager.IsSandboxEnabled = true;
}
public override string Description => "Sandbox, go and build something!";
public override string ModeTitle => "Sandbox";
public override string Description => "No stress, build something!";
}
}

View File

@@ -100,6 +100,7 @@ namespace Content.Server.GameTicking
_netManager.RegisterNetMessage<MsgTickerJoinGame>(nameof(MsgTickerJoinGame));
_netManager.RegisterNetMessage<MsgTickerLobbyStatus>(nameof(MsgTickerLobbyStatus));
_netManager.RegisterNetMessage<MsgTickerLobbyInfo>(nameof(MsgTickerLobbyInfo));
_netManager.RegisterNetMessage<MsgRoundEndMessage>(nameof(MsgRoundEndMessage));
SetStartPreset(_configurationManager.GetCVar<string>("game.defaultpreset"));
@@ -200,6 +201,13 @@ namespace Content.Server.GameTicking
Logger.InfoS("ticker", "Ending round!");
RunLevel = GameRunLevel.PostRound;
//Tell every client the round has ended.
var roundEndMessage = _netManager.CreateNetMessage<MsgRoundEndMessage>();
roundEndMessage.GamemodeTitle = MakeGamePreset().ModeTitle;
//TODO:Grab actual timespan of round.
roundEndMessage.DurationInHours = 1337;
_netManager.ServerSendToAll(roundEndMessage);
}
public void Respawn(IPlayerSession targetPlayer)
@@ -559,10 +567,12 @@ namespace Content.Server.GameTicking
private string GetInfoText()
{
var gameMode = MakeGamePreset().Description;
var gmTitle = MakeGamePreset().ModeTitle;
var desc = MakeGamePreset().Description;
return _localization.GetString(@"Hi and welcome to [color=white]Space Station 14![/color]
The current game mode is [color=white]{0}[/color]", gameMode);
The current game mode is: [color=white]{0}[/color].
[color=yellow]{1}[/color]", gmTitle, desc );
}
private void UpdateInfoText()