mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-18 03:55:19 -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;
|
FastColour textCol = part.TextColour;
|
||||||
float point = font.Size;
|
float point = font.Size;
|
||||||
int xMul = font.Style == FontStyle.Italic ? 1 : 0;
|
int xMul = font.Style == FontStyle.Italic ? 1 : 0;
|
||||||
|
int originX = x;
|
||||||
|
|
||||||
foreach( char c in text ) {
|
foreach( char c in text ) {
|
||||||
int coords = ConvertToCP437( c );
|
int coords = ConvertToCP437( c );
|
||||||
@ -101,6 +102,12 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
x += PtToPx( point, srcWidth + 1 );
|
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 ) {
|
public override Size MeasureBitmappedSize( ref DrawTextArgs args ) {
|
||||||
|
@ -291,18 +291,20 @@ namespace ClassicalSharp {
|
|||||||
int y = normalChat.Y + normalChat.Height - height;
|
int y = normalChat.Y + normalChat.Height - height;
|
||||||
if( new Rectangle( normalChat.X, y, normalChat.Width, height ).Contains( mouseX, mouseY ) ) {
|
if( new Rectangle( normalChat.X, y, normalChat.Width, height ).Contains( mouseX, mouseY ) ) {
|
||||||
string text = normalChat.GetSelected( mouseX, mouseY );
|
string text = normalChat.GetSelected( mouseX, mouseY );
|
||||||
if( text != null ) {
|
if( text == null ) return false;
|
||||||
if( Utils.IsUrlPrefix( text ) ) {
|
|
||||||
game.ShowWarning( new WarningScreen(
|
if( Utils.IsUrlPrefix( text ) ) {
|
||||||
game, text, OpenUrl, AppendUrl,
|
game.ShowWarning( new WarningScreen(
|
||||||
"Are you sure you want to go to this url?",
|
game, text, OpenUrl, AppendUrl,
|
||||||
text,
|
"Are you sure you want to go to this url?",
|
||||||
"Be careful - urls from strangers may link to websites that",
|
text,
|
||||||
" may have viruses, or things you may not want to open/see."
|
"Be careful - urls from strangers may link to websites that",
|
||||||
) );
|
" may have viruses, or things you may not want to open/see."
|
||||||
}
|
) );
|
||||||
return true;
|
} else {
|
||||||
|
textInput.AppendText( text );
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -116,9 +116,8 @@ namespace ClassicalSharp {
|
|||||||
public string GetSelected( int mouseX, int mouseY ) {
|
public string GetSelected( int mouseX, int mouseY ) {
|
||||||
for( int i = 0; i < Textures.Length; i++ ) {
|
for( int i = 0; i < Textures.Length; i++ ) {
|
||||||
Texture tex = Textures[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 GetUrl( i, mouseX ) ?? lines[i];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,8 @@ namespace ClassicalSharp {
|
|||||||
|
|
||||||
public sealed class ChatLog : IDisposable {
|
public sealed class ChatLog : IDisposable {
|
||||||
|
|
||||||
public ChatLine Status1, Status2, Status3, BottomRight1 = "F",
|
public ChatLine Status1, Status2, Status3, BottomRight1,
|
||||||
BottomRight2 = "G", BottomRight3 = "H", Announcement;
|
BottomRight2, BottomRight3, Announcement;
|
||||||
|
|
||||||
Game game;
|
Game game;
|
||||||
public ChatLog( Game game ) {
|
public ChatLog( Game game ) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// <copyright file="SimpleJson.cs" company="The Outercurve Foundation">
|
// <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 not use this file except in compliance with the License.
|
||||||
// You may obtain a copy of the License at
|
// You may obtain a copy of the License at
|
||||||
// http://www.opensource.org/licenses/mit-license.php
|
// http://www.opensource.org/licenses/mit-license.php
|
||||||
@ -13,7 +13,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
// </copyright>
|
// </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>
|
// <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
|
// 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