Merge pull request #5411 from RoosterDragon/general-clean
General Cleanup
This commit is contained in:
@@ -191,8 +191,8 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
if (!IsVisible()) return;
|
||||
// TODO: fix
|
||||
|
||||
int paletteHeight = DrawPalette(CurrentQueue);
|
||||
DrawBuildTabs(world, paletteHeight);
|
||||
DrawPalette(CurrentQueue);
|
||||
DrawBuildTabs(world);
|
||||
}
|
||||
|
||||
int numActualRows = 5;
|
||||
@@ -413,7 +413,7 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
Game.GetModifierKeys().HasModifier(Modifiers.Shift) ? 5 : 1));
|
||||
}
|
||||
|
||||
void DrawBuildTabs(World world, int paletteHeight)
|
||||
void DrawBuildTabs(World world)
|
||||
{
|
||||
const int tabWidth = 24;
|
||||
const int tabHeight = 40;
|
||||
@@ -450,7 +450,7 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
}
|
||||
}
|
||||
|
||||
void DrawRightAligned(string text, int2 pos, Color c)
|
||||
static void DrawRightAligned(string text, int2 pos, Color c)
|
||||
{
|
||||
var font = Game.Renderer.Fonts["Bold"];
|
||||
font.DrawText(text, pos - new int2(font.Measure(text).X, 0), c);
|
||||
|
||||
@@ -264,7 +264,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
return true;
|
||||
}
|
||||
|
||||
void ShowColorDropDown(DropDownButtonWidget color, ColorPreviewManagerWidget preview, World world)
|
||||
static void ShowColorDropDown(DropDownButtonWidget color, ColorPreviewManagerWidget preview, World world)
|
||||
{
|
||||
Action onExit = () =>
|
||||
{
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
};
|
||||
}
|
||||
|
||||
string ChooseNickname(string nickname)
|
||||
static string ChooseNickname(string nickname)
|
||||
{
|
||||
if (!IrcUtils.IsNickname(nickname))
|
||||
{
|
||||
@@ -172,7 +172,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
IrcClient.Instance.Connect(s.Hostname, s.Port, s.ConnectionTimeout, nickname, s.Username ?? nickname, s.Realname ?? nickname);
|
||||
}
|
||||
|
||||
Widget MakeLabelWidget(LabelWidget template, object item)
|
||||
static Widget MakeLabelWidget(LabelWidget template, object item)
|
||||
{
|
||||
var itemString = item.ToString();
|
||||
var widget = (LabelWidget)template.Clone();
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
}
|
||||
}
|
||||
|
||||
string GetNewsCacheFile()
|
||||
static string GetNewsCacheFile()
|
||||
{
|
||||
var cacheDir = Path.Combine(Platform.SupportDir, "Cache", Game.modData.Manifest.Mod.Id);
|
||||
Directory.CreateDirectory(cacheDir);
|
||||
@@ -190,7 +190,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
public string Content;
|
||||
}
|
||||
|
||||
IEnumerable<NewsItem> ReadNews(byte[] bytes)
|
||||
static IEnumerable<NewsItem> ReadNews(byte[] bytes)
|
||||
{
|
||||
var str = Encoding.UTF8.GetString(bytes);
|
||||
return MiniYaml.FromString(str).Select(node => new NewsItem
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
modOffset = selectedIndex - 4;
|
||||
}
|
||||
|
||||
void LoadMod(ModMetadata mod)
|
||||
static void LoadMod(ModMetadata mod)
|
||||
{
|
||||
Game.RunAfterTick(() =>
|
||||
{
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
});
|
||||
}
|
||||
|
||||
string SongLengthLabel(MusicInfo song)
|
||||
static string SongLengthLabel(MusicInfo song)
|
||||
{
|
||||
return "{0:D1}:{1:D2}".F(song.Length / 60, song.Length % 60);
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
});
|
||||
}
|
||||
|
||||
string MapControl(double control)
|
||||
static string MapControl(double control)
|
||||
{
|
||||
return (control * 100).ToString("F1") + "%";
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
ConnectionLogic.Connect(host, port, "", OpenLobby, DoNothing);
|
||||
}
|
||||
|
||||
string GetPlayersLabel(GameServer game)
|
||||
static string GetPlayersLabel(GameServer game)
|
||||
{
|
||||
if (game == null || game.Players == 0)
|
||||
return "";
|
||||
@@ -298,7 +298,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
return "{0} / {1}".F(game.Players, map.PlayerCount == 0 ? "?" : map.PlayerCount.ToString());
|
||||
}
|
||||
|
||||
string GetStateLabel(GameServer game)
|
||||
static string GetStateLabel(GameServer game)
|
||||
{
|
||||
if (game == null)
|
||||
return "";
|
||||
|
||||
@@ -211,7 +211,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
soundDevice = devices.FirstOrDefault(d => d.Engine == ss.Engine && d.Device == ss.Device) ?? devices.First();
|
||||
|
||||
var audioDeviceDropdown = panel.Get<DropDownButtonWidget>("AUDIO_DEVICE");
|
||||
audioDeviceDropdown.OnMouseDown = _ => ShowAudioDeviceDropdown(audioDeviceDropdown, ss, devices);
|
||||
audioDeviceDropdown.OnMouseDown = _ => ShowAudioDeviceDropdown(audioDeviceDropdown, devices);
|
||||
audioDeviceDropdown.GetText = () => soundDevice.Label;
|
||||
|
||||
return () =>
|
||||
@@ -400,7 +400,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
};
|
||||
}
|
||||
|
||||
bool ShowMouseScrollDropdown(DropDownButtonWidget dropdown, GameSettings s)
|
||||
static bool ShowMouseScrollDropdown(DropDownButtonWidget dropdown, GameSettings s)
|
||||
{
|
||||
var options = new Dictionary<string, MouseScrollType>()
|
||||
{
|
||||
@@ -422,7 +422,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ShowAudioDeviceDropdown(DropDownButtonWidget dropdown, SoundSettings s, SoundDevice[] devices)
|
||||
bool ShowAudioDeviceDropdown(DropDownButtonWidget dropdown, SoundDevice[] devices)
|
||||
{
|
||||
var i = 0;
|
||||
var options = devices.ToDictionary(d => (i++).ToString(), d => d);
|
||||
@@ -441,7 +441,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ShowWindowModeDropdown(DropDownButtonWidget dropdown, GraphicSettings s)
|
||||
static bool ShowWindowModeDropdown(DropDownButtonWidget dropdown, GraphicSettings s)
|
||||
{
|
||||
var options = new Dictionary<string, WindowMode>()
|
||||
{
|
||||
@@ -464,7 +464,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ShowLanguageDropdown(DropDownButtonWidget dropdown)
|
||||
static bool ShowLanguageDropdown(DropDownButtonWidget dropdown)
|
||||
{
|
||||
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
||||
{
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
}
|
||||
}
|
||||
|
||||
Action<MouseInput> HandleSupportPower(string key, SupportPowerManager manager)
|
||||
static Action<MouseInput> HandleSupportPower(string key, SupportPowerManager manager)
|
||||
{
|
||||
return mi =>
|
||||
{
|
||||
|
||||
@@ -251,7 +251,7 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ToggleStatusBars()
|
||||
static bool ToggleStatusBars()
|
||||
{
|
||||
Game.Settings.Game.AlwaysShowStatusBars ^= true;
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user