private static bool ConvertToShape(Shapes.Text2D shape, TextEntry entry)
 {
     shape.ID       = entry.ID;
     shape.Category = entry.Category;
     shape.Flags    = entry.ObjectFlags;
     shape.SetPosition(entry.Position.x, entry.Position.y, entry.Position.z);
     shape.Text = entry.Text;
     return(true);
 }
示例#2
0
        private static bool Serialise(Text2DManager textManager, PacketBuffer packet, BinaryWriter writer, ref uint count)
        {
            Shapes.Text2D shape          = new Shapes.Text2D(null);
            uint          progressMarker = 0;
            int           dataResult     = 1;
            bool          shapeOk        = true;

            foreach (TextEntry entry in textManager.Entries)
            {
                ++count;
                shape.ID       = entry.ID;
                shape.Category = entry.Category;
                shape.Flags    = entry.ObjectFlags;
                shape.SetPosition(entry.Position.x, entry.Position.y, entry.Position.z);
                shape.Text = entry.Text;
                shape.WriteCreate(packet);

                shapeOk = packet.FinalisePacket();
                if (shapeOk)
                {
                    packet.ExportTo(writer);

                    if (shape.IsComplex)
                    {
                        dataResult = 1;
                        while (dataResult > 0 && shapeOk)
                        {
                            shape.WriteData(packet, ref progressMarker);
                            shapeOk = packet.FinalisePacket();
                            if (shapeOk)
                            {
                                packet.ExportTo(writer);
                            }
                        }

                        shapeOk = dataResult == 0;
                    }
                }

                if (!shapeOk)
                {
                    return(false);
                }
            }

            return(true);
        }