public void Update(GameTime gameTime, Scene scene) { KeyboardState keybState = Keyboard.GetState(); if (Game.IsActive) { if (keybState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl) && keybState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.S)) { SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Filter = "XML file|*.xml"; saveFileDialog1.Title = "Save an XML File"; DialogResult dr = saveFileDialog1.ShowDialog(); if (dr == DialogResult.OK) System.IO.File.WriteAllText(saveFileDialog1.FileName, SceneToXml(scene)); } else if (keybState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl) && keybState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.O)) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Filter = "XML file|*.xml"; openFileDialog1.Title = "Open an XML File"; DialogResult dr = openFileDialog1.ShowDialog(); if (dr == DialogResult.OK) { scene.Clean(); SceneFromXml(openFileDialog1.FileName, scene); Vector2 characterPosition = Vector2.Zero; foreach (Element i in scene.Elements) if (i is Character) characterPosition = i.Position; scene.Camera.Position = characterPosition; } } else if (keybState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl) && keybState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.N)) { if (MessageBox.Show("Are you sure you want to clean the scene?", "New scene", MessageBoxButtons.YesNo) == DialogResult.Yes) { scene.Clean(); } } } }