forked from debreuil/Swf2XNA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathV2DReader.cs
39 lines (34 loc) · 1.2 KB
/
V2DReader.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using DDW.V2D;
//using Microsoft.Xna.Framework.Content.Pipeline.Graphics;
//using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate;
//using DDW.V2D.Serialization;
using System.Xml.Serialization;
using System.IO;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using DDW.V2D;
using DDW.V2D.Serialization;
namespace DDW.V2D
{
public class V2DReader : ContentTypeReader<V2DContent>
{
protected override V2DContent Read(ContentReader input, V2DContent existingInstance)
{
if (existingInstance == null)
{
existingInstance = new V2DContent();
}
//string xml = input.ReadObject<string>();
//XmlSerializer s = new XmlSerializer(typeof(V2DWorld));
//existingInstance.v2dWorld = (V2DWorld)s.Deserialize(new StringReader(xml));
// need two steps as content and output can be two types (eg textures)
existingInstance.v2dWorld = input.ReadObject<V2DWorld>();
existingInstance.textures = input.ReadObject<Dictionary<string, Texture2D>>();
return existingInstance;
}
}
}