public void SetLayout(int index, FieldLayout layout) { if ((index >= 0) && (index < sequence.Count)) { sequence[index] = layout; } }
internal static SavedLayout AskUserForSavedLayoutDetails(ICollection <FieldObject> fieldObjects, string fieldTypeTag, string[] existingLayoutCategories) { using (SavedLayoutInformation dialog = new SavedLayoutInformation()) { foreach (var fo in fieldObjects) { SavedLayoutEntryItem e = new SavedLayoutEntryItem() { Tag = fo.Tag, Name = fo.Name }; dialog.entriesListBox.Items.Add(e, true); } dialog.categoryComboBox.DataSource = existingLayoutCategories; dialog.categoryComboBox.SelectedIndex = -1; // make sure nothing is specified at first if (dialog.ShowDialog() == DialogResult.OK) { FieldLayout layout = FieldControl.ConvertFieldObjectsToLayout(fieldObjects); for (int index = 0; index < dialog.entriesListBox.Items.Count; index++) { if (!dialog.entriesListBox.GetItemChecked(index)) { layout.RemoveEntry(((SavedLayoutEntryItem)(dialog.entriesListBox.Items[index])).Tag); } } return(new SavedLayout(dialog.nameTextBox.Text, dialog.categoryComboBox.Text, dialog.descriptionTextBox.Text, layout, fieldTypeTag)); } return(null); } }
public void DrawIntoImage(Image image, FieldLayout layoutToDraw, FieldLayout nextLayoutData) { using (Graphics graphics = Graphics.FromImage(image)) { if (image.GetType() == typeof(Bitmap)) { Brush brush = null; try { if (null == FieldType) { brush = new SolidBrush(Color.White); } else { brush = new SolidBrush(this.FieldType.SurfaceColor); } graphics.FillRectangle(brush, 0, 0, image.Width, image.Height); } finally { if (null != brush) { brush.Dispose(); } } } DrawLayoutIntoGraphics(graphics, layoutToDraw, nextLayoutData); } }
public SavedLayout(string name, string category, string description, FieldLayout layout, string fieldTypeTag) { this.name = name; this.category = category; this.description = description; this.layout = layout; this.fieldTypeTag = fieldTypeTag; }
public SavedLayout() { name = ""; category = ""; description = ""; layout = new FieldLayout(); fieldTypeTag = ""; }
static public FieldLayout ConvertFieldObjectsToLayout(ICollection <FieldObject> fieldObjects) { FieldLayout layout = new FieldLayout(); foreach (FieldObject fo in fieldObjects) { layout.AddEntry(fo.Tag, fo.Position); } return(layout); }
public int AddNewLayout(int index, FieldLayout layout) { if (index >= sequence.Count) { sequence.Add(layout); return(sequence.Count - 1); } else { sequence.Insert(index, layout); return(index); } }
protected override void OnPaint(PaintEventArgs e) { if (null == e) { return; } FieldLayout nextLayoutData = null; if (showMovementLines) { nextLayoutData = nextLayout; } DrawLayoutIntoGraphics(e.Graphics, null, nextLayoutData); }
public void SetLayout(FieldLayout layout) { if (null != layout) { foreach (FieldObject fo in fieldObjects) { if (layout.HasEntry(fo.Tag)) { fo.Position = layout.GetEntryPosition(fo.Tag); IsDirty = true; } } Invalidate(); } }
private void DrawLayoutIntoGraphics(Graphics g, FieldLayout layoutToDraw, FieldLayout nextLayoutData) { if (null == FieldType) { return; } g.SmoothingMode = SmoothingMode.AntiAlias; g.Transform = fieldToDisplayTransform; FieldType.DrawMarkings(g); // Draw the movement lines that show the movement between the current position and // the next position in the sequence (these are drawn first so that they appear under // the players) if (nextLayoutData != null) { foreach (FieldObject fieldObject in fieldObjects) { if (nextLayoutData.HasEntry(fieldObject.Tag)) { if (null != layoutToDraw) { fieldObject.DrawMovementLineFrom(g, layoutToDraw.GetEntryPosition(fieldObject.Tag), nextLayoutData.GetEntryPosition(fieldObject.Tag)); } else { fieldObject.DrawMovementLine(g, nextLayoutData.GetEntryPosition(fieldObject.Tag)); } } // endif } } // Draw each of the field objects foreach (FieldObject fieldObject in fieldObjects) { if (null != layoutToDraw) { fieldObject.DrawAt(g, layoutToDraw.GetEntryPosition(fieldObject.Tag)); } else { fieldObject.Draw(g); } } }
public void SetLayouts(FieldLayout layout, FieldLayout newNextLayout) { nextLayout = newNextLayout; SetLayout(layout); }
public void SetNextLayout(FieldLayout layout) { nextLayout = layout; Invalidate(); }