mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-24 04:41:10 +00:00
128 lines
No EOL
3.2 KiB
C#
128 lines
No EOL
3.2 KiB
C#
|
|
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
|
|
|
/*
|
|
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
|
* This program is released under GNU General Public License
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
*/
|
|
|
|
#endregion
|
|
|
|
#region ================== Namespaces
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using CodeImp.DoomBuilder.Map;
|
|
using CodeImp.DoomBuilder.Images;
|
|
|
|
#endregion
|
|
|
|
namespace CodeImp.DoomBuilder.Interface
|
|
{
|
|
internal partial class MapOptionsForm : DelayedForm
|
|
{
|
|
// Variables
|
|
private MapOptions options;
|
|
|
|
// Properties
|
|
public MapOptions Options { get { return options; } }
|
|
|
|
// Constructor
|
|
public MapOptionsForm(MapOptions options)
|
|
{
|
|
int index;
|
|
|
|
// Initialize
|
|
InitializeComponent();
|
|
|
|
// Keep settings
|
|
this.options = options;
|
|
|
|
// Go for all configurations
|
|
for(int i = 0; i < General.Configs.Count; i++)
|
|
{
|
|
// Add config name to list
|
|
index = config.Items.Add(General.Configs[i]);
|
|
|
|
// Is this configuration currently selected?
|
|
if(string.Compare(General.Configs[i].Filename, options.ConfigFile, true) == 0)
|
|
{
|
|
// Select this item
|
|
config.SelectedIndex = index;
|
|
}
|
|
}
|
|
|
|
// Set the level name
|
|
levelname.Text = options.CurrentName;
|
|
|
|
// Fill the resources list
|
|
resourcelocations.EditResourceLocationList(options.Resources);
|
|
}
|
|
|
|
// OK clicked
|
|
private void apply_Click(object sender, EventArgs e)
|
|
{
|
|
// Configuration selected?
|
|
if(config.SelectedIndex == -1)
|
|
{
|
|
// Select a configuration!
|
|
MessageBox.Show(this, "Please select a game configuration to use for editing your map.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
config.Focus();
|
|
return;
|
|
}
|
|
|
|
// Level name empty?
|
|
if(levelname.Text.Length == 0)
|
|
{
|
|
// Enter a level name!
|
|
MessageBox.Show(this, "Please enter a level name for your map.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
levelname.Focus();
|
|
return;
|
|
}
|
|
|
|
// Apply changes
|
|
options.ClearResources();
|
|
options.ConfigFile = General.Configs[config.SelectedIndex].Filename;
|
|
options.CurrentName = levelname.Text.Trim().ToUpper();
|
|
options.CopyResources(resourcelocations.GetResources());
|
|
|
|
// Hide window
|
|
this.DialogResult = DialogResult.OK;
|
|
this.Hide();
|
|
}
|
|
|
|
// Cancel clicked
|
|
private void cancel_Click(object sender, EventArgs e)
|
|
{
|
|
// Just hide window
|
|
this.DialogResult = DialogResult.Cancel;
|
|
this.Hide();
|
|
}
|
|
|
|
// Game configuration chosen
|
|
private void config_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
ConfigurationInfo ci;
|
|
|
|
// Anything selected?
|
|
if(config.SelectedIndex > -1)
|
|
{
|
|
// Get the info
|
|
ci = (ConfigurationInfo)config.SelectedItem;
|
|
|
|
// Show resources
|
|
resourcelocations.FixedResourceLocationList(ci.Resources);
|
|
}
|
|
}
|
|
}
|
|
} |