本文整理汇总了C++中bf_read::ReadString方法的典型用法代码示例。如果您正苦于以下问题:C++ bf_read::ReadString方法的具体用法?C++ bf_read::ReadString怎么用?C++ bf_read::ReadString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bf_read
的用法示例。
在下文中一共展示了bf_read::ReadString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetArgsFromBuffer
void GetArgsFromBuffer(
bf_read &buf,
CUtlVector<char*> &newArgv,
bool *bShowAppWindow )
{
int nArgs = buf.ReadWord();
bool bSpewArgs = false;
for ( int iArg=0; iArg < nArgs; iArg++ )
{
char argStr[512];
buf.ReadString( argStr, sizeof( argStr ) );
AppendArg( newArgv, argStr );
if ( stricmp( argStr, "-mpi_verbose" ) == 0 )
bSpewArgs = true;
if ( stricmp( argStr, "-mpi_ShowAppWindow" ) == 0 )
*bShowAppWindow = true;
}
if ( bSpewArgs )
{
Msg( "nArgs: %d\n", newArgv.Count() );
for ( int i=0; i < newArgv.Count(); i++ )
Msg( "Arg %d: %s\n", i, newArgv[i] );
}
}
示例2: MsgFunc_TaskList
// ----------------------------------------------------------
// ----------------------------------------------------------
void CHudTaskList::MsgFunc_TaskList( bf_read &msg )
{
char szString[256];
int task_index;
int task_priority;
task_index = msg.ReadByte();
task_priority = msg.ReadByte();
msg.ReadString( szString, sizeof(szString) );
DevMsg (2, "CHudTaskList::MsgFunc_TaskList - got message for task %d, priority %d, string %s\n", task_index, task_priority, szString );
// ----------------------------------------------------------
// --- Convert it to localize friendly unicode
// ----------------------------------------------------------
g_pVGuiLocalize->ConvertANSIToUnicode( szString, m_pText[task_index], sizeof(m_pText[task_index]) );
// ----------------------------------------------------------
// --- Setup a time tracker for tasks just added or updated
// ----------------------------------------------------------
if ( m_iPriority[task_index] != task_priority )
{
m_flStartTime[task_index] = gpGlobals->curtime;
m_flDuration[task_index] = TASKLINE_FLASH_TIME;
}
m_iPriority[task_index] = task_priority;
}
示例3: MsgFunc_SendAudio
void CHud::MsgFunc_SendAudio( bf_read &msg )
{
char szString[2048];
msg.ReadString( szString, sizeof(szString) );
CLocalPlayerFilter filter;
C_BaseEntity::EmitSound( filter, SOUND_FROM_LOCAL_PLAYER, szString );
}
示例4: MsgFunc_SayText
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pszName -
// iSize -
// *pbuf -
//-----------------------------------------------------------------------------
void CHudChat::MsgFunc_SayText( bf_read &msg )
{
char szString[256];
msg.ReadByte(); // client ID
msg.ReadString( szString, sizeof(szString) );
Printf( CHAT_FILTER_NONE, "%s", szString );
}
示例5: __MsgFunc_LessonLearned
void __MsgFunc_LessonLearned( bf_read &msg )
{
char szString[256];
msg.ReadString(szString, sizeof(szString));
C_SDKPlayer* pPlayer = C_SDKPlayer::GetLocalSDKPlayer();
pPlayer->Instructor_LessonLearned(szString);
}
示例6: MsgFunc_ItemPickup
//-----------------------------------------------------------------------------
// Purpose: Handle an item pickup event from the server
//-----------------------------------------------------------------------------
void CHudHistoryResource::MsgFunc_ItemPickup( bf_read &msg )
{
char szName[1024];
msg.ReadString( szName, sizeof(szName) );
// Add the item to the history
AddToHistory( HISTSLOT_ITEM, szName );
}
示例7: MsgFunc_HintText
void CHudLessonPanel::MsgFunc_HintText( bf_read &msg )
{
// Read the string(s)
char szString[255];
msg.ReadString( szString, sizeof(szString) );
char *tmpStr = hudtextmessage->LookupString( szString, NULL );
LocalizeAndDisplay( tmpStr, szString );
}
示例8: MsgFunc_ShowMenu
//-----------------------------------------------------------------------------
// Purpose: Message handler for ShowMenu message
// takes four values:
// short: a bitfield of keys that are valid input
// char : the duration, in seconds, the menu should stay up. -1 means is stays until something is chosen.
// byte : a boolean, TRUE if there is more string yet to be received before displaying the menu, false if it's the last string
// string: menu string to display
// if this message is never received, then scores will simply be the combined totals of the players.
//-----------------------------------------------------------------------------
void CHudMenu::MsgFunc_ShowMenu( bf_read &msg)
{
m_bitsValidSlots = (short)msg.ReadWord();
int DisplayTime = msg.ReadChar();
int NeedMore = msg.ReadByte();
if ( DisplayTime > 0 )
{
m_flShutoffTime = m_flOpenCloseTime + DisplayTime + gpGlobals->realtime;
}
else
{
m_flShutoffTime = -1;
}
if ( m_bitsValidSlots )
{
char szString[2048];
msg.ReadString( szString, sizeof(szString) );
if ( !m_fWaitingForMore ) // this is the start of a new menu
{
Q_strncpy( g_szPrelocalisedMenuString, szString, sizeof( g_szPrelocalisedMenuString ) );
}
else
{ // append to the current menu string
Q_strncat( g_szPrelocalisedMenuString, szString, sizeof( g_szPrelocalisedMenuString ), COPY_ALL_CHARACTERS );
}
if ( !NeedMore )
{
GetClientMode()->GetViewportAnimationController()->StartAnimationSequence("MenuOpen");
m_nSelectedItem = -1;
// we have the whole string, so we can localise it now
char szMenuString[MAX_MENU_STRING];
Q_strncpy( szMenuString, ConvertCRtoNL( hudtextmessage->BufferedLocaliseTextString( g_szPrelocalisedMenuString ) ), sizeof( szMenuString ) );
g_pVGuiLocalize->ConvertANSIToUnicode( szMenuString, g_szMenuString, sizeof( g_szMenuString ) );
ProcessText();
}
m_bMenuDisplayed = true;
m_bMenuTakesInput = true;
m_flSelectionTime = gpGlobals->curtime;
}
else
{
HideMenu();
}
m_fWaitingForMore = NeedMore;
}
示例9: HandlePacket_FORCE_PASSWORD_CHANGE
void HandlePacket_FORCE_PASSWORD_CHANGE( bf_read &buf, const CIPAddr &ipFrom )
{
char newPassword[512];
buf.ReadString( newPassword, sizeof( newPassword ) );
Msg( "Got a FORCE_PASSWORD_CHANGE (%s) packet.\n", newPassword );
SetPassword( newPassword );
if ( g_pConnMgr )
g_pConnMgr->SendCurStateTo( -1 );
}
示例10: MsgFunc_HoloMessage
void CHoloShipComm::MsgFunc_HoloMessage( bf_read &msg )
{
char szDisplayName[ 128 ];
char szWaveName[ 128 ];
msg.ReadString( szDisplayName, sizeof( szDisplayName ) );
msg.ReadString( szWaveName, sizeof( szWaveName ) );
const float flDuration = msg.ReadFloat();
//Msg( "Holo message received: %s, %s, %f\n", szDisplayName, szWaveName, flDuration );
wchar_t wszFormatted[ 64 ];
g_pVGuiLocalize->ConstructString( wszFormatted, sizeof( wszFormatted ),
SafeLocalizeInline( "#holo_gui_comm_incoming" ).Get(),
1, SafeLocalizeInline( szDisplayName ).Get() );
m_pLabelHeader->SetText( wszFormatted );
m_flResetTimer = flDuration;
m_flFlashTimer = 0.5f;
ResetWaveForm( szWaveName );
}
示例11: __MsgFunc_PyNetworkCls
// Message handler for PyNetworkCls
void __MsgFunc_PyNetworkCls( bf_read &msg )
{
char clientClass[PYNETCLS_BUFSIZE];
char networkName[PYNETCLS_BUFSIZE];
int iType = msg.ReadByte();
msg.ReadString(clientClass, PYNETCLS_BUFSIZE);
msg.ReadString(networkName, PYNETCLS_BUFSIZE);
DbgStrPyMsg( "__MsgFunc_PyNetworkCls: Registering Python network class message %d %s %s\n", iType, clientClass, networkName );
// Get module path
const char *pch = Q_strrchr( networkName, '.' );
if( !pch )
{
Warning( "Invalid python class name %s\n", networkName );
return;
}
int n = pch - networkName + 1;
char modulePath[PYNETCLS_BUFSIZE];
Q_strncpy( modulePath, networkName, n );
// Make sure the client class is imported
SrcPySystem()->Import( modulePath );
// Read which client class we are modifying
PyClientClassBase *p = FindPyClientClass( clientClass );
if( !p )
{
Warning( "__MsgFunc_PyNetworkCls: Invalid networked class %s\n", clientClass );
return;
}
// Set type
p->SetType( iType );
SetupClientClassRecv( p, iType );
// Read network class name
Q_strncpy( p->m_strPyNetworkedClassName, networkName, PYNETCLS_BUFSIZE );
// Attach if a network class exists
unsigned short lookup = m_NetworkClassDatabase.Find( networkName );
if ( lookup != m_NetworkClassDatabase.InvalidIndex() )
{
m_NetworkClassDatabase.Element(lookup)->AttachClientClass( p );
}
else
{
Warning( "__MsgFunc_PyNetworkCls: Invalid networked class %s\n", networkName );
}
}
示例12: MsgFunc_GameMessage
void CHudGameMessage::MsgFunc_GameMessage( bf_read &msg )
{
// Read in our string
char szString[256];
msg.ReadString( szString, sizeof(szString) );
// Convert it to localize friendly unicode
g_pVGuiLocalize->ConvertANSIToUnicode( szString, m_pText, sizeof(m_pText) );
// Setup our time trackers
m_flStartTime = gpGlobals->curtime;
m_flDuration = 5.0f;
}
示例13: __MsgFunc_PyNetworkCls
// Message handler for PyNetworkCls
void __MsgFunc_PyNetworkCls( bf_read &msg )
{
int iClassID;
char networkName[PYNETCLS_BUFSIZE];
iClassID = msg.ReadWord();
msg.ReadString( networkName, PYNETCLS_BUFSIZE );
DbgStrPyMsg( "__MsgFunc_PyNetworkCls: Registering Python network class message %d %s\n", iClassID, networkName );
// Get module path
const char *pch = V_strrchr( networkName, '.' );
if( !pch )
{
Warning( "Invalid python class name %s\n", networkName );
return;
}
int n = pch - networkName + 1;
char modulePath[PYNETCLS_BUFSIZE];
V_strncpy( modulePath, networkName, n );
// Make sure the client class is imported
SrcPySystem()->Import( modulePath );
// Read which client class we are modifying
PyClientClassBase *p = FindPyClientClassByID( iClassID );
if( !p )
{
Warning( "__MsgFunc_PyNetworkCls: Invalid networked class %d\n", iClassID );
return;
}
// Read network class name
V_strncpy( p->m_strPyNetworkedClassName, networkName, sizeof( p->m_strPyNetworkedClassName ) );
// Attach if a network class exists
unsigned short lookup = m_NetworkClassDatabase.Find( networkName );
if ( lookup != m_NetworkClassDatabase.InvalidIndex() )
{
m_NetworkClassDatabase.Element(lookup)->AttachClientClass( p );
}
else
{
Warning( "__MsgFunc_PyNetworkCls: Invalid networked class %s\n", networkName );
}
}
示例14: MsgFunc_HudNotifyCustom
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CHudNotificationPanel::MsgFunc_HudNotifyCustom( bf_read &msg )
{
// Ignore notifications in minmode
ConVarRef cl_hud_minmode( "cl_hud_minmode", true );
if ( cl_hud_minmode.IsValid() && cl_hud_minmode.GetBool() )
return;
// Reload the base
LoadControlSettings( "resource/UI/notifications/base_notification.res" );
char szText[256];
char szIcon[256];
msg.ReadString( szText, sizeof(szText) );
msg.ReadString( szIcon, sizeof(szIcon) );
int iBackgroundTeam = msg.ReadByte();
SetupNotifyCustom( szText, szIcon, iBackgroundTeam );
}
示例15: MsgFunc_SayText
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pszName -
// iSize -
// *pbuf -
//-----------------------------------------------------------------------------
void CHudChat::MsgFunc_SayText( bf_read &msg )
{
char szString[256];
int client = msg.ReadByte();
msg.ReadString( szString, sizeof(szString) );
bool bWantsToChat = msg.ReadByte();
if ( bWantsToChat )
{
// print raw chat text
ChatPrintf( client, "%s", szString );
}
else
{
// try to lookup translated string
Printf( "%s", hudtextmessage->LookupString( szString ) );
}
Msg( "%s", szString );
}