Upgrading player gui

This commit is contained in:
s1ww
2014-09-23 04:17:53 +02:00
parent 01f83b8d4a
commit b4705add88
5 changed files with 15 additions and 0 deletions

View File

@@ -10,6 +10,7 @@
using OpenRA.Mods.RA.Power;
using OpenRA.Widgets;
using System.Drawing;
namespace OpenRA.Mods.RA.Widgets.Logic
{
@@ -20,7 +21,10 @@ namespace OpenRA.Mods.RA.Widgets.Logic
{
var powerManager = world.LocalPlayer.PlayerActor.Trait<PowerManager>();
var power = widget.Get<LabelWithTooltipWidget>("POWER");
var powerIcon = widget.Get<ImageWidget>("POWER_ICON");
powerIcon.GetImageName = () => powerManager.ExcessPower < 0 ? "power-critical" : "power-normal";
power.GetColor = () => powerManager.ExcessPower < 0 ? Color.Red : Color.White;
power.GetText = () => powerManager.PowerProvided == 1000000 ? "inf" : powerManager.ExcessPower.ToString();
power.GetTooltipText = () => "Power Usage: " + powerManager.PowerDrained.ToString() + (powerManager.PowerProvided != 1000000 ? "/" + powerManager.PowerProvided.ToString() : "");
}

Binary file not shown.

View File

@@ -50,6 +50,10 @@ sidebar-bits: chrome.png
production-tooltip-cost: 448, 80, 16, 16
production-iconoverlay: 314,118,238,48
power-icons: chrome.png
power-normal: 350,0,12,18
power-critical: 363,0,12,18
production-icons: chrome.png
building: 384,0,16,16
building-disabled: 384,16,16,16

View File

@@ -164,6 +164,7 @@ Container@PLAYER_WIDGETS:
Children:
Label@GAME_TIMER:
Logic: GameTimerLogic
X: 3
Y: 263
Width: PARENT_RIGHT
Height: 22
@@ -190,6 +191,12 @@ Container@PLAYER_WIDGETS:
Text: {0}
TooltipContainer: TOOLTIP_CONTAINER
TooltipTemplate: SIMPLE_TOOLTIP
Children:
Image@POWER_ICON:
X: PARENT_RIGHT + 4
Y: 5
ImageCollection: power-icons
ImageName: power-normal
Container@SIDEBAR_PRODUCTION:
Logic: ClassicProductionLogic
X: WINDOW_RIGHT - 250

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 94 KiB