Replace cash tick options with a simple on/off.
This commit is contained in:
@@ -20,7 +20,6 @@ using OpenRA.Server;
|
|||||||
namespace OpenRA.GameRules
|
namespace OpenRA.GameRules
|
||||||
{
|
{
|
||||||
public enum MouseScrollType { Disabled, Standard, Inverted }
|
public enum MouseScrollType { Disabled, Standard, Inverted }
|
||||||
public enum SoundCashTicks { Disabled, Normal, Extreme }
|
|
||||||
|
|
||||||
public class ServerSettings
|
public class ServerSettings
|
||||||
{
|
{
|
||||||
@@ -116,7 +115,7 @@ namespace OpenRA.GameRules
|
|||||||
public string Engine = "AL";
|
public string Engine = "AL";
|
||||||
public string Device = null;
|
public string Device = null;
|
||||||
|
|
||||||
public SoundCashTicks SoundCashTickType = SoundCashTicks.Extreme;
|
public bool CashTicks = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PlayerSettings
|
public class PlayerSettings
|
||||||
|
|||||||
@@ -27,8 +27,6 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
readonly Player Owner;
|
readonly Player Owner;
|
||||||
int AdviceInterval;
|
int AdviceInterval;
|
||||||
|
|
||||||
int cashtickallowed = 0;
|
|
||||||
|
|
||||||
public PlayerResources(Actor self, PlayerResourcesInfo info)
|
public PlayerResources(Actor self, PlayerResourcesInfo info)
|
||||||
{
|
{
|
||||||
@@ -103,13 +101,13 @@ namespace OpenRA.Traits
|
|||||||
const float displayCashFracPerFrame = .07f;
|
const float displayCashFracPerFrame = .07f;
|
||||||
const int displayCashDeltaPerFrame = 37;
|
const int displayCashDeltaPerFrame = 37;
|
||||||
int nextSiloAdviceTime = 0;
|
int nextSiloAdviceTime = 0;
|
||||||
|
int nextCashTickTime = 0;
|
||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
{
|
{
|
||||||
if(cashtickallowed > 0) {
|
if (nextCashTickTime > 0)
|
||||||
cashtickallowed = cashtickallowed - 1;
|
nextCashTickTime--;
|
||||||
}
|
|
||||||
|
|
||||||
OreCapacity = self.World.ActorsWithTrait<IStoreOre>()
|
OreCapacity = self.World.ActorsWithTrait<IStoreOre>()
|
||||||
.Where(a => a.Actor.Owner == Owner)
|
.Where(a => a.Actor.Owner == Owner)
|
||||||
.Sum(a => a.Trait.Capacity);
|
.Sum(a => a.Trait.Capacity);
|
||||||
@@ -165,22 +163,17 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
public void playCashTickUp(Actor self)
|
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);
|
Sound.PlayNotification(self.Owner, "Sounds", "CashTickUp", self.Owner.Country.Race);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void playCashTickDown(Actor self)
|
public void playCashTickDown(Actor self)
|
||||||
{
|
{
|
||||||
if (
|
if (Game.Settings.Sound.CashTicks && nextCashTickTime == 0)
|
||||||
Game.Settings.Sound.SoundCashTickType == SoundCashTicks.Extreme ||
|
{
|
||||||
(Game.Settings.Sound.SoundCashTickType == SoundCashTicks.Normal && cashtickallowed == 0)
|
|
||||||
) {
|
|
||||||
Sound.PlayNotification(self.Owner, "Sounds", "CashTickDown", self.Owner.Country.Race);
|
Sound.PlayNotification(self.Owner, "Sounds", "CashTickDown", self.Owner.Country.Race);
|
||||||
cashtickallowed = 3;
|
nextCashTickTime = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,10 +97,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
videoslider.OnChange += x => Sound.VideoVolume = x;
|
videoslider.OnChange += x => Sound.VideoVolume = x;
|
||||||
videoslider.Value = Sound.VideoVolume;
|
videoslider.Value = Sound.VideoVolume;
|
||||||
|
|
||||||
var cashticksdropdown = audio.Get<DropDownButtonWidget>("CASH_TICK_TYPE");
|
var cashTicksCheckbox = audio.Get<CheckboxWidget>("CASHTICK_CHECKBOX");
|
||||||
cashticksdropdown.OnMouseDown = _ => ShowSoundTickDropdown(cashticksdropdown, soundSettings);
|
cashTicksCheckbox.IsChecked = () => Game.Settings.Sound.CashTicks;
|
||||||
cashticksdropdown.GetText = () => soundSettings.SoundCashTickType == SoundCashTicks.Extreme ?
|
cashTicksCheckbox.OnClick = () => Game.Settings.Sound.CashTicks ^= true;
|
||||||
"Extreme" : soundSettings.SoundCashTickType == SoundCashTicks.Normal ? "Normal" : "Disabled";
|
|
||||||
|
|
||||||
var mapMusicCheckbox = audio.Get<CheckboxWidget>("MAP_MUSIC_CHECKBOX");
|
var mapMusicCheckbox = audio.Get<CheckboxWidget>("MAP_MUSIC_CHECKBOX");
|
||||||
mapMusicCheckbox.IsChecked = () => Game.Settings.Sound.MapMusic;
|
mapMusicCheckbox.IsChecked = () => Game.Settings.Sound.MapMusic;
|
||||||
@@ -290,29 +289,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, Game.modData.Languages, setupItem);
|
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, Game.modData.Languages, setupItem);
|
||||||
return true;
|
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)
|
public static bool ShowWindowModeDropdown(DropDownButtonWidget dropdown, GraphicSettings s)
|
||||||
{
|
{
|
||||||
var options = new Dictionary<string, WindowMode>()
|
var options = new Dictionary<string, WindowMode>()
|
||||||
|
|||||||
@@ -165,17 +165,12 @@ Background@SETTINGS_MENU:
|
|||||||
Width:250
|
Width:250
|
||||||
Height:20
|
Height:20
|
||||||
Ticks:5
|
Ticks:5
|
||||||
Label@SOUND_TICK_TYPE_LABEL:
|
Checkbox@CASHTICK_CHECKBOX:
|
||||||
X:0
|
X:0
|
||||||
Y:100
|
|
||||||
Text: Cash ticks
|
|
||||||
DropDownButton@CASH_TICK_TYPE:
|
|
||||||
X:100
|
|
||||||
Y:90
|
Y:90
|
||||||
Width:250
|
Width:200
|
||||||
Height:25
|
Height:20
|
||||||
Font:Regular
|
Text:Cash Ticks
|
||||||
Text:Extreme
|
|
||||||
Checkbox@MAP_MUSIC_CHECKBOX:
|
Checkbox@MAP_MUSIC_CHECKBOX:
|
||||||
X:0
|
X:0
|
||||||
Y:120
|
Y:120
|
||||||
|
|||||||
Reference in New Issue
Block a user