mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 09:35:23 -04:00
Use new pause menu by default, drop some ugly commands now replaced by the options and environment settings parts of the pause menu.
This commit is contained in:
parent
fde7eef0db
commit
eccf108a90
@ -55,7 +55,7 @@ namespace ClassicalSharp {
|
||||
(g, v) => g.Map.SetWaterLevel( Int32.Parse( v ) ) ),
|
||||
|
||||
Make( 0, 5, "Back to menu", Docking.BottomOrRight,
|
||||
g => g.SetNewScreen( new NewPauseScreen( g ) ), null, null ),
|
||||
g => g.SetNewScreen( new PauseScreen( g ) ), null, null ),
|
||||
null,
|
||||
};
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace ClassicalSharp {
|
||||
|
||||
MakeKeys( KeyMapping.Forward, descriptionsLeft, -140 );
|
||||
MakeKeys( KeyMapping.Screenshot, descriptionsRight, 140 );
|
||||
buttons[index] = Make( 0, 5, "Back to menu", Docking.BottomOrRight, g => g.SetNewScreen( new NewPauseScreen( g ) ) );
|
||||
buttons[index] = Make( 0, 5, "Back to menu", Docking.BottomOrRight, g => g.SetNewScreen( new PauseScreen( g ) ) );
|
||||
}
|
||||
|
||||
int index;
|
||||
|
@ -28,7 +28,7 @@ namespace ClassicalSharp {
|
||||
|
||||
Make( -140, 50, "VSync active", Docking.Centre, OnWidgetClick,
|
||||
g => g.VSync ? "yes" : "no",
|
||||
(g, v) => g.VSync = v == "yes" ),
|
||||
(g, v) => g.Graphics.SetVSync( g, v == "yes" ) ),
|
||||
Make( 140, -50, "Mouse sensitivity", Docking.Centre, OnWidgetClick,
|
||||
g => g.MouseSensitivity.ToString(),
|
||||
(g, v) => g.MouseSensitivity = Int32.Parse( v ) ),
|
||||
@ -43,7 +43,7 @@ namespace ClassicalSharp {
|
||||
} ),
|
||||
|
||||
Make( 0, 5, "Back to menu", Docking.BottomOrRight,
|
||||
g => g.SetNewScreen( new NewPauseScreen( g ) ), null, null ),
|
||||
g => g.SetNewScreen( new PauseScreen( g ) ), null, null ),
|
||||
null,
|
||||
};
|
||||
validators = new MenuInputValidator[] {
|
||||
|
@ -4,9 +4,9 @@ using OpenTK.Input;
|
||||
|
||||
namespace ClassicalSharp {
|
||||
|
||||
public class NewPauseScreen : MenuScreen {
|
||||
public class PauseScreen : MenuScreen {
|
||||
|
||||
public NewPauseScreen( Game game ) : base( game ) {
|
||||
public PauseScreen( Game game ) : base( game ) {
|
||||
}
|
||||
|
||||
public override void Init() {
|
||||
@ -14,7 +14,7 @@ namespace ClassicalSharp {
|
||||
buttons = new ButtonWidget[] {
|
||||
Make( 0, -50, "Options", Docking.Centre, g => g.SetNewScreen( new OptionsScreen( g ) ) ),
|
||||
Make( 0, 0, "Environment settings", Docking.Centre, g => g.SetNewScreen( new EnvSettingsScreen( g ) ) ),
|
||||
Make( 0, 50, "Key mappings", Docking.Centre, g => g.SetNewScreen( new KeyMappingsScreen( g ) ) ),
|
||||
Make( 0, 50, "Key mappings", Docking.Centre, g => g.SetNewScreen( new OldPauseScreen( g ) ) ), // TODO: Temp fix
|
||||
Make( 0, 55, "Back to game", Docking.BottomOrRight, g => g.SetNewScreen( new NormalScreen( g ) ) ),
|
||||
Make( 0, 5, "Exit", Docking.BottomOrRight, g => g.Exit() ),
|
||||
};
|
@ -4,12 +4,12 @@ using OpenTK.Input;
|
||||
|
||||
namespace ClassicalSharp {
|
||||
|
||||
public class PauseScreen : Screen {
|
||||
public class OldPauseScreen : Screen {
|
||||
|
||||
public PauseScreen( Game game ) : base( game ) {
|
||||
public OldPauseScreen( Game game ) : base( game ) {
|
||||
}
|
||||
|
||||
TextWidget controlsWidget, gameWidget, exitWidget, keyStatusWidget;
|
||||
TextWidget controlsWidget, gameWidget, keyStatusWidget;
|
||||
KeyMapWidget[] keysLeft, keysRight;
|
||||
KeyMapWidget widgetToChange;
|
||||
|
||||
@ -18,7 +18,6 @@ namespace ClassicalSharp {
|
||||
graphicsApi.Texturing = true;
|
||||
controlsWidget.Render( delta );
|
||||
gameWidget.Render( delta );
|
||||
exitWidget.Render( delta );
|
||||
keyStatusWidget.Render( delta );
|
||||
for( int i = 0; i < keysLeft.Length; i++ ) {
|
||||
keysLeft[i].Render( delta );
|
||||
@ -40,8 +39,7 @@ namespace ClassicalSharp {
|
||||
textFont = new Font( "Arial", 14, FontStyle.Bold );
|
||||
controlsWidget = TextWidget.Create( game, 0, 20, "&eControls list", Docking.Centre, Docking.LeftOrTop, titleFont );
|
||||
keyStatusWidget = TextWidget.Create( game, 0, 70, "", Docking.Centre, Docking.BottomOrRight, keyStatusFont );
|
||||
gameWidget = TextWidget.Create( game, 0, 40, "&eBack to game", Docking.Centre, Docking.BottomOrRight, titleFont );
|
||||
exitWidget = TextWidget.Create( game, 0, 5, "&eExit", Docking.Centre, Docking.BottomOrRight, titleFont );
|
||||
gameWidget = TextWidget.Create( game, 0, 40, "&eBack to menu", Docking.Centre, Docking.BottomOrRight, titleFont );
|
||||
|
||||
string[] descriptionsLeft = { "Forward", "Back", "Left", "Right", "Jump", "Respawn", "Set spawn",
|
||||
"Open chat", "Send chat", "Pause", "Open inventory", "Take screenshot" };
|
||||
@ -75,7 +73,6 @@ namespace ClassicalSharp {
|
||||
keyStatusWidget.Dispose();
|
||||
gameWidget.Dispose();
|
||||
controlsWidget.Dispose();
|
||||
exitWidget.Dispose();
|
||||
for( int i = 0; i < keysLeft.Length; i++ ) {
|
||||
keysLeft[i].Dispose();
|
||||
}
|
||||
@ -87,7 +84,6 @@ namespace ClassicalSharp {
|
||||
public override void OnResize( int oldWidth, int oldHeight, int width, int height ) {
|
||||
gameWidget.OnResize( oldWidth, oldHeight, width, height );
|
||||
controlsWidget.OnResize( oldWidth, oldHeight, width, height );
|
||||
exitWidget.OnResize( oldWidth, oldHeight, width, height );
|
||||
keyStatusWidget.OnResize( oldWidth, oldHeight, width, height );
|
||||
for( int i = 0; i < keysLeft.Length; i++ ) {
|
||||
keysLeft[i].OnResize( oldWidth, oldHeight, width, height );
|
||||
@ -149,13 +145,9 @@ namespace ClassicalSharp {
|
||||
}
|
||||
|
||||
public override bool HandlesMouseClick( int mouseX, int mouseY, MouseButton button ) {
|
||||
if( button != MouseButton.Left ) return false;
|
||||
if( exitWidget.ContainsPoint( mouseX, mouseY ) ) {
|
||||
game.Exit();
|
||||
return true;
|
||||
} else if( gameWidget.ContainsPoint( mouseX, mouseY ) ) {
|
||||
game.SetNewScreen( new NormalScreen( game ) );
|
||||
return true;
|
||||
if( button != MouseButton.Left ) return true;
|
||||
if( gameWidget.ContainsPoint( mouseX, mouseY ) ) {
|
||||
game.SetNewScreen( new PauseScreen( game ) );
|
||||
} else if( widgetToChange == null ) {
|
||||
for( int i = 0; i < keysLeft.Length; i++ ) {
|
||||
KeyMapWidget widget = keysLeft[i];
|
||||
@ -172,7 +164,7 @@ namespace ClassicalSharp {
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void SetWidgetToChange( KeyMapWidget widget ) {
|
@ -75,10 +75,10 @@
|
||||
<Compile Include="2D\Screens\Menu\KeyMappingsScreen.cs" />
|
||||
<Compile Include="2D\Screens\Menu\MenuInputScreen.cs" />
|
||||
<Compile Include="2D\Screens\Menu\MenuScreen.cs" />
|
||||
<Compile Include="2D\Screens\Menu\NewPauseScreen.cs" />
|
||||
<Compile Include="2D\Screens\Menu\PauseScreen.cs" />
|
||||
<Compile Include="2D\Screens\Menu\OptionsScreen.cs" />
|
||||
<Compile Include="2D\Screens\NormalScreen.cs" />
|
||||
<Compile Include="2D\Screens\PauseScreen.cs" />
|
||||
<Compile Include="2D\Screens\OldPauseScreen.cs" />
|
||||
<Compile Include="2D\Screens\Screen.cs" />
|
||||
<Compile Include="2D\Texture.cs" />
|
||||
<Compile Include="2D\Utils2D.cs" />
|
||||
|
@ -15,12 +15,8 @@ namespace ClassicalSharp.Commands {
|
||||
this.game = game;
|
||||
RegisterCommand( new CommandsCommand() );
|
||||
RegisterCommand( new HelpCommand() );
|
||||
RegisterCommand( new EnvCommand() );
|
||||
RegisterCommand( new InfoCommand() );
|
||||
RegisterCommand( new RenderTypeCommand() );
|
||||
RegisterCommand( new ChatFontSizeCommand() );
|
||||
RegisterCommand( new MouseSensitivityCommand() );
|
||||
RegisterCommand( new ViewDistanceCommand() );
|
||||
RegisterCommand( new TexturePackCommand() );
|
||||
}
|
||||
|
||||
|
@ -38,69 +38,6 @@ namespace ClassicalSharp.Commands {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Command that modifies various aspects of the environment of the current map. </summary>
|
||||
public sealed class EnvCommand : Command {
|
||||
|
||||
public EnvCommand() {
|
||||
Name = "Env";
|
||||
Help = new [] {
|
||||
"&a/client env [property] [value]",
|
||||
"&bproperties: &eskycol, fogcol, cloudscol, cloudsspeed,",
|
||||
" &esuncol, shadowcol, weather",
|
||||
"&bcol properties: &evalue must be a hex colour code (either #RRGGBB or RRGGBB).",
|
||||
"&bcloudsspeed: &evalue must be a decimal number. (e.g. 0.5, 1, 4.5).",
|
||||
"&eIf no args are given, the current env variables will be displayed.",
|
||||
};
|
||||
}
|
||||
|
||||
public override void Execute( CommandReader reader ) {
|
||||
string property = reader.Next();
|
||||
if( property == null ) {
|
||||
game.AddChat( "Fog colour: " + game.Map.FogCol.ToRGBHexString() );
|
||||
game.AddChat( "Clouds colour: " + game.Map.CloudsCol.ToRGBHexString() );
|
||||
game.AddChat( "Sky colour: " + game.Map.SkyCol.ToRGBHexString() );
|
||||
} else if( Utils.CaselessEquals( property, "skycol" ) ) {
|
||||
ReadHexColourAnd( reader, c => game.Map.SetSkyColour( c ) );
|
||||
} else if( Utils.CaselessEquals( property, "fogcol" ) ) {
|
||||
ReadHexColourAnd( reader, c => game.Map.SetFogColour( c ) );
|
||||
} else if( Utils.CaselessEquals( property, "cloudscol" )
|
||||
|| Utils.CaselessEquals( property, "cloudcol" ) ) {
|
||||
ReadHexColourAnd( reader, c => game.Map.SetCloudsColour( c ) );
|
||||
} else if( Utils.CaselessEquals( property, "suncol" ) ) {
|
||||
ReadHexColourAnd( reader, c => game.Map.SetSunlight( c ) );
|
||||
} else if( Utils.CaselessEquals( property, "shadowcol" ) ) {
|
||||
ReadHexColourAnd( reader, c => game.Map.SetShadowlight( c ) );
|
||||
} else if( Utils.CaselessEquals( property, "cloudsspeed" )
|
||||
|| Utils.CaselessEquals( property, "cloudspeed" ) ) {
|
||||
float speed;
|
||||
if( !reader.NextFloat( out speed ) ) {
|
||||
game.AddChat( "&e/client env: &cInvalid clouds speed." );
|
||||
} else {
|
||||
StandardEnvRenderer env = game.EnvRenderer as StandardEnvRenderer;
|
||||
if( env != null ) {
|
||||
env.CloudsSpeed = speed;
|
||||
}
|
||||
}
|
||||
} else if( Utils.CaselessEquals( property, "weather" ) ) {
|
||||
int weather;
|
||||
if( !reader.NextInt( out weather ) || weather < 0 || weather > 2 ) {
|
||||
game.AddChat( "&e/client env: &cInvalid weather." );
|
||||
} else {
|
||||
game.Map.SetWeather( (Weather)weather );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ReadHexColourAnd( CommandReader reader, Action<FastColour> action ) {
|
||||
FastColour colour;
|
||||
if( !reader.NextHexColour( out colour ) ) {
|
||||
game.AddChat( "&e/client env: &cInvalid hex colour." );
|
||||
} else {
|
||||
action( colour );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Command that displays information about an input client command. </summary>
|
||||
public sealed class HelpCommand : Command {
|
||||
|
||||
@ -210,86 +147,6 @@ namespace ClassicalSharp.Commands {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Command that modifies the font size of chat in the normal gui screen. </summary>
|
||||
public sealed class ChatFontSizeCommand : Command {
|
||||
|
||||
public ChatFontSizeCommand() {
|
||||
Name = "ChatSize";
|
||||
Help = new [] {
|
||||
"&a/client chatsize [fontsize]",
|
||||
"&bfontsize: &eWhole number specifying the new font size for chat.",
|
||||
};
|
||||
}
|
||||
|
||||
public override void Execute( CommandReader reader ) {
|
||||
int fontSize;
|
||||
if( !reader.NextInt( out fontSize ) ) {
|
||||
game.AddChat( "&e/client chatsize: &cInvalid font size." );
|
||||
} else {
|
||||
if( fontSize < 6 ) {
|
||||
game.AddChat( "&e/client chatsize: &cFont size too small." );
|
||||
return;
|
||||
} else if( fontSize > 30 ) {
|
||||
game.AddChat( "&e/client chatsize: &cFont size too big." );
|
||||
return;
|
||||
}
|
||||
game.ChatFontSize = fontSize;
|
||||
game.SetNewScreen( null );
|
||||
game.chatInInputBuffer = null;
|
||||
game.SetNewScreen( new NormalScreen( game ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Command that modifies how sensitive the client is to changes in the mouse position. </summary>
|
||||
public sealed class MouseSensitivityCommand : Command {
|
||||
|
||||
public MouseSensitivityCommand() {
|
||||
Name = "Sensitivity";
|
||||
Help = new [] {
|
||||
"&a/client sensitivity [mouse sensitivity]",
|
||||
"&bmouse sensitivity: &eInteger between 1 to 100 specifiying the mouse sensitivity.",
|
||||
};
|
||||
}
|
||||
|
||||
public override void Execute( CommandReader reader ) {
|
||||
int sensitivity;
|
||||
if( !reader.NextInt( out sensitivity ) ) {
|
||||
game.AddChat( "&e/client sensitivity: Current sensitivity is: " + game.MouseSensitivity );
|
||||
} else if( sensitivity < 1 || sensitivity > 100 ) {
|
||||
game.AddChat( "&e/client sensitivity: &cMouse sensitivity must be between 1 to 100." );
|
||||
} else {
|
||||
game.MouseSensitivity = sensitivity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Command that modifies how far the client can see. </summary>
|
||||
public sealed class ViewDistanceCommand : Command {
|
||||
|
||||
public ViewDistanceCommand() {
|
||||
Name = "ViewDistance";
|
||||
Help = new [] {
|
||||
"&a/client viewdistance [range]",
|
||||
"&brange: &eInteger specifying how far you can see before fog appears.",
|
||||
"&eThe minimum range is 8, the maximum is 4096.",
|
||||
};
|
||||
}
|
||||
|
||||
public override void Execute( CommandReader reader ) {
|
||||
int newDist;
|
||||
if( !reader.NextInt( out newDist ) ) {
|
||||
game.AddChat( "View distance: " + game.ViewDistance );
|
||||
} else if( newDist < 8 ) {
|
||||
game.AddChat( "&e/client viewdistance: &cThat view distance is way too small." );
|
||||
} else if( newDist > 4096 ) {
|
||||
game.AddChat( "&e/client viewdistance: &cThat view distance is way too large." );
|
||||
} else {
|
||||
game.SetViewDistance( newDist );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Command that changes the client's texture pack. </summary>
|
||||
public sealed class TexturePackCommand : Command {
|
||||
|
||||
|
@ -125,8 +125,6 @@ namespace ClassicalSharp {
|
||||
SetViewDistance( viewDistances[0] );
|
||||
} else if( key == Keys[KeyMapping.PauseOrExit] && !Map.IsNotLoaded ) {
|
||||
SetNewScreen( new PauseScreen( this ) );
|
||||
} else if( key == Key.F9 && !Map.IsNotLoaded ) { // TODO: Temp gui debug
|
||||
SetNewScreen( new NewPauseScreen( this ) );
|
||||
} else if( key == Keys[KeyMapping.OpenInventory] ) {
|
||||
SetNewScreen( new BlockSelectScreen( this ) );
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user