Update wire protocol to version 5, introducing pupil slots and item counts in map snapshots. Enhance UI components to display pupil slots and item counts in game screens and map editors. Revise localization strings for improved user guidance. Update tests to validate new functionalities and ensure robustness in handling room and item data.
This commit is contained in:
@@ -116,11 +116,12 @@ public static class ProtocolCodec
|
||||
{
|
||||
size += sizeof(byte);
|
||||
size += StringSize(node.Id) + StringSize(node.ParentId) + StringSize(node.Name);
|
||||
size += sizeof(ushort);
|
||||
|
||||
size += sizeof(byte);
|
||||
foreach (var item in node.Items)
|
||||
{
|
||||
size += StringSize(item);
|
||||
size += StringSize(item.Name) + sizeof(byte);
|
||||
}
|
||||
|
||||
size += sizeof(byte);
|
||||
@@ -156,10 +157,12 @@ public static class ProtocolCodec
|
||||
writer.WriteString(node.Id);
|
||||
writer.WriteString(node.ParentId);
|
||||
writer.WriteString(node.Name);
|
||||
writer.WriteUInt16(node.PupilSlots);
|
||||
writer.WriteByte((byte)node.Items.Count);
|
||||
foreach (var item in node.Items)
|
||||
{
|
||||
writer.WriteString(item);
|
||||
writer.WriteString(item.Name);
|
||||
writer.WriteByte(item.Count);
|
||||
}
|
||||
|
||||
writer.WriteByte((byte)node.Positions.Count);
|
||||
@@ -263,11 +266,14 @@ public static class ProtocolCodec
|
||||
var id = reader.ReadString();
|
||||
var parentId = reader.ReadString();
|
||||
var name = reader.ReadString();
|
||||
var pupilSlots = reader.ReadUInt16();
|
||||
var itemCount = reader.ReadByte();
|
||||
var items = new string[itemCount];
|
||||
var items = new MapSnapshotItem[itemCount];
|
||||
for (var item = 0; item < itemCount; item++)
|
||||
{
|
||||
items[item] = reader.ReadString();
|
||||
var itemName = reader.ReadString();
|
||||
var count = reader.ReadByte();
|
||||
items[item] = new MapSnapshotItem(itemName, count);
|
||||
}
|
||||
|
||||
var positionCount = reader.ReadByte();
|
||||
@@ -277,7 +283,7 @@ public static class ProtocolCodec
|
||||
positions[position] = reader.ReadString();
|
||||
}
|
||||
|
||||
nodes[i] = new MapSnapshotNode(kind, id, parentId, name, items, positions);
|
||||
nodes[i] = new MapSnapshotNode(kind, id, parentId, name, pupilSlots, items, positions);
|
||||
}
|
||||
|
||||
return new ServerMapSnapshotMessage(schoolId, nodes);
|
||||
|
||||
Reference in New Issue
Block a user