Beispiel #1
0
        void map_BtnLoad_Click(object sender, EventArgs e)
        {
            object selected = map_lbUnloaded.SelectedItem;

            if (selected == null)
            {
                Popup.Warning("No map file selected."); return;
            }

            UIHelpers.HandleCommand("Load " + selected.ToString());
        }
Beispiel #2
0
        string Map_GetComboboxItem(ComboBox box, string propName)
        {
            object selected = box.SelectedItem;
            string value    = selected == null ? "" : selected.ToString();

            if (value.Length == 0)
            {
                Popup.Warning("Map " + propName + " cannot be blank.");
                return(null);
            }
            return(value);
        }
Beispiel #3
0
        void map_BtnGen_Click(object sender, EventArgs e)
        {
            if (mapgen)
            {
                Popup.Warning("Another map is already being generated."); return;
            }

            string name = map_txtName.Text;
            string seed = map_txtSeed.Text;

            if (String.IsNullOrEmpty(name))
            {
                Popup.Warning("Map name cannot be blank."); return;
            }

            string x = Map_GetComboboxItem(map_cmbX, "width");

            if (x == null)
            {
                return;
            }
            string y = Map_GetComboboxItem(map_cmbY, "height");

            if (y == null)
            {
                return;
            }
            string z = Map_GetComboboxItem(map_cmbZ, "length");

            if (z == null)
            {
                return;
            }
            string type = Map_GetComboboxItem(map_cmbType, "type");

            if (type == null)
            {
                return;
            }

            string args = name + " " + x + " " + y + " " + z + " " + type;

            if (!String.IsNullOrEmpty(seed))
            {
                args += " " + seed;
            }

            Thread genThread = new Thread(() => DoGen(name, args));

            genThread.Name = "MCG_GuiGenMap";
            genThread.Start();
        }
Beispiel #4
0
 void eco_lvlDelete_Click(object sender, EventArgs e)
 {
     if (eco_dgvMaps.SelectedRows.Count == 0)
     {
         Popup.Warning("No available presets to remove");
     }
     else
     {
         DataGridViewRow row = eco_dgvMaps.SelectedRows[0];
         eco_dgvMaps.Rows.Remove(row);
         eco_dgvMaps_Apply();
     }
 }
Beispiel #5
0
        void eco_dgv_DataError(object sender, DataGridViewDataErrorEventArgs e)
        {
            string col = eco_dgvMaps.Columns[e.ColumnIndex].HeaderText;

            if (e.ColumnIndex > 0)
            {
                Popup.Warning(col + " must be an integer greater than zero");
            }
            else
            {
                Popup.Warning("Error setting contents of column " + col);
            }
        }
Beispiel #6
0
        void DelMap_Click(object sender, EventArgs e)
        {
            try {
                object selected = lbUsed.SelectedItem;
                if (selected == null)
                {
                    Popup.Warning("No map selected"); return;
                }
                string map = (string)selected;

                LevelConfig lvlCfg = LevelInfo.GetConfig(map);
                RoundsGameConfig.RemoveMap(Player.Console, map, lvlCfg, game);
            } catch (Exception ex) {
                Logger.LogError("Error removing map from game", ex);
            }
        }
        void AddMap_Click(object sender, EventArgs e)
        {
            try {
                object selected = lbNotUsed.SelectedItem;
                if (selected == null)
                {
                    Popup.Warning("No map selected"); return;
                }
                string map = (string)selected;

                Level       lvl;
                LevelConfig lvlCfg = LevelInfo.GetConfig(map, out lvl);
                RoundsGameConfig.AddMap(Player.Console, map, lvlCfg, game);
            } catch (Exception ex) {
                Logger.LogError("Error adding map to game", ex);
            }
        }
Beispiel #8
0
        string Map_GetComboboxSize(ComboBox box, string propName)
        {
            string value = box.Text;

            if (value.Length == 0)
            {
                Popup.Warning("Map " + propName + " cannot be blank.");
                return(null);
            }

            ushort size;

            if (!ushort.TryParse(value, out size) || size == 0 || size > 16384)
            {
                Popup.Warning("Map " + propName + " must be an integer between 1 and 16384");
                return(null);
            }
            return(value);
        }
Beispiel #9
0
        // warn user if they're using the GUI with a DLL for different server version
        static void CheckVersions()
        {
            string gui_version = Server.InternalVersion;
            string dll_version = Server.Version;

            if (gui_version.CaselessEq(dll_version))
            {
                return;
            }

            const string fmt =
                @"Currently you are using:
  {2} for {0} {1}
  {4} for {0} {3}

Trying to mix two versions is unsupported - you may experience issues";
            string msg = string.Format(fmt, Server.SoftwareName,
                                       gui_version, AssemblyFile(typeof(Window), "MCGalaxy.exe"),
                                       dll_version, AssemblyFile(typeof(Server), "MCGalaxy_.dll"));

            RunAsync(() => Popup.Warning(msg));
        }
Beispiel #10
0
 void NoPlayerSelected()
 {
     Popup.Warning("No player selected");
 }