2016-06-11 17:56:37 +10:00
|
|
|
|
// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
|
|
|
|
|
using System;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using OpenTK.Input;
|
|
|
|
|
|
|
|
|
|
namespace ClassicalSharp.Gui {
|
|
|
|
|
|
|
|
|
|
public class OptionsGroupScreen : MenuScreen {
|
|
|
|
|
|
|
|
|
|
public OptionsGroupScreen( Game game ) : base( game ) {
|
|
|
|
|
}
|
|
|
|
|
TextWidget descWidget;
|
|
|
|
|
ButtonWidget selectedWidget;
|
|
|
|
|
|
|
|
|
|
public override void Render( double delta ) {
|
|
|
|
|
RenderMenuBounds();
|
|
|
|
|
api.Texturing = true;
|
|
|
|
|
RenderMenuWidgets( delta );
|
|
|
|
|
if( descWidget != null )
|
|
|
|
|
descWidget.Render( delta );
|
|
|
|
|
api.Texturing = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Init() {
|
|
|
|
|
base.Init();
|
|
|
|
|
game.Events.HackPermissionsChanged += CheckHacksAllowed;
|
|
|
|
|
regularFont = new Font( game.FontName, 16, FontStyle.Regular );
|
|
|
|
|
|
|
|
|
|
MakeNormal();
|
|
|
|
|
CheckHacksAllowed( null, null );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MakeNormal() {
|
|
|
|
|
widgets = new Widget[] {
|
|
|
|
|
Make( -1, -100, "Misc options",
|
2016-07-25 12:11:55 +10:00
|
|
|
|
(g, w) => g.Gui.SetNewScreen( new MiscOptionsScreen( g ) ) ),
|
2016-06-11 17:56:37 +10:00
|
|
|
|
Make( -1, -50, "Gui options",
|
2016-07-25 12:11:55 +10:00
|
|
|
|
(g, w) => g.Gui.SetNewScreen( new GuiOptionsScreen( g ) ) ),
|
2016-06-11 17:56:37 +10:00
|
|
|
|
Make( -1, 0, "Graphics options",
|
2016-07-25 12:11:55 +10:00
|
|
|
|
(g, w) => g.Gui.SetNewScreen( new GraphicsOptionsScreen( g ) ) ),
|
2016-06-11 17:56:37 +10:00
|
|
|
|
Make( -1, 50, "Controls",
|
2016-07-25 12:11:55 +10:00
|
|
|
|
(g, w) => g.Gui.SetNewScreen( new NormalKeyBindingsScreen( g ) ) ),
|
2016-06-11 17:56:37 +10:00
|
|
|
|
Make( 1, -50, "Hacks settings",
|
2016-07-25 12:11:55 +10:00
|
|
|
|
(g, w) => g.Gui.SetNewScreen( new HacksSettingsScreen( g ) ) ),
|
2016-06-11 17:56:37 +10:00
|
|
|
|
Make( 1, 0, "Env settings",
|
2016-07-25 12:11:55 +10:00
|
|
|
|
(g, w) => g.Gui.SetNewScreen( new EnvSettingsScreen( g ) ) ),
|
2016-06-11 17:56:37 +10:00
|
|
|
|
Make( 1, 50, "Nostalgia options",
|
2016-07-25 12:11:55 +10:00
|
|
|
|
(g, w) => g.Gui.SetNewScreen( new NostalgiaScreen( g ) ) ),
|
2016-06-11 17:56:37 +10:00
|
|
|
|
|
|
|
|
|
MakeBack( false, titleFont,
|
2016-07-25 12:11:55 +10:00
|
|
|
|
(g, w) => g.Gui.SetNewScreen( new PauseScreen( g ) ) ),
|
2016-06-11 17:56:37 +10:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CheckHacksAllowed( object sender, EventArgs e ) {
|
|
|
|
|
if( game.UseClassicOptions ) return;
|
|
|
|
|
widgets[5].Disabled = !game.LocalPlayer.Hacks.CanAnyHacks; // env settings
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void WidgetSelected( Widget widget ) {
|
|
|
|
|
ButtonWidget button = widget as ButtonWidget;
|
|
|
|
|
if( selectedWidget == widget || button == null ||
|
|
|
|
|
button == widgets[widgets.Length - 1] ) return;
|
|
|
|
|
|
|
|
|
|
selectedWidget = button;
|
|
|
|
|
if( descWidget != null ) descWidget.Dispose();
|
|
|
|
|
if( button == null ) return;
|
|
|
|
|
|
|
|
|
|
string text = descriptions[Array.IndexOf<Widget>(widgets, button)];
|
|
|
|
|
descWidget = ChatTextWidget.Create( game, 0, 100, text, Anchor.Centre, Anchor.Centre, regularFont );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ButtonWidget Make( int dir, int y, string text, Action<Game, Widget> onClick ) {
|
|
|
|
|
return ButtonWidget.Create( game, dir * 160, y, 301, 40, text,
|
|
|
|
|
Anchor.Centre, Anchor.Centre, titleFont, LeftOnly( onClick ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool HandlesKeyDown( Key key ) {
|
|
|
|
|
if( key == Key.Escape )
|
2016-07-25 12:11:55 +10:00
|
|
|
|
game.Gui.SetNewScreen( null );
|
2016-06-11 17:56:37 +10:00
|
|
|
|
return key < Key.F1 || key > Key.F35;
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-25 12:24:57 +10:00
|
|
|
|
public override void OnResize( int width, int height ) {
|
2016-06-11 17:56:37 +10:00
|
|
|
|
if( descWidget != null )
|
2016-07-25 12:24:57 +10:00
|
|
|
|
descWidget.OnResize( width, height );
|
|
|
|
|
base.OnResize( width, height );
|
2016-06-11 17:56:37 +10:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Dispose() {
|
|
|
|
|
if( descWidget != null )
|
|
|
|
|
descWidget.Dispose();
|
|
|
|
|
base.Dispose();
|
|
|
|
|
game.Events.HackPermissionsChanged -= CheckHacksAllowed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static string[] descriptions = {
|
|
|
|
|
"&eMusic/Sound, view bobbing, and more",
|
|
|
|
|
"&eChat options, gui scale, font settings, and more",
|
|
|
|
|
"&eFPS limit, view distance, entity names/shadows",
|
|
|
|
|
"&eSet key bindings, bind keys to act as mouse clicks",
|
|
|
|
|
"&eHacks allowed, jump settings, and more",
|
|
|
|
|
"&eEnv colours, water level, weather, and more",
|
|
|
|
|
"&eSettings for resembling the original classic",
|
|
|
|
|
};
|
|
|
|
|
}
|
2016-03-05 23:34:07 +11:00
|
|
|
|
}
|