private void InsertFeature(Guid id) { var f = this.mapModel.GetFeatureInstance(id); var coords = f.Location; var index = this.ToFeatureIndex(coords); var featureRecord = this.featureService.TryGetFeature(f.FeatureName).Or(DefaultFeatureRecord); var r = featureRecord.GetDrawBounds(this.mapModel.BaseTile.HeightGrid, coords.X, coords.Y); var i = new DrawableItem( r.X, r.Y, index + 1000, // magic number to separate from tiles new DrawableBitmap(featureRecord.Image)); i.Tag = new FeatureTag(f.Id); i.Visible = this.featuresVisible; this.featureMapping[f.Id] = i; this.itemsLayer.Value.Items.Add(i); if (this.mapModel.SelectedFeatures.Contains(f.Id)) { this.itemsLayer.Value.AddToSelection(i); } }
private void UpdateBandbox() { if (this.bandboxMapping != null) { this.itemsLayer.Value.Items.Remove(this.bandboxMapping); } if (this.mapModel == null) { return; } if (this.mapModel.BandboxRectangle == Rectangle.Empty) { return; } var bandbox = DrawableBandbox.CreateSimple( this.mapModel.BandboxRectangle.Size, BandboxFillColor, BandboxBorderColor); this.bandboxMapping = new DrawableItem( this.mapModel.BandboxRectangle.X, this.mapModel.BandboxRectangle.Y, BandboxDepth, bandbox); this.bandboxMapping.Locked = true; this.itemsLayer.Value.Items.Add(this.bandboxMapping); }
private void UpdateBaseTile() { if (this.baseItem != null) { this.itemsLayer.Value.Items.Remove(this.baseItem); } if (this.mapModel == null) { this.baseTile = null; this.baseItem = null; return; } this.baseTile = new DrawableTile(this.mapModel.BaseTile); this.baseTile.BackgroundColor = Color.CornflowerBlue; this.baseTile.DrawHeightMap = this.model.HeightmapVisible; this.baseTile.SeaLevel = this.mapModel.SeaLevel; this.baseItem = new DrawableItem( 0, 0, -1, this.baseTile); this.baseItem.Locked = true; this.itemsLayer.Value.Items.Add(this.baseItem); }
private void editToolStripMenuItem_Click(object sender, EventArgs e) { var selectedItem = DrawableListView.SelectedItems[0]; var group = DrawableXML.categories.Find(x => x.tag == selectedItem.SubItems[1].Text); var item = group.DrawableItems.Find(x => x.tag == selectedItem.SubItems[2].Text); DR_DrawbleText.Text = item.drawable; comboBox1.SelectedIndex = comboBox1.FindStringExact(group.name); DrawbleSelectedItem = item; DrawableDoneButton.Enabled = true; DrawableCancelButton.Enabled = true; }
private void UpdateStartPosition(int index) { if (this.startPositionMapping[index] != null) { var mapping = this.startPositionMapping[index]; this.itemsLayer.Value.Items.Remove(mapping); this.itemsLayer.Value.RemoveFromSelection(mapping); this.startPositionMapping[index] = null; } if (this.mapModel == null) { return; } var p = this.mapModel.GetStartPosition(index); if (p.HasValue) { var heightX = p.Value.X / 16; var heightY = p.Value.Y / 16; var heightValue = 0; if (heightX >= 0 && heightX < this.mapModel.BaseTile.HeightGrid.Width && heightY >= 0 && heightY < this.mapModel.BaseTile.HeightGrid.Height) { heightValue = this.mapModel.BaseTile.HeightGrid.Get(heightX, heightY); } var img = StartPositionImages[index]; var i = new DrawableItem( p.Value.X - (img.Width / 2), p.Value.Y - 58 - (heightValue / 2), int.MaxValue, img); i.Tag = new StartPositionTag(index); this.startPositionMapping[index] = i; this.itemsLayer.Value.Items.Add(i); if (this.mapModel.SelectedStartPosition == index) { this.itemsLayer.Value.AddToSelection(i); } } }
private void InsertTile(Positioned <IMapTile> t, int index) { var drawable = new DrawableTile(t.Item); drawable.BackgroundColor = Color.CornflowerBlue; var i = new DrawableItem( t.Location.X * 32, t.Location.Y * 32, index, drawable); i.Tag = new SectionTag(index); this.tileMapping.Insert(index, i); this.itemsLayer.Value.Items.Add(i); if (this.mapModel.SelectedTile == index) { this.itemsLayer.Value.AddToSelection(i); } }