Make number of chatlines configurable.

This commit is contained in:
UnknownShadow200 2015-10-23 10:52:50 +11:00
parent a9401cda70
commit 328df182c9
5 changed files with 27 additions and 20 deletions

View File

@ -133,9 +133,6 @@ namespace ClassicalSharp {
}
public override Size MeasureSize( ref DrawTextArgs args ) {
if( String.IsNullOrEmpty( args.Text ) )
return Size.Empty;
GetTextParts( args.Text );
SizeF total = SizeF.Empty;
for( int i = 0; i < parts.Count; i++ ) {

View File

@ -8,9 +8,10 @@ namespace ClassicalSharp {
public class ChatScreen : Screen {
public ChatScreen( Game game ) : base( game ) {
chatLines = game.ChatLines;
}
const int chatLines = 12;
int chatLines;
Texture announcementTex;
TextInputWidget textInput;
TextGroupWidget status, bottomRight, normalChat;

View File

@ -18,34 +18,39 @@ namespace ClassicalSharp {
g => g.ShowFPS ? "yes" : "no",
(g, v) => g.ShowFPS = v == "yes" ),
Make( 140, -50, "Chat lines", Anchor.Centre, OnWidgetClick,
g => g.ChatLines.ToString(),
(g, v) => { g.ChatLines = Int32.Parse( v );
Options.Set( OptionsKey.ChatLines, v ); } ),
Make( -140, 0, "View distance", Anchor.Centre, OnWidgetClick,
g => g.ViewDistance.ToString(),
(g, v) => g.SetViewDistance( Int32.Parse( v ) ) ),
Make( -140, 50, "VSync active", Anchor.Centre, OnWidgetClick,
g => g.VSync ? "yes" : "no",
(g, v) => g.Graphics.SetVSync( g, v == "yes" ) ),
Make( 140, -50, "Mouse sensitivity", Anchor.Centre, OnWidgetClick,
g => g.MouseSensitivity.ToString(),
(g, v) => { g.MouseSensitivity = Int32.Parse( v );
Options.Set( OptionsKey.Sensitivity, v ); } ),
Make( 140, 0, "Chat font size", Anchor.Centre, OnWidgetClick,
g => g.Chat.FontSize.ToString(),
(g, v) => { g.Chat.FontSize = Int32.Parse( v );
Options.Set( OptionsKey.FontSize, v ); } ),
!network.IsSinglePlayer ? null :
Make( -140, -100, "Singleplayer physics", Anchor.Centre, OnWidgetClick,
g => ((SinglePlayerServer)network).physics.Enabled ? "yes" : "no",
(g, v) => ((SinglePlayerServer)network).physics.Enabled = (v == "yes") ),
Make( -140, 50, "VSync active", Anchor.Centre, OnWidgetClick,
g => g.VSync ? "yes" : "no",
(g, v) => g.Graphics.SetVSync( g, v == "yes" ) ),
Make( -140, -100, "Mouse sensitivity", Anchor.Centre, OnWidgetClick,
g => g.MouseSensitivity.ToString(),
(g, v) => { g.MouseSensitivity = Int32.Parse( v );
Options.Set( OptionsKey.Sensitivity, v ); } ),
Make( 140, -100, "Speed multiplier", Anchor.Centre, OnWidgetClick,
g => g.LocalPlayer.SpeedMultiplier.ToString(),
(g, v) => { g.LocalPlayer.SpeedMultiplier = Int32.Parse( v );
Options.Set( OptionsKey.Speed, v ); } ),
!network.IsSinglePlayer ? null :
Make( -140, -150, "Singleplayer physics", Anchor.Centre, OnWidgetClick,
g => ((SinglePlayerServer)network).physics.Enabled ? "yes" : "no",
(g, v) => ((SinglePlayerServer)network).physics.Enabled = (v == "yes") ),
Make( 140, 50, "Key mappings", Anchor.Centre,
(g, w) => g.SetNewScreen( new KeyMappingsScreen( g ) ), null, null ),
@ -55,12 +60,13 @@ namespace ClassicalSharp {
};
validators = new MenuInputValidator[] {
new BooleanValidator(),
new IntegerValidator( 1, 30 ),
new IntegerValidator( 16, 4096 ),
new IntegerValidator( 6, 30 ),
new BooleanValidator(),
new IntegerValidator( 1, 100 ),
new IntegerValidator( 6, 30 ),
network.IsSinglePlayer ? new BooleanValidator() : null,
new IntegerValidator( 1, 50 ),
network.IsSinglePlayer ? new BooleanValidator() : null,
};
okayIndex = buttons.Length - 1;
}

View File

@ -68,6 +68,7 @@ namespace ClassicalSharp {
public AsyncDownloader AsyncDownloader;
public Matrix4 View, Projection;
public int MouseSensitivity = 40;
public int ChatLines = 12;
public bool HideGui = false, ShowFPS = true;
public Animations Animations;
internal int CloudsTextureId, RainTextureId, SnowTextureId;
@ -105,6 +106,7 @@ namespace ClassicalSharp {
MouseSensitivity = Options.GetInt( OptionsKey.Sensitivity, 1, 100, 40 );
BlockInfo = new BlockInfo();
BlockInfo.Init();
ChatLines = Options.GetInt( OptionsKey.ChatLines, 1, 30, 12 );
ModelCache = new ModelCache( this );
ModelCache.InitCache();

View File

@ -11,6 +11,7 @@ namespace ClassicalSharp {
public const string FontSize = "chatfontsize";
public const string Sensitivity = "mousesensitivity";
public const string Speed = "speedmultiplier";
public const string ChatLines = "chatlines";
public const string MouseLeft = "mouseleft";
public const string MouseMiddle = "mousemiddle";