Fix d2k spacing and ordering style nits.
This commit is contained in:
@@ -95,7 +95,6 @@ namespace OpenRA.Mods.D2k.Traits
|
||||
})
|
||||
.OrderBy(p => (self.Location - p.Actor.Location).LengthSquared);
|
||||
|
||||
|
||||
foreach (var p in carryables)
|
||||
{
|
||||
// Check if its actually me who's the best candidate
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.D2k.Traits
|
||||
public readonly ushort Template = 0;
|
||||
|
||||
[Desc("The terrain types that this template will be placed on")]
|
||||
public readonly string[] TerrainTypes = {};
|
||||
public readonly string[] TerrainTypes = { };
|
||||
|
||||
[Desc("Offset relative to the actor TopLeft. Not used if the template is PickAny")]
|
||||
public readonly CVec Offset = CVec.Zero;
|
||||
|
||||
@@ -41,6 +41,10 @@ namespace OpenRA.Mods.D2k.Widgets
|
||||
public int IconWidth = 64;
|
||||
public int IconHeight = 48;
|
||||
|
||||
readonly WorldRenderer worldRenderer;
|
||||
readonly World world;
|
||||
readonly OrderManager orderManager;
|
||||
|
||||
ProductionQueue CurrentQueue;
|
||||
List<ProductionQueue> VisibleQueues;
|
||||
|
||||
@@ -59,10 +63,6 @@ namespace OpenRA.Mods.D2k.Widgets
|
||||
Animation cantBuild;
|
||||
Animation clock;
|
||||
|
||||
readonly WorldRenderer worldRenderer;
|
||||
readonly World world;
|
||||
readonly OrderManager orderManager;
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public BuildPaletteWidget(OrderManager orderManager, World world, WorldRenderer worldRenderer)
|
||||
{
|
||||
@@ -79,7 +79,7 @@ namespace OpenRA.Mods.D2k.Widgets
|
||||
|
||||
public override void Initialize(WidgetArgs args)
|
||||
{
|
||||
paletteOpenOrigin = new float2(Game.Renderer.Resolution.Width - Columns*IconWidth - 23, 280);
|
||||
paletteOpenOrigin = new float2(Game.Renderer.Resolution.Width - Columns * IconWidth - 23, 280);
|
||||
paletteClosedOrigin = new float2(Game.Renderer.Resolution.Width - 16, 280);
|
||||
paletteOrigin = paletteClosedOrigin;
|
||||
base.Initialize(args);
|
||||
@@ -87,7 +87,7 @@ namespace OpenRA.Mods.D2k.Widgets
|
||||
|
||||
public override Rectangle EventBounds
|
||||
{
|
||||
get { return new Rectangle((int)(paletteOrigin.X) - 24, (int)(paletteOrigin.Y), 239, Math.Max(IconHeight * numActualRows, 40 * tabs.Count + 9)); }
|
||||
get { return new Rectangle((int)paletteOrigin.X - 24, (int)paletteOrigin.Y, 239, Math.Max(IconHeight * numActualRows, 40 * tabs.Count + 9)); }
|
||||
}
|
||||
|
||||
public override void Tick()
|
||||
@@ -108,6 +108,7 @@ namespace OpenRA.Mods.D2k.Widgets
|
||||
else if (CurrentQueue == queue)
|
||||
CurrentQueue = null;
|
||||
}
|
||||
|
||||
if (CurrentQueue == null)
|
||||
CurrentQueue = VisibleQueues.FirstOrDefault();
|
||||
|
||||
@@ -195,9 +196,10 @@ namespace OpenRA.Mods.D2k.Widgets
|
||||
|
||||
public override void Draw()
|
||||
{
|
||||
if (!IsVisible()) return;
|
||||
// TODO: fix
|
||||
if (!IsVisible())
|
||||
return;
|
||||
|
||||
// TODO: fix
|
||||
DrawPalette(CurrentQueue);
|
||||
DrawBuildTabs(world);
|
||||
}
|
||||
@@ -231,7 +233,6 @@ namespace OpenRA.Mods.D2k.Widgets
|
||||
WidgetUtils.DrawRGBA(ChromeProvider.GetImage(paletteCollection, "bottom"),
|
||||
new float2(origin.X - 9, origin.Y - 1 + IconHeight * numActualRows));
|
||||
|
||||
|
||||
// Icons
|
||||
string tooltipItem = null;
|
||||
var tooltipHotkey = Hotkey.Invalid;
|
||||
@@ -279,7 +280,9 @@ namespace OpenRA.Mods.D2k.Widgets
|
||||
if (++x == Columns) { x = 0; y++; }
|
||||
i++;
|
||||
}
|
||||
if (x != 0) y++;
|
||||
|
||||
if (x != 0)
|
||||
y++;
|
||||
|
||||
foreach (var ob in overlayBits)
|
||||
WidgetUtils.DrawSHPCentered(ob.First, ob.Second + iconOffset, worldRenderer);
|
||||
@@ -334,7 +337,7 @@ namespace OpenRA.Mods.D2k.Widgets
|
||||
Sound.PlayNotification(world.Map.Rules, null, "Sounds", "TabClick", null);
|
||||
|
||||
if (name != null)
|
||||
HandleBuildPalette(world, name, (mi.Button == MouseButton.Left));
|
||||
HandleBuildPalette(world, name, mi.Button == MouseButton.Left);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -499,11 +502,11 @@ namespace OpenRA.Mods.D2k.Widgets
|
||||
var power = pl.PlayerActor.Trait<PowerManager>();
|
||||
|
||||
DrawRightAligned("${0}".F(cost), pos + new int2(-5, 5),
|
||||
(resources.DisplayCash + resources.DisplayResources >= cost ? Color.White : Color.Red));
|
||||
resources.DisplayCash + resources.DisplayResources >= cost ? Color.White : Color.Red);
|
||||
|
||||
var lowpower = power.PowerState != PowerState.Normal;
|
||||
var time = CurrentQueue.GetBuildTime(info.Name)
|
||||
* ((lowpower) ? CurrentQueue.Info.LowPowerSlowdown : 1);
|
||||
* (lowpower ? CurrentQueue.Info.LowPowerSlowdown : 1);
|
||||
DrawRightAligned(WidgetUtils.FormatTime(time), pos + new int2(-5, 35), lowpower ? Color.Red : Color.White);
|
||||
|
||||
var pis = info.Traits.WithInterface<PowerInfo>().Where(i => i.UpgradeMinEnabledLevel < 1);
|
||||
@@ -572,6 +575,7 @@ namespace OpenRA.Mods.D2k.Widgets
|
||||
SetCurrentTab(nextQueue);
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Widgets;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.Common.Widgets;
|
||||
using OpenRA.Mods.D2k.Widgets;
|
||||
using OpenRA.Mods.RA;
|
||||
using OpenRA.Mods.RA.Widgets;
|
||||
@@ -63,7 +63,7 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
|
||||
Game.LoadWidget(world, "OBSERVER_WIDGETS", playerRoot, new WidgetArgs());
|
||||
}
|
||||
|
||||
enum RadarBinState { Closed, BinAnimating, RadarAnimating, Open };
|
||||
enum RadarBinState { Closed, BinAnimating, RadarAnimating, Open }
|
||||
void InitPlayerWidgets()
|
||||
{
|
||||
var playerWidgets = Game.LoadWidget(world, "PLAYER_WIDGETS", playerRoot, new WidgetArgs());
|
||||
@@ -80,11 +80,11 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
|
||||
radarMap.AfterOpen = () => binState = RadarBinState.Open;
|
||||
radarMap.AfterClose = () => binState = RadarBinState.BinAnimating;
|
||||
|
||||
radarBin.Get<ImageWidget>("RADAR_BIN_BG").GetImageCollection = () => "chrome-"+world.LocalPlayer.Country.Race;
|
||||
radarBin.Get<ImageWidget>("RADAR_BIN_BG").GetImageCollection = () => "chrome-" + world.LocalPlayer.Country.Race;
|
||||
|
||||
var powerManager = world.LocalPlayer.PlayerActor.Trait<PowerManager>();
|
||||
var powerBar = radarBin.Get<ResourceBarWidget>("POWERBAR");
|
||||
powerBar.IndicatorCollection = "power-"+world.LocalPlayer.Country.Race;
|
||||
powerBar.IndicatorCollection = "power-" + world.LocalPlayer.Country.Race;
|
||||
powerBar.GetProvided = () => powerManager.PowerProvided;
|
||||
powerBar.GetUsed = () => powerManager.PowerDrained;
|
||||
powerBar.TooltipFormat = "Power Usage: {0}/{1}";
|
||||
@@ -106,7 +106,7 @@ namespace OpenRA.Mods.D2k.Widgets.Logic
|
||||
.Any(a => a.Actor.Owner == world.LocalPlayer && a.Trait.IsActive);
|
||||
|
||||
if (radarActive != cachedRadarActive)
|
||||
Sound.PlayNotification(world.Map.Rules, null, "Sounds", (radarActive ? "RadarUp" : "RadarDown"), null);
|
||||
Sound.PlayNotification(world.Map.Rules, null, "Sounds", radarActive ? "RadarUp" : "RadarDown", null);
|
||||
cachedRadarActive = radarActive;
|
||||
|
||||
// Switch to observer mode after win/loss
|
||||
|
||||
@@ -29,8 +29,11 @@ namespace OpenRA.Mods.D2k.Widgets
|
||||
|
||||
public override void Draw()
|
||||
{
|
||||
if( world.LocalPlayer == null ) return;
|
||||
if( world.LocalPlayer.WinState != WinState.Undefined ) return;
|
||||
if (world.LocalPlayer == null)
|
||||
return;
|
||||
|
||||
if (world.LocalPlayer.WinState != WinState.Undefined)
|
||||
return;
|
||||
|
||||
var digitCollection = "digits-" + world.LocalPlayer.Country.Race;
|
||||
var chromeCollection = "chrome-" + world.LocalPlayer.Country.Race;
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace OpenRA.Mods.D2k.Widgets
|
||||
public int2 ClosedOffset = int2.Zero;
|
||||
public int AnimationLength = 0;
|
||||
public Func<bool> IsOpen = () => false;
|
||||
public Action AfterOpen = () => {};
|
||||
public Action AfterClose = () => {};
|
||||
public Action AfterOpen = () => { };
|
||||
public Action AfterClose = () => { };
|
||||
|
||||
int2 offset;
|
||||
int frame;
|
||||
|
||||
@@ -27,13 +27,14 @@ namespace OpenRA.Mods.D2k.Widgets
|
||||
public int IconWidth = 64;
|
||||
public int IconHeight = 48;
|
||||
|
||||
Animation icon;
|
||||
Animation clock;
|
||||
readonly List<Pair<Rectangle, Action<MouseInput>>> buttons = new List<Pair<Rectangle,Action<MouseInput>>>();
|
||||
readonly List<Pair<Rectangle, Action<MouseInput>>> buttons = new List<Pair<Rectangle, Action<MouseInput>>>();
|
||||
|
||||
readonly World world;
|
||||
readonly WorldRenderer worldRenderer;
|
||||
|
||||
Animation icon;
|
||||
Animation clock;
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public SupportPowerBinWidget(World world, WorldRenderer worldRenderer)
|
||||
{
|
||||
@@ -74,7 +75,8 @@ namespace OpenRA.Mods.D2k.Widgets
|
||||
{
|
||||
buttons.Clear();
|
||||
|
||||
if( world.LocalPlayer == null ) return;
|
||||
if (world.LocalPlayer == null)
|
||||
return;
|
||||
|
||||
var manager = world.LocalPlayer.PlayerActor.Trait<SupportPowerManager>();
|
||||
var powers = manager.Powers.Where(p => !p.Value.Disabled);
|
||||
@@ -82,7 +84,7 @@ namespace OpenRA.Mods.D2k.Widgets
|
||||
if (numPowers == 0) return;
|
||||
|
||||
var rectBounds = RenderBounds;
|
||||
WidgetUtils.DrawRGBA(WidgetUtils.GetChromeImage(world, "specialbin-top"),new float2(rectBounds.X,rectBounds.Y));
|
||||
WidgetUtils.DrawRGBA(WidgetUtils.GetChromeImage(world, "specialbin-top"), new float2(rectBounds.X, rectBounds.Y));
|
||||
for (var i = 1; i < numPowers; i++)
|
||||
WidgetUtils.DrawRGBA(WidgetUtils.GetChromeImage(world, "specialbin-middle"), new float2(rectBounds.X, rectBounds.Y + i * 51));
|
||||
WidgetUtils.DrawRGBA(WidgetUtils.GetChromeImage(world, "specialbin-bottom"), new float2(rectBounds.X, rectBounds.Y + numPowers * 51));
|
||||
@@ -104,17 +106,17 @@ namespace OpenRA.Mods.D2k.Widgets
|
||||
if (rect.Contains(Viewport.LastMousePos))
|
||||
{
|
||||
var pos = drawPos.ToInt2();
|
||||
var tl = new int2(pos.X-3,pos.Y-3);
|
||||
var m = new int2(pos.X+64+3,pos.Y+48+3);
|
||||
var br = tl + new int2(64+3+20,40);
|
||||
var tl = new int2(pos.X - 3, pos.Y - 3);
|
||||
var m = new int2(pos.X + 64 + 3, pos.Y + 48 + 3);
|
||||
var br = tl + new int2(64 + 3 + 20, 40);
|
||||
|
||||
if (sp.TotalTime > 0)
|
||||
br += new int2(0,20);
|
||||
br += new int2(0, 20);
|
||||
|
||||
if (sp.Info.LongDesc != null)
|
||||
br += Game.Renderer.Fonts["Regular"].Measure(sp.Info.LongDesc.Replace("\\n", "\n"));
|
||||
else
|
||||
br += new int2(300,0);
|
||||
br += new int2(300, 0);
|
||||
|
||||
var border = WidgetUtils.GetBorderSizes("dialog4");
|
||||
|
||||
@@ -130,9 +132,9 @@ namespace OpenRA.Mods.D2k.Widgets
|
||||
|
||||
if (sp.TotalTime > 0)
|
||||
{
|
||||
pos += new int2(0,20);
|
||||
pos += new int2(0, 20);
|
||||
Game.Renderer.Fonts["Bold"].DrawText(WidgetUtils.FormatTime(sp.RemainingTime), pos, Color.White);
|
||||
Game.Renderer.Fonts["Bold"].DrawText("/ {0}".F(WidgetUtils.FormatTime(sp.TotalTime)), pos + new int2(45,0), Color.White);
|
||||
Game.Renderer.Fonts["Bold"].DrawText("/ {0}".F(WidgetUtils.FormatTime(sp.TotalTime)), pos + new int2(45, 0), Color.White);
|
||||
}
|
||||
|
||||
if (sp.Info.LongDesc != null)
|
||||
@@ -160,7 +162,7 @@ namespace OpenRA.Mods.D2k.Widgets
|
||||
font.DrawTextWithContrast(overlay, overlayPos - new float2(size.X / 2, 0), Color.White, Color.Black, 1);
|
||||
}
|
||||
|
||||
buttons.Add(Pair.New(rect,HandleSupportPower(kv.Key, manager)));
|
||||
buttons.Add(Pair.New(rect, HandleSupportPower(kv.Key, manager)));
|
||||
|
||||
y += 51;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user