Exemplo n.º 1
0
            /// <summary>
            /// Reads a ContentEntry object from the content pipeline.
            /// </summary>
            protected override ContentEntry <T> Read(ContentReader input,
                                                     ContentEntry <T> existingInstance)
            {
                ContentEntry <T> member = existingInstance;

                if (member == null)
                {
                    member = new ContentEntry <T>();
                }
                member.ContentName = input.ReadString();
                member.Count       = input.ReadInt32();

                return(member);
            }
Exemplo n.º 2
0
        /// <summary>
        /// Clone implementation for chest copies.
        /// </summary>
        /// <remarks>
        /// The game has to handle chests that have had some contents removed
        /// without modifying the original chest (and all chests that come after).
        /// </remarks>
        public object Clone()
        {
            // create the new chest
            Chest chest = new Chest();

            // copy the data
            chest.Gold        = Gold;
            chest.Name        = Name;
            chest.Texture     = Texture;
            chest.TextureName = TextureName;

            // recreate the list and entries, as counts may have changed
            chest.entries = new List <ContentEntry <Gear> >();
            foreach (ContentEntry <Gear> originalEntry in Entries)
            {
                ContentEntry <Gear> newEntry = new ContentEntry <Gear>();
                newEntry.Count       = originalEntry.Count;
                newEntry.ContentName = originalEntry.ContentName;
                newEntry.Content     = originalEntry.Content;
                chest.Entries.Add(newEntry);
            }

            return(chest);
        }