game(android): add custom chat

This commit is contained in:
nillerusr 2022-09-08 21:23:06 +03:00
parent 93c71cb74a
commit 09924b7998
2 changed files with 41 additions and 10 deletions

View File

@ -24,7 +24,7 @@
#include "vgui/IInput.h"
#include "vgui/ILocalize.h"
#include "multiplay_gamerules.h"
#include "tier0/icommandline.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
@ -37,6 +37,9 @@ ConVar cl_showtextmsg( "cl_showtextmsg", "1", 0, "Enable/disable text messages p
ConVar cl_chatfilters( "cl_chatfilters", "63", FCVAR_CLIENTDLL | FCVAR_ARCHIVE, "Stores the chat filter settings " );
ConVar cl_chatfilter_version( "cl_chatfilter_version", "0", FCVAR_CLIENTDLL | FCVAR_ARCHIVE | FCVAR_HIDDEN, "Stores the chat filter version" );
#undef IsAndroid
#define IsAndroid() 1
const int kChatFilterVersion = 1;
Color g_ColorBlue( 153, 204, 255, 255 );
@ -393,9 +396,13 @@ CBaseHudChatInputLine::CBaseHudChatInputLine( vgui::Panel *parent, char const *p
void CBaseHudChatInputLine::ApplySchemeSettings(vgui::IScheme *pScheme)
{
BaseClass::ApplySchemeSettings(pScheme);
vgui::HFont hFont;
// FIXME: Outline
vgui::HFont hFont = pScheme->GetFont( "ChatFont" );
if( IsAndroid() )
hFont = pScheme->GetFont( "ChatFont", true );
else
hFont = pScheme->GetFont( "ChatFont" );
m_pPrompt->SetFont( hFont );
m_pInput->SetFont( hFont );
@ -582,7 +589,13 @@ void CHudChatFilterButton::DoClick( void )
CHudChatHistory::CHudChatHistory( vgui::Panel *pParent, const char *panelName ) : BaseClass( pParent, "HudChatHistory" )
{
vgui::HScheme scheme = vgui::scheme()->LoadSchemeFromFileEx( enginevgui->GetPanel( PANEL_CLIENTDLL ), "resource/ChatScheme.res", "ChatScheme");
vgui::HScheme scheme;
if( IsAndroid() && !CommandLine()->FindParm( "-nocustomchat" ) )
scheme = vgui::scheme()->LoadSchemeFromFileEx( enginevgui->GetPanel( PANEL_CLIENTDLL ), "resource/customchatscheme.res", "ChatScheme");
else
scheme = vgui::scheme()->LoadSchemeFromFileEx( enginevgui->GetPanel( PANEL_CLIENTDLL ), "resource/ChatScheme.res", "ChatScheme");
SetScheme(scheme);
InsertFade( -1, -1 );
@ -592,7 +605,11 @@ void CHudChatHistory::ApplySchemeSettings( vgui::IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
if( IsAndroid() )
SetFont( pScheme->GetFont( "ChatFont", true ) );
else
SetFont( pScheme->GetFont( "ChatFont" ) );
SetAlpha( 255 );
}
@ -606,7 +623,13 @@ CBaseHudChat::CBaseHudChat( const char *pElementName )
vgui::Panel *pParent = g_pClientMode->GetViewport();
SetParent( pParent );
vgui::HScheme scheme = vgui::scheme()->LoadSchemeFromFileEx( enginevgui->GetPanel( PANEL_CLIENTDLL ), "resource/ChatScheme.res", "ChatScheme" );
vgui::HScheme scheme;
if( IsAndroid() && !CommandLine()->FindParm( "-nocustomchat" ) )
scheme = vgui::scheme()->LoadSchemeFromFileEx( enginevgui->GetPanel( PANEL_CLIENTDLL ), "resource/customchatscheme.res", "ChatScheme" );
else
scheme = vgui::scheme()->LoadSchemeFromFileEx( enginevgui->GetPanel( PANEL_CLIENTDLL ), "resource/ChatScheme.res", "ChatScheme" );
SetScheme(scheme);
g_pVGuiLocalize->AddFile( "resource/chat_%language%.txt" );
@ -676,7 +699,12 @@ CHudChatFilterPanel *CBaseHudChat::GetChatFilterPanel( void )
if ( m_pFilterPanel )
{
vgui::HScheme scheme = vgui::scheme()->LoadSchemeFromFileEx( enginevgui->GetPanel( PANEL_CLIENTDLL ), "resource/ChatScheme.res", "ChatScheme");
vgui::HScheme scheme;
if( IsAndroid() && !CommandLine()->FindParm( "-nocustomchat" ) )
scheme = vgui::scheme()->LoadSchemeFromFileEx( enginevgui->GetPanel( PANEL_CLIENTDLL ), "resource/customchatscheme.res", "ChatScheme");
else
scheme = vgui::scheme()->LoadSchemeFromFileEx( enginevgui->GetPanel( PANEL_CLIENTDLL ), "resource/ChatScheme.res", "ChatScheme");
m_pFilterPanel->SetScheme( scheme );
m_pFilterPanel->InvalidateLayout( true, true );
@ -692,6 +720,9 @@ CHudChatFilterPanel *CBaseHudChat::GetChatFilterPanel( void )
void CBaseHudChat::ApplySchemeSettings( vgui::IScheme *pScheme )
{
if( IsAndroid() && !CommandLine()->FindParm( "-nocustomchat" ) )
LoadControlSettings( "resource/UI/customchat.res" );
else
LoadControlSettings( "resource/UI/BaseChat.res" );
BaseClass::ApplySchemeSettings( pScheme );
@ -1054,7 +1085,7 @@ void CBaseHudChat::OnTick( void )
if ( line )
{
vgui::HFont font = line->GetFont();
m_iFontHeight = vgui::surface()->GetFontTall( font ) + 2;
m_iFontHeight = vgui::scheme()->GetProportionalScaledValue(vgui::surface()->GetFontTall( font )) + 2;
// Put input area at bottom

View File

@ -244,7 +244,7 @@ void CCreateMultiplayerGameGameplayPage::LoadGameOptionsList()
}
pCtrl->pScrObj = pObj;
pCtrl->SetSize( 100, 28 );
pCtrl->SetSize( 100, scheme()->GetProportionalScaledValue(28) );
//pCtrl->SetBorder( scheme()->GetBorder(1, "DepressedButtonBorder") );
m_pOptionsList->AddItem( pCtrl );