コード例 #1
0
        private void MapSelection_SelectedIndexChanged(object sender, EventArgs e)
        {
            EventSelection.Items.Clear();
            int selection = MapSelection.SelectedIndex;

            if (selection != -1)
            {
                MapXSelection.Maximum = Genus2D.GameData.MapInfo.GetMapInfo(selection).Width;
                MapYSelection.Maximum = Genus2D.GameData.MapInfo.GetMapInfo(selection).Height;

                Genus2D.GameData.MapData data = Genus2D.GameData.MapInfo.LoadMap(selection);
                for (int i = 0; i < data.MapEventsCount(); i++)
                {
                    EventSelection.Items.Add(data.GetMapEvent(i).Name);
                }
                EventSelection.SelectedIndex = EventSelection.Items.Count > 0 ? 0 : -1;
            }
            else
            {
                EventSelection.SelectedIndex = -1;
                MapXSelection.Maximum        = 0;
                MapYSelection.Maximum        = 0;
            }

            MapXSelection.Value = 0;
            MapYSelection.Value = 0;
        }
コード例 #2
0
        public EditMapForm(EditorForm editor, Genus2D.GameData.MapData mapData)
        {
            InitializeComponent();
            _editor  = editor;
            _mapData = mapData;

            NameField.Text           = mapData.GetMapName();
            WidthField.Value         = mapData.GetWidth();
            HeightField.Value        = mapData.GetHeight();
            PvpCheck.Checked         = mapData.PvpEnabled;
            MultiCombatCheck.Checked = mapData.MultiCombat;
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (MapSelection.SelectedIndex == -1)
            {
                MessageBox.Show("Please select a map");
                return;
            }

            Genus2D.GameData.MapData map = Genus2D.GameData.MapInfo.LoadMap(MapSelection.SelectedIndex);
            _editor.SetMapData(map, MapSelection.SelectedIndex);

            this.Close();
        }
コード例 #4
0
 public void SetMapData(Genus2D.GameData.MapData data, int mapID)
 {
     MapData = data;
     MapID   = mapID;
     if (data != null)
     {
         this.AutoScrollMinSize = new Size(data.GetWidth() * 32, data.GetHeight() * 32);
     }
     else
     {
         this.AutoScrollMinSize = new Size(0, 0);
     }
 }
コード例 #5
0
        public MapPanel() : base()
        {
            MapData = null;

            this.AutoScroll        = true;
            this.DoubleBuffered    = true;
            this.Anchor            = (AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Top);
            this.BackColor         = Color.LightGray;
            _tilesetImages         = new List <Image>();
            AutoTileImages         = new Dictionary <string, Image>();
            _coordsLabel           = new Label();
            _coordsLabel.BackColor = Color.Transparent;
            _coordsLabel.Font      = new Font("Arial", 12, FontStyle.Bold);
            this.Controls.Add(_coordsLabel);
        }
コード例 #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            string name   = NameField.Text;
            int    width  = (int)WidthField.Value;
            int    height = (int)HeightField.Value;

            if (name == "")
            {
                MessageBox.Show("Please enter a map name.");
                return;
            }
            else if (Genus2D.GameData.MapInfo.GetMapInfoStrings().Contains(name))
            {
                MessageBox.Show("A map with that name already exists.");
                return;
            }

            Genus2D.GameData.MapData map = new Genus2D.GameData.MapData(name, width, height);
            _editor.SetMapData(map, Genus2D.GameData.MapInfo.NumberMaps());
            Genus2D.GameData.MapInfo.SaveMap(map);

            this.Close();
        }