protected override UniversalGuid?Process(PacketBase basePacket, PacketUpdateObject packet) { if (packet.Created.Count + packet.Destroyed.Count + packet.Updated.Count + packet.OutOfRange.Count > 1) { return(null); } if (packet.Created.Count == 1) { return(packet.Created[0].Guid); } if (packet.Destroyed.Count == 1) { return(packet.Destroyed[0].Guid); } if (packet.Updated.Count == 1) { return(packet.Updated[0].Guid); } if (packet.OutOfRange.Count == 1) { return(packet.OutOfRange[0].Guid); } return(null); }
protected override IEnumerable <PacketHolder>?Process(PacketBase basePacket, PacketUpdateObject packet) { foreach (var destroyed in packet.Destroyed) { var fake = new PacketUpdateObject(); fake.Destroyed.Add(destroyed); yield return(new PacketHolder() { BaseData = new PacketBase(basePacket) { StringData = GenerateText(basePacket, destroyed.Text) }, UpdateObject = fake }); } foreach (var outOfRange in packet.OutOfRange) { var fake = new PacketUpdateObject(); fake.OutOfRange.Add(outOfRange); yield return(new PacketHolder() { BaseData = new PacketBase(basePacket) { StringData = GenerateText(basePacket, outOfRange.Text) }, UpdateObject = fake }); } foreach (var created in packet.Created) { var fake = new PacketUpdateObject(); fake.Created.Add(created); yield return(new PacketHolder() { BaseData = new PacketBase(basePacket) { StringData = GenerateText(basePacket, created.Text) }, UpdateObject = fake }); } foreach (var updated in packet.Updated) { var fake = new PacketUpdateObject(); fake.Updated.Add(updated); yield return(new PacketHolder() { BaseData = new PacketBase(basePacket) { StringData = GenerateText(basePacket, updated.Text) }, UpdateObject = fake }); } }
protected virtual T?Process(PacketBase basePacket, PacketUpdateObject packet) => default;