add a total resource cash counter to the map editor

This commit is contained in:
Matthias Mailänder
2015-08-23 09:55:46 +02:00
parent d77839bb3d
commit fea59346a5
4 changed files with 33 additions and 0 deletions

View File

@@ -9,6 +9,7 @@
#endregion
using System;
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Mods.Common.Traits;
using OpenRA.Widgets;
@@ -65,6 +66,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var coordinateLabel = widget.GetOrNull<LabelWidget>("COORDINATE_LABEL");
if (coordinateLabel != null)
coordinateLabel.GetText = () => worldRenderer.Viewport.ViewToWorld(Viewport.LastMousePos).ToString();
var cashLabel = widget.GetOrNull<LabelWidget>("CASH_LABEL");
if (cashLabel != null)
{
var reslayer = worldRenderer.World.WorldActor.TraitsImplementing<EditorResourceLayer>().FirstOrDefault();
if (reslayer != null)
cashLabel.GetText = () => "$ {0}".F(reslayer.NetWorth);
}
}
}
}