2016-03-26 13:51:42 +11:00
|
|
|
|
// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
|
|
|
|
|
using System;
|
2016-01-28 00:02:10 +11:00
|
|
|
|
using System.Drawing;
|
|
|
|
|
using ClassicalSharp.Singleplayer;
|
|
|
|
|
|
2016-03-27 09:33:51 +11:00
|
|
|
|
namespace ClassicalSharp.Gui {
|
2016-01-28 00:02:10 +11:00
|
|
|
|
|
|
|
|
|
public class ClassicOptionsScreen : MenuOptionsScreen {
|
|
|
|
|
|
|
|
|
|
public ClassicOptionsScreen( Game game ) : base( game ) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Init() {
|
|
|
|
|
base.Init();
|
|
|
|
|
INetworkProcessor network = game.Network;
|
|
|
|
|
|
2016-02-06 23:56:29 +11:00
|
|
|
|
widgets = new Widget[] {
|
2016-01-28 00:02:10 +11:00
|
|
|
|
// Column 1
|
2016-04-22 08:39:29 +10:00
|
|
|
|
MakeBool( -1, -150, "Music", OptionsKey.UseMusic,
|
2016-03-27 17:41:22 +11:00
|
|
|
|
OnWidgetClick, g => g.UseMusic,
|
|
|
|
|
(g, v) => { g.UseMusic = v; g.AudioPlayer.SetMusic( g.UseMusic ); }),
|
2016-01-28 00:02:10 +11:00
|
|
|
|
|
2016-04-22 08:39:29 +10:00
|
|
|
|
MakeBool( -1, -100, "Invert mouse", OptionsKey.InvertMouse,
|
2016-03-27 17:41:22 +11:00
|
|
|
|
OnWidgetClick, g => g.InvertMouse, (g, v) => g.InvertMouse = v ),
|
2016-01-28 00:02:10 +11:00
|
|
|
|
|
2016-06-01 22:01:21 +10:00
|
|
|
|
MakeOpt( -1, -50, "View distance", OnWidgetClick,
|
2016-01-28 00:02:10 +11:00
|
|
|
|
g => g.ViewDistance.ToString(),
|
|
|
|
|
(g, v) => g.SetViewDistance( Int32.Parse( v ), true ) ),
|
|
|
|
|
|
|
|
|
|
!network.IsSinglePlayer ? null :
|
2016-04-22 08:39:29 +10:00
|
|
|
|
MakeBool( -1, 0, "Block physics", OptionsKey.SingleplayerPhysics, OnWidgetClick,
|
2016-03-27 17:41:22 +11:00
|
|
|
|
g => ((SinglePlayerServer)network).physics.Enabled,
|
|
|
|
|
(g, v) => ((SinglePlayerServer)network).physics.Enabled = v),
|
2016-01-28 00:02:10 +11:00
|
|
|
|
|
|
|
|
|
// Column 2
|
2016-04-22 08:39:29 +10:00
|
|
|
|
MakeBool( 1, -150, "Sound", OptionsKey.UseSound,
|
2016-03-27 17:41:22 +11:00
|
|
|
|
OnWidgetClick, g => g.UseSound,
|
|
|
|
|
(g, v) => { g.UseSound = v; g.AudioPlayer.SetSound( g.UseSound ); }),
|
2016-01-28 00:02:10 +11:00
|
|
|
|
|
2016-04-22 08:39:29 +10:00
|
|
|
|
MakeBool( 1, -100, "Show FPS", OptionsKey.ShowFPS,
|
2016-03-27 17:41:22 +11:00
|
|
|
|
OnWidgetClick, g => g.ShowFPS, (g, v) => g.ShowFPS = v ),
|
2016-01-28 00:02:10 +11:00
|
|
|
|
|
2016-04-22 08:39:29 +10:00
|
|
|
|
MakeBool( 1, -50, "View bobbing", OptionsKey.ViewBobbing,
|
2016-03-27 17:41:22 +11:00
|
|
|
|
OnWidgetClick, g => g.ViewBobbing, (g, v) => g.ViewBobbing = v ),
|
2016-01-28 00:02:10 +11:00
|
|
|
|
|
2016-06-01 22:01:21 +10:00
|
|
|
|
MakeOpt( 1, 0, "FPS mode", OnWidgetClick,
|
2016-01-28 00:02:10 +11:00
|
|
|
|
g => g.FpsLimit.ToString(),
|
|
|
|
|
(g, v) => { object raw = Enum.Parse( typeof(FpsLimitMethod), v );
|
|
|
|
|
g.SetFpsLimitMethod( (FpsLimitMethod)raw );
|
|
|
|
|
Options.Set( OptionsKey.FpsLimit, v ); } ),
|
|
|
|
|
|
2016-03-26 17:45:52 +11:00
|
|
|
|
!game.ClassicHacks ? null :
|
2016-04-22 08:39:29 +10:00
|
|
|
|
MakeBool( 0, 60, "Hacks enabled", OptionsKey.HacksEnabled,
|
2016-03-27 17:41:22 +11:00
|
|
|
|
OnWidgetClick, g => g.LocalPlayer.Hacks.Enabled,
|
|
|
|
|
(g, v) => { g.LocalPlayer.Hacks.Enabled = v;
|
|
|
|
|
g.LocalPlayer.CheckHacksConsistency(); } ),
|
2016-03-26 17:45:52 +11:00
|
|
|
|
|
2016-06-10 16:22:46 +10:00
|
|
|
|
MakeTitle( 0, 110, "Controls", LeftOnly(
|
|
|
|
|
(g, w) => g.SetNewScreen( new ClassicKeyBindingsScreen( g ) ) ) ),
|
2016-01-30 23:20:03 +11:00
|
|
|
|
|
2016-04-16 23:36:42 +10:00
|
|
|
|
MakeBack( "Done", 25, titleFont, (g, w) => g.SetNewScreen( new PauseScreen( g ) ) ),
|
2016-02-06 23:56:29 +11:00
|
|
|
|
null, null,
|
2016-01-28 00:02:10 +11:00
|
|
|
|
};
|
|
|
|
|
MakeValidators();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MakeValidators() {
|
|
|
|
|
INetworkProcessor network = game.Network;
|
|
|
|
|
validators = new MenuInputValidator[] {
|
|
|
|
|
new BooleanValidator(),
|
|
|
|
|
new BooleanValidator(),
|
|
|
|
|
new IntegerValidator( 16, 4096 ),
|
2016-03-26 17:45:52 +11:00
|
|
|
|
network.IsSinglePlayer ? new BooleanValidator() : null,
|
2016-01-28 00:02:10 +11:00
|
|
|
|
|
|
|
|
|
new BooleanValidator(),
|
|
|
|
|
new BooleanValidator(),
|
|
|
|
|
new BooleanValidator(),
|
2016-03-30 18:03:52 +11:00
|
|
|
|
new EnumValidator( typeof(FpsLimitMethod) ),
|
2016-03-26 17:45:52 +11:00
|
|
|
|
game.ClassicHacks ? new BooleanValidator() : null,
|
2016-01-28 00:02:10 +11:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|