private void onstepMenuItem_Click(object sender, EventArgs e) { string currentScript = CurrentLayer[0].tiles[tileLocation.Value.X, tileLocation.Value.Y].onStep; using(ScriptSelector selector = new ScriptSelector(currentScript, currentProject)) { if (selector.ShowDialog(this) == DialogResult.OK) { currentProject.Undo.DoCommand(new UndoCommandList("Changed OnStep event", new UndoCommand( delegate() { CurrentLayer[0].tiles[tileLocation.Value.X, tileLocation.Value.Y].onStep = selector.Script; }, delegate() { CurrentLayer[0].tiles[tileLocation.Value.X, tileLocation.Value.Y].onStep = currentScript; } ))); } } }
private void onCollideToolStripMenuItem_Click(object sender, EventArgs e) { Map.Obj obj = CurrentLayer[0].objects[tileLocation.Value.X, tileLocation.Value.Y]; string currentScript = obj.collideScript; using(ScriptSelector selector = new ScriptSelector(currentScript, currentProject)) { if (selector.ShowDialog(this) == DialogResult.OK) { currentProject.Undo.DoCommand(new UndoCommandList("Changed OnCollide event", new UndoCommand( delegate() { obj.collideScript = selector.Script; }, delegate() { obj.collideScript = currentScript; } ))); } } }