private Panel CreateExistingWorldInterface(String[] worldNames) { var panel = new Panel(ControlManager.Manager) { Width = 856, Height = 467, AutoScroll = true, Left = 300, Top = 50 }; panel.Init(); ControlManager.Add(panel); if (!worldNames.Any()) { var label = new Label(ControlManager.Manager) { Height = 50, Left = 20, Width = 400, Text = "There are no existing worlds to edit!\nSelect the Create New World tab to create one." }; panel.Add(label); return panel; } var existingWorldLabel = new Label(ControlManager.Manager) { Text = "Existing World :: ", Width = 200, Left = 16, Top = 16, Parent = panel }; var worldNamesSelection = new ComboBox(ControlManager.Manager) { Width = 200, Parent = panel, Top = 16, Left = existingWorldLabel.Left + existingWorldLabel.Width + 20 }; worldNamesSelection.Items.AddRange(worldNames); worldNamesSelection.Init(); worldNamesSelection.ItemIndex = 0; worldNamesSelection.Left = existingWorldLabel.Left + existingWorldLabel.Width + 16; panel.Add(worldNamesSelection); var beginWorldEditor = new Button(ControlManager.Manager) { Text = "Load world", Top = 200, Left = 100, Width = 200 }; beginWorldEditor.Init(); beginWorldEditor.Click += (sender, args) => LoadExistingWorld(worldNamesSelection.Text); panel.Add(beginWorldEditor); return panel; }
public override void Initialize() { base.Initialize(); ScreenResolutions = new List<RadioButton>(); var top = 50; var exit = new Button(ControlManager.Manager) {Text = "Back to previous screen", Left = 50, Top = top, Width = 200, Height = 50}; exit.Init(); ControlManager.Add(exit); exit.Click += (sender, args) => ScreenManager.SwapScreens(this, Constants.ScreenNames.MainMenu); var panel = new Panel(ControlManager.Manager) {Width = 856, Height = 467, Left = 300, Top = 50 }; panel.Init(); ControlManager.Add(panel); var resLabel = new Label(ControlManager.Manager) {Text = "Screen Resolution:", Top = top, Left = 20, Width = 250}; resLabel.Init(); panel.Add(resLabel); top += 50; resolutionPanel = new Panel(ControlManager.Manager) {Color = Color.Gray, Width = 300, Height = 150, Top = 70, Left = 50, Parent = panel, AutoScroll = true}; resolutionPanel.Init(); var resTop = 10; DisplayMode current = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode; foreach (DisplayMode mode in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes.Where(i => i.Format == SurfaceFormat.Color && i.Width >= 1224)) { if (mode.Width > current.Width) FullScreenResolution = mode; var option = new RadioButton(ControlManager.Manager) { Text = String.Format("{0}x{1}", mode.Width, mode.Height), Width = 200, Left = 50, Top = resTop, Parent = resolutionPanel}; option.Checked = mode.Width == GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width && mode.Height == GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height; int x = mode.Width; int y = mode.Height; option.Click += (sender, args) => ApplyResolution(x, y); resTop += 30; option.Init(); current = mode; ScreenResolutions.Add(option); } top += resolutionPanel.Height; var fullScreenModeLabel = new Label(ControlManager.Manager) { Text = "Full Screen Mode:", Top = top, Left = resLabel.Left, Parent = panel, Width = 200 }; fullScreenModeLabel.Init(); top += fullScreenModeLabel.Height; var fullScreenPanel = new Panel(ControlManager.Manager) { Color = Color.Gray, Width = resolutionPanel.Width, Height = 50, Top = top, Left = resolutionPanel.Left, Parent = panel }; fullScreenPanel.Init(); top += fullScreenModeLabel.Height; String OnOff = Application.Graphics.IsFullScreen ? "On" : "Off"; var fullScreenIndicator = new RadioButton(ControlManager.Manager) { Top = top, Left = 100, Width = 200, Parent = panel, Text = "Full Screen: " + OnOff, Checked = Application.Graphics.IsFullScreen }; fullScreenIndicator.Click += (sender, args) => FullScreenMode(fullScreenIndicator); fullScreenIndicator.Init(); top += fullScreenPanel.Height; var backgroundSoundLabel = new Label(ControlManager.Manager) { Text = "Background Volume:", Top = top, Left = 20, Width = 250 }; backgroundSoundLabel.Init(); panel.Add(backgroundSoundLabel); top += backgroundSoundLabel.Height; var backgroundVolumePercentage = new Label(ControlManager.Manager) { Text = "50%", Top = top, Left = 480, Width = 250 }; backgroundVolumePercentage.Init(); panel.Add(backgroundVolumePercentage); var backgroundVolume = new TrackBar(ControlManager.Manager) {Width = 400, Top = top, Left = 50}; backgroundVolume.Init(); panel.Add(backgroundVolume); backgroundVolume.Value = 50; backgroundVolume.ValueChanged += (sender, args) => ChangeBackgroundVolume(backgroundVolumePercentage, backgroundVolume.Value); top += 20; var soundEffectsLabel = new Label(ControlManager.Manager) { Text = "Effects Volume:", Top = top, Left = 20, Width = 250 }; soundEffectsLabel.Init(); panel.Add(soundEffectsLabel); top += 20; var effectsVolumePercentage = new Label(ControlManager.Manager) { Text = "50%", Top = top, Left = 480, Width = 250 }; backgroundVolumePercentage.Init(); panel.Add(effectsVolumePercentage); var effectsVolume = new TrackBar(ControlManager.Manager) {Width = 400, Top = top, Left = 50 }; effectsVolume.Init(); panel.Add(effectsVolume); effectsVolume.Value = 50; effectsVolume.ValueChanged += (sender, args) => ChangeEffectsVolume(effectsVolumePercentage, effectsVolume.Value); }