public DummyCar(TrafficVoxel target, DummyCarContribution _contrib, int _color, int _index) { this.index = (byte)_index; this.contrib = _contrib; this.color = _color; target.accessory = this; }
protected virtual void onColorChanged(object sender, System.EventArgs e) { DummyCarContribution builder = (DummyCarContribution)typeBox.SelectedItem; if (builder != null) { builder.currentColor = this.currentColor; updatePreview(builder); } }
private void onTypeChanged(object sender, System.EventArgs e) { DummyCarContribution builder = (DummyCarContribution)typeBox.SelectedItem; if (builder != null) { int colors = builder.colorVariations; if (this.colSelector.current > colors) { this.colSelector.current = colors; } this.colSelector.count = colors; builder.currentColor = colors; updatePreview(builder); } }
/// <summary> /// Called when a selection of the structure has changed. /// </summary> protected virtual void updatePreview(DummyCarContribution builder) { //DummyCarContribution builder = (DummyCarContribution)typeBox.SelectedItem; using (PreviewDrawer drawer = new PreviewDrawer(preview.Size, new Size(10, 1), 0)) { drawer.draw(builder.getSprites(), 5, 0); if (previewBitmap != null) { previewBitmap.Dispose(); } preview.Image = previewBitmap = drawer.createBitmap(); } if (isPlacing) { currentController = builder.createBuilder(this.siteImpl); } else { currentController = builder.createRemover(this.siteImpl); } }
public ControllerImpl(DummyCarContribution _contrib, IControllerSite _site, bool _remover) : base(_site) { this.remove = _remover; this.contribution = _contrib; this.color = _contrib.currentColor; }