public SerializableSortedList<int, LayerItem> MapGlitchItems(@object decos, Layer layer) { var items = new SerializableSortedList<int, LayerItem>(); //FIX middleground items, they are handle a bit different; var middleGroundFixX = 0; var middleGroundFixY = 0; if (layer.Name == "middleground") { middleGroundFixX = layer.Width /2; middleGroundFixY = layer.Height; } foreach (var obj in decos.object1) { var item = new LayerItem { Height = Convert.ToInt32([email protected](x => x.id == "h").Value), Width = Convert.ToInt32([email protected](x => x.id == "w").Value), X = Convert.ToInt32([email protected](x => x.id == "x").Value) + middleGroundFixX, Y = Convert.ToInt32([email protected](x => x.id == "y").Value) + middleGroundFixY, ZIndex = Convert.ToInt32([email protected](x => x.id == "z").Value), Name = obj.str.Single(x => x.id == "name").Value, SpriteClass = String.Format("{0}.png", obj.str.Single(x => x.id == "sprite_class").Value), Visible = true, }; var rotate = [email protected](x => x.id == "r"); if (rotate != null) { item.Rotate = Convert.ToInt32(rotate.Value); } if (obj.@bool != null) { var flip = [email protected](x => x.id == "h_flip"); if (flip != null) { item.Flip = Convert.ToBoolean(flip.Value); } } items.Add(item.ZIndex, item); } return items; }
public LayerItemViewModel(LayerItem layerItem) { _layerItem = layerItem; var options = FileManipulationService.LoadOptions(); _assetsFolder = options.AssetsFolder; }