void ButtonGenerateClick(object sender, EventArgs e) { restoreMap = MapInterface.TheMap; MapInterface.TheMap = null; // To avoid multithread problems // Disable button buttonGenerate.Enabled = false; // Setup config GeneratorConfig config = new GeneratorConfig(); if (comboBoxMapType.SelectedIndex < 0) { return; } config.MapType = (GeneratorConfig.MapPreset)comboBoxMapType.SelectedIndex + 1; config.RandomSeed = (int)numericMapSeed.Value; config.Allow3SideWalls = checkBoxSmoothWalls.Checked; config.PopulateMap = checkBoxPopulate.Checked; Generator.SetConfig(config); // Setup worker handlers Generator.Worker.ProgressChanged += new ProgressChangedEventHandler(Generator_Worker_ProgressChanged); Generator.Worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(Generator_Worker_RunWorkerCompleted); // Generate Generator.GenerateMap(restoreMap); }
/// <summary> /// Updates control, building new script container for specified map /// </summary> public void UpdateForMap(NoxShared.Map map) { scriptContainer = new ScriptObjContainer(map.Scripts); UpdateFunctionsList(); codeBox.SetScriptContainer(scriptContainer); }