Beispiel #1
0
		public static string Show(string title, string caption, string defaultText)
		{
			InputForm frm = new InputForm(title, caption, defaultText);
			if (frm.ShowDialog() == DialogResult.OK) {
				return frm.InputText;
			} else {
				return defaultText;
			}
		}
Beispiel #2
0
        public static string Show(string title, string caption, string defaultText)
        {
            InputForm frm = new InputForm(title, caption, defaultText);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                return(frm.InputText);
            }
            else
            {
                return(defaultText);
            }
        }
Beispiel #3
0
        private void duplicateAndPhaseRibbonButton_Click(object sender, EventArgs e)
        {
            if (!IsEditorAvailable())
            {
                return;
            }

            //Check if there is only one peg selected
            LevelEntryCollection objs = LevelEditor.GetSelectedObjects();

            if (objs.Count != 1)
            {
                MessageBox.Show("You must have only one movement peg selected.");
                return;
            }

            //Check if its a moving peg
            LevelEntry movementPeg = objs[0];

            if (movementPeg == null)
            {
                MessageBox.Show("You must have only one movement peg selected.");
                return;
            }

            //Check if the peg has moving details
            Movement movement = movementPeg.MovementInfo;

            if (movement == null)
            {
                MessageBox.Show("The peg must have movement properties.");
                return;
            }

            //Find out how many pegs to duplicate
            string ans = InputForm.Show("How many pegs would you like in this movement cycle, including the selected one?", "Duplicate and Phase", "8");
            int    num_pegs;

            if (!Int32.TryParse(ans, out num_pegs) || num_pegs < 0 || num_pegs > 100)
            {
                MessageBox.Show("Invalid number of pegs.");
                return;
            }

            LevelEntryCollection entries = new LevelEntryCollection();

            entries.Add((LevelEntry)objs[0]);

            //Duplicate the peg
            for (int i = 0; i < num_pegs - 1; i++)
            {
                LevelEntry entry = (LevelEntry)objs[0].Clone();
                LevelEditor.Level.Entries.Add(entry);
                entries.Add(entry);
            }

            LevelEditor.ClearSelection();
            LevelEditor.SelectedEntries = entries;

            spreadPhaseRibbonButton_Click(sender, e);

            LevelEditor.UpdateRedraw();
            UpdatePropertyGrid();
        }