void ShowOptionsPanel() { // Disable previous stage resolutionPanel.Enabled = false; // Create backdrop if (!backdropCreated) CreateBackdrop(); // Add options panel optionsPanel.Outline.Enabled = true; optionsPanel.BackgroundColor = backgroundColor; optionsPanel.HorizontalAlignment = HorizontalAlignment.Center; //optionsPanel.VerticalAlignment = VerticalAlignment.Middle; optionsPanel.Position = new Vector2(0, 8); optionsPanel.Size = new Vector2(318, 165); NativePanel.Components.Add(optionsPanel); // Add options title text TextLabel titleLabel = new TextLabel(); titleLabel.Text = "Options"; titleLabel.Position = new Vector2(0, 2); titleLabel.HorizontalAlignment = HorizontalAlignment.Center; optionsPanel.Components.Add(titleLabel); // Add settings path text TextLabel settingsPathLabel = new TextLabel(); settingsPathLabel.Text = DaggerfallUnity.Settings.PersistentDataPath; settingsPathLabel.Position = new Vector2(0, 170); settingsPathLabel.HorizontalAlignment = HorizontalAlignment.Center; settingsPathLabel.ShadowPosition = Vector2.zero; settingsPathLabel.TextColor = Color.gray; settingsPathLabel.BackgroundColor = backgroundColor; optionsPanel.Components.Add(settingsPathLabel); // Setup options checkboxes float x = 8; optionPos = 20; alwayShowOptions = AddOption(x, "Always show this window", "Always show this window on startup\rOtherwise use settings.ini to configure", DaggerfallUnity.Settings.ShowOptionsAtStart); vsync = AddOption(x, "Vertical Sync", "Sync FPS with monitor refresh", DaggerfallUnity.Settings.VSync); swapHealthAndFatigue = AddOption(x, "Swap Health & Fatigue", "Swap health & fatigue bar colors", DaggerfallUnity.Settings.SwapHealthAndFatigueColors); invertMouseVertical = AddOption(x, "Invert Mouse", "Invert mouse-look vertical", DaggerfallUnity.Settings.InvertMouseVertical); mouseSmoothing = AddOption(x, "Mouse Smoothing", "Smooth mouse-look sampling", DaggerfallUnity.Settings.MouseLookSmoothing); leftHandWeapons = AddOption(x, "Left Hand Weapons", "Draw weapons on left side of screen", GetLeftHandWeapons()); playerNudity = AddOption(x, "Player Nudity", "Allow nudity on paper doll", DaggerfallUnity.Settings.PlayerNudity); // Setup mods checkboxes x = 165; optionPos = 20; enhancedSky = AddOption(x, "Enhanced Sky (LypyL)", "Enhanced sky with lunar cycles", DaggerfallUnity.Settings.LypyL_EnhancedSky); distantTerrain = AddOption(x, "Distant Terrain (Nystul)", "Enhanced and distant terrain", DaggerfallUnity.Settings.Nystul_IncreasedTerrainDistance); realtimeReflections = AddOption(x, "Realtime Reflections (Nystul)", "Realtime reflections on water and select surfaces", DaggerfallUnity.Settings.Nystul_RealtimeReflections); tallGrass = AddOption(x, "Tall Grass (Uncanny_Valley)", "Animated tall grass", DaggerfallUnity.Settings.UncannyValley_RealGrass); flyingBirds = AddOption(x, "Flying Birds (Uncanny Valley)", "Animated flying birds", DaggerfallUnity.Settings.UncannyValley_BirdsInDaggerfall); // Add mod note string modNote = "Note: Enabling mods can increase performance requirements"; TextLabel modNoteLabel = DaggerfallUI.AddTextLabel(DaggerfallUI.DefaultFont, new Vector2(0, 115), modNote, optionsPanel); modNoteLabel.HorizontalAlignment = HorizontalAlignment.Center; modNoteLabel.ShadowPosition = Vector2.zero; // Confirm button Button optionsConfirmButton = new Button(); optionsConfirmButton.Position = new Vector2(0, optionsPanel.InteriorHeight - 15); optionsConfirmButton.Size = new Vector2(40, 12); optionsConfirmButton.Outline.Enabled = true; optionsConfirmButton.Label.Text = "Play"; optionsConfirmButton.BackgroundColor = new Color(0.0f, 0.5f, 0.0f, 0.4f); optionsConfirmButton.HorizontalAlignment = HorizontalAlignment.Center; optionsConfirmButton.OnMouseClick += OptionsConfirmButton_OnMouseClick; optionsPanel.Components.Add(optionsConfirmButton); // Restart button Button restartButton = new Button(); restartButton.Size = new Vector2(45, 12); restartButton.Label.Text = "< Restart"; restartButton.Label.ShadowPosition = Vector2.zero; restartButton.Label.TextColor = Color.gray; restartButton.ToolTip = defaultToolTip; restartButton.ToolTipText = "Restart setup from beginning"; restartButton.VerticalAlignment = VerticalAlignment.Top; restartButton.HorizontalAlignment = HorizontalAlignment.Left; restartButton.OnMouseClick += RestartButton_OnMouseClick; optionsPanel.Components.Add(restartButton); if (DaggerfallUnity.Settings.LypyL_ModSystem) { Button ShowModsButton = new Button(); ShowModsButton.Label.Text = "Mods"; ShowModsButton.Position = new Vector2(0, optionsConfirmButton.Position.y); ShowModsButton.HorizontalAlignment = HorizontalAlignment.Left; ShowModsButton.Size = optionsConfirmButton.Size; ShowModsButton.BackgroundColor = optionsConfirmButton.BackgroundColor; ShowModsButton.Label.TextColor = optionsConfirmButton.Label.TextColor; ShowModsButton.Outline.Enabled = true; optionsPanel.Components.Add(ShowModsButton); ShowModsButton.OnMouseClick += ModsButton_OnOnMouseBlick; } }
Checkbox AddOption(float x, string text, string tip, bool isChecked) { Checkbox checkbox = new Checkbox(); checkbox.Label.Text = text; checkbox.Label.TextColor = selectedTextColor; checkbox.CheckBoxColor = selectedTextColor; checkbox.ToolTip = defaultToolTip; checkbox.ToolTipText = tip; checkbox.IsChecked = isChecked; checkbox.Position = new Vector2(x, optionPos); optionsPanel.Components.Add(checkbox); optionPos += optionSpacing; return checkbox; }