diff --git a/ClassicalSharp/2D/Drawing/GdiPlusDrawer2D.TextMC.cs b/ClassicalSharp/2D/Drawing/GdiPlusDrawer2D.TextMC.cs index c1915cf41..441786e36 100644 --- a/ClassicalSharp/2D/Drawing/GdiPlusDrawer2D.TextMC.cs +++ b/ClassicalSharp/2D/Drawing/GdiPlusDrawer2D.TextMC.cs @@ -72,6 +72,7 @@ namespace ClassicalSharp { FastColour textCol = part.TextColour; float point = font.Size; int xMul = font.Style == FontStyle.Italic ? 1 : 0; + int originX = x; foreach( char c in text ) { int coords = ConvertToCP437( c ); @@ -101,6 +102,12 @@ namespace ClassicalSharp { } x += PtToPx( point, srcWidth + 1 ); } + + if( font.Style == FontStyle.Underline ) { + int* dstRow = fastBmp.GetRowPtr( y ); + for( int xx = originX; xx < x; xx++ ) + dstRow[xx] = FastColour.Green.ToArgb(); + } } public override Size MeasureBitmappedSize( ref DrawTextArgs args ) { diff --git a/ClassicalSharp/2D/Screens/ChatScreen.cs b/ClassicalSharp/2D/Screens/ChatScreen.cs index 30762755e..7f46e53be 100644 --- a/ClassicalSharp/2D/Screens/ChatScreen.cs +++ b/ClassicalSharp/2D/Screens/ChatScreen.cs @@ -291,18 +291,20 @@ namespace ClassicalSharp { int y = normalChat.Y + normalChat.Height - height; if( new Rectangle( normalChat.X, y, normalChat.Width, height ).Contains( mouseX, mouseY ) ) { string text = normalChat.GetSelected( mouseX, mouseY ); - if( text != null ) { - if( Utils.IsUrlPrefix( text ) ) { - game.ShowWarning( new WarningScreen( - game, text, OpenUrl, AppendUrl, - "Are you sure you want to go to this url?", - text, - "Be careful - urls from strangers may link to websites that", - " may have viruses, or things you may not want to open/see." - ) ); - } - return true; + if( text == null ) return false; + + if( Utils.IsUrlPrefix( text ) ) { + game.ShowWarning( new WarningScreen( + game, text, OpenUrl, AppendUrl, + "Are you sure you want to go to this url?", + text, + "Be careful - urls from strangers may link to websites that", + " may have viruses, or things you may not want to open/see." + ) ); + } else { + textInput.AppendText( text ); } + return true; } return false; } diff --git a/ClassicalSharp/2D/Widgets/Chat/TextGroupWidget.cs b/ClassicalSharp/2D/Widgets/Chat/TextGroupWidget.cs index c15cb26ff..af6edac92 100644 --- a/ClassicalSharp/2D/Widgets/Chat/TextGroupWidget.cs +++ b/ClassicalSharp/2D/Widgets/Chat/TextGroupWidget.cs @@ -116,9 +116,8 @@ namespace ClassicalSharp { public string GetSelected( int mouseX, int mouseY ) { for( int i = 0; i < Textures.Length; i++ ) { Texture tex = Textures[i]; - if( tex.IsValid && tex.Bounds.Contains( mouseX, mouseY ) ) { - return GetUrl( i, mouseX ) ?? lines[i]; - } + if( tex.IsValid && tex.Bounds.Contains( mouseX, mouseY ) ) + return GetUrl( i, mouseX ) ?? lines[i]; } return null; } diff --git a/ClassicalSharp/Game/ChatLog.cs b/ClassicalSharp/Game/ChatLog.cs index 753103b7a..00f2d8502 100644 --- a/ClassicalSharp/Game/ChatLog.cs +++ b/ClassicalSharp/Game/ChatLog.cs @@ -7,8 +7,8 @@ namespace ClassicalSharp { public sealed class ChatLog : IDisposable { - public ChatLine Status1, Status2, Status3, BottomRight1 = "F", - BottomRight2 = "G", BottomRight3 = "H", Announcement; + public ChatLine Status1, Status2, Status3, BottomRight1, + BottomRight2, BottomRight3, Announcement; Game game; public ChatLog( Game game ) { diff --git a/Launcher2/Utils/JSON.cs b/Launcher2/Utils/JSON.cs index cbb0c926c..b83712176 100644 --- a/Launcher2/Utils/JSON.cs +++ b/Launcher2/Utils/JSON.cs @@ -1,8 +1,8 @@ //----------------------------------------------------------------------- // -// Copyright ( c ) 2011, The Outercurve Foundation. +// Copyright (c) 2011, The Outercurve Foundation. // -// Licensed under the MIT License ( the "License" ); +// Licensed under the MIT License (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.opensource.org/licenses/mit-license.php @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // -// Nathan Totten ( ntotten.com ), Jim Zimmerman ( jimzimmerman.com ) and Prabir Shrestha ( prabir.me ) +// Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me) // https://github.com/facebook-csharp-sdk/simple-json //----------------------------------------------------------------------- // original json parsing code from http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html