private void toolStripButtonAutoDetect_Click(object sender, EventArgs e) { spriteEditorControl.Sprite.SourceRectangle = null; // if we are not already selecting a tile if (spriteEditorControl.SelectionMode != SpriteEditorSelectionMode.SelectingTile) { spriteEditorControl.SpriteRectangles = this.Sprite.Material.Areas; if (spriteEditorControl.SpriteRectangles.Count >= 1) { String firstKey = null; foreach (String key in this.Sprite.Material.Areas.Keys) { firstKey = key; break; } spriteEditorControl.SelectionMode = SpriteEditorSelectionMode.SelectingTile; spriteEditorControl.SelectedRectangle = firstKey; toolStripButtonUseFullTexture.Enabled = true; toolStripButtonAutoDetect.Enabled = false; } else { MilkshakeForm.ShowErrorMessage("This texture has no detected grid"); } } }
private void buttonSelectTexture_Click(object sender, EventArgs e) { MaterialSelectorDialog materialSelectorDialog = new MaterialSelectorDialog(); materialSelectorDialog.SelectedMaterial = this.AnimatedSprite.Material; materialSelectorDialog.ShowLocalTextures = ItemIsLocal; if (materialSelectorDialog.ShowDialog() == DialogResult.OK && this.AnimatedSprite.Material != materialSelectorDialog.SelectedMaterial) { if (materialSelectorDialog.SelectedMaterial.Areas.Keys.Count == 0) { MilkshakeForm.ShowErrorMessage("The selected Material \"" + materialSelectorDialog.SelectedMaterial.ToString() + "\" does contain any defined Areas.\n" + "To use the animations you need to load an area definition file with this Material"); } else { this.AnimatedSprite.Material = materialSelectorDialog.SelectedMaterial; this.AnimatedSprite.SourceRectangle = null; this.AnimatedSprite.MaterialArea = ""; labelTextureName.Text = materialSelectorDialog.SelectedMaterial.ToString(); RefreshAreaComboList(); } } }
private void buttonGenerate_Click(object sender, EventArgs e) { try { StartSpriteSheetGeneration(); MilkshakeForm.ShowInfoMessage("Spritesheet \"" + comboBoxName.Text + "\" generated successfully"); } catch (Exception ex) { MilkshakeForm.ShowErrorMessage("Could not generate spritesheet: " + ex.Message); } }
protected virtual void RestoreValue(String errorMessage) { if (_initialized) { SetValue(_previousValue); MilkshakeForm.ShowErrorMessage(errorMessage); } else { SetValue(_defaultValue); } }
private void textBoxLife_Validated(object sender, EventArgs e) { try { int newLife = Int32.Parse(textBoxLife.Text, System.Globalization.CultureInfo.InvariantCulture); if (newLife <= 0) { throw new Exception("The life of the animation must be greater than 0"); } PostProcessAnimation.Life = newLife; } catch (Exception ex) { textBoxLife.Text = PostProcessAnimation.Life.ToString(CultureInfo.InvariantCulture); MilkshakeForm.ShowErrorMessage(ex.Message); } }
private void textBoxLoopAmount_Validated(object sender, EventArgs e) { try { int newLoop = int.Parse(textBoxLoopAmount.Text, System.Globalization.CultureInfo.InvariantCulture); if (newLoop < 0) { throw new Exception("The loop amount of the animation must be greater than or equal to 0 (0 = infinite)"); } PostProcessAnimation.LoopMax = newLoop; } catch (Exception ex) { textBoxLoopAmount.Text = PostProcessAnimation.LoopMax.ToString(CultureInfo.InvariantCulture); MilkshakeForm.ShowErrorMessage(ex.Message); } }
private void textBoxMax_Validated(object sender, EventArgs e) { try { int value = int.Parse(textBoxMax.Text, System.Globalization.CultureInfo.InvariantCulture); if (value <= selectedLinearProperty.LowerBound) { throw new Exception("The upper bound must be higher than the lower bound"); } SelectedLinearProperty.UpperBound = value; ApplyNewRangeOfValues(); } catch (Exception ex) { textBoxMax.Text = selectedLinearProperty.UpperBound .ToString(System.Globalization.CultureInfo.InvariantCulture); MilkshakeForm.ShowErrorMessage(ex.Message); } }
private void PasteTemplate() { TreeNode node = MilkshakeForm.Instance.treeViewResources.SelectedNode; if (node == null || node.Tag == null || (node.Tag is SceneItem) == false) { MilkshakeForm.ShowErrorMessage("You must select a Template first"); } else { SceneItem template = node.Tag as SceneItem; if (template.IsTemplate == false) { MilkshakeForm.ShowErrorMessage("The selected SceneItem is not a Template"); } else { SceneItem copy = MilkshakeForm.Instance.CreateNewInstaceCopyOf(template); MilkshakeForm.Instance.AddNewSceneItemInstance(copy, SceneItemGroup.SceneInstances, false); copy.Position = this.SceneMousePos; } } }