protected virtual void Parse(XmlElement element) { Vector2 position; position.x = element.GetFloat("x", 0.0f); position.y = element.GetFloat("y", 0.0f); Position = position; Vector2 scale = Vector2.one; scale.x = element.GetFloat("scale_x", 1.0f); scale.y = element.GetFloat("scale_y", 1.0f); Scale = scale; Angle_Deg = element.GetFloat("angle", 0.0f); Spin = (SpinDirection)element.GetInt("spin", 1); }
protected virtual void Parse(XmlElement element) { Vector2 position; position.x = element.GetFloat("x", 0.0f); position.y = element.GetFloat("y", 0.0f); Position = position; Vector2 scale = Vector2.one; scale.x = element.GetFloat("scale_x", 1.0f); scale.y = element.GetFloat("scale_y", 1.0f); Scale = scale; Angle_Deg = element.GetFloat("angle", 0.0f); int spinVal = element.GetInt("spin", 1); Spin = (spinVal == -1) ? SpinDirection.Clockwise : SpinDirection.CounterClockwise; }
protected virtual void Parse(XmlElement element, Folder folder) { Folder = folder; var type = element.GetString("type", "image"); switch(type) { case "image": FileType = FileType.Image; break; case "atlas_image": FileType = FileType.AtlasImage; break; case "sound_effect": FileType = FileType.SoundEffect; break; case "entity": FileType = FileType.Entity; break; default: FileType = FileType.INVALID_TYPE; break; } Name = element.GetString("name", ""); Vector2 pivot; pivot.x = element.GetFloat("pivot_x", 0.0f); pivot.y = element.GetFloat("pivot_y", 0.0f); Pivot = pivot; Vector2 size; size.x = element.GetInt("width", 0); size.y = element.GetInt("height", 0); Size = size; Vector2 offset; offset.x = element.GetInt("offset_x", 0); offset.y = element.GetInt("offset_y", 0); Offset = offset; Vector2 originalSize; originalSize.x = element.GetInt("original_width", 0); originalSize.y = element.GetInt("original_height", 0); OriginalSize = originalSize; }