Now all 'yes/no' widgets show 'ON/OFF' in their title instead. (Thanks FrostFox), closes #146.

This commit is contained in:
UnknownShadow200 2016-03-27 17:41:22 +11:00
parent 757008060c
commit b433e144fd
9 changed files with 160 additions and 191 deletions

View file

@ -16,59 +16,44 @@ namespace ClassicalSharp.Gui {
widgets = new Widget[] {
// Column 1
MakeClassic( -165, -200, "Music", OnWidgetClick,
g => g.UseMusic ? "yes" : "no",
(g, v) => { g.UseMusic = v == "yes";
g.AudioPlayer.SetMusic( g.UseMusic );
Options.Set( OptionsKey.UseMusic, v == "yes" ); }),
MakeClassicBool( -1, -200, "Music", OptionsKey.UseMusic,
OnWidgetClick, g => g.UseMusic,
(g, v) => { g.UseMusic = v; g.AudioPlayer.SetMusic( g.UseMusic ); }),
MakeClassic( -165, -150, "Invert mouse", OnWidgetClick,
g => g.InvertMouse ? "yes" : "no",
(g, v) => { g.InvertMouse = v == "yes";
Options.Set( OptionsKey.InvertMouse, v == "yes" ); }),
MakeClassicBool( -1, -150, "Invert mouse", OptionsKey.InvertMouse,
OnWidgetClick, g => g.InvertMouse, (g, v) => g.InvertMouse = v ),
MakeClassic( -165, -100, "View distance", OnWidgetClick,
MakeClassic( -1, -100, "View distance", OnWidgetClick,
g => g.ViewDistance.ToString(),
(g, v) => g.SetViewDistance( Int32.Parse( v ), true ) ),
!network.IsSinglePlayer ? null :
MakeClassic( -165, -50, "Block physics", OnWidgetClick,
g => ((SinglePlayerServer)network).physics.Enabled ? "yes" : "no",
(g, v) => {
((SinglePlayerServer)network).physics.Enabled = v == "yes";
Options.Set( OptionsKey.SingleplayerPhysics, v == "yes" );
}),
MakeClassicBool( -1, -50, "Block physics", OptionsKey.SingleplayerPhysics, OnWidgetClick,
g => ((SinglePlayerServer)network).physics.Enabled,
(g, v) => ((SinglePlayerServer)network).physics.Enabled = v),
// Column 2
MakeClassic( 165, -200, "Sound", OnWidgetClick,
g => g.UseSound ? "yes" : "no",
(g, v) => { g.UseSound = v == "yes";
g.AudioPlayer.SetSound( g.UseSound );
Options.Set( OptionsKey.UseSound, v == "yes" ); }),
MakeClassicBool( 1, -200, "Sound", OptionsKey.UseSound,
OnWidgetClick, g => g.UseSound,
(g, v) => { g.UseSound = v; g.AudioPlayer.SetSound( g.UseSound ); }),
MakeClassic( 165, -150, "Show FPS", OnWidgetClick,
g => g.ShowFPS ? "yes" : "no",
(g, v) => { g.ShowFPS = v == "yes";
Options.Set( OptionsKey.ShowFPS, v == "yes" ); }),
MakeClassicBool( 1, -150, "Show FPS", OptionsKey.ShowFPS,
OnWidgetClick, g => g.ShowFPS, (g, v) => g.ShowFPS = v ),
MakeClassic( 165, -100, "View bobbing", OnWidgetClick,
g => g.ViewBobbing ? "yes" : "no",
(g, v) => { g.ViewBobbing = v == "yes";
Options.Set( OptionsKey.ViewBobbing, v == "yes" ); }),
MakeClassicBool( 1, -100, "View bobbing", OptionsKey.ViewBobbing,
OnWidgetClick, g => g.ViewBobbing, (g, v) => g.ViewBobbing = v ),
MakeClassic( 165, -50, "FPS limit mode", OnWidgetClick,
MakeClassic( 1, -50, "FPS limit mode", OnWidgetClick,
g => g.FpsLimit.ToString(),
(g, v) => { object raw = Enum.Parse( typeof(FpsLimitMethod), v );
g.SetFpsLimitMethod( (FpsLimitMethod)raw );
Options.Set( OptionsKey.FpsLimit, v ); } ),
!game.ClassicHacks ? null :
MakeClassic( 165, 0, "Hacks enabled", OnWidgetClick,
g => g.LocalPlayer.Hacks.Enabled ? "yes" : "no",
(g, v) => { g.LocalPlayer.Hacks.Enabled = v == "yes";
Options.Set( OptionsKey.HacksEnabled, v == "yes" );
g.LocalPlayer.CheckHacksConsistency();
} ),
MakeClassicBool( 0, 0, "Hacks enabled", OptionsKey.HacksEnabled,
OnWidgetClick, g => g.LocalPlayer.Hacks.Enabled,
(g, v) => { g.LocalPlayer.Hacks.Enabled = v;
g.LocalPlayer.CheckHacksConsistency(); } ),
MakeControlsWidget(),

View file

@ -18,39 +18,41 @@ namespace ClassicalSharp.Gui {
base.Init();
widgets = new Widget[] {
Make( -140, -150, "Clouds colour", OnWidgetClick,
// Column 1
Make( -1, -150, "Clouds colour", OnWidgetClick,
g => g.World.CloudsCol.ToRGBHexString(),
(g, v) => g.World.SetCloudsColour( FastColour.Parse( v ) ) ),
Make( -140, -100, "Sky colour", OnWidgetClick,
Make( -1, -100, "Sky colour", OnWidgetClick,
g => g.World.SkyCol.ToRGBHexString(),
(g, v) => g.World.SetSkyColour( FastColour.Parse( v ) ) ),
Make( -140, -50, "Fog colour", OnWidgetClick,
Make( -1, -50, "Fog colour", OnWidgetClick,
g => g.World.FogCol.ToRGBHexString(),
(g, v) => g.World.SetFogColour( FastColour.Parse( v ) ) ),
Make( -140, 0, "Clouds speed", OnWidgetClick,
Make( -1, 0, "Clouds speed", OnWidgetClick,
g => g.World.CloudsSpeed.ToString(),
(g, v) => g.World.SetCloudsSpeed( Single.Parse( v ) ) ),
Make( -140, 50, "Clouds height", OnWidgetClick,
Make( -1, 50, "Clouds height", OnWidgetClick,
g => g.World.CloudHeight.ToString(),
(g, v) => g.World.SetCloudsLevel( Int32.Parse( v ) ) ),
Make( 140, -100, "Sunlight colour", OnWidgetClick,
// Column 2
Make( 1, -100, "Sunlight colour", OnWidgetClick,
g => g.World.Sunlight.ToRGBHexString(),
(g, v) => g.World.SetSunlight( FastColour.Parse( v ) ) ),
Make( 140, -50, "Shadow colour", OnWidgetClick,
Make( 1, -50, "Shadow colour", OnWidgetClick,
g => g.World.Shadowlight.ToRGBHexString(),
(g, v) => g.World.SetShadowlight( FastColour.Parse( v ) ) ),
Make( 140, 0, "Weather", OnWidgetClick,
Make( 1, 0, "Weather", OnWidgetClick,
g => g.World.Weather.ToString(),
(g, v) => g.World.SetWeather( (Weather)Enum.Parse( typeof(Weather), v ) ) ),
Make( 140, 50, "Water level", OnWidgetClick,
Make( 1, 50, "Water level", OnWidgetClick,
g => g.World.EdgeHeight.ToString(),
(g, v) => g.World.SetEdgeLevel( Int32.Parse( v ) ) ),

View file

@ -17,23 +17,23 @@ namespace ClassicalSharp.Gui {
widgets = new Widget[] {
Make( -140, 0, "FPS limit mode", OnWidgetClick,
Make( -1, 0, "FPS limit mode", OnWidgetClick,
g => g.FpsLimit.ToString(),
(g, v) => { object raw = Enum.Parse( typeof(FpsLimitMethod), v );
g.SetFpsLimitMethod( (FpsLimitMethod)raw );
Options.Set( OptionsKey.FpsLimit, v ); } ),
Make( -140, 50, "View distance", OnWidgetClick,
Make( -1, 50, "View distance", OnWidgetClick,
g => g.ViewDistance.ToString(),
(g, v) => g.SetViewDistance( Int32.Parse( v ), true ) ),
Make( 140, 0, "Names mode", OnWidgetClick,
Make( 1, 0, "Names mode", OnWidgetClick,
g => g.Players.NamesMode.ToString(),
(g, v) => { object raw = Enum.Parse( typeof(NameMode), v );
g.Players.NamesMode = (NameMode)raw;
Options.Set( OptionsKey.NamesMode, v ); } ),
Make( 140, 50, "Entity shadows", OnWidgetClick,
Make( 1, 50, "Entity shadows", OnWidgetClick,
g => g.Players.ShadowMode.ToString(),
(g, v) => { object raw = Enum.Parse( typeof(EntityShadow), v );
g.Players.ShadowMode = (EntityShadow)raw;

View file

@ -13,66 +13,52 @@ namespace ClassicalSharp.Gui {
widgets = new Widget[] {
// Column 1
Make( -140, -150, "Block in hand", OnWidgetClick,
g => g.ShowBlockInHand ? "yes" : "no",
(g, v) => { g.ShowBlockInHand = v == "yes";
Options.Set( OptionsKey.ShowBlockInHand, v == "yes" );
} ),
MakeBool( -1, -150, "Block in hand", OptionsKey.ShowBlockInHand,
OnWidgetClick, g => g.ShowBlockInHand, (g, v) => g.ShowBlockInHand = v ),
Make( -140, -100, "Show FPS", OnWidgetClick,
g => g.ShowFPS ? "yes" : "no",
(g, v) => { g.ShowFPS = v == "yes";
Options.Set( OptionsKey.ShowFPS, v == "yes" ); }),
MakeBool( -1, -100, "Show FPS", OptionsKey.ShowFPS,
OnWidgetClick, g => g.ShowFPS, (g, v) => g.ShowFPS = v ),
Make( -140, -50, "Hotbar scale", OnWidgetClick,
Make( -1, -50, "Hotbar scale", OnWidgetClick,
g => g.HotbarScale.ToString(),
(g, v) => { g.HotbarScale = Single.Parse( v );
Options.Set( OptionsKey.HotbarScale, v );
g.RefreshHud();
} ),
Make( -140, 0, "Inventory scale", OnWidgetClick,
Make( -1, 0, "Inventory scale", OnWidgetClick,
g => g.InventoryScale.ToString(),
(g, v) => { g.InventoryScale = Single.Parse( v );
Options.Set( OptionsKey.InventoryScale, v );
g.RefreshHud();
} ),
Make( -140, 50, "Tab auto-complete", OnWidgetClick,
g => g.TabAutocomplete ? "yes" : "no",
(g, v) => { g.TabAutocomplete = v == "yes";
Options.Set( OptionsKey.TabAutocomplete, v == "yes" );
} ),
MakeBool( -1, 50, "Tab auto-complete", OptionsKey.TabAutocomplete,
OnWidgetClick, g => g.TabAutocomplete, (g, v) => g.TabAutocomplete = v ),
// Column 2
Make( 140, -150, "Clickable chat", OnWidgetClick,
g => g.ClickableChat ? "yes" : "no",
(g, v) => { g.ClickableChat = v == "yes";
Options.Set( OptionsKey.ClickableChat, v == "yes" );
} ),
MakeBool( 1, -150, "Clickable chat", OptionsKey.ClickableChat,
OnWidgetClick, g => g.ClickableChat, (g, v) => g.ClickableChat = v ),
Make( 140, -100, "Chat scale", OnWidgetClick,
Make( 1, -100, "Chat scale", OnWidgetClick,
g => g.ChatScale.ToString(),
(g, v) => { g.ChatScale = Single.Parse( v );
Options.Set( OptionsKey.ChatScale, v );
g.RefreshHud();
} ),
Make( 140, -50, "Chat lines", OnWidgetClick,
Make( 1, -50, "Chat lines", OnWidgetClick,
g => g.ChatLines.ToString(),
(g, v) => { g.ChatLines = Int32.Parse( v );
Options.Set( OptionsKey.ChatLines, v );
g.RefreshHud();
} ),
Make( 140, 0, "Arial chat font", OnWidgetClick,
g => g.Drawer2D.UseBitmappedChat ? "no" : "yes",
(g, v) => { g.Drawer2D.UseBitmappedChat = v == "no";
Options.Set( OptionsKey.ArialChatFont, v == "yes" );
HandleFontChange();
} ),
MakeBool( 1, 0, "Arial chat font", OptionsKey.ArialChatFont,
OnWidgetClick, g => !g.Drawer2D.UseBitmappedChat,
(g, v) => { g.Drawer2D.UseBitmappedChat = !v; HandleFontChange(); } ),
Make( 140, 50, "Chat font name", OnWidgetClick,
Make( 1, 50, "Chat font name", OnWidgetClick,
g => g.FontName,
(g, v) => { g.FontName = v;
Options.Set( OptionsKey.FontName, v );
@ -88,16 +74,19 @@ namespace ClassicalSharp.Gui {
void HandleFontChange() {
game.Events.RaiseChatFontChanged();
if( inputWidget != null ) {
inputWidget.Dispose(); inputWidget = null;
widgets[widgets.Length - 2] = null;
}
if( descWidget != null ) {
descWidget.Dispose(); descWidget = null;
}
base.Dispose();
base.Init();
game.RefreshHud();
Recreate();
for( int i = 0; i < widgets.Length; i++) {
if( widgets[i] == null || !(widgets[i] is ButtonWidget)) {
widgets[i] = null; continue;
}
ButtonWidget btn = widgets[i] as ButtonWidget;
btn.font = titleFont;
btn.SetText( btn.Text );
}
}
void MakeValidators() {

View file

@ -16,49 +16,40 @@ namespace ClassicalSharp.Gui {
widgets = new Widget[] {
// Column 1
Make( -140, -150, "Hacks enabled", OnWidgetClick,
g => g.LocalPlayer.Hacks.Enabled ? "yes" : "no",
(g, v) => { g.LocalPlayer.Hacks.Enabled = v == "yes";
Options.Set( OptionsKey.HacksEnabled, v == "yes" );
g.LocalPlayer.CheckHacksConsistency();
} ),
MakeBool( -1, -150, "Hacks enabled", OptionsKey.HacksEnabled,
OnWidgetClick, g => g.LocalPlayer.Hacks.Enabled,
(g, v) => { g.LocalPlayer.Hacks.Enabled = v;
g.LocalPlayer.CheckHacksConsistency(); } ),
Make( -140, -100, "Speed multiplier", OnWidgetClick,
Make( -1, -100, "Speed multiplier", OnWidgetClick,
g => g.LocalPlayer.Hacks.SpeedMultiplier.ToString(),
(g, v) => { g.LocalPlayer.Hacks.SpeedMultiplier = Single.Parse( v );
Options.Set( OptionsKey.Speed, v ); } ),
Make( -140, -50, "Camera clipping", OnWidgetClick,
g => g.CameraClipping ? "yes" : "no",
(g, v) => { g.CameraClipping = v == "yes";
Options.Set( OptionsKey.CameraClipping, v == "yes" ); } ),
MakeBool( -1, -50, "Camera clipping", OptionsKey.CameraClipping,
OnWidgetClick, g => g.CameraClipping, (g, v) => g.CameraClipping = v ),
Make( -140, 0, "Jump height", OnWidgetClick,
Make( -1, 0, "Jump height", OnWidgetClick,
g => g.LocalPlayer.JumpHeight.ToString( "F3" ),
(g, v) => g.LocalPlayer.CalculateJumpVelocity( Single.Parse( v ) ) ),
Make( -140, 50, "Double jump", OnWidgetClick,
g => g.LocalPlayer.Hacks.DoubleJump ? "yes" : "no",
(g, v) => { g.LocalPlayer.Hacks.DoubleJump = v == "yes";
Options.Set( OptionsKey.DoubleJump, v == "yes" ); } ),
MakeBool( -1, 50, "Double jump", OptionsKey.DoubleJump,
OnWidgetClick, g => g.LocalPlayer.Hacks.DoubleJump,
(g, v) => g.LocalPlayer.Hacks.DoubleJump = v ),
// Column 2
Make( 140, -100, "Modifiable liquids", OnWidgetClick,
g => g.ModifiableLiquids ? "yes" : "no",
(g, v) => { g.ModifiableLiquids = v == "yes";
Options.Set( OptionsKey.ModifiableLiquids, v == "yes" ); } ),
MakeBool( 1, -100, "Modifiable liquids", OptionsKey.ModifiableLiquids,
OnWidgetClick, g => g.ModifiableLiquids, (g, v) => g.ModifiableLiquids = v ),
Make( 140, -50, "Pushback placing", OnWidgetClick,
g => g.LocalPlayer.Hacks.PushbackPlacing ? "yes" : "no",
(g, v) => { g.LocalPlayer.Hacks.PushbackPlacing = v == "yes";
Options.Set( OptionsKey.PushbackPlacing, v == "yes" ); }),
MakeBool( 1, -50, "Pushback placing", OptionsKey.PushbackPlacing,
OnWidgetClick, g => g.LocalPlayer.Hacks.PushbackPlacing,
(g, v) => g.LocalPlayer.Hacks.PushbackPlacing = v ),
Make( 140, 0, "Noclip slide", OnWidgetClick,
g => g.LocalPlayer.Hacks.NoclipSlide ? "yes" : "no",
(g, v) => { g.LocalPlayer.Hacks.NoclipSlide = v == "yes";
Options.Set( OptionsKey.NoclipSlide, v == "yes" ); } ),
MakeBool( 1, 0, "Noclip slide", OptionsKey.NoclipSlide,
OnWidgetClick, g => g.LocalPlayer.Hacks.NoclipSlide,
(g, v) => g.LocalPlayer.Hacks.NoclipSlide = v ),
Make( 140, 50, "Field of view", OnWidgetClick,
Make( 1, 50, "Field of view", OnWidgetClick,
g => g.FieldOfView.ToString(),
(g, v) => { g.FieldOfView = Int32.Parse( v );
Options.Set( OptionsKey.FieldOfView, v );

View file

@ -87,10 +87,15 @@ namespace ClassicalSharp.Gui {
}
public override void Dispose() {
if( descWidget != null )
if( descWidget != null ) {
descWidget.Dispose();
if( inputWidget != null )
descWidget = null;
}
if( inputWidget != null ) {
inputWidget.Dispose();
inputWidget = null;
}
game.Keyboard.KeyRepeat = false;
extendedHelpFont.Dispose();
DisposeExtendedHelp();
@ -114,8 +119,11 @@ namespace ClassicalSharp.Gui {
DisposeExtendedHelp();
if( widget == null || widget.GetValue == null ) return;
string text = widget.Text + ": " + widget.GetValue( game );
descWidget = TextWidget.Create( game, 0, 100, text, Anchor.Centre, Anchor.Centre, regularFont );
int index = Array.IndexOf<Widget>( widgets, widget );
if( index >= validators.Length || !(validators[index] is BooleanValidator) ) {
string text = widget.Text + ": " + widget.GetValue( game );
descWidget = TextWidget.Create( game, 0, 100, text, Anchor.Centre, Anchor.Centre, regularFont );
}
ShowExtendedHelp();
}
@ -123,22 +131,48 @@ namespace ClassicalSharp.Gui {
protected virtual void InputClosed() { }
protected ButtonWidget Make( int x, int y, string text, ClickHandler onClick,
protected ButtonWidget Make( int dir, int y, string text, ClickHandler onClick,
Func<Game, string> getter, Action<Game, string> setter ) {
ButtonWidget widget = ButtonWidget.Create( game, x, y, 240, 35, text, Anchor.Centre,
ButtonWidget widget = ButtonWidget.Create( game, 160 * dir, y, 280, 35, text, Anchor.Centre,
Anchor.Centre, titleFont, onClick );
widget.GetValue = getter; widget.SetValue = setter;
return widget;
}
protected ButtonWidget MakeClassic( int x, int y, string text, ClickHandler onClick,
protected ButtonWidget MakeBool( int dir, int y, string optName, string optKey,
ClickHandler onClick, Func<Game, bool> getter, Action<Game, bool> setter ) {
return MakeBoolImpl( 160 * dir, y, 280, 35, optName, optKey, onClick, getter, setter );
}
protected ButtonWidget MakeClassic( int dir, int y, string text, ClickHandler onClick,
Func<Game, string> getter, Action<Game, string> setter ) {
ButtonWidget widget = ButtonWidget.Create( game, x, y, 301, 41, text, Anchor.Centre,
ButtonWidget widget = ButtonWidget.Create( game, 165 * dir, y, 301, 41, text, Anchor.Centre,
Anchor.Centre, titleFont, onClick );
widget.GetValue = getter; widget.SetValue = setter;
return widget;
}
protected ButtonWidget MakeClassicBool( int dir, int y, string text, string optKey,
ClickHandler onClick, Func<Game, bool> getter, Action<Game, bool> setter ) {
return MakeBoolImpl( 165 * dir, y, 301, 41, text, optKey, onClick, getter, setter );
}
ButtonWidget MakeBoolImpl( int x, int y, int width, int height, string text, string optKey,
ClickHandler onClick, Func<Game, bool> getter, Action<Game, bool> setter ) {
string optName = text;
text = text + ": " + (getter( game ) ? "ON" : "OFF");
ButtonWidget widget = ButtonWidget.Create( game, x, y, width, height, text, Anchor.Centre,
Anchor.Centre, titleFont, onClick );
widget.Metadata = optName;
widget.GetValue = g => getter( g ) ? "yes" : "no";
widget.SetValue = (g, v) => {
setter( g, v == "yes" );
Options.Set( optKey, v == "yes" );
widget.SetText( (string)widget.Metadata + ": " + (v == "yes" ? "ON" : "OFF") );
};
return widget;
}
void ShowExtendedHelp() {
bool canShow = inputWidget == null && selectedWidget != null && descriptions != null;
if( !canShow ) return;

View file

@ -17,46 +17,35 @@ namespace ClassicalSharp.Gui {
widgets = new Widget[] {
// Column 1
!network.IsSinglePlayer ? null :
Make( -140, -100, "Click distance", OnWidgetClick,
Make( -1, -100, "Click distance", OnWidgetClick,
g => g.LocalPlayer.ReachDistance.ToString(),
(g, v) => g.LocalPlayer.ReachDistance = Single.Parse( v ) ),
Make( -140, -50, "Music", OnWidgetClick,
g => g.UseMusic ? "yes" : "no",
(g, v) => { g.UseMusic = v == "yes";
g.AudioPlayer.SetMusic( g.UseMusic );
Options.Set( OptionsKey.UseMusic, v == "yes" ); }),
MakeBool( -1, -50, "Music", OptionsKey.UseMusic,
OnWidgetClick, g => g.UseMusic,
(g, v) => { g.UseMusic = v; g.AudioPlayer.SetMusic( g.UseMusic ); }),
Make( -140, 0, "Sound", OnWidgetClick,
g => g.UseSound ? "yes" : "no",
(g, v) => { g.UseSound = v == "yes";
g.AudioPlayer.SetSound( g.UseSound );
Options.Set( OptionsKey.UseSound, v == "yes" ); }),
MakeBool( -1, 0, "Sound", OptionsKey.UseSound,
OnWidgetClick, g => g.UseSound,
(g, v) => { g.UseSound = v; g.AudioPlayer.SetSound( g.UseSound ); }),
Make( -140, 50, "View bobbing", OnWidgetClick,
g => g.ViewBobbing ? "yes" : "no",
(g, v) => { g.ViewBobbing = v == "yes";
Options.Set( OptionsKey.ViewBobbing, v == "yes" ); }),
MakeBool( -1, 50, "View bobbing", OptionsKey.ViewBobbing,
OnWidgetClick, g => g.ViewBobbing, (g, v) => g.ViewBobbing = v ),
// Column 2
!network.IsSinglePlayer ? null :
Make( 140, -100, "Block physics", OnWidgetClick,
g => ((SinglePlayerServer)network).physics.Enabled ? "yes" : "no",
(g, v) => {
((SinglePlayerServer)network).physics.Enabled = v == "yes";
Options.Set( OptionsKey.SingleplayerPhysics, v == "yes" );
}),
MakeBool( 1, -100, "Block physics", OptionsKey.SingleplayerPhysics, OnWidgetClick,
g => ((SinglePlayerServer)network).physics.Enabled,
(g, v) => ((SinglePlayerServer)network).physics.Enabled = v ),
Make( 140, -50, "Auto close launcher", OnWidgetClick,
g => Options.GetBool( OptionsKey.AutoCloseLauncher, true ) ? "yes" : "no",
(g, v) => Options.Set( OptionsKey.AutoCloseLauncher, v == "yes" ) ),
MakeBool( 1, -50, "Auto close launcher", OptionsKey.AutoCloseLauncher, OnWidgetClick,
g => Options.GetBool( OptionsKey.AutoCloseLauncher, true ),
(g, v) => Options.Set( OptionsKey.AutoCloseLauncher, v ) ),
Make( 140, 0, "Invert mouse", OnWidgetClick,
g => g.InvertMouse ? "yes" : "no",
(g, v) => { g.InvertMouse = v == "yes";
Options.Set( OptionsKey.InvertMouse, v == "yes" ); }),
MakeBool( 1, 0, "Invert mouse", OptionsKey.InvertMouse,
OnWidgetClick, g => g.InvertMouse, (g, v) => g.InvertMouse = v ),
Make( 140, 50, "Mouse sensitivity", OnWidgetClick,
Make( 1, 50, "Mouse sensitivity", OnWidgetClick,
g => g.MouseSensitivity.ToString(),
(g, v) => { g.MouseSensitivity = Int32.Parse( v );
Options.Set( OptionsKey.Sensitivity, v ); } ),
@ -77,7 +66,7 @@ namespace ClassicalSharp.Gui {
new BooleanValidator(),
new BooleanValidator(),
network.IsSinglePlayer ? new BooleanValidator() : null,
network.IsSinglePlayer ? new BooleanValidator() : null,
new BooleanValidator(),
new BooleanValidator(),
new IntegerValidator( 1, 100 ),

View file

@ -15,48 +15,28 @@ namespace ClassicalSharp.Gui {
base.Init();
widgets = new Widget[] {
// Column 1
Make( -140, -100, "Simple arms anim", OnWidgetClick,
g => g.SimpleArmsAnim? "yes" : "no",
(g, v) => { g.SimpleArmsAnim = v == "yes";
Options.Set( OptionsKey.SimpleArmsAnim, v == "yes" ); }),
// Column 1
MakeBool( -1, -100, "Simple arms anim", OptionsKey.SimpleArmsAnim,
OnWidgetClick, g => g.SimpleArmsAnim, (g, v) => g.SimpleArmsAnim = v ),
Make( -140, -50, "Classic gui textures", OnWidgetClick,
g => g.UseClassicGui ? "yes" : "no",
(g, v) => { g.UseClassicGui = v == "yes";
Options.Set( OptionsKey.UseClassicGui, v == "yes" );
} ),
MakeBool( -1, -50, "Classic gui textures", OptionsKey.UseClassicGui,
OnWidgetClick, g => g.UseClassicGui, (g, v) => g.UseClassicGui = v ),
Make( -140, 0, "Classic player list", OnWidgetClick,
g => g.UseClassicTabList ? "yes" : "no",
(g, v) => { g.UseClassicTabList = v == "yes";
Options.Set( OptionsKey.UseClassicTabList, v == "yes" );
} ),
MakeBool( -1, 0, "Classic player list", OptionsKey.UseClassicTabList,
OnWidgetClick, g => g.UseClassicTabList, (g, v) => g.UseClassicTabList = v ),
Make( -140, 50, "Classic options menu", OnWidgetClick,
g => g.UseClassicOptions ? "yes" : "no",
(g, v) => { g.UseClassicOptions = v == "yes";
Options.Set( OptionsKey.UseClassicOptions, v == "yes" );
} ),
MakeBool( -1, 50, "Classic options menu", OptionsKey.UseClassicOptions,
OnWidgetClick, g => g.UseClassicOptions, (g, v) => g.UseClassicOptions = v ),
// Column 2
Make( 140, -100, "Allow custom blocks", OnWidgetClick,
g => g.AllowCustomBlocks ? "yes" : "no",
(g, v) => { g.AllowCustomBlocks = v == "yes";
Options.Set( OptionsKey.AllowCustomBlocks, v == "yes" );
} ),
MakeBool( 1, -100, "Allow custom blocks", OptionsKey.AllowCustomBlocks,
OnWidgetClick, g => g.AllowCustomBlocks, (g, v) => g.AllowCustomBlocks = v ),
Make( 140, -50, "Use CPE", OnWidgetClick,
g => g.UseCPE ? "yes" : "no",
(g, v) => { g.UseCPE = v == "yes";
Options.Set( OptionsKey.UseCPE, v == "yes" );
} ),
MakeBool( 1, -50, "Use CPE", OptionsKey.UseCPE,
OnWidgetClick, g => g.UseCPE, (g, v) => g.UseCPE = v ),
Make( 140, 0, "Allow server textures", OnWidgetClick,
g => g.AllowServerTextures ? "yes" : "no",
(g, v) => { g.AllowServerTextures = v == "yes";
Options.Set( OptionsKey.AllowServerTextures, v == "yes" );
} ),
MakeBool( 1, 0, "Allow server textures", OptionsKey.AllowServerTextures,
OnWidgetClick, g => g.AllowServerTextures, (g, v) => g.AllowServerTextures = v ),
MakeBack( false, titleFont,
(g, w) => g.SetNewScreen( new PauseScreen( g ) ) ),

View file

@ -30,7 +30,6 @@ namespace ClassicalSharp.Entities {
if( !jumping ) {
canLiquidJump = false; return;
}
==
bool touchWater = TouchesAnyWater();
bool touchLava = TouchesAnyLava();