source: OniSplit/Objects/Furniture.cs@ 1170

Last change on this file since 1170 was 1114, checked in by iritscen, 5 years ago

Adding OniSplit source code (v0.9.99.0). Many thanks to Neo for all his work over the years.

File size: 1.6 KB
Line 
1using System.Xml;
2
3namespace Oni.Objects
4{
5 internal class Furniture : GunkObject
6 {
7 public FurnitureClass Class;
8 public string ParticleTag;
9
10 public Furniture()
11 {
12 TypeId = ObjectType.Furniture;
13 }
14
15 protected override void WriteOsd(BinaryWriter writer)
16 {
17 writer.Write(ClassName, 32);
18 writer.Write(ParticleTag, 48);
19 }
20
21 protected override void ReadOsd(BinaryReader reader)
22 {
23 ClassName = reader.ReadString(32);
24 ParticleTag = reader.ReadString(48);
25 }
26
27 protected override void WriteOsd(XmlWriter xml)
28 {
29 xml.WriteElementString("Class", ClassName);
30 xml.WriteElementString("Particle", ParticleTag);
31 }
32
33 protected override void ReadOsd(XmlReader xml, ObjectLoadContext context)
34 {
35 string className = null;
36
37 while (xml.IsStartElement())
38 {
39 switch (xml.LocalName)
40 {
41 case "Class":
42 className = xml.ReadElementContentAsString();
43 break;
44 case "Particle":
45 ParticleTag = xml.ReadElementContentAsString();
46 break;
47 default:
48 xml.Skip();
49 break;
50 }
51 }
52
53
54 Class = context.GetClass(TemplateTag.OFGA, className, FurnitureClass.Read);
55 GunkClass = Class;
56 }
57 }
58}
Note: See TracBrowser for help on using the repository browser.