Extracted CashTickUp and CashTickDown to PlayerResources.
This commit is contained in:
@@ -47,6 +47,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Delay (in ticks) during which warnings will be muted.")]
|
[Desc("Delay (in ticks) during which warnings will be muted.")]
|
||||||
public readonly int InsufficientFundsNotificationDelay = 750;
|
public readonly int InsufficientFundsNotificationDelay = 750;
|
||||||
|
|
||||||
|
public readonly string CashTickUpNotification = null;
|
||||||
|
public readonly string CashTickDownNotification = null;
|
||||||
|
|
||||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
|
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
|
||||||
{
|
{
|
||||||
var startingCash = SelectableCash.ToDictionary(c => c.ToString(), c => "$" + c.ToString());
|
var startingCash = SelectableCash.ToDictionary(c => c.ToString(), c => "$" + c.ToString());
|
||||||
@@ -61,12 +64,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public class PlayerResources : ITick, ISync
|
public class PlayerResources : ITick, ISync
|
||||||
{
|
{
|
||||||
readonly PlayerResourcesInfo info;
|
public readonly PlayerResourcesInfo Info;
|
||||||
readonly Player owner;
|
readonly Player owner;
|
||||||
|
|
||||||
public PlayerResources(Actor self, PlayerResourcesInfo info)
|
public PlayerResources(Actor self, PlayerResourcesInfo info)
|
||||||
{
|
{
|
||||||
this.info = info;
|
Info = info;
|
||||||
owner = self.Owner;
|
owner = self.Owner;
|
||||||
|
|
||||||
var startingCash = self.World.LobbyInfo.GlobalSettings
|
var startingCash = self.World.LobbyInfo.GlobalSettings
|
||||||
@@ -164,11 +167,11 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
if (Cash + Resources < num)
|
if (Cash + Resources < num)
|
||||||
{
|
{
|
||||||
if (notifyLowFunds && !string.IsNullOrEmpty(info.InsufficientFundsNotification) &&
|
if (notifyLowFunds && !string.IsNullOrEmpty(Info.InsufficientFundsNotification) &&
|
||||||
owner.World.WorldTick - lastNotificationTick >= info.InsufficientFundsNotificationDelay)
|
owner.World.WorldTick - lastNotificationTick >= Info.InsufficientFundsNotificationDelay)
|
||||||
{
|
{
|
||||||
lastNotificationTick = owner.World.WorldTick;
|
lastNotificationTick = owner.World.WorldTick;
|
||||||
Game.Sound.PlayNotification(owner.World.Map.Rules, owner, "Speech", info.InsufficientFundsNotification, owner.Faction.InternalName);
|
Game.Sound.PlayNotification(owner.World.Map.Rules, owner, "Speech", Info.InsufficientFundsNotification, owner.Faction.InternalName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
displayResources += move;
|
displayResources += move;
|
||||||
|
|
||||||
if (Game.Settings.Sound.CashTicks)
|
if (Game.Settings.Sound.CashTicks)
|
||||||
Game.Sound.PlayNotification(world.Map.Rules, player, "Sounds", "CashTickUp", player.Faction.InternalName);
|
Game.Sound.PlayNotification(world.Map.Rules, player, "Sounds", playerResources.Info.CashTickUpNotification, player.Faction.InternalName);
|
||||||
}
|
}
|
||||||
else if (displayResources > actual)
|
else if (displayResources > actual)
|
||||||
{
|
{
|
||||||
@@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
if (Game.Settings.Sound.CashTicks && nextCashTickTime == 0)
|
if (Game.Settings.Sound.CashTicks && nextCashTickTime == 0)
|
||||||
{
|
{
|
||||||
Game.Sound.PlayNotification(world.Map.Rules, player, "Sounds", "CashTickDown", player.Faction.InternalName);
|
Game.Sound.PlayNotification(world.Map.Rules, player, "Sounds", playerResources.Info.CashTickDownNotification, player.Faction.InternalName);
|
||||||
nextCashTickTime = 2;
|
nextCashTickTime = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ Player:
|
|||||||
PowerManager:
|
PowerManager:
|
||||||
AllyRepair:
|
AllyRepair:
|
||||||
PlayerResources:
|
PlayerResources:
|
||||||
|
CashTickUpNotification: CashTickUp
|
||||||
|
CashTickDownNotification: CashTickDown
|
||||||
DeveloperMode:
|
DeveloperMode:
|
||||||
CheckboxDisplayOrder: 8
|
CheckboxDisplayOrder: 8
|
||||||
BaseAttackNotifier:
|
BaseAttackNotifier:
|
||||||
|
|||||||
@@ -68,6 +68,8 @@ Player:
|
|||||||
PlayerResources:
|
PlayerResources:
|
||||||
SelectableCash: 2500, 5000, 7000, 10000, 20000
|
SelectableCash: 2500, 5000, 7000, 10000, 20000
|
||||||
InsufficientFundsNotification: InsufficientFunds
|
InsufficientFundsNotification: InsufficientFunds
|
||||||
|
CashTickUpNotification: CashTickUp
|
||||||
|
CashTickDownNotification: CashTickDown
|
||||||
DeveloperMode:
|
DeveloperMode:
|
||||||
CheckboxDisplayOrder: 7
|
CheckboxDisplayOrder: 7
|
||||||
BaseAttackNotifier:
|
BaseAttackNotifier:
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ Player:
|
|||||||
AllyRepair:
|
AllyRepair:
|
||||||
PlayerResources:
|
PlayerResources:
|
||||||
InsufficientFundsNotification: InsufficientFunds
|
InsufficientFundsNotification: InsufficientFunds
|
||||||
|
CashTickUpNotification: CashTickUp
|
||||||
|
CashTickDownNotification: CashTickDown
|
||||||
DeveloperMode:
|
DeveloperMode:
|
||||||
CheckboxDisplayOrder: 9
|
CheckboxDisplayOrder: 9
|
||||||
GpsWatcher:
|
GpsWatcher:
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ Player:
|
|||||||
AllyRepair:
|
AllyRepair:
|
||||||
PlayerResources:
|
PlayerResources:
|
||||||
InsufficientFundsNotification: InsufficientFunds
|
InsufficientFundsNotification: InsufficientFunds
|
||||||
|
CashTickUpNotification: CashTickUp
|
||||||
|
CashTickDownNotification: CashTickDown
|
||||||
DeveloperMode:
|
DeveloperMode:
|
||||||
CheckboxEnabled: true
|
CheckboxEnabled: true
|
||||||
CheckboxDisplayOrder: 8
|
CheckboxDisplayOrder: 8
|
||||||
|
|||||||
Reference in New Issue
Block a user