added hidden audio settings to ra/d2k GUI

- video volume
- map music (was shellmap music)
- sound engine
This commit is contained in:
Matthias Mailänder
2013-02-14 19:14:24 +01:00
parent 19e6a588b8
commit ba8c9bb1b1
5 changed files with 69 additions and 6 deletions

View File

@@ -88,7 +88,7 @@ namespace OpenRA.GameRules
public float VideoVolume = 0.5f; public float VideoVolume = 0.5f;
public bool Shuffle = false; public bool Shuffle = false;
public bool Repeat = false; public bool Repeat = false;
public bool ShellmapMusic = true; public bool MapMusic = true;
public string Engine = "AL"; public string Engine = "AL";
public SoundCashTicks SoundCashTickType = SoundCashTicks.Extreme; public SoundCashTicks SoundCashTickType = SoundCashTicks.Extreme;

View File

@@ -109,8 +109,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
musicSlider.Value = soundSettings.MusicVolume; musicSlider.Value = soundSettings.MusicVolume;
var shellmapMusicCheckbox = generalPane.Get<CheckboxWidget>("SHELLMAP_MUSIC"); var shellmapMusicCheckbox = generalPane.Get<CheckboxWidget>("SHELLMAP_MUSIC");
shellmapMusicCheckbox.IsChecked = () => soundSettings.ShellmapMusic; shellmapMusicCheckbox.IsChecked = () => soundSettings.MapMusic;
shellmapMusicCheckbox.OnClick = () => soundSettings.ShellmapMusic ^= true; shellmapMusicCheckbox.OnClick = () => soundSettings.MapMusic ^= true;
// Input pane // Input pane
var inputPane = panel.Get("INPUT_CONTROLS"); var inputPane = panel.Get("INPUT_CONTROLS");

View File

@@ -86,11 +86,24 @@ namespace OpenRA.Mods.RA.Widgets.Logic
musicslider.OnChange += x => Sound.MusicVolume = x; musicslider.OnChange += x => Sound.MusicVolume = x;
musicslider.Value = Sound.MusicVolume; musicslider.Value = Sound.MusicVolume;
var videoslider = audio.Get<SliderWidget>("VIDEO_VOLUME");
videoslider.OnChange += x => Sound.VideoVolume = x;
videoslider.Value = Sound.VideoVolume;
var cashticksdropdown = audio.Get<DropDownButtonWidget>("CASH_TICK_TYPE"); var cashticksdropdown = audio.Get<DropDownButtonWidget>("CASH_TICK_TYPE");
cashticksdropdown.OnMouseDown = _ => ShowSoundTickDropdown(cashticksdropdown, soundSettings); cashticksdropdown.OnMouseDown = _ => ShowSoundTickDropdown(cashticksdropdown, soundSettings);
cashticksdropdown.GetText = () => soundSettings.SoundCashTickType == SoundCashTicks.Extreme ? cashticksdropdown.GetText = () => soundSettings.SoundCashTickType == SoundCashTicks.Extreme ?
"Extreme" : soundSettings.SoundCashTickType == SoundCashTicks.Normal ? "Normal" : "Disabled"; "Extreme" : soundSettings.SoundCashTickType == SoundCashTicks.Normal ? "Normal" : "Disabled";
var mapMusicCheckbox = audio.Get<CheckboxWidget>("MAP_MUSIC_CHECKBOX");
mapMusicCheckbox.IsChecked = () => Game.Settings.Sound.MapMusic;
mapMusicCheckbox.OnClick = () => Game.Settings.Sound.MapMusic ^= true;
var soundEngineDropdown = audio.Get<DropDownButtonWidget>("SOUND_ENGINE");
soundEngineDropdown.OnMouseDown = _ => ShowSoundEngineDropdown(soundEngineDropdown, soundSettings);
soundEngineDropdown.GetText = () => soundSettings.Engine == "AL" ?
"OpenAL" : soundSettings.Engine == "Null" ? "None" : "OpenAL";
// Display // Display
var display = bg.Get("DISPLAY_PANE"); var display = bg.Get("DISPLAY_PANE");
@@ -298,5 +311,26 @@ namespace OpenRA.Mods.RA.Widgets.Logic
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem); dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem);
return true; return true;
} }
public static bool ShowSoundEngineDropdown(DropDownButtonWidget dropdown, SoundSettings s)
{
var options = new Dictionary<string, string>()
{
{ "OpenAL", "AL" },
{ "None", "Null" },
};
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
{
var item = ScrollItemWidget.Setup(itemTemplate,
() => s.Engine == options[o],
() => s.Engine = options[o]);
item.Get<LabelWidget>("LABEL").GetText = () => o;
return item;
};
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem);
return true;
}
} }
} }

View File

@@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA
{ {
var onComplete = Info.Loop ? (Action)PlayMusic : () => {}; var onComplete = Info.Loop ? (Action)PlayMusic : () => {};
if (Game.Settings.Sound.ShellmapMusic && if (Game.Settings.Sound.MapMusic &&
Rules.Music.ContainsKey(Info.Music)) Rules.Music.ContainsKey(Info.Music))
Sound.PlayMusicThen(Rules.Music[Info.Music], onComplete); Sound.PlayMusicThen(Rules.Music[Info.Music], onComplete);
} }

View File

@@ -149,17 +149,46 @@ Background@SETTINGS_MENU:
Width:250 Width:250
Height:20 Height:20
Ticks:5 Ticks:5
Label@SOUND_TICK_TYPE_LABEL: Label@VIDEO_VOLUME_LABEL:
X:0 X:0
Y:70 Y:70
Text: Video Volume
Slider@VIDEO_VOLUME:
X:100
Y:60
Width:250
Height:20
Ticks:5
Label@SOUND_TICK_TYPE_LABEL:
X:0
Y:100
Text: Cash ticks Text: Cash ticks
DropDownButton@CASH_TICK_TYPE: DropDownButton@CASH_TICK_TYPE:
X:100 X:100
Y:60 Y:90
Width:250 Width:250
Height:25 Height:25
Font:Regular Font:Regular
Text:Extreme Text:Extreme
Checkbox@MAP_MUSIC_CHECKBOX:
X:0
Y:120
Width:200
Height:20
Text: Autoplay Music After Map Load
Label@SOUND_ENGINE_LABEL:
X:0
Y:150
Width:75
Height:25
Text:Sound Engine:
DropDownButton@SOUND_ENGINE:
X:100
Y:150
Width:120
Height:25
Font:Regular
Text:OpenAL
Container@DISPLAY_PANE: Container@DISPLAY_PANE:
X:37 X:37
Y:100 Y:100