Browse Source

game(android): add custom chat

pull/122/head
nillerusr 2 years ago
parent
commit
09924b7998
  1. 47
      game/client/hud_basechat.cpp
  2. 2
      gameui/CreateMultiplayerGameGameplayPage.cpp

47
game/client/hud_basechat.cpp

@ -24,7 +24,7 @@
#include "vgui/IInput.h" #include "vgui/IInput.h"
#include "vgui/ILocalize.h" #include "vgui/ILocalize.h"
#include "multiplay_gamerules.h" #include "multiplay_gamerules.h"
#include "tier0/icommandline.h"
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h" #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_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" ); 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; const int kChatFilterVersion = 1;
Color g_ColorBlue( 153, 204, 255, 255 ); 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) void CBaseHudChatInputLine::ApplySchemeSettings(vgui::IScheme *pScheme)
{ {
BaseClass::ApplySchemeSettings(pScheme); BaseClass::ApplySchemeSettings(pScheme);
vgui::HFont hFont;
// FIXME: Outline // 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_pPrompt->SetFont( hFont );
m_pInput->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" ) 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); SetScheme(scheme);
InsertFade( -1, -1 ); InsertFade( -1, -1 );
@ -592,7 +605,11 @@ void CHudChatHistory::ApplySchemeSettings( vgui::IScheme *pScheme )
{ {
BaseClass::ApplySchemeSettings( pScheme ); BaseClass::ApplySchemeSettings( pScheme );
SetFont( pScheme->GetFont( "ChatFont" ) ); if( IsAndroid() )
SetFont( pScheme->GetFont( "ChatFont", true ) );
else
SetFont( pScheme->GetFont( "ChatFont" ) );
SetAlpha( 255 ); SetAlpha( 255 );
} }
@ -606,7 +623,13 @@ CBaseHudChat::CBaseHudChat( const char *pElementName )
vgui::Panel *pParent = g_pClientMode->GetViewport(); vgui::Panel *pParent = g_pClientMode->GetViewport();
SetParent( pParent ); 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); SetScheme(scheme);
g_pVGuiLocalize->AddFile( "resource/chat_%language%.txt" ); g_pVGuiLocalize->AddFile( "resource/chat_%language%.txt" );
@ -676,7 +699,12 @@ CHudChatFilterPanel *CBaseHudChat::GetChatFilterPanel( void )
if ( m_pFilterPanel ) 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->SetScheme( scheme );
m_pFilterPanel->InvalidateLayout( true, true ); m_pFilterPanel->InvalidateLayout( true, true );
@ -692,7 +720,10 @@ CHudChatFilterPanel *CBaseHudChat::GetChatFilterPanel( void )
void CBaseHudChat::ApplySchemeSettings( vgui::IScheme *pScheme ) void CBaseHudChat::ApplySchemeSettings( vgui::IScheme *pScheme )
{ {
LoadControlSettings( "resource/UI/BaseChat.res" ); if( IsAndroid() && !CommandLine()->FindParm( "-nocustomchat" ) )
LoadControlSettings( "resource/UI/customchat.res" );
else
LoadControlSettings( "resource/UI/BaseChat.res" );
BaseClass::ApplySchemeSettings( pScheme ); BaseClass::ApplySchemeSettings( pScheme );
@ -1054,7 +1085,7 @@ void CBaseHudChat::OnTick( void )
if ( line ) if ( line )
{ {
vgui::HFont font = line->GetFont(); 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 // Put input area at bottom

2
gameui/CreateMultiplayerGameGameplayPage.cpp

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

Loading…
Cancel
Save