mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-07-08 15:40:33 -04:00
Removed NioTSO client and server
- NioTSO client isn't needed because we're using RayLib - Added FreeSO's API server to handle most backend operations
This commit is contained in:
parent
f12ba1502b
commit
22191ce648
591 changed files with 53264 additions and 3362 deletions
76
server/FSO.Server.Protocol/Electron/Packets/NhoodCandidateList.cs
Executable file
76
server/FSO.Server.Protocol/Electron/Packets/NhoodCandidateList.cs
Executable file
|
@ -0,0 +1,76 @@
|
|||
using FSO.Common.Serialization;
|
||||
using Mina.Core.Buffer;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace FSO.Server.Protocol.Electron.Packets
|
||||
{
|
||||
public class NhoodCandidateList : AbstractElectronPacket
|
||||
{
|
||||
public bool NominationMode;
|
||||
public List<NhoodCandidate> Candidates;
|
||||
|
||||
public override void Deserialize(IoBuffer input, ISerializationContext context)
|
||||
{
|
||||
NominationMode = input.GetBool();
|
||||
int candCount = input.GetInt32();
|
||||
|
||||
Candidates = new List<NhoodCandidate>();
|
||||
for (int i=0; i<candCount; i++)
|
||||
{
|
||||
var candidate = new NhoodCandidate()
|
||||
{
|
||||
ID = input.GetUInt32(),
|
||||
Name = input.GetPascalVLCString(),
|
||||
Rating = input.GetUInt32()
|
||||
};
|
||||
|
||||
if (!NominationMode)
|
||||
{
|
||||
candidate.LastNhoodName = input.GetPascalVLCString();
|
||||
candidate.LastNhoodID = input.GetUInt32();
|
||||
candidate.TermNumber = input.GetUInt32();
|
||||
candidate.Message = input.GetPascalVLCString();
|
||||
}
|
||||
Candidates.Add(candidate);
|
||||
}
|
||||
}
|
||||
|
||||
public override ElectronPacketType GetPacketType()
|
||||
{
|
||||
return ElectronPacketType.NhoodCandidateList;
|
||||
}
|
||||
|
||||
public override void Serialize(IoBuffer output, ISerializationContext context)
|
||||
{
|
||||
output.PutBool(NominationMode);
|
||||
output.PutInt32(Candidates.Count);
|
||||
|
||||
foreach (var candidate in Candidates)
|
||||
{
|
||||
output.PutUInt32(candidate.ID);
|
||||
output.PutPascalVLCString(candidate.Name);
|
||||
output.PutUInt32(candidate.Rating);
|
||||
|
||||
if (!NominationMode)
|
||||
{
|
||||
output.PutPascalVLCString(candidate.LastNhoodName);
|
||||
output.PutUInt32(candidate.LastNhoodID);
|
||||
output.PutUInt32(candidate.TermNumber);
|
||||
output.PutPascalVLCString(candidate.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class NhoodCandidate
|
||||
{
|
||||
public uint ID;
|
||||
public string Name;
|
||||
public uint Rating;
|
||||
|
||||
public string LastNhoodName = "";
|
||||
public uint LastNhoodID;
|
||||
public uint TermNumber;
|
||||
public string Message = "";
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue