We have a lobby! (#127)
It's shoddy as hell but it works for our purposes.
This commit is contained in:
committed by
GitHub
parent
f887d22a16
commit
845d0f9182
@@ -108,6 +108,7 @@
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<Compile Include="Input\ContentKeyFunctions.cs" />
|
||||
<Compile Include="SharedGameTicker.cs" />
|
||||
<Compile Include="SharedNotifyManager.cs" />
|
||||
<Compile Include="Utility\ContentHelpers.cs" />
|
||||
<Compile Include="GameObjects\Components\Power\SharedSmesComponent.cs" />
|
||||
|
||||
94
Content.Shared/SharedGameTicker.cs
Normal file
94
Content.Shared/SharedGameTicker.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Lidgren.Network;
|
||||
using SS14.Shared.Interfaces.Network;
|
||||
using SS14.Shared.Interfaces.Serialization;
|
||||
using SS14.Shared.IoC;
|
||||
using SS14.Shared.Map;
|
||||
using SS14.Shared.Network;
|
||||
|
||||
namespace Content.Shared
|
||||
{
|
||||
public abstract class SharedGameTicker
|
||||
{
|
||||
protected class MsgTickerJoinLobby : NetMessage
|
||||
{
|
||||
#region REQUIRED
|
||||
|
||||
public const MsgGroups GROUP = MsgGroups.Command;
|
||||
public const string NAME = nameof(MsgTickerJoinLobby);
|
||||
public MsgTickerJoinLobby(INetChannel channel) : base(NAME, GROUP) { }
|
||||
|
||||
#endregion
|
||||
|
||||
public override void ReadFromBuffer(NetIncomingMessage buffer)
|
||||
{
|
||||
}
|
||||
|
||||
public override void WriteToBuffer(NetOutgoingMessage buffer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
protected class MsgTickerJoinGame : NetMessage
|
||||
{
|
||||
#region REQUIRED
|
||||
|
||||
public const MsgGroups GROUP = MsgGroups.Command;
|
||||
public const string NAME = nameof(MsgTickerJoinGame);
|
||||
public MsgTickerJoinGame(INetChannel channel) : base(NAME, GROUP) { }
|
||||
|
||||
#endregion
|
||||
|
||||
public override void ReadFromBuffer(NetIncomingMessage buffer)
|
||||
{
|
||||
}
|
||||
|
||||
public override void WriteToBuffer(NetOutgoingMessage buffer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
protected class MsgTickerLobbyStatus : NetMessage
|
||||
{
|
||||
#region REQUIRED
|
||||
|
||||
public const MsgGroups GROUP = MsgGroups.Command;
|
||||
public const string NAME = nameof(MsgTickerLobbyStatus);
|
||||
public MsgTickerLobbyStatus(INetChannel channel) : base(NAME, GROUP) { }
|
||||
|
||||
#endregion
|
||||
|
||||
public bool IsRoundStarted { get; set; }
|
||||
public bool YouAreReady { get; set; }
|
||||
// UTC.
|
||||
public DateTime StartTime { get; set; }
|
||||
|
||||
public override void ReadFromBuffer(NetIncomingMessage buffer)
|
||||
{
|
||||
IsRoundStarted = buffer.ReadBoolean();
|
||||
|
||||
if (IsRoundStarted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
YouAreReady = buffer.ReadBoolean();
|
||||
StartTime = new DateTime(buffer.ReadInt64(), DateTimeKind.Utc);
|
||||
}
|
||||
|
||||
public override void WriteToBuffer(NetOutgoingMessage buffer)
|
||||
{
|
||||
buffer.Write(IsRoundStarted);
|
||||
|
||||
if (IsRoundStarted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
buffer.Write(YouAreReady);
|
||||
buffer.Write(StartTime.Ticks);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user