Exemplo n.º 1
0
        private async void ouvrirToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "FRoG Creator map (*.frog)|*.frog";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                IndefinedWaitingFrame waintingFrame = new IndefinedWaitingFrame();
                try
                {
                    waintingFrame.Location = new Point(this.Location.X + (this.Width - waintingFrame.Width) / 2,
                                                       this.Location.Y + (this.Height - waintingFrame.Height) / 2);
                    waintingFrame.Show(this);

                    GameMap map = await GameMap.Load(openFileDialog.FileName);

                    MapPanel mapPanel = new MapPanel(TilesetPanel.Instance.TilesetInfo, map);
                    this.DockPanel.SuspendLayout();
                    mapPanel.Show(this.DockPanel);
                    mapPanel.DockState        = DockState.Document;
                    mapPanel.Dock             = DockStyle.Fill;
                    mapPanel.State            = this.toolStripButtonErase.Checked ? GameEditorState.Erase : GameEditorState.Default;
                    mapPanel.UndoRedoUpdated += MapPanel_UndoRedoUpdated;
                    this.DockPanel.ResumeLayout(true, true);

                    MapPanels.Add(mapPanel);

                    LayerPanel.Instance.LayerPane.Load(map.Layers);
                }
                catch (Exception ex)
                {
                    ConsolePanel.Instance.WriteLine(ex);
                }
                finally
                {
                    waintingFrame.Close();
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Évènement appelé lorsqu'un Redo a été effectué
 /// </summary>
 private void UndoRedoSystem_RedoHappened(object sender, MemoryStream e)
 {
     this.Map             = GameMap.Load(e);
     this.Map.MapChanged += GameMap_MapChanged;
     this.picMap.Invalidate();
 }