Wire up cash display
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using OpenRA.Traits;
|
||||||
using OpenRA.Widgets;
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Cnc.Widgets.Logic
|
namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||||
@@ -39,15 +40,21 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
|||||||
world.WorldActor.Trait<CncMenuPaletteEffect>()
|
world.WorldActor.Trait<CncMenuPaletteEffect>()
|
||||||
.Fade(CncMenuPaletteEffect.EffectType.None);
|
.Fade(CncMenuPaletteEffect.EffectType.None);
|
||||||
|
|
||||||
|
|
||||||
Game.AddChatLine += AddChatLine;
|
Game.AddChatLine += AddChatLine;
|
||||||
Game.BeforeGameStart += UnregisterEvents;
|
Game.BeforeGameStart += UnregisterEvents;
|
||||||
|
|
||||||
ingameRoot = widget.GetWidget("INGAME_ROOT");
|
ingameRoot = widget.GetWidget("INGAME_ROOT");
|
||||||
|
|
||||||
if (world.LocalPlayer != null)
|
if (world.LocalPlayer != null)
|
||||||
widget.GetWidget("PLAYER_WIDGETS").IsVisible = () => true;
|
{
|
||||||
|
var playerWidgets = widget.GetWidget("PLAYER_WIDGETS");
|
||||||
|
playerWidgets.IsVisible = () => true;
|
||||||
|
|
||||||
|
var sidebarRoot = playerWidgets.GetWidget("SIDEBAR_BACKGROUND");
|
||||||
|
var playerResources = world.LocalPlayer.PlayerActor.Trait<PlayerResources>();
|
||||||
|
sidebarRoot.GetWidget<LabelWidget>("CASH_DISPLAY").GetText = () =>
|
||||||
|
"${0}".F(playerResources.DisplayCash + playerResources.DisplayOre);
|
||||||
|
}
|
||||||
ingameRoot.GetWidget<ButtonWidget>("OPTIONS_BUTTON").OnClick = () =>
|
ingameRoot.GetWidget<ButtonWidget>("OPTIONS_BUTTON").OnClick = () =>
|
||||||
{
|
{
|
||||||
if (menu != MenuType.None)
|
if (menu != MenuType.None)
|
||||||
|
|||||||
@@ -155,12 +155,12 @@ Container@INGAME_ROOT:
|
|||||||
Text:T
|
Text:T
|
||||||
Font:Bold
|
Font:Bold
|
||||||
Label@CASH:
|
Label@CASH:
|
||||||
|
Id:CASH_DISPLAY
|
||||||
Y:160
|
Y:160
|
||||||
Width:PARENT_RIGHT
|
Width:PARENT_RIGHT
|
||||||
Height:25
|
Height:25
|
||||||
Align:Center
|
Align:Center
|
||||||
Font:Bold
|
Font:Bold
|
||||||
Text:$5000
|
|
||||||
Container@PRODUCTION:
|
Container@PRODUCTION:
|
||||||
X:10
|
X:10
|
||||||
Y:190
|
Y:190
|
||||||
|
|||||||
Reference in New Issue
Block a user