mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 19:45:23 -04:00
Fix clicking on chat.
This commit is contained in:
parent
bd9da4d83d
commit
41cd8a3c0b
@ -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 ) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 ) ) {
|
||||
if( tex.IsValid && tex.Bounds.Contains( mouseX, mouseY ) )
|
||||
return GetUrl( i, mouseX ) ?? lines[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -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 ) {
|
||||
|
@ -1,8 +1,8 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="SimpleJson.cs" company="The Outercurve Foundation">
|
||||
// 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.
|
||||
// </copyright>
|
||||
// <author>Nathan Totten ( ntotten.com ), Jim Zimmerman ( jimzimmerman.com ) and Prabir Shrestha ( prabir.me )</author>
|
||||
// <author>Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me)</author>
|
||||
// <website>https://github.com/facebook-csharp-sdk/simple-json</website>
|
||||
//-----------------------------------------------------------------------
|
||||
// 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user