本文整理汇总了C++中P_PLAYER::inputMode方法的典型用法代码示例。如果您正苦于以下问题:C++ P_PLAYER::inputMode方法的具体用法?C++ P_PLAYER::inputMode怎么用?C++ P_PLAYER::inputMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_PLAYER
的用法示例。
在下文中一共展示了P_PLAYER::inputMode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InputSpeech
bool InputSpeech( cUOSocket* socket, P_PLAYER pChar, const QString& speech )
{
if ( pChar->inputMode() == cPlayer::enNone )
return false;
P_ITEM pItem = FindItemBySerial( pChar->inputItem() );
if ( !pItem )
return false;
//bool ok = false;
//Q_INT32 num = speech.toInt( &ok ); // Generally try to convert it
QString notification;
switch ( pChar->inputMode() )
{
// Pricing an item - PlayerVendors
case cPlayer::enPricing:
socket->sysMessage( "Ops, sorry not implemented" );
pChar->setInputMode( cPlayer::enDescription );
socket->sysMessage( tr( "Enter a description for this item." ) );
break;
// Describing an item
case cPlayer::enDescription:
socket->sysMessage( "Description is not used anywhere :( not implemented right now" );
socket->sysMessage( tr( "This item is now described as %1." ).arg( speech ) );
pChar->setInputMode( cPlayer::enNone );
pChar->setInputItem( INVALID_SERIAL );
break;
// Renaming ourself
case cPlayer::enNameDeed:
pChar->setName( speech );
socket->sysMessage( tr( "Your new name is: %1" ).arg( speech ) );
pChar->setInputMode( cPlayer::enNone );
pChar->setInputItem( INVALID_SERIAL );
break;
// Renaming a house sign
case cPlayer::enHouseSign:
pItem->setName( speech );
socket->sysMessage( tr( "Your house has been renamed to: %1" ).arg( speech ) );
pChar->setInputMode( cPlayer::enNone );
pChar->setInputItem( INVALID_SERIAL );
break;
default:
break; // do nothing
}
return true;
}
示例2: InputSpeech
bool InputSpeech( cUOSocket *socket, P_PLAYER pChar, const QString &speech )
{
if( pChar->inputMode() == cPlayer::enNone )
return false;
P_ITEM pItem = FindItemBySerial( pChar->inputItem() );
if( !pItem )
return false;
bool ok;
INT32 num = speech.toInt( &ok ); // Generally try to convert it
QString notification;
switch (pChar->inputMode())
{
// Pricing an item - PlayerVendors
case cPlayer::enPricing:
if (ok)
{
pItem->setPrice( num );
socket->sysMessage( tr( "This item's price has been set to %1." ).arg( num ) );
}
else
socket->sysMessage( tr( "You have to enter a numeric price" ) );
pChar->setInputMode(cPlayer::enDescription);
socket->sysMessage( tr( "Enter a description for this item." ) );
break;
// Describing an item
case cPlayer::enDescription:
pItem->setDescription( speech );
socket->sysMessage( tr( "This item is now described as %1." ).arg( speech ) );
pChar->setInputMode(cPlayer::enNone);
pChar->setInputItem(INVALID_SERIAL);
break;
// Renaming a rune
case cPlayer::enRenameRune:
pItem->setName( tr( "Rune to: %1" ).arg( speech ) );
socket->sysMessage( tr( "Rune renamed to: Rune to: %1" ).arg( speech ) );
pChar->setInputMode(cPlayer::enNone);
pChar->setInputItem(INVALID_SERIAL);
break;
// Renaming ourself
case cPlayer::enNameDeed:
pChar->setName( speech );
socket->sysMessage( tr( "Your new name is: %1" ).arg( speech ) );
pChar->setInputMode(cPlayer::enNone);
pChar->setInputItem(INVALID_SERIAL);
break;
// Renaming a house sign
case cPlayer::enHouseSign:
pItem->setName( speech );
socket->sysMessage( tr( "Your house has been renamed to: %1" ).arg( speech ) );
pChar->setInputMode(cPlayer::enNone);
pChar->setInputItem(INVALID_SERIAL);
break;
// Paging a GM
case cPlayer::enPageGM:
{
cPage* pPage = new cPage( pChar->serial(), PT_GM, speech, pChar->pos() );
cPagesManager::getInstance()->push_back( pPage );
notification = tr( "GM Page from %1: %2" ).arg( pChar->name() ).arg( speech );
for ( cUOSocket *mSock = cNetwork::instance()->first(); mSock; mSock = cNetwork::instance()->next())
if( mSock->player() && mSock->player()->isGM() )
mSock->sysMessage( notification );
if( cNetwork::instance()->count() > 0 )
socket->sysMessage( tr( "Available Game Masters have been notified of your request." ) );
else
socket->sysMessage( tr( "There was no Game Master available, page queued." ) );
pChar->setInputMode(cPlayer::enNone);
}
break;
// Paging a Counselor
case cPlayer::enPageCouns:
{
cPage* pPage = new cPage( pChar->serial(), PT_COUNSELOR, speech, pChar->pos() );
cPagesManager::getInstance()->push_back( pPage );
notification = tr( "Counselor Page from %1: %2" ).arg( pChar->name() ).arg( speech );
for ( cUOSocket *mSock = cNetwork::instance()->first(); mSock; mSock = cNetwork::instance()->next())
if( mSock->player() && (socket->player()->isCounselor() || socket->player()->isGM()) )
mSock->sysMessage( notification );
if( cNetwork::instance()->count() > 0 )
socket->sysMessage( tr( "Available Counselors have been notified of your request." ) );
else
socket->sysMessage( tr( "There was no Counselor available, page queued." ) );
pChar->setInputMode(cPlayer::enNone);
}
//.........这里部分代码省略.........