Moves ExamineSystem to Shared & adds next step info to construction examine (#1567)

This commit is contained in:
Exp
2020-08-01 17:37:12 +02:00
committed by GitHub
parent 7f0c379e87
commit c61e6d541b
21 changed files with 159 additions and 83 deletions

View File

@@ -21,7 +21,7 @@ namespace Content.Client.GameObjects.EntitySystems
/// The client-side implementation of the construction system, which is used for constructing entities in game.
/// </summary>
[UsedImplicitly]
public class ConstructionSystem : Shared.GameObjects.EntitySystems.ConstructionSystem
public class ConstructionSystem : Shared.GameObjects.EntitySystems.SharedConstructionSystem
{
#pragma warning disable 649
[Dependency] private readonly IGameHud _gameHud;

View File

@@ -106,37 +106,43 @@ namespace Content.Client.GameObjects.EntitySystems
_examineTooltipOpen.Open(UIBox2.FromDimensions(popupPos, size));
FormattedMessage message;
if (entity.Uid.IsClientSide())
{
return;
message = ExamineSystem.GetExamineText(entity, _playerManager.LocalPlayer.ControlledEntity);
}
else
{
// Ask server for extra examine info.
RaiseNetworkEvent(new ExamineSystemMessages.RequestExamineInfoMessage(entity.Uid));
ExamineSystemMessages.ExamineInfoResponseMessage response;
try
{
_requestCancelTokenSource = new CancellationTokenSource();
response =
await AwaitNetworkEvent<ExamineSystemMessages.ExamineInfoResponseMessage>(_requestCancelTokenSource
.Token);
}
catch (TaskCanceledException)
{
return;
}
finally
{
_requestCancelTokenSource = null;
}
message = response.Message;
}
// Ask server for extra examine info.
RaiseNetworkEvent(new ExamineSystemMessages.RequestExamineInfoMessage(entity.Uid));
ExamineSystemMessages.ExamineInfoResponseMessage response;
try
{
_requestCancelTokenSource = new CancellationTokenSource();
response =
await AwaitNetworkEvent<ExamineSystemMessages.ExamineInfoResponseMessage>(_requestCancelTokenSource
.Token);
}
catch (TaskCanceledException)
{
return;
}
finally
{
_requestCancelTokenSource = null;
}
foreach (var msg in response.Message.Tags.OfType<FormattedMessage.TagText>())
foreach (var msg in message.Tags.OfType<FormattedMessage.TagText>())
{
if (!string.IsNullOrWhiteSpace(msg.Text))
{
var richLabel = new RichTextLabel();
richLabel.SetMessage(response.Message);
richLabel.SetMessage(message);
vBox.AddChild(richLabel);
break;
}