Remove some misc redundancies

This commit is contained in:
ScottNZ
2013-11-12 17:40:34 +13:00
parent 8197f29606
commit 1394c1dcee
48 changed files with 104 additions and 103 deletions

View File

@@ -290,7 +290,7 @@ namespace OpenRA.Mods.RA.Widgets
new float2(Game.Renderer.Resolution.Width - 14, origin.Y - 23));
for (int i = 0; i < numActualRows; i++)
WidgetUtils.DrawRGBA(ChromeProvider.GetImage(paletteCollection, "dock-" + (i % 4).ToString()),
WidgetUtils.DrawRGBA(ChromeProvider.GetImage(paletteCollection, "dock-" + (i % 4)),
new float2(Game.Renderer.Resolution.Width - 14, origin.Y + IconHeight * i));
WidgetUtils.DrawRGBA(ChromeProvider.GetImage(paletteCollection, "dock-bottom"),

View File

@@ -12,6 +12,7 @@ using System;
using System.IO;
using System.Linq;
using System.Threading;
using OpenRA.Utility;
using OpenRA.Widgets;
namespace OpenRA.Mods.RA.Widgets.Logic
@@ -69,21 +70,21 @@ namespace OpenRA.Mods.RA.Widgets.Logic
{
progressBar.Percentage = i*100/ExtractGameFiles.Count();
statusLabel.GetText = () => "Extracting...";
Utility.Command.ExtractFiles(ExtractGameFiles[i]);
Command.ExtractFiles(ExtractGameFiles[i]);
}
for (int i = 0; i < ExportToPng.Length; i++)
{
progressBar.Percentage = i*100/ExportToPng.Count();
statusLabel.GetText = () => "Exporting SHP to PNG...";
Utility.Command.ConvertShpToPng(ExportToPng[i]);
Command.ConvertShpToPng(ExportToPng[i]);
}
for (int i = 0; i < ImportFromPng.Length; i++)
{
progressBar.Percentage = i*100/ImportFromPng.Count();
statusLabel.GetText = () => "Converting PNG to SHP...";
Utility.Command.ConvertPngToShp(ImportFromPng[i]);
Command.ConvertPngToShp(ImportFromPng[i]);
}
Game.RunAfterTick(() =>

View File

@@ -319,7 +319,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
fragileAlliance.IsDisabled = () => Map.Options.FragileAlliances.HasValue || configurationDisabled();
fragileAlliance.OnClick = () => orderManager.IssueOrder(Order.Command(
"fragilealliance {0}".F(!orderManager.LobbyInfo.GlobalSettings.FragileAlliances)));
};
}
var difficulty = optionsBin.GetOrNull<DropDownButtonWidget>("DIFFICULTY_DROPDOWNBUTTON");
if (difficulty != null)
@@ -417,7 +417,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
enableShroud.IsDisabled = () => Map.Options.Shroud.HasValue || configurationDisabled();
enableShroud.OnClick = () => orderManager.IssueOrder(Order.Command(
"shroud {0}".F(!orderManager.LobbyInfo.GlobalSettings.Shroud)));
};
}
var enableFog = optionsBin.GetOrNull<CheckboxWidget>("FOG_CHECKBOX");
if (enableFog != null)
@@ -426,7 +426,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
enableFog.IsDisabled = () => Map.Options.Fog.HasValue || configurationDisabled();
enableFog.OnClick = () => orderManager.IssueOrder(Order.Command(
"fog {0}".F(!orderManager.LobbyInfo.GlobalSettings.Fog)));
};
}
var disconnectButton = lobby.Get<ButtonWidget>("DISCONNECT_BUTTON");
disconnectButton.OnClick = () => { CloseWindow(); onExit(); };

View File

@@ -254,7 +254,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
slot.IsVisible = () => true;
slot.IsDisabled = () => orderManager.LocalClient.IsReady;
slot.GetText = () => c != null ? c.Name : s.Closed ? "Closed" : "Open";
slot.OnMouseDown = _ => LobbyUtils.ShowSlotDropDown(slot, s, c, orderManager);
slot.OnMouseDown = _ => ShowSlotDropDown(slot, s, c, orderManager);
// Ensure Name selector (if present) is hidden
var name = parent.GetOrNull("NAME");
@@ -297,7 +297,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
{
var color = parent.Get<DropDownButtonWidget>("COLOR");
color.IsDisabled = () => (s != null && s.LockColor) || orderManager.LocalClient.IsReady;
color.OnMouseDown = _ => LobbyUtils.ShowColorDropDown(color, c, orderManager, colorPreview);
color.OnMouseDown = _ => ShowColorDropDown(color, c, orderManager, colorPreview);
SetupColorWidget(color, s, c);
}
@@ -312,7 +312,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
{
var dropdown = parent.Get<DropDownButtonWidget>("FACTION");
dropdown.IsDisabled = () => s.LockRace || orderManager.LocalClient.IsReady;
dropdown.OnMouseDown = _ => LobbyUtils.ShowRaceDropDown(dropdown, c, orderManager, countryNames);
dropdown.OnMouseDown = _ => ShowRaceDropDown(dropdown, c, orderManager, countryNames);
SetupFactionWidget(dropdown, s, c, countryNames);
}
@@ -329,7 +329,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
{
var dropdown = parent.Get<DropDownButtonWidget>("TEAM");
dropdown.IsDisabled = () => s.LockTeam || orderManager.LocalClient.IsReady;
dropdown.OnMouseDown = _ => LobbyUtils.ShowTeamDropDown(dropdown, c, orderManager, teamCount);
dropdown.OnMouseDown = _ => ShowTeamDropDown(dropdown, c, orderManager, teamCount);
dropdown.GetText = () => (c.Team == 0) ? "-" : c.Team.ToString();
}

View File

@@ -11,6 +11,7 @@
using System;
using System.Linq;
using OpenRA.GameRules;
using OpenRA.Traits;
using OpenRA.Widgets;
namespace OpenRA.Mods.RA.Widgets.Logic

View File

@@ -194,7 +194,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
return;
}
if (games.Count() == 0)
if (!games.Any())
{
searchStatus = SearchStatus.NoGames;
return;

View File

@@ -126,7 +126,7 @@ namespace OpenRA.Mods.RA.Widgets
if (sp.TotalTime > 0)
{
pos += new int2(0,20);
Game.Renderer.Fonts["Bold"].DrawText(WidgetUtils.FormatTime(sp.RemainingTime).ToString(), pos, Color.White);
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);
}