mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-10-08 05:27:33 -04:00
90 lines
3.1 KiB
C#
90 lines
3.1 KiB
C#
using System;
|
|
using System.Drawing;
|
|
using ClassicalSharp.Singleplayer;
|
|
|
|
namespace ClassicalSharp {
|
|
|
|
public class HacksSettingsScreen : MenuInputScreen {
|
|
|
|
public HacksSettingsScreen( Game game ) : base( game ) {
|
|
}
|
|
|
|
public override void Init() {
|
|
base.Init();
|
|
INetworkProcessor network = game.Network;
|
|
|
|
buttons = new ButtonWidget[] {
|
|
// Column 1
|
|
Make( -140, -100, "Hacks enabled", OnWidgetClick,
|
|
g => g.LocalPlayer.HacksEnabled ? "yes" : "no",
|
|
(g, v) => { g.LocalPlayer.HacksEnabled = v == "yes";
|
|
Options.Set( OptionsKey.HacksEnabled, v == "yes" );
|
|
g.LocalPlayer.CheckHacksConsistency();
|
|
} ),
|
|
|
|
Make( -140, -50, "Speed multiplier", OnWidgetClick,
|
|
g => g.LocalPlayer.SpeedMultiplier.ToString(),
|
|
(g, v) => { g.LocalPlayer.SpeedMultiplier = Single.Parse( v );
|
|
Options.Set( OptionsKey.Speed, v ); } ),
|
|
|
|
Make( -140, 0, "Camera clipping", OnWidgetClick,
|
|
g => g.CameraClipping ? "yes" : "no",
|
|
(g, v) => { g.CameraClipping = v == "yes";
|
|
Options.Set( OptionsKey.CameraClipping, v == "yes" ); } ),
|
|
|
|
// Column 2
|
|
Make( 140, -100, "Liquids breakable", OnWidgetClick,
|
|
g => g.LiquidsBreakable ? "yes" : "no",
|
|
(g, v) => { g.LiquidsBreakable = v == "yes";
|
|
Options.Set( OptionsKey.LiquidsBreakable, v == "yes" ); } ),
|
|
|
|
Make( 140, -50, "Pushback placing", OnWidgetClick,
|
|
g => g.LocalPlayer.PushbackPlacing
|
|
&& g.LocalPlayer.CanPushbackBlocks ? "yes" : "no",
|
|
(g, v) => {
|
|
if( g.LocalPlayer.CanPushbackBlocks) {
|
|
g.LocalPlayer.PushbackPlacing = v == "yes";
|
|
Options.Set( OptionsKey.PushbackPlacing, v == "yes" );
|
|
}
|
|
}),
|
|
|
|
Make( 140, 0, "Noclip slide", OnWidgetClick,
|
|
g => g.LocalPlayer.NoclipSlide ? "yes" : "no",
|
|
(g, v) => { g.LocalPlayer.NoclipSlide = v == "yes";
|
|
Options.Set( OptionsKey.NoclipSlide, v == "yes" ); } ),
|
|
|
|
Make( -140, 50, "Field of view", OnWidgetClick,
|
|
g => g.FieldOfView.ToString(),
|
|
(g, v) => { g.FieldOfView = Int32.Parse( v );
|
|
Options.Set( OptionsKey.FieldOfView, v );
|
|
g.UpdateProjection();
|
|
} ),
|
|
|
|
MakeBack( false, titleFont,
|
|
(g, w) => g.SetNewScreen( new PauseScreen( g ) ) ),
|
|
null,
|
|
};
|
|
|
|
validators = new MenuInputValidator[] {
|
|
new BooleanValidator(),
|
|
new RealValidator( 0.1f, 50 ),
|
|
new BooleanValidator(),
|
|
|
|
new BooleanValidator(),
|
|
new BooleanValidator(),
|
|
new BooleanValidator(),
|
|
new IntegerValidator( 1, 179 ),
|
|
};
|
|
okayIndex = buttons.Length - 1;
|
|
}
|
|
|
|
ButtonWidget Make( int x, int y, string text, Action<Game, Widget> onClick,
|
|
Func<Game, string> getter, Action<Game, string> setter ) {
|
|
ButtonWidget widget = ButtonWidget.Create( game, x, y, 240, 35, text, Anchor.Centre,
|
|
Anchor.Centre, titleFont, onClick );
|
|
widget.GetValue = getter;
|
|
widget.SetValue = setter;
|
|
return widget;
|
|
}
|
|
}
|
|
} |