remove match timer configuration crap
This commit is contained in:
@@ -28,8 +28,9 @@ namespace OpenRA.GameRules
|
||||
public string MasterServer = "http://master.open-ra.org/";
|
||||
public bool AllowCheats = false;
|
||||
public string Map = null;
|
||||
|
||||
|
||||
public ServerSettings() { }
|
||||
|
||||
public ServerSettings(ServerSettings other)
|
||||
{
|
||||
Name = other.Name;
|
||||
@@ -41,7 +42,7 @@ namespace OpenRA.GameRules
|
||||
Map = other.Map;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class DebugSettings
|
||||
{
|
||||
public bool BotDebug = false;
|
||||
@@ -64,7 +65,7 @@ namespace OpenRA.GameRules
|
||||
public int NumTempBuffers = 8;
|
||||
public int SheetSize = 2048;
|
||||
}
|
||||
|
||||
|
||||
public class SoundSettings
|
||||
{
|
||||
public float SoundVolume = 0.5f;
|
||||
@@ -73,27 +74,23 @@ namespace OpenRA.GameRules
|
||||
public bool Shuffle = false;
|
||||
public bool Repeat = false;
|
||||
}
|
||||
|
||||
|
||||
public class PlayerSettings
|
||||
{
|
||||
public string Name = "Newbie";
|
||||
[Obsolete] public Color Color1 = Color.FromArgb(255,160,238);
|
||||
[Obsolete] public Color Color2 = Color.FromArgb(68,0,56);
|
||||
public ColorRamp ColorRamp = new ColorRamp(75, 255, 180, 25);
|
||||
public string LastServer = "localhost:1234";
|
||||
}
|
||||
|
||||
|
||||
public enum MouseScrollType { Disabled, Standard, Inverted }
|
||||
|
||||
public class GameSettings
|
||||
{
|
||||
public string[] Mods = { "ra" };
|
||||
public bool MatchTimer = true;
|
||||
public bool ShellmapMusic = true;
|
||||
|
||||
// Chat settings
|
||||
|
||||
public bool TeamChatToggle = false;
|
||||
|
||||
// Behaviour settings
|
||||
public bool ViewportEdgeScroll = true;
|
||||
public MouseScrollType MouseScroll = MouseScrollType.Standard;
|
||||
public float ViewportEdgeScrollStep = 10f;
|
||||
|
||||
@@ -16,11 +16,6 @@ namespace OpenRA.Widgets
|
||||
public class TimerWidget : Widget
|
||||
{
|
||||
public Stopwatch Stopwatch;
|
||||
|
||||
public TimerWidget ()
|
||||
{
|
||||
IsVisible = () => Game.Settings.Game.MatchTimer;
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
{
|
||||
|
||||
@@ -20,16 +20,12 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{
|
||||
public class CncSettingsLogic
|
||||
{
|
||||
enum PanelType
|
||||
{
|
||||
General,
|
||||
Input
|
||||
}
|
||||
enum PanelType { General, Input }
|
||||
|
||||
PanelType Settings = PanelType.General;
|
||||
CncColorPickerPaletteModifier playerPalettePreview;
|
||||
World world;
|
||||
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public CncSettingsLogic([ObjectCreator.Param] Widget widget,
|
||||
[ObjectCreator.Param] World world,
|
||||
@@ -37,55 +33,51 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{
|
||||
this.world = world;
|
||||
var panel = widget.GetWidget("SETTINGS_PANEL");
|
||||
|
||||
|
||||
// General pane
|
||||
var generalButton = panel.GetWidget<ButtonWidget>("GENERAL_BUTTON");
|
||||
generalButton.OnClick = () => Settings = PanelType.General;
|
||||
generalButton.IsDisabled = () => Settings == PanelType.General;
|
||||
|
||||
|
||||
var generalPane = panel.GetWidget("GENERAL_CONTROLS");
|
||||
generalPane.IsVisible = () => Settings == PanelType.General;
|
||||
|
||||
|
||||
var gameSettings = Game.Settings.Game;
|
||||
var playerSettings = Game.Settings.Player;
|
||||
var debugSettings = Game.Settings.Debug;
|
||||
var graphicsSettings = Game.Settings.Graphics;
|
||||
var soundSettings = Game.Settings.Sound;
|
||||
|
||||
|
||||
// Player profile
|
||||
var nameTextfield = generalPane.GetWidget<TextFieldWidget>("NAME_TEXTFIELD");
|
||||
nameTextfield.Text = playerSettings.Name;
|
||||
|
||||
|
||||
playerPalettePreview = world.WorldActor.Trait<CncColorPickerPaletteModifier>();
|
||||
playerPalettePreview.Ramp = playerSettings.ColorRamp;
|
||||
|
||||
|
||||
var colorDropdown = generalPane.GetWidget<DropDownButtonWidget>("COLOR_DROPDOWN");
|
||||
colorDropdown.OnMouseDown = _ => ShowColorPicker(colorDropdown, playerSettings);
|
||||
colorDropdown.GetWidget<ColorBlockWidget>("COLORBLOCK").GetColor = () => playerSettings.ColorRamp.GetColor(0);
|
||||
|
||||
|
||||
// Debug
|
||||
var perftextCheckbox = generalPane.GetWidget<CheckboxWidget>("PERFTEXT_CHECKBOX");
|
||||
perftextCheckbox.IsChecked = () => debugSettings.PerfText;
|
||||
perftextCheckbox.OnClick = () => debugSettings.PerfText ^= true;
|
||||
|
||||
|
||||
var perfgraphCheckbox = generalPane.GetWidget<CheckboxWidget>("PERFGRAPH_CHECKBOX");
|
||||
perfgraphCheckbox.IsChecked = () => debugSettings.PerfGraph;
|
||||
perfgraphCheckbox.OnClick = () => debugSettings.PerfGraph ^= true;
|
||||
|
||||
var matchtimerCheckbox = generalPane.GetWidget<CheckboxWidget>("MATCHTIME_CHECKBOX");
|
||||
matchtimerCheckbox.IsChecked = () => gameSettings.MatchTimer;
|
||||
matchtimerCheckbox.OnClick = () => gameSettings.MatchTimer ^= true;
|
||||
|
||||
|
||||
var checkunsyncedCheckbox = generalPane.GetWidget<CheckboxWidget>("CHECKUNSYNCED_CHECKBOX");
|
||||
checkunsyncedCheckbox.IsChecked = () => debugSettings.SanityCheckUnsyncedCode;
|
||||
checkunsyncedCheckbox.OnClick = () => debugSettings.SanityCheckUnsyncedCode ^= true;
|
||||
|
||||
|
||||
// Video
|
||||
var windowModeDropdown = generalPane.GetWidget<DropDownButtonWidget>("MODE_DROPDOWN");
|
||||
windowModeDropdown.OnMouseDown = _ => ShowWindowModeDropdown(windowModeDropdown, graphicsSettings);
|
||||
windowModeDropdown.GetText = () => graphicsSettings.Mode == WindowMode.Windowed ?
|
||||
"Windowed" : graphicsSettings.Mode == WindowMode.Fullscreen ? "Fullscreen" : "Pseudo-Fullscreen";
|
||||
|
||||
|
||||
var pixelDoubleCheckbox = generalPane.GetWidget<CheckboxWidget>("PIXELDOUBLE_CHECKBOX");
|
||||
pixelDoubleCheckbox.IsChecked = () => graphicsSettings.PixelDouble;
|
||||
pixelDoubleCheckbox.OnClick = () =>
|
||||
@@ -97,7 +89,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
generalPane.GetWidget("WINDOW_RESOLUTION").IsVisible = () => graphicsSettings.Mode == WindowMode.Windowed;
|
||||
var windowWidth = generalPane.GetWidget<TextFieldWidget>("WINDOW_WIDTH");
|
||||
windowWidth.Text = graphicsSettings.WindowedSize.X.ToString();
|
||||
|
||||
|
||||
var windowHeight = generalPane.GetWidget<TextFieldWidget>("WINDOW_HEIGHT");
|
||||
windowHeight.Text = graphicsSettings.WindowedSize.Y.ToString();
|
||||
|
||||
@@ -105,16 +97,15 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
var soundSlider = generalPane.GetWidget<SliderWidget>("SOUND_SLIDER");
|
||||
soundSlider.OnChange += x => { soundSettings.SoundVolume = x; Sound.SoundVolume = x;};
|
||||
soundSlider.Value = soundSettings.SoundVolume;
|
||||
|
||||
|
||||
var musicSlider = generalPane.GetWidget<SliderWidget>("MUSIC_SLIDER");
|
||||
musicSlider.OnChange += x => { soundSettings.MusicVolume = x; Sound.MusicVolume = x; };
|
||||
musicSlider.Value = soundSettings.MusicVolume;
|
||||
|
||||
|
||||
var shellmapMusicCheckbox = generalPane.GetWidget<CheckboxWidget>("SHELLMAP_MUSIC");
|
||||
shellmapMusicCheckbox.IsChecked = () => gameSettings.ShellmapMusic;
|
||||
shellmapMusicCheckbox.OnClick = () => gameSettings.ShellmapMusic ^= true;
|
||||
|
||||
|
||||
|
||||
// Input pane
|
||||
var inputPane = panel.GetWidget("INPUT_CONTROLS");
|
||||
inputPane.IsVisible = () => Settings == PanelType.Input;
|
||||
@@ -122,25 +113,25 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
var inputButton = panel.GetWidget<ButtonWidget>("INPUT_BUTTON");
|
||||
inputButton.OnClick = () => Settings = PanelType.Input;
|
||||
inputButton.IsDisabled = () => Settings == PanelType.Input;
|
||||
|
||||
|
||||
inputPane.GetWidget<CheckboxWidget>("CLASSICORDERS_CHECKBOX").IsDisabled = () => true;
|
||||
|
||||
|
||||
var scrollSlider = inputPane.GetWidget<SliderWidget>("SCROLLSPEED_SLIDER");
|
||||
scrollSlider.Value = gameSettings.ViewportEdgeScrollStep;
|
||||
scrollSlider.OnChange += x => gameSettings.ViewportEdgeScrollStep = x;
|
||||
|
||||
|
||||
var edgescrollCheckbox = inputPane.GetWidget<CheckboxWidget>("EDGESCROLL_CHECKBOX");
|
||||
edgescrollCheckbox.IsChecked = () => gameSettings.ViewportEdgeScroll;
|
||||
edgescrollCheckbox.OnClick = () => gameSettings.ViewportEdgeScroll ^= true;
|
||||
|
||||
|
||||
var mouseScrollDropdown = inputPane.GetWidget<DropDownButtonWidget>("MOUSE_SCROLL");
|
||||
mouseScrollDropdown.OnMouseDown = _ => ShowMouseScrollDropdown(mouseScrollDropdown, gameSettings);
|
||||
mouseScrollDropdown.GetText = () => gameSettings.MouseScroll.ToString();
|
||||
|
||||
|
||||
var teamchatCheckbox = inputPane.GetWidget<CheckboxWidget>("TEAMCHAT_CHECKBOX");
|
||||
teamchatCheckbox.IsChecked = () => gameSettings.TeamChatToggle;
|
||||
teamchatCheckbox.OnClick = () => gameSettings.TeamChatToggle ^= true;
|
||||
|
||||
|
||||
panel.GetWidget<ButtonWidget>("BACK_BUTTON").OnClick = () =>
|
||||
{
|
||||
playerSettings.Name = nameTextfield.Text;
|
||||
@@ -153,31 +144,23 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
onExit();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
bool ShowColorPicker(DropDownButtonWidget color, PlayerSettings s)
|
||||
{
|
||||
Action<ColorRamp> onSelect = c =>
|
||||
{
|
||||
s.ColorRamp = c;
|
||||
color.RemovePanel();
|
||||
};
|
||||
|
||||
Action<ColorRamp> onChange = c =>
|
||||
{
|
||||
playerPalettePreview.Ramp = c;
|
||||
};
|
||||
|
||||
Action<ColorRamp> onSelect = c => { s.ColorRamp = c; color.RemovePanel(); };
|
||||
Action<ColorRamp> onChange = c => { playerPalettePreview.Ramp = c; };
|
||||
|
||||
var colorChooser = Game.LoadWidget(world, "COLOR_CHOOSER", null, new WidgetArgs()
|
||||
{
|
||||
{ "onSelect", onSelect },
|
||||
{ "onChange", onChange },
|
||||
{ "initialRamp", s.ColorRamp }
|
||||
});
|
||||
|
||||
|
||||
color.AttachPanel(colorChooser);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ShowWindowModeDropdown(DropDownButtonWidget dropdown, GraphicSettings s)
|
||||
{
|
||||
var options = new Dictionary<string, WindowMode>()
|
||||
@@ -186,21 +169,20 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{ "Fullscreen", WindowMode.Fullscreen },
|
||||
{ "Windowed", WindowMode.Windowed },
|
||||
};
|
||||
|
||||
|
||||
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
||||
{
|
||||
var item = ScrollItemWidget.Setup(itemTemplate,
|
||||
() => s.Mode == options[o],
|
||||
() => s.Mode = options[o]);
|
||||
() => s.Mode == options[o],
|
||||
() => s.Mode = options[o]);
|
||||
item.GetWidget<LabelWidget>("LABEL").GetText = () => o;
|
||||
return item;
|
||||
};
|
||||
|
||||
|
||||
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys.ToList(), setupItem);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool ShowMouseScrollDropdown(DropDownButtonWidget dropdown, GameSettings s)
|
||||
{
|
||||
var options = new Dictionary<string, MouseScrollType>()
|
||||
@@ -209,16 +191,16 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
{ "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]);
|
||||
() => s.MouseScroll == options[o],
|
||||
() => s.MouseScroll = options[o]);
|
||||
item.GetWidget<LabelWidget>("LABEL").GetText = () => o;
|
||||
return item;
|
||||
};
|
||||
|
||||
|
||||
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys.ToList(), setupItem);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -74,11 +74,11 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
var musicslider = audio.GetWidget<SliderWidget>("MUSIC_VOLUME");
|
||||
musicslider.OnChange += x => Sound.MusicVolume = x;
|
||||
musicslider.Value = Sound.MusicVolume;
|
||||
|
||||
|
||||
// Display
|
||||
var display = bg.GetWidget("DISPLAY_PANE");
|
||||
var gs = Game.Settings.Graphics;
|
||||
|
||||
|
||||
var windowModeDropdown = display.GetWidget<DropDownButtonWidget>("MODE_DROPDOWN");
|
||||
windowModeDropdown.OnMouseDown = _ => ShowWindowModeDropdown(windowModeDropdown, gs);
|
||||
windowModeDropdown.GetText = () => gs.Mode == WindowMode.Windowed ?
|
||||
@@ -87,7 +87,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
display.GetWidget("WINDOW_RESOLUTION").IsVisible = () => gs.Mode == WindowMode.Windowed;
|
||||
var windowWidth = display.GetWidget<TextFieldWidget>("WINDOW_WIDTH");
|
||||
windowWidth.Text = gs.WindowedSize.X.ToString();
|
||||
|
||||
|
||||
var windowHeight = display.GetWidget<TextFieldWidget>("WINDOW_HEIGHT");
|
||||
windowHeight.Text = gs.WindowedSize.Y.ToString();
|
||||
|
||||
@@ -105,13 +105,11 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
var perfgraphCheckbox = debug.GetWidget<CheckboxWidget>("PERFDEBUG_CHECKBOX");
|
||||
perfgraphCheckbox.IsChecked = () => Game.Settings.Debug.PerfGraph;
|
||||
perfgraphCheckbox.OnClick = () => Game.Settings.Debug.PerfGraph ^= true;
|
||||
|
||||
Game.Settings.Game.MatchTimer = true;
|
||||
|
||||
|
||||
var checkunsyncedCheckbox = debug.GetWidget<CheckboxWidget>("CHECKUNSYNCED_CHECKBOX");
|
||||
checkunsyncedCheckbox.IsChecked = () => Game.Settings.Debug.SanityCheckUnsyncedCode;
|
||||
checkunsyncedCheckbox.OnClick = () => Game.Settings.Debug.SanityCheckUnsyncedCode ^= true;
|
||||
|
||||
|
||||
bg.GetWidget<ButtonWidget>("BUTTON_CLOSE").OnClick = () =>
|
||||
{
|
||||
int x = gs.WindowedSize.X, y = gs.WindowedSize.Y;
|
||||
|
||||
@@ -77,18 +77,10 @@ Container@SETTINGS_PANEL:
|
||||
Height:20
|
||||
Font:Regular
|
||||
Text:Show Performance Graph
|
||||
Checkbox@MATCHTIME_CHECKBOX:
|
||||
Id:MATCHTIME_CHECKBOX
|
||||
X:15
|
||||
Y:180
|
||||
Width:300
|
||||
Height:20
|
||||
Font:Regular
|
||||
Text:Show Match Timer
|
||||
Checkbox@CHECKUNSYNCED_CHECKBOX:
|
||||
Id:CHECKUNSYNCED_CHECKBOX
|
||||
X:15
|
||||
Y:210
|
||||
Y:180
|
||||
Width:300
|
||||
Height:20
|
||||
Font:Regular
|
||||
|
||||
Reference in New Issue
Block a user