mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 11:06:06 -04:00
Initial implementation of classic options menu.
This commit is contained in:
parent
70a45f3290
commit
3794876119
@ -32,6 +32,12 @@ namespace ClassicalSharp {
|
|||||||
Options.Set( OptionsKey.UseClassicTabList, v == "yes" );
|
Options.Set( OptionsKey.UseClassicTabList, v == "yes" );
|
||||||
} ),
|
} ),
|
||||||
|
|
||||||
|
Make( -140, 50, "Classic options menu", OnWidgetClick,
|
||||||
|
g => g.UseClassicOptions ? "yes" : "no",
|
||||||
|
(g, v) => { g.UseClassicOptions = v == "yes";
|
||||||
|
Options.Set( OptionsKey.UseClassicOptions, v == "yes" );
|
||||||
|
} ),
|
||||||
|
|
||||||
// Column 2
|
// Column 2
|
||||||
Make( 140, -100, "Allow custom blocks", OnWidgetClick,
|
Make( 140, -100, "Allow custom blocks", OnWidgetClick,
|
||||||
g => g.AllowCustomBlocks ? "yes" : "no",
|
g => g.AllowCustomBlocks ? "yes" : "no",
|
||||||
|
@ -19,34 +19,43 @@ namespace ClassicalSharp {
|
|||||||
public override void Init() {
|
public override void Init() {
|
||||||
base.Init();
|
base.Init();
|
||||||
game.Events.HackPermissionsChanged += CheckHacksAllowed;
|
game.Events.HackPermissionsChanged += CheckHacksAllowed;
|
||||||
|
|
||||||
|
if( game.UseClassicOptions )
|
||||||
|
MakeClassic();
|
||||||
|
else
|
||||||
|
MakeNormal();
|
||||||
|
CheckHacksAllowed( null, null );
|
||||||
|
}
|
||||||
|
|
||||||
|
void MakeNormal() {
|
||||||
widgets = new ButtonWidget[] {
|
widgets = new ButtonWidget[] {
|
||||||
// Column 1
|
// Column 1
|
||||||
Make( -140, -150, "Misc options", Anchor.Centre,
|
Make( -140, -150, "Misc options", Anchor.Centre,
|
||||||
(g, w) => g.SetNewScreen( new MiscOptionsScreen( g ) ) ),
|
(g, w) => g.SetNewScreen( new MiscOptionsScreen( g ) ) ),
|
||||||
Make( -140, -100, "Gui options", Anchor.Centre,
|
Make( -140, -100, "Gui options", Anchor.Centre,
|
||||||
(g, w) => g.SetNewScreen( new GuiOptionsScreen( g ) ) ),
|
(g, w) => g.SetNewScreen( new GuiOptionsScreen( g ) ) ),
|
||||||
Make( -140, -50, "Hacks settings", Anchor.Centre,
|
Make( -140, -50, "Hacks settings", Anchor.Centre,
|
||||||
(g, w) => g.SetNewScreen( new HacksSettingsScreen( g ) ) ),
|
(g, w) => g.SetNewScreen( new HacksSettingsScreen( g ) ) ),
|
||||||
Make( -140, 0, "Env settings", Anchor.Centre,
|
Make( -140, 0, "Env settings", Anchor.Centre,
|
||||||
(g, w) => g.SetNewScreen( new EnvSettingsScreen( g ) ) ),
|
(g, w) => g.SetNewScreen( new EnvSettingsScreen( g ) ) ),
|
||||||
Make( -140, 50, "Key bindings", Anchor.Centre,
|
Make( -140, 50, "Key bindings", Anchor.Centre,
|
||||||
(g, w) => g.SetNewScreen( new NormalKeyBindingsScreen( g ) ) ),
|
(g, w) => g.SetNewScreen( new NormalKeyBindingsScreen( g ) ) ),
|
||||||
|
|
||||||
// Column 2
|
// Column 2
|
||||||
Make( 140, -150, "Save level", Anchor.Centre,
|
Make( 140, -150, "Save level", Anchor.Centre,
|
||||||
(g, w) => g.SetNewScreen( new SaveLevelScreen( g ) ) ),
|
(g, w) => g.SetNewScreen( new SaveLevelScreen( g ) ) ),
|
||||||
!game.Network.IsSinglePlayer ? null :
|
!game.Network.IsSinglePlayer ? null :
|
||||||
Make( 140, -100, "Load level", Anchor.Centre,
|
Make( 140, -100, "Load level", Anchor.Centre,
|
||||||
(g, w) => g.SetNewScreen( new LoadLevelScreen( g ) ) ),
|
(g, w) => g.SetNewScreen( new LoadLevelScreen( g ) ) ),
|
||||||
!game.Network.IsSinglePlayer ? null :
|
!game.Network.IsSinglePlayer ? null :
|
||||||
Make( 140, -50, "Generate level", Anchor.Centre,
|
Make( 140, -50, "Generate level", Anchor.Centre,
|
||||||
(g, w) => g.SetNewScreen( new GenLevelScreen( g ) ) ),
|
(g, w) => g.SetNewScreen( new GenLevelScreen( g ) ) ),
|
||||||
Make( 140, 0, "Select texture pack", Anchor.Centre,
|
Make( 140, 0, "Select texture pack", Anchor.Centre,
|
||||||
(g, w) => g.SetNewScreen( new TexturePackScreen( g ) ) ),
|
(g, w) => g.SetNewScreen( new TexturePackScreen( g ) ) ),
|
||||||
Make( 140, 50, "Hotkeys", Anchor.Centre,
|
Make( 140, 50, "Hotkeys", Anchor.Centre,
|
||||||
(g, w) => g.SetNewScreen( new HotkeyScreen( g ) ) ),
|
(g, w) => g.SetNewScreen( new HotkeyScreen( g ) ) ),
|
||||||
|
|
||||||
Make( 0, 100, "Nostalgia options", Anchor.Centre,
|
Make( 0, 100, "Nostalgia options", Anchor.Centre,
|
||||||
(g, w) => g.SetNewScreen( new NostalgiaScreen( g ) ) ),
|
(g, w) => g.SetNewScreen( new NostalgiaScreen( g ) ) ),
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
@ -55,10 +64,32 @@ namespace ClassicalSharp {
|
|||||||
MakeBack( true, titleFont,
|
MakeBack( true, titleFont,
|
||||||
(g, w) => g.SetNewScreen( null ) ),
|
(g, w) => g.SetNewScreen( null ) ),
|
||||||
};
|
};
|
||||||
CheckHacksAllowed( null, null );
|
}
|
||||||
|
|
||||||
|
void MakeClassic() {
|
||||||
|
widgets = new ButtonWidget[] {
|
||||||
|
MakeClassic( 0, -150, "Options", Anchor.Centre,
|
||||||
|
(g, w) => g.SetNewScreen( new MiscOptionsScreen( g ) ) ),
|
||||||
|
MakeClassic( 0, -100, "Key bindings", Anchor.Centre,
|
||||||
|
(g, w) => g.SetNewScreen( new NormalKeyBindingsScreen( g ) ) ),
|
||||||
|
MakeClassic( 0, -50, "Save level", Anchor.Centre,
|
||||||
|
(g, w) => g.SetNewScreen( new SaveLevelScreen( g ) ) ),
|
||||||
|
!game.Network.IsSinglePlayer ? null :
|
||||||
|
MakeClassic( 0, 0, "Load level", Anchor.Centre,
|
||||||
|
(g, w) => g.SetNewScreen( new LoadLevelScreen( g ) ) ),
|
||||||
|
!game.Network.IsSinglePlayer ? null :
|
||||||
|
MakeClassic( 0, 50, "Generate level", Anchor.Centre,
|
||||||
|
(g, w) => g.SetNewScreen( new GenLevelScreen( g ) ) ),
|
||||||
|
|
||||||
|
MakeClassic( 0, 100, "Nostalgia options", Anchor.Centre,
|
||||||
|
(g, w) => g.SetNewScreen( new NostalgiaScreen( g ) ) ),
|
||||||
|
|
||||||
|
MakeBack( true, titleFont,
|
||||||
|
(g, w) => g.SetNewScreen( null ) ),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckHacksAllowed( object sender, EventArgs e ) {
|
void CheckHacksAllowed( object sender, EventArgs e ) {
|
||||||
for( int i = 0; i < widgets.Length; i++ ) {
|
for( int i = 0; i < widgets.Length; i++ ) {
|
||||||
if( widgets[i] == null ) continue;
|
if( widgets[i] == null ) continue;
|
||||||
widgets[i].Disabled = false;
|
widgets[i].Disabled = false;
|
||||||
@ -70,12 +101,17 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ButtonWidget Make( int x, int y, string text, Anchor vDocking, Action<Game, Widget> onClick ) {
|
ButtonWidget Make( int x, int y, string text, Anchor vDocking, Action<Game, Widget> onClick ) {
|
||||||
return ButtonWidget.Create( game, x, y, 240, 35, text,
|
return ButtonWidget.Create( game, x, y, 240, 35, text,
|
||||||
|
Anchor.Centre, vDocking, titleFont, LeftOnly( onClick ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
ButtonWidget MakeClassic( int x, int y, string text, Anchor vDocking, Action<Game, Widget> onClick ) {
|
||||||
|
return ButtonWidget.Create( game, x, y, 400, 40, text,
|
||||||
Anchor.Centre, vDocking, titleFont, LeftOnly( onClick ) );
|
Anchor.Centre, vDocking, titleFont, LeftOnly( onClick ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
ButtonWidget MakeOther( int x, int y, int width, string text, Anchor hAnchor, Action<Game, Widget> onClick ) {
|
ButtonWidget MakeOther( int x, int y, int width, string text, Anchor hAnchor, Action<Game, Widget> onClick ) {
|
||||||
return ButtonWidget.Create( game, x, y, width, 35, text,
|
return ButtonWidget.Create( game, x, y, width, 35, text,
|
||||||
hAnchor, Anchor.BottomOrRight, titleFont, LeftOnly( onClick ) );
|
hAnchor, Anchor.BottomOrRight, titleFont, LeftOnly( onClick ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,6 +206,7 @@ namespace ClassicalSharp {
|
|||||||
/// <summary> Parses hack flags specified in the motd and/or name of the server. </summary>
|
/// <summary> Parses hack flags specified in the motd and/or name of the server. </summary>
|
||||||
/// <remarks> Recognises +/-hax, +/-fly, +/-noclip, +/-speed, +/-respawn, +/-ophax </remarks>
|
/// <remarks> Recognises +/-hax, +/-fly, +/-noclip, +/-speed, +/-respawn, +/-ophax </remarks>
|
||||||
public void ParseHackFlags( string name, string motd ) {
|
public void ParseHackFlags( string name, string motd ) {
|
||||||
|
return;
|
||||||
string joined = name + motd;
|
string joined = name + motd;
|
||||||
SetAllHacks( true );
|
SetAllHacks( true );
|
||||||
// By default (this is also the case with WoM), we can use hacks.
|
// By default (this is also the case with WoM), we can use hacks.
|
||||||
|
@ -128,7 +128,7 @@ namespace ClassicalSharp {
|
|||||||
|
|
||||||
public bool TabAutocomplete;
|
public bool TabAutocomplete;
|
||||||
|
|
||||||
public bool UseClassicGui, UseClassicTabList;
|
public bool UseClassicGui, UseClassicTabList, UseClassicOptions;
|
||||||
|
|
||||||
public bool AllowCustomBlocks, UseCPE, AllowServerTextures;
|
public bool AllowCustomBlocks, UseCPE, AllowServerTextures;
|
||||||
|
|
||||||
|
@ -68,6 +68,7 @@ namespace ClassicalSharp {
|
|||||||
|
|
||||||
UseClassicGui = Options.GetBool( OptionsKey.UseClassicGui, true );
|
UseClassicGui = Options.GetBool( OptionsKey.UseClassicGui, true );
|
||||||
UseClassicTabList = Options.GetBool( OptionsKey.UseClassicTabList, false );
|
UseClassicTabList = Options.GetBool( OptionsKey.UseClassicTabList, false );
|
||||||
|
UseClassicOptions = Options.GetBool( OptionsKey.UseClassicOptions, false );
|
||||||
AllowCustomBlocks = Options.GetBool( OptionsKey.AllowCustomBlocks, true );
|
AllowCustomBlocks = Options.GetBool( OptionsKey.AllowCustomBlocks, true );
|
||||||
UseCPE = Options.GetBool( OptionsKey.UseCPE, true );
|
UseCPE = Options.GetBool( OptionsKey.UseCPE, true );
|
||||||
AllowServerTextures = Options.GetBool( OptionsKey.AllowServerTextures, true );
|
AllowServerTextures = Options.GetBool( OptionsKey.AllowServerTextures, true );
|
||||||
|
@ -45,9 +45,9 @@ namespace ClassicalSharp {
|
|||||||
public const string UseClassicGui = "nostalgia-classicgui";
|
public const string UseClassicGui = "nostalgia-classicgui";
|
||||||
public const string SimpleArmsAnim = "nostalgia-simplearms";
|
public const string SimpleArmsAnim = "nostalgia-simplearms";
|
||||||
public const string UseClassicTabList = "nostalgia-classictablist";
|
public const string UseClassicTabList = "nostalgia-classictablist";
|
||||||
|
public const string UseClassicOptions = "nostalgia-classicoptions";
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: implement this
|
|
||||||
public enum FpsLimitMethod {
|
public enum FpsLimitMethod {
|
||||||
LimitVSync,
|
LimitVSync,
|
||||||
Limit30FPS,
|
Limit30FPS,
|
||||||
|
@ -94,6 +94,7 @@ namespace Launcher2 {
|
|||||||
Options.Set( "nostalgia-usecpe", !game.ClassicMode );
|
Options.Set( "nostalgia-usecpe", !game.ClassicMode );
|
||||||
Options.Set( "nostalgia-servertextures", !game.ClassicMode );
|
Options.Set( "nostalgia-servertextures", !game.ClassicMode );
|
||||||
Options.Set( "nostalgia-classictablist", game.ClassicMode );
|
Options.Set( "nostalgia-classictablist", game.ClassicMode );
|
||||||
|
Options.Set( "nostalgia-classicoptions", game.ClassicMode );
|
||||||
Options.Set( "hacksenabled", !game.ClassicMode );
|
Options.Set( "hacksenabled", !game.ClassicMode );
|
||||||
Options.Set( "doublejump", false );
|
Options.Set( "doublejump", false );
|
||||||
Options.Save();
|
Options.Save();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user