diff --git a/ClassicalSharp/2D/Screens/Menu/KeyBindingsScreen.cs b/ClassicalSharp/2D/Screens/Menu/KeyBindingsScreen.cs index 34a0b7591..6cf1cfadb 100644 --- a/ClassicalSharp/2D/Screens/Menu/KeyBindingsScreen.cs +++ b/ClassicalSharp/2D/Screens/Menu/KeyBindingsScreen.cs @@ -29,8 +29,9 @@ namespace ClassicalSharp.Gui { if( keyNames == null ) keyNames = Enum.GetNames( typeof( Key ) ); keyFont = new Font( game.FontName, 15, FontStyle.Bold ); - regularFont = new Font( game.FontName, 15, FontStyle.Italic ); - statusWidget = TextWidget.Create( game, 0, 130, "", Anchor.Centre, Anchor.Centre, regularFont ); + regularFont = new Font( game.FontName, 16, FontStyle.Italic ); + statusWidget = ChatTextWidget.Create( game, 0, 130, "", + Anchor.Centre, Anchor.Centre, regularFont ); } protected int index; diff --git a/ClassicalSharp/2D/Screens/WarningScreen.cs b/ClassicalSharp/2D/Screens/WarningScreen.cs index 15939851b..c1bd350ad 100644 --- a/ClassicalSharp/2D/Screens/WarningScreen.cs +++ b/ClassicalSharp/2D/Screens/WarningScreen.cs @@ -28,7 +28,7 @@ namespace ClassicalSharp.Gui { public override void Init() { titleFont = new Font( game.FontName, 16, FontStyle.Bold ); - regularFont = new Font( game.FontName, 14, FontStyle.Regular ); + regularFont = new Font( game.FontName, 16, FontStyle.Regular ); InitStandardButtons(); SetText( title, body ); } @@ -58,8 +58,9 @@ namespace ClassicalSharp.Gui { labels[0] = TextWidget.Create( game, 0, -120, title, Anchor.Centre, Anchor.Centre, titleFont ); for( int i = 0; i < body.Length; i++ ) { - labels[i + 1] = TextWidget.Create( game, 0, -70 + 20 * i, body[i], + labels[i + 1] = ChatTextWidget.Create( game, 0, -70 + 20 * i, body[i], Anchor.Centre, Anchor.Centre, regularFont ); + labels[i + 1].Colour = new FastColour( 224, 224, 224 ); } } TextWidget[] labels; diff --git a/ClassicalSharp/2D/Widgets/ButtonWidget.cs b/ClassicalSharp/2D/Widgets/ButtonWidget.cs index 3b371242c..5f259f5a3 100644 --- a/ClassicalSharp/2D/Widgets/ButtonWidget.cs +++ b/ClassicalSharp/2D/Widgets/ButtonWidget.cs @@ -35,7 +35,7 @@ namespace ClassicalSharp.Gui { public override void Init() { DrawTextArgs args = new DrawTextArgs( "I", font, true ); - defaultHeight = game.Drawer2D.MeasureSize( ref args ).Height; + defaultHeight = game.Drawer2D.MeasureChatSize( ref args ).Height; Height = defaultHeight; } diff --git a/ClassicalSharp/2D/Widgets/Menu/MenuInputWidget.cs b/ClassicalSharp/2D/Widgets/Menu/MenuInputWidget.cs index 8282c4a5e..92a9d77a6 100644 --- a/ClassicalSharp/2D/Widgets/Menu/MenuInputWidget.cs +++ b/ClassicalSharp/2D/Widgets/Menu/MenuInputWidget.cs @@ -51,7 +51,7 @@ namespace ClassicalSharp.Gui { public override void Init() { DrawTextArgs caretArgs = new DrawTextArgs( "_", boldFont, false ); - chatCaretTexture = game.Drawer2D.MakeTextTexture( ref caretArgs, 0, 0 ); + chatCaretTexture = game.Drawer2D.MakeChatTextTexture( ref caretArgs, 0, 0 ); SetText( chatInputText.GetString() ); } @@ -60,7 +60,16 @@ namespace ClassicalSharp.Gui { chatInputText.Clear(); chatInputText.Append( 0, value ); DrawTextArgs args = new DrawTextArgs( value, font, false ); - Size textSize = game.Drawer2D.MeasureSize( ref args ); + Size textSize = game.Drawer2D.MeasureChatSize( ref args ); + // Ensure we don't have 0 text height + if( textSize.Height == 0 ) { + args.Text = Validator.Range; + textSize.Height = game.Drawer2D.MeasureChatSize( ref args ).Height; + args.Text = value; + } else { + args.SkipPartsCheck = true; + } + Size size = new Size( Math.Max( textSize.Width, DesiredMaxWidth ), Math.Max( textSize.Height, DesiredMaxHeight ) ); yOffset = 0; @@ -72,18 +81,17 @@ namespace ClassicalSharp.Gui { { drawer.SetBitmap( bmp ); drawer.DrawRect( backColour, 0, 0, size.Width, size.Height ); - args.SkipPartsCheck = true; - drawer.DrawText( ref args, 0, 0 ); + drawer.DrawChatText( ref args, 3, yOffset ); args.Text = Validator.Range; args.SkipPartsCheck = false; - Size hintSize = drawer.MeasureSize( ref args ); + Size hintSize = drawer.MeasureChatSize( ref args ); args.SkipPartsCheck = true; int hintX = size.Width - hintSize.Width; - if( textSize.Width < hintX ) - drawer.DrawText( ref args, hintX, 0 ); - chatInputTexture = drawer.Make2DTexture( bmp, size, 0, yOffset ); + if( textSize.Width + 3 < hintX ) + drawer.DrawChatText( ref args, hintX, yOffset ); + chatInputTexture = drawer.Make2DTexture( bmp, size, 0, 0 ); } X = CalcOffset( game.Width, size.Width, XOffset, HorizontalAnchor ); diff --git a/ClassicalSharp/Network/INetworkProcessor.cs b/ClassicalSharp/Network/INetworkProcessor.cs index 4c67e3037..a6dad7904 100644 --- a/ClassicalSharp/Network/INetworkProcessor.cs +++ b/ClassicalSharp/Network/INetworkProcessor.cs @@ -67,18 +67,25 @@ namespace ClassicalSharp { string url = identifier.Substring( 3 ); float contentLengthMB = (contentLength / 1024f / 1024f ); + string address = url; + if( url.StartsWith( "https://" ) ) address = url.Substring( 8 ); + if( url.StartsWith( "http://" ) ) address = url.Substring( 7 ); screen.SetText( "Do you want to download the server's texture pack?", - "Texture pack url:", url, + "Texture pack url:", address, "Download size: " + contentLengthMB.ToString( "F3" ) + " MB" ); } protected internal void RetrieveTexturePack( string url ) { if( !game.AcceptedUrls.HasUrl( url ) && !game.DeniedUrls.HasUrl( url ) ) { game.AsyncDownloader.RetrieveContentLength( url, true, "CL_" + url ); + string address = url; + if( url.StartsWith( "https://" ) ) address = url.Substring( 8 ); + if( url.StartsWith( "http://" ) ) address = url.Substring( 7 ); + game.ShowWarning( new WarningScreen( game, "CL_" + url, true, true, "Do you want to download the server's texture pack?", DownloadTexturePack, null, WarningScreenTick, - "Texture pack url:", url, + "Texture pack url:", address, "Download size: Determining..." ) ); } else { DownloadTexturePack( url );