Red Alert CashTicks

Three options for cash ticks:
Extreme: current behavoir (every cash countdown tick is heard)
Normal: RedAlert countdown style (only one cash countdown tick every ~1 or 2 seconds)
Disabled: No cash tickdown or tickup is heard.

Thanks to Tirili for hints on the settings system.
This commit is contained in:
Remco van der Zon
2012-05-05 11:27:03 +02:00
committed by Chris Forbes
parent 6291c8396b
commit 6c96a106e7
4 changed files with 76 additions and 6 deletions

View File

@@ -71,6 +71,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
// Audio
var audio = bg.Get("AUDIO_PANE");
var soundSettings = Game.Settings.Sound;
var soundslider = audio.Get<SliderWidget>("SOUND_VOLUME");
soundslider.OnChange += x => Sound.SoundVolume = x;
@@ -80,6 +81,12 @@ namespace OpenRA.Mods.RA.Widgets.Logic
musicslider.OnChange += x => Sound.MusicVolume = x;
musicslider.Value = Sound.MusicVolume;
var cashticksdropdown = audio.Get<DropDownButtonWidget>("CASH_TICK_TYPE");
cashticksdropdown.OnMouseDown = _ => ShowSoundTickDropdown(cashticksdropdown, soundSettings);
cashticksdropdown.GetText = () => soundSettings.SoundCashTickType == SoundCashTicks.Extreme ?
"Extreme" : soundSettings.SoundCashTickType == SoundCashTicks.Normal ? "Normal" : "Disabled";
// Display
var display = bg.Get("DISPLAY_PANE");
var gs = Game.Settings.Graphics;
@@ -138,6 +145,29 @@ namespace OpenRA.Mods.RA.Widgets.Logic
return true;
}
public static bool ShowSoundTickDropdown(DropDownButtonWidget dropdown, SoundSettings audio)
{
var options = new Dictionary<string, SoundCashTicks>()
{
{ "Extreme", SoundCashTicks.Extreme },
{ "Normal", SoundCashTicks.Normal },
{ "Disabled", SoundCashTicks.Disabled },
};
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
{
var item = ScrollItemWidget.Setup(itemTemplate,
() => audio.SoundCashTickType == options[o],
() => audio.SoundCashTickType = options[o]);
item.Get<LabelWidget>("LABEL").GetText = () => o;
return item;
};
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem);
return true;
}
public static bool ShowWindowModeDropdown(DropDownButtonWidget dropdown, GraphicSettings s)
{
var options = new Dictionary<string, WindowMode>()