CreateDefaultParameters() private method

private CreateDefaultParameters ( ) : MapGeneratorParameters
return MapGeneratorParameters
示例#1
0
        void SelectGenerator( MapGenerator newGen ) {
            int genIndex = cGenerator.Items.IndexOf( newGen.Name );
            if( cGenerator.SelectedIndex != genIndex ) {
                cGenerator.SelectedIndex = genIndex;
                return;
            }

            generatorParamsPanel.SuspendLayout();
            if( genGui != null ) {
                generatorParamsPanel.Controls.Clear();
                genGui.Dispose();
                genGui = null;
            }

            generator = newGen;
            genGui = MapGenGuiUtil.GetGuiForGenerator( newGen ).CreateGui();

            genGui.Width = generatorParamsPanel.Width;
            generatorParamsPanel.Controls.Add( genGui );
            SetGenParams( generator.CreateDefaultParameters() );
            generatorParamsPanel.ResumeLayout();
            generatorParamsPanel.PerformLayout();

            // clear existing presets
            for( int i = tsbLoadPreset.DropDownItems.Count; i > 4; i-- ) {
                var item = tsbLoadPreset.DropDownItems[0];
                tsbLoadPreset.DropDownItems.RemoveAt( 0 );
                item.Dispose();
            }

            // add new presets
            tsbDefaultPreset.Text = generator.Presets[0];
            foreach( string presetName in generator.Presets.Skip( 1 ) ) {
                tsbLoadPreset.DropDownItems.Insert( 0, new ToolStripMenuItem( presetName ) );
            }
        }
示例#2
0
        void SelectGenerator(MapGenerator newGen) {
            int genIndex = cGenerator.Items.IndexOf(newGen.Name);
            if (cGenerator.SelectedIndex != genIndex) {
                cGenerator.SelectedIndex = genIndex;
                return;
            }

            generatorParamsPanel.SuspendLayout();
            if (genGui != null) {
                generatorParamsPanel.Controls.Clear();
                genGui.Dispose();
                genGui = null;
            }

            generator = newGen;

            // make sure the map dimensions do not conflict with generator's settings
            if (nMapWidth.Value < generator.MinSupportedMapDimension) nMapWidth.Value = generator.MinSupportedMapDimension;
            if (nMapLength.Value < generator.MinSupportedMapDimension) nMapLength.Value = generator.MinSupportedMapDimension;
            if (nMapHeight.Value < generator.MinSupportedMapDimension) nMapHeight.Value = generator.MinSupportedMapDimension;

            // create GUI
            genGui = MapGenGuiUtil.GetGuiForGenerator(newGen).CreateGui();
            genGui.Width = generatorParamsPanel.Width;
            generatorParamsPanel.Controls.Add(genGui);
            SetGenParams(generator.CreateDefaultParameters());
            generatorParamsPanel.ResumeLayout();
            generatorParamsPanel.PerformLayout();

            // clear existing presets
            for (int i = tsbLoadPreset.DropDownItems.Count; i > 4; i--) {
                var item = tsbLoadPreset.DropDownItems[0];
                tsbLoadPreset.DropDownItems.RemoveAt(0);
                item.Dispose();
            }

            // add new presets
            tsbDefaultPreset.Text = generator.Presets[0];
            foreach (string presetName in generator.Presets.Skip(1)) {
                tsbLoadPreset.DropDownItems.Insert(0, new ToolStripMenuItem(presetName));
            }
        }