示例#1
0
        private void LoadMap(string fileName)
        {
            MapperMap map = MapperMap.Load(fileName);

            if (map != null)
            {
                EditorData.AddMap(map);

                // Preserve selection reference
                if (EditorData.CurrentMap != null)
                {
                    //map.Selection.AddRange(EditorData.CurrentMap.Selection.Clone());
                    if (frmLayerInfo != null && frmLayerInfo.Visible)
                    {
                        showSelectionBuffer(map);
                    }
                }

                EditorData.CurrentMap = map;

                this.Text = title + fileName;

                headerToolStripMenuItem.Enabled =
                    menuFileExport.Enabled      =
                        viewMapTreeToolStripMenuItem.Enabled = true;

                viewPortSize.X = ((map.GetEdgeCoords(FOHexMap.Direction.Right).X) - (map.GetEdgeCoords(FOHexMap.Direction.Left).X)) + 100.0f;
                viewPortSize.Y = ((map.GetEdgeCoords(FOHexMap.Direction.Down).Y) - (map.GetEdgeCoords(FOHexMap.Direction.Up).Y)) + 100.0f;

                resizeViewport();
                centerViewport();
                RefreshViewport();

                // TODO: Check critter/proto names and PID in the map itself instead of just graphics.
                var errors = DrawMap.GetErrors();
                errors.Sort();
                frmErrors frmErrors = new frmErrors(fileName, string.Join(Environment.NewLine, errors.Distinct().ToArray()));
                if (errors.Count != 0)
                {
                    frmErrors.ShowDialog();
                }
            }
            else
            {
                MessageBox.Show("Error loading map " + fileName);
            }
        }
示例#2
0
        private void LoadMap( string fileName )
        {
            MapperMap map = MapperMap.Load( fileName);
            if( map != null )
            {
                EditorData.AddMap( map );

                // Preserve selection reference
                if (EditorData.CurrentMap != null)
                {
                    //map.Selection.AddRange(EditorData.CurrentMap.Selection.Clone());
                    if (frmLayerInfo.Visible)
                        showSelectionBuffer(map);
                }

                EditorData.CurrentMap = map;

                this.Text = title + fileName;

                headerToolStripMenuItem.Enabled =
                menuFileExport.Enabled =
                viewMapTreeToolStripMenuItem.Enabled = true;

                viewPortSize.X = ((map.GetEdgeCoords(FOHexMap.Direction.Right).X) - (map.GetEdgeCoords(FOHexMap.Direction.Left).X)) + 100.0f;
                viewPortSize.Y = ((map.GetEdgeCoords(FOHexMap.Direction.Down).Y)  - (map.GetEdgeCoords(FOHexMap.Direction.Up).Y)) + 100.0f;

                resizeViewport();
                centerViewport();
                RefreshViewport();

                // TODO: Check critter/proto names and PID in the map itself instead of just graphics.
                var errors = DrawMap.GetErrors();
                errors.Sort();
                frmErrors frmErrors = new frmErrors(fileName, string.Join(Environment.NewLine, errors.Distinct().ToArray()));
                if(errors.Count != 0)
                    frmErrors.ShowDialog();
            }
            else
                MessageBox.Show( "Error loading map " + fileName );
        }