public override void SaveNode() { IOHelp.WriteFloat(_Width); IOHelp.WriteFloat(_Depth); IOHelp.WriteFloat(_YScale); IOHelp.WriteString(_HeightMapPath); }
public void WriteClass(object cls) { IOHelp.WriteString(cls.GetType().Name); IOHelp.WriteInt(cls.GetType().GetProperties().Length); foreach (var prop in cls.GetType().GetProperties()) { IOHelp.WriteString(prop.GetType().Name); var val = prop.GetValue(cls); WriteVal(val); } }
private void WriteVal(object val) { if (val == null) { IOHelp.WriteInt(-1); } else if (val is string) { IOHelp.WriteInt(0); IOHelp.WriteString(val as string); } else if (val is int) { IOHelp.WriteInt(1); IOHelp.WriteInt((int)val); } else if (val is float) { IOHelp.WriteInt(2); IOHelp.WriteFloat((float)val); } else if (val is double) { IOHelp.WriteInt(3); IOHelp.WriteDouble((double)val); } else if (val is Texture.Texture2D) { IOHelp.WriteInt(4); IOHelp.WriteTexture2D(val as Texture.Texture2D); } else if (val is bool) { IOHelp.WriteInt(5); IOHelp.WriteBool((bool)val); } else if (val is Vector3) { IOHelp.WriteInt(6); IOHelp.WriteVec((Vector3)val); } else if (val is Vector4) { IOHelp.WriteInt(7); IOHelp.WriteVec((Vector4)val); } else if (val is Matrix4) { IOHelp.WriteInt(8); IOHelp.WriteMatrix((Matrix4)val); } else { if (val.GetType().Name.Contains("List")) { IOHelp.WriteInt(9); dynamic vo = val; IOHelp.WriteInt(vo.Count); //dynamic vo = val; foreach (dynamic vi in vo) { WriteVal(vi); } } else { // IOHelp.WriteInt(10); // WriteClass(val); } } }
public override void SaveNode() { IOHelp.WriteString(SongPath); }