reenable cash sounds; if you want to disable them for your mod, don't set those evaAlerts properties. (as done in cnc); add SplitOreAndCash property to MoneyBinWidget, restoring old RA behavior (cnc is unchanged)

This commit is contained in:
Chris Forbes
2010-06-16 20:18:01 +12:00
parent 01e95b67d6
commit 5f58379f5b
4 changed files with 21 additions and 14 deletions

View File

@@ -70,12 +70,12 @@ namespace OpenRA.Traits
if (DisplayCash < Cash)
{
DisplayCash += move;
//Sound.PlayToPlayer(self.Owner, eva.CashTickUp);
Sound.PlayToPlayer(self.Owner, eva.CashTickUp);
}
else if (DisplayCash > Cash)
{
DisplayCash -= move;
//Sound.PlayToPlayer(self.Owner, eva.CashTickDown);
Sound.PlayToPlayer(self.Owner, eva.CashTickDown);
}
diff = Math.Abs(Ore - DisplayOre);
@@ -85,12 +85,12 @@ namespace OpenRA.Traits
if (DisplayOre < Ore)
{
DisplayOre += move;
//Sound.PlayToPlayer(self.Owner, eva.CashTickUp);
Sound.PlayToPlayer(self.Owner, eva.CashTickUp);
}
else if (DisplayOre > Ore)
{
DisplayOre -= move;
//Sound.PlayToPlayer(self.Owner, eva.CashTickDown);
Sound.PlayToPlayer(self.Owner, eva.CashTickDown);
}
}

View File

@@ -31,6 +31,7 @@ namespace OpenRA.Widgets
class MoneyBinWidget : Widget
{
const int chromeButtonGap = 2;
public bool SplitOreAndCash = false;
/* legacy crap!!! */
List<Pair<Rectangle, Action<MouseInput>>> buttons = new List<Pair<Rectangle, Action<MouseInput>>>();
@@ -53,7 +54,8 @@ namespace OpenRA.Widgets
new float2(Bounds.Left, 0), "chrome");
// Cash
var cashDigits = playerResources.DisplayCash.ToString();
var cashDigits = (SplitOreAndCash ? playerResources.DisplayCash
: (playerResources.DisplayCash + playerResources.DisplayOre)).ToString();
var x = Bounds.Right - 65;
foreach (var d in cashDigits.Reverse())
@@ -63,16 +65,20 @@ namespace OpenRA.Widgets
new float2(x, 6), "chrome");
x -= 14;
}
x -= 14;
// Ore
var oreDigits = playerResources.DisplayOre.ToString();
foreach (var d in oreDigits.Reverse())
if (SplitOreAndCash)
{
Game.chrome.renderer.RgbaSpriteRenderer.DrawSprite(
ChromeProvider.GetImage(Game.chrome.renderer, digitCollection, (d - '0').ToString()),
new float2(x, 6), "chrome");
x -= 14;
// Ore
var oreDigits = playerResources.DisplayOre.ToString();
foreach (var d in oreDigits.Reverse())
{
Game.chrome.renderer.RgbaSpriteRenderer.DrawSprite(
ChromeProvider.GetImage(Game.chrome.renderer, digitCollection, (d - '0').ToString()),
new float2(x, 6), "chrome");
x -= 14;
}
}
var origin = new int2(Game.viewport.Width - 200, 2);

View File

@@ -552,6 +552,7 @@ Container:
Y:0
Width:320
Height: 32
SplitOreAndCash: yes
Background@INGAME_OPTIONS_BG:
Id:INGAME_OPTIONS_BG
X:(WINDOW_RIGHT - WIDTH)/2

View File

@@ -236,8 +236,8 @@ World:
UnitReadyAudio: unitredy.aud
OnHoldAudio: onhold1.aud
CancelledAudio: cancel1.aud
CashTickUp: tone15.aud
CashTickDown:
CashTickUp:
CashTickDown:
LowPower: lopower1.aud
SilosNeeded: silos1.aud
UnitLost: unitlost.aud