Exemplo n.º 1
0
        public void RebuildList(List <T> items)
        {
            //max bytes per part: 16384
            int maxpartbytes = 16384; //0x4000
            int itembytes    = ItemSize;
            int itemsperpart = maxpartbytes / itembytes;
            int currentitem  = 0;

            var parts     = new ResourceSimpleArray <NavMeshListPart <T> >();
            var partitems = new List <T>();
            var offsets   = new List <uint>();

            while (currentitem < items.Count)
            {
                partitems.Clear();
                int lastitem = currentitem + itemsperpart;
                if (lastitem > items.Count)
                {
                    lastitem = items.Count;
                }
                for (int i = currentitem; i < lastitem; i++)
                {
                    partitems.Add(items[i]);
                }
                var part = new NavMeshListPart <T>();
                part.Items       = partitems.ToArray();
                part.Unknown_0Ch = 0;
                parts.Add(part);
                offsets.Add((uint)currentitem);
                currentitem = lastitem;
            }
            ListParts   = parts;
            ListOffsets = offsets.ToArray();
            ItemCount   = (uint)items.Count;
        }
Exemplo n.º 2
0
        public override void Read(ResourceDataReader reader, params object[] parameters)
        {
            base.Read(reader, parameters);

            this.Unknown_10h    = reader.ReadUInt32();
            this.Unknown_14h    = reader.ReadUInt32();
            this.EntriesPointer = reader.ReadUInt64();
            this.EntriesCount   = reader.ReadUInt32();
            this.Unknown_24h    = reader.ReadUInt32();
            this.Unknown_28h    = reader.ReadUInt32();
            this.Unknown_2Ch    = reader.ReadUInt32();

            this.Entries = reader.ReadBlockAt <ResourceSimpleArray <WaypointRecordEntry> >(
                this.EntriesPointer, // offset
                this.EntriesCount
                );
        }
Exemplo n.º 3
0
        public void ReadXml(XmlNode node)
        {
            var entries = new List <WaypointRecordEntry>();

            var inodes = node.SelectNodes("Item");

            if (inodes != null)
            {
                foreach (XmlNode inode in inodes)
                {
                    var e = new WaypointRecordEntry();
                    e.ReadXml(inode);
                    entries.Add(e);
                }
            }

            Entries      = new ResourceSimpleArray <WaypointRecordEntry>();
            Entries.Data = entries;
        }