StyleCop clean Cnc DLL
This commit is contained in:
@@ -16,9 +16,9 @@ using OpenRA.FileFormats;
|
||||
using OpenRA.FileFormats.Graphics;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Mods.RA;
|
||||
using OpenRA.Mods.RA.Widgets;
|
||||
using OpenRA.Mods.RA.Widgets.Logic;
|
||||
using OpenRA.Widgets;
|
||||
using OpenRA.Mods.RA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{
|
||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
enum PanelType { General, Input }
|
||||
|
||||
SoundDevice soundDevice;
|
||||
PanelType Settings = PanelType.General;
|
||||
PanelType settingsPanel = PanelType.General;
|
||||
ColorPreviewManagerWidget colorPreview;
|
||||
World world;
|
||||
|
||||
@@ -39,11 +39,11 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
|
||||
// General pane
|
||||
var generalButton = panel.Get<ButtonWidget>("GENERAL_BUTTON");
|
||||
generalButton.OnClick = () => Settings = PanelType.General;
|
||||
generalButton.IsHighlighted = () => Settings == PanelType.General;
|
||||
generalButton.OnClick = () => settingsPanel = PanelType.General;
|
||||
generalButton.IsHighlighted = () => settingsPanel == PanelType.General;
|
||||
|
||||
var generalPane = panel.Get("GENERAL_CONTROLS");
|
||||
generalPane.IsVisible = () => Settings == PanelType.General;
|
||||
generalPane.IsVisible = () => settingsPanel == PanelType.General;
|
||||
|
||||
var gameSettings = Game.Settings.Game;
|
||||
var playerSettings = Game.Settings.Player;
|
||||
@@ -102,7 +102,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
|
||||
// Audio
|
||||
var soundSlider = generalPane.Get<SliderWidget>("SOUND_SLIDER");
|
||||
soundSlider.OnChange += x => { soundSettings.SoundVolume = x; Sound.SoundVolume = x;};
|
||||
soundSlider.OnChange += x => { soundSettings.SoundVolume = x; Sound.SoundVolume = x; };
|
||||
soundSlider.Value = soundSettings.SoundVolume;
|
||||
|
||||
var musicSlider = generalPane.Get<SliderWidget>("MUSIC_SLIDER");
|
||||
@@ -122,11 +122,11 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
|
||||
// Input pane
|
||||
var inputPane = panel.Get("INPUT_CONTROLS");
|
||||
inputPane.IsVisible = () => Settings == PanelType.Input;
|
||||
inputPane.IsVisible = () => settingsPanel == PanelType.Input;
|
||||
|
||||
var inputButton = panel.Get<ButtonWidget>("INPUT_BUTTON");
|
||||
inputButton.OnClick = () => Settings = PanelType.Input;
|
||||
inputButton.IsHighlighted = () => Settings == PanelType.Input;
|
||||
inputButton.OnClick = () => settingsPanel = PanelType.Input;
|
||||
inputButton.IsHighlighted = () => settingsPanel == PanelType.Input;
|
||||
|
||||
var classicMouseCheckbox = inputPane.Get<CheckboxWidget>("CLASSICORDERS_CHECKBOX");
|
||||
classicMouseCheckbox.IsChecked = () => gameSettings.UseClassicMouseStyle;
|
||||
@@ -154,7 +154,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
int x, y;
|
||||
int.TryParse(windowWidth.Text, out x);
|
||||
int.TryParse(windowHeight.Text, out y);
|
||||
graphicsSettings.WindowedSize = new int2(x,y);
|
||||
graphicsSettings.WindowedSize = new int2(x, y);
|
||||
soundSettings.Device = soundDevice.Device;
|
||||
soundSettings.Engine = soundDevice.Engine;
|
||||
Game.Settings.Save();
|
||||
@@ -163,6 +163,28 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
};
|
||||
}
|
||||
|
||||
static bool ShowMouseScrollDropdown(DropDownButtonWidget dropdown, GameSettings s)
|
||||
{
|
||||
var options = new Dictionary<string, MouseScrollType>()
|
||||
{
|
||||
{ "Disabled", MouseScrollType.Disabled },
|
||||
{ "Standard", MouseScrollType.Standard },
|
||||
{ "Inverted", MouseScrollType.Inverted },
|
||||
};
|
||||
|
||||
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
||||
{
|
||||
var item = ScrollItemWidget.Setup(itemTemplate,
|
||||
() => s.MouseScroll == options[o],
|
||||
() => s.MouseScroll = options[o]);
|
||||
item.Get<LabelWidget>("LABEL").GetText = () => o;
|
||||
return item;
|
||||
};
|
||||
|
||||
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ShowColorPicker(DropDownButtonWidget color, PlayerSettings s)
|
||||
{
|
||||
Action<HSLColor> onChange = c => colorPreview.Color = c;
|
||||
@@ -183,28 +205,6 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ShowMouseScrollDropdown(DropDownButtonWidget dropdown, GameSettings s)
|
||||
{
|
||||
var options = new Dictionary<string, MouseScrollType>()
|
||||
{
|
||||
{ "Disabled", MouseScrollType.Disabled },
|
||||
{ "Standard", MouseScrollType.Standard },
|
||||
{ "Inverted", MouseScrollType.Inverted },
|
||||
};
|
||||
|
||||
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
||||
{
|
||||
var item = ScrollItemWidget.Setup(itemTemplate,
|
||||
() => s.MouseScroll == options[o],
|
||||
() => s.MouseScroll = options[o]);
|
||||
item.Get<LabelWidget>("LABEL").GetText = () => o;
|
||||
return item;
|
||||
};
|
||||
|
||||
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ShowAudioDeviceDropdown(DropDownButtonWidget dropdown, SoundSettings s, SoundDevice[] devices)
|
||||
{
|
||||
var i = 0;
|
||||
|
||||
Reference in New Issue
Block a user