Exemplo n.º 1
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (_isDirty)
                AskToSaveObjectName(true);

            var openDialog = new OpenFileDialog
                {
                    Filter = "Map File (*.xml)|*.xml",
                    Title = "Open Map xml",
                    RestoreDirectory = true,
                    InitialDirectory = ResourcePath.MapRoot
                };
            if (openDialog.ShowDialog(this) == DialogResult.OK)
            {
                _map = MapObject.Load<WorldMap>(openDialog.FileName);

                ResizeCanvas();

                LoadPallet(_map.Pallet.FileName);
                UpdateEditorTitle();
                panelCanvas.Invalidate();
            }
        }
Exemplo n.º 2
0
        private void LoadPallet(string tilesetName)
        {
            if (!tilesetName.EndsWith(".png", StringComparison.OrdinalIgnoreCase))
                tilesetName += ".png";

            if (_map != null)
                _map.Pallet = Pallet.Get(tilesetName);
            else _map = new WorldMap(tilesetName);

            picturePallet.Image = _map.Pallet.Image;
        }