//----------------------------------------------------------------------------- // MapEntryWriter.cs // // Microsoft XNA Community Game Platform // Copyright (C) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- using System; using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Content.Pipeline; using Microsoft.Xna.Framework.Content.Pipeline.Graphics; using Microsoft.Xna.Framework.Content.Pipeline.Processors; using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler; using RolePlaying.Data; namespace RolePlaying.Processors { /// /// This class will be instantiated by the XNA Framework Content Pipeline /// to write the specified data type into binary .xnb format. /// /// This should be part of a Content Pipeline Extension Library project. /// [ContentTypeWriter] public class MapEntryWriter : RolePlayingGameWriter> where T : ContentObject { ContentEntryWriter contentEntryWriter = null; protected override void Initialize(ContentCompiler compiler) { contentEntryWriter = compiler.GetTypeWriter(typeof(ContentEntry)) as ContentEntryWriter; base.Initialize(compiler); } protected override void Write(ContentWriter output, MapEntry value) { output.WriteRawObject>(value as ContentEntry, contentEntryWriter); output.WriteObject(value.MapPosition); output.Write((Int32)value.Direction); } } }