Replace cash tick options with a simple on/off.

This commit is contained in:
Paul Chote
2013-10-23 19:35:32 +13:00
parent 878e03adb9
commit 4814c0541e
4 changed files with 16 additions and 52 deletions

View File

@@ -20,7 +20,6 @@ using OpenRA.Server;
namespace OpenRA.GameRules
{
public enum MouseScrollType { Disabled, Standard, Inverted }
public enum SoundCashTicks { Disabled, Normal, Extreme }
public class ServerSettings
{
@@ -116,7 +115,7 @@ namespace OpenRA.GameRules
public string Engine = "AL";
public string Device = null;
public SoundCashTicks SoundCashTickType = SoundCashTicks.Extreme;
public bool CashTicks = true;
}
public class PlayerSettings

View File

@@ -28,8 +28,6 @@ namespace OpenRA.Traits
readonly Player Owner;
int AdviceInterval;
int cashtickallowed = 0;
public PlayerResources(Actor self, PlayerResourcesInfo info)
{
Owner = self.Owner;
@@ -103,12 +101,12 @@ namespace OpenRA.Traits
const float displayCashFracPerFrame = .07f;
const int displayCashDeltaPerFrame = 37;
int nextSiloAdviceTime = 0;
int nextCashTickTime = 0;
public void Tick(Actor self)
{
if(cashtickallowed > 0) {
cashtickallowed = cashtickallowed - 1;
}
if (nextCashTickTime > 0)
nextCashTickTime--;
OreCapacity = self.World.ActorsWithTrait<IStoreOre>()
.Where(a => a.Actor.Owner == Owner)
@@ -165,22 +163,17 @@ namespace OpenRA.Traits
public void playCashTickUp(Actor self)
{
if (Game.Settings.Sound.SoundCashTickType != SoundCashTicks.Disabled)
{
if (Game.Settings.Sound.CashTicks)
Sound.PlayNotification(self.Owner, "Sounds", "CashTickUp", self.Owner.Country.Race);
}
}
public void playCashTickDown(Actor self)
{
if (
Game.Settings.Sound.SoundCashTickType == SoundCashTicks.Extreme ||
(Game.Settings.Sound.SoundCashTickType == SoundCashTicks.Normal && cashtickallowed == 0)
) {
if (Game.Settings.Sound.CashTicks && nextCashTickTime == 0)
{
Sound.PlayNotification(self.Owner, "Sounds", "CashTickDown", self.Owner.Country.Race);
cashtickallowed = 3;
}
nextCashTickTime = 2;
}
}
}
}

View File

@@ -97,10 +97,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic
videoslider.OnChange += x => Sound.VideoVolume = x;
videoslider.Value = Sound.VideoVolume;
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";
var cashTicksCheckbox = audio.Get<CheckboxWidget>("CASHTICK_CHECKBOX");
cashTicksCheckbox.IsChecked = () => Game.Settings.Sound.CashTicks;
cashTicksCheckbox.OnClick = () => Game.Settings.Sound.CashTicks ^= true;
var mapMusicCheckbox = audio.Get<CheckboxWidget>("MAP_MUSIC_CHECKBOX");
mapMusicCheckbox.IsChecked = () => Game.Settings.Sound.MapMusic;
@@ -291,28 +290,6 @@ 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>()

View File

@@ -165,17 +165,12 @@ Background@SETTINGS_MENU:
Width:250
Height:20
Ticks:5
Label@SOUND_TICK_TYPE_LABEL:
Checkbox@CASHTICK_CHECKBOX:
X:0
Y:100
Text: Cash ticks
DropDownButton@CASH_TICK_TYPE:
X:100
Y:90
Width:250
Height:25
Font:Regular
Text:Extreme
Width:200
Height:20
Text:Cash Ticks
Checkbox@MAP_MUSIC_CHECKBOX:
X:0
Y:120