本文整理汇总了C++中cegui::String类的典型用法代码示例。如果您正苦于以下问题:C++ String类的具体用法?C++ String怎么用?C++ String使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了String类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: OnPlayerShopAddBuyNum
bool OnPlayerShopAddBuyNum(const CEGUI::EventArgs& e)
{
CEGUI::Window* wnd = WEArgs(e).window;
if(!wnd) return false;
CEGUI::Window* goodsWnd = wnd->getParent();
if (goodsWnd)
{
CGoods* goods = static_cast<CGoods*>(goodsWnd->getUserData());
if (!goods) return false;
PlayerShop::tagGoodsItem* pGoodsItem = GetPlayerShop().FindtagGoods(goods);
if (pGoodsItem!=NULL)
{
char str[32];
// 取得输入框控件名
CEGUI::String name = wnd->getName();
name.assign(name, 0, name.find_last_of("/"));
name += "/BuyNum";
CEGUI::Window* buyNumWnd = GetWndMgr().getWindow(name);
ulong num = atoi(buyNumWnd->getText().c_str());
if (num>=pGoodsItem->groupNum)
{
sprintf(str,"%d",num);
wnd->disable();
}
else
sprintf(str,"%d",++num);
buyNumWnd->setText(ToCEGUIString(str));
pGoodsItem->readyTradeNum = num;
}
}
return true;
}
开发者ID:xiongshaogang,项目名称:mmo-resourse,代码行数:37,代码来源:PlayerShopPage.cpp
示例2: updateLoginWelcomeText
void GameMenuDemo::updateLoginWelcomeText(float passedTime)
{
if(d_timeSinceLoginAccepted <= 0.0f)
return;
static const CEGUI::String firstPart = "Welcome ";
CEGUI::String displayText = firstPart + d_userName;
CEGUI::String finalText;
int progress = static_cast<int>(d_timeSinceLoginAccepted / 0.08f);
if(progress > 0)
finalText += displayText.substr(0, std::min<unsigned int>(displayText.length(), progress));
finalText += "[font='DejaVuSans-12']";
double blinkPeriod = 0.8;
double blinkTime = std::modf(static_cast<double>(d_timeSinceStart), &blinkPeriod);
if(blinkTime > 0.55 || d_currentWriteFocus != WF_TopBar)
finalText += "[colour='00000000']";
finalText += reinterpret_cast<const encoded_char*>("❚");
d_topBarLabel->setText(finalText);
}
开发者ID:AjaxWang1989,项目名称:cegui,代码行数:24,代码来源:GameMenu.cpp
示例3: logEvent
void CEGUILogger::logEvent(const CEGUI::String& message, CEGUI::LoggingLevel level)
{
//just reroute to the Ember logging service
static std::string cegui("(CEGUI) ");
if (d_level >= level) {
switch (level) {
case CEGUI::Insane:
Log::slog("CEGUI", Log::VERBOSE) << cegui << message.c_str() << Log::END_MESSAGE;
break;
case CEGUI::Informative:
Log::slog("CEGUI", Log::VERBOSE) << cegui << message.c_str() << Log::END_MESSAGE;
break;
case CEGUI::Standard:
Log::slog("CEGUI", Log::INFO) << cegui << message.c_str() << Log::END_MESSAGE;
break;
case CEGUI::Warnings:
Log::slog("CEGUI", Log::WARNING) << cegui << message.c_str() << Log::END_MESSAGE;
break;
case CEGUI::Errors:
Log::slog("CEGUI", Log::FAILURE) << cegui << message.c_str() << Log::END_MESSAGE;
break;
}
}
}
开发者ID:angkorcn,项目名称:ember,代码行数:24,代码来源:CEGUILogger.cpp
示例4:
virtual void loadRawDataContainer (const CEGUI::String &filename,
CEGUI::RawDataContainer &output, const CEGUI::String &resourceGroup)
{
ZFile file;
if (file.Open(filename.c_str()))
{
int fn = file.GetSize();
char *ptr = new char [fn+1];
file.Read(ptr, fn);
ptr[fn] = 0;
output.setData((CEGUI::uint8*)ptr);
output.setSize(fn);
}
}
开发者ID:pulkomandy,项目名称:.theRush-,代码行数:16,代码来源:ZCEGui.cpp
示例5:
void CNebula2Logger::logEvent(const CEGUI::String& message, CEGUI::LoggingLevel level)
{
if (Enable && level <= getLoggingLevel())
switch (level)
{
case CEGUI::Errors:
//nKernelServer::Instance()->Error("%s\n", message.c_str()); ///!!! TODO
//break;
case CEGUI::Standard:
case CEGUI::Informative:
case CEGUI::Insane:
n_printf("%s\n", message.c_str());
break;
default:
n_error("Unknown CEGUI logging level\n");
}
}
开发者ID:moltenguy1,项目名称:deusexmachina,代码行数:17,代码来源:CEGUINebula2Logger.cpp
示例6: ParseText
void GameConsoleWindow::ParseText(CEGUI::String inMsg)
{
// I personally like working with std::string. So i'm going to convert it here.
std::string inString = inMsg.c_str();
if (inString.length() >= 1) // Be sure we got a string longer than 0
{
if (inString.at(0) == '/') // Check if the first letter is a 'command'
{
std::string::size_type commandEnd = inString.find(" ", 1);
std::string command = inString.substr(1, commandEnd - 1);
std::string commandArgs = inString.substr(commandEnd + 1, inString.length() - (commandEnd + 1));
//convert command to lower case
for(std::string::size_type i=0; i < command.length(); i++)
{
command[i] = tolower(command[i]);
}
// Begin processing
if (command == "say")
{
std::string outString = "You:" + inString; // Append our 'name' to the message we'll display in the list
OutputText(outString);
}
else if (command == "quit")
{
// do a /quit
}
else if (command == "help")
{
// do a /help
}
else
{
std::string outString = "<" + inString + "> is an invalid command.";
(this)->OutputText(outString,CEGUI::Colour(1.0f,0.0f,0.0f)); // With red ANGRY colors!
}
} // End if
else
{
(this)->OutputText(inString); // no commands, just output what they wrote
}
}
}
开发者ID:xcasadio,项目名称:casaengine,代码行数:45,代码来源:GameConsoleWindow.cpp
示例7: AcceptsWindowAsChild
//------------------------------------------------------------------------
bool WindowContext::AcceptsWindowAsChild() const
{
// Validations
wxASSERT_MSG(m_pWindow != NULL, wxT("Window member is NULL"));
const CEGUI::String strWindowType = m_pWindow->getType();
// These require different parent / child handling.
// The current type must not be equal to the checks below
// Because of the "find" instead of exact matches, it works for different
// looknfeels, e.g. both "TaharezLook/Combobox" and "Windowslook/Combobox".
return strWindowType.find("Combobox") == CEGUI::String::npos &&
strWindowType.find("ComboDropList") == CEGUI::String::npos &&
strWindowType.find("ListHeader") == CEGUI::String::npos &&
strWindowType.find("Combobox") == CEGUI::String::npos &&
strWindowType.find("ListBox") == CEGUI::String::npos &&
strWindowType.find("MultiColumnList");
}
开发者ID:yestein,项目名称:dream-of-idle,代码行数:19,代码来源:WindowContext.cpp
示例8: initialiseAvailableWidgetsMap
void WidgetDemo::initialiseAvailableWidgetsMap()
{
//Retrieve the widget look types and add a Listboxitem for each widget, to the right scheme in the map
CEGUI::WindowFactoryManager& windowFactorymanager = CEGUI::WindowFactoryManager::getSingleton();
CEGUI::WindowFactoryManager::FalagardMappingIterator falMappingIter = windowFactorymanager.getFalagardMappingIterator();
while(!falMappingIter.isAtEnd())
{
CEGUI::String falagardBaseType = falMappingIter.getCurrentValue().d_windowType;
int slashPos = falagardBaseType.find_first_of('/');
CEGUI::String group = falagardBaseType.substr(0, slashPos);
CEGUI::String name = falagardBaseType.substr(slashPos + 1, falagardBaseType.size() - 1);
if(group.compare("SampleBrowserSkin") != 0)
{
std::map<CEGUI::String, WidgetListType>::iterator iter = d_skinListItemsMap.find(group);
if(iter == d_skinListItemsMap.end())
{
//Create new list
d_skinListItemsMap[group];
}
WidgetListType& widgetList = d_skinListItemsMap.find(group)->second;
addItemToWidgetList(name, widgetList);
}
++falMappingIter;
}
//Add the default types as well
d_skinListItemsMap["No Skin"];
WidgetListType& defaultWidgetsList = d_skinListItemsMap["No Skin"];
addItemToWidgetList("DefaultWindow", defaultWidgetsList);
addItemToWidgetList("DragContainer", defaultWidgetsList);
addItemToWidgetList("VerticalLayoutContainer", defaultWidgetsList);
addItemToWidgetList("HorizontalLayoutContainer", defaultWidgetsList);
addItemToWidgetList("GridLayoutContainer", defaultWidgetsList);
}
开发者ID:AjaxWang1989,项目名称:cegui,代码行数:41,代码来源:WidgetDemo.cpp
示例9: getPoints
int GamePlate::getPoints()
{
CEGUI::Window* window = d_window->getChild("ImageWindowObject");
CEGUI::String objectImage = window->getProperty("Image");
if(objectImage.compare(HUDDemo::s_imageNameBread) == 0)
return 2;
else if(objectImage.compare(HUDDemo::s_imageNamePoo) == 0)
return -6;
else if(objectImage.compare(HUDDemo::s_imageNameSteak) == 0)
return -13;
else if(objectImage.compare(HUDDemo::s_imageNamePrizza) == 0)
return 3;
else if(objectImage.compare(HUDDemo::s_imageNameVegPeople) == 0)
return 1;
else if(objectImage.compare(HUDDemo::s_imageNameVegFruits) == 0)
return 88;
return 0;
}
开发者ID:scw000000,项目名称:Engine,代码行数:21,代码来源:HUDemo.cpp
示例10: loadRawDataContainer
void CEGUIResourceProvider::loadRawDataContainer(const CEGUI::String &filename,
CEGUI::RawDataContainer &output,
const CEGUI::String &resourceGroup)
{
DBG(0, "%s", filename.c_str());
if (strcmp(filename.c_str(), "TaharezLook.scheme") == 0) {
DBG(0, "size %d", sizeof(taharez_look_schem));
output.setData((CEGUI::uint8*)taharez_look_schem);
output.setSize(sizeof(taharez_look_schem));
return;
}
if (strcmp(filename.c_str(), "TaharezLook.imageset") == 0) {
DBG(0, "size %d", sizeof(taharez_look_imageset));
output.setData((CEGUI::uint8*)taharez_look_imageset);
output.setSize(sizeof(taharez_look_imageset));
return;
}
if (strcmp(filename.c_str(), "TaharezLook.tga") == 0) {
DBG(0, "size %d", sizeof(taharez_look_tga));
output.setData((CEGUI::uint8*)taharez_look_tga);
output.setSize(sizeof(taharez_look_tga));
return;
}
if (strcmp(filename.c_str(), "Commonwealth-10.font") == 0) {
DBG(0, "size %d", sizeof(commonwealth_10_font));
output.setData((CEGUI::uint8*)commonwealth_10_font);
output.setSize(sizeof(commonwealth_10_font));
return;
}
if (strcmp(filename.c_str(), "Commonv2c.ttf") == 0) {
DBG(0, "size %d", sizeof(commonv2c_ttf));
output.setData((CEGUI::uint8*)commonv2c_ttf);
output.setSize(sizeof(commonv2c_ttf));
return;
}
if (strcmp(filename.c_str(), "TaharezLook.looknfeel") == 0) {
DBG(0, "size %d", sizeof(taharez_look_looknfeel));
output.setData((CEGUI::uint8*)taharez_look_looknfeel);
output.setSize(sizeof(taharez_look_looknfeel));
return;
}
if (strcmp(filename.c_str(), "DejaVuSans-10.font") == 0) {
DBG(0, "size %d", sizeof(dejavu_sans_10_font));
output.setData((CEGUI::uint8*)dejavu_sans_10_font);
output.setSize(sizeof(dejavu_sans_10_font));
return;
}
if (strcmp(filename.c_str(), "DejaVuSans.ttf") == 0) {
DBG(0, "size %d", sizeof(dejavu_sans_ttf));
output.setData((CEGUI::uint8*)dejavu_sans_ttf);
output.setSize(sizeof(dejavu_sans_ttf));
return;
}
throw CEGUI::GenericException("failed");
}
开发者ID:colama,项目名称:colama-3rdparty-tools,代码行数:63,代码来源:resource_provider.cpp
示例11: interp
CEGUI::Event::Connection FalconScriptingModule::subscribeEvent(CEGUI::EventSet* target, const CEGUI::String& name, CEGUI::Event::Group group, const CEGUI::String& subscriber_name)
{
FalconInterpreter interp(d_vm, subscriber_name.c_str());
return target->subscribeEvent(name, group, CEGUI::Event::Subscriber(interp));
}
开发者ID:Bobhostern,项目名称:Disandria,代码行数:5,代码来源:FalconScriptingModule.cpp
示例12: postChatText
void ImplChatNetworkingVRC::postChatText( const CEGUI::String& text, const std::string& recipient )
{
// check for commands
if ( !text.compare( 0, 1, "/" ) )
{
std::vector< std::string > args;
yaf3d::explode( text.c_str(), " ", &args );
// all commands without arguments go here
if ( args.size() == 1 )
{
if ( ( args[ 0 ] == "/names" ) || ( args[ 0 ] == "/NAMES" ) )
{
tChatData chatdata;
chatdata._sessionID = _clientSID;
NOMINATED_REPLICAS_FUNCTION_CALL( 1, &_serverSID, RPC_RequestMemberList( chatdata ) );
return;
}
else
{
_p_protVRC->recvMessage( "", "", VRC_CMD_LIST );
return;
}
}
// all commands with one single argument go here
else if ( ( args.size() > 1 ) && ( ( args[ 0 ] == "/nick" ) || ( args[ 0 ] == "/NICK" ) ) )
{
tChatData chatdata;
chatdata._sessionID = _clientSID;
strcpy( chatdata._nickname, &( text.c_str()[ 6 ] ) );
NOMINATED_REPLICAS_FUNCTION_CALL( 1, &_serverSID, RPC_RequestChangeNickname( chatdata ) );
return;
}
else
{
_p_protVRC->recvMessage( "", "", VRC_CMD_LIST );
return;
}
}
else // if no command given then send the raw text
{
// prepare the telegram
tChatMsg textdata;
memset( textdata._text, 0, sizeof( textdata._text ) ); // zero out the text buffer
textdata._recipientID = 0 ; // init to non-whisper message
// determine the length of utf8 string and copy the content into send buffer
CEGUI::String lenstr( text );
memcpy( textdata._text, lenstr.data(), std::min( ( std::size_t )lenstr.utf8_stream_len( sizeof( textdata._text ) - 1, 0 ), ( std::size_t )sizeof( textdata._text ) - 2 ) );
assert( sizeof( textdata._text ) > 3 );
textdata._text[ sizeof( textdata._text ) - 1 ] = 0; // terminate the string to be on the safe side
textdata._text[ sizeof( textdata._text ) - 2 ] = 0; // terminate the string to be on the safe side
textdata._text[ sizeof( textdata._text ) - 3 ] = 0; // terminate the string to be on the safe side
textdata._sessionID = _clientSID;
// are we whispering to somebody?
if ( recipient.length() )
{
// try to find the session ID of recipient
std::map< int, std::string >::iterator p_recipientID = _nickNames.begin(), p_end = _nickNames.end();
for ( ; p_recipientID != p_end; ++p_recipientID )
{
if ( p_recipientID->second == recipient )
{
// set the recipient session ID
textdata._recipientID = p_recipientID->first;
break;
}
}
}
NOMINATED_REPLICAS_FUNCTION_CALL( 1, &_serverSID, RPC_PostChatText( textdata ) );
}
}
开发者ID:BackupTheBerlios,项目名称:yag2002-svn,代码行数:74,代码来源:vrc_chatprotVRC.cpp
示例13: HandleEnterKey
//.........这里部分代码省略.........
if(we.scancode == CEGUI::Key::ArrowDown)
{
if(_itltext != _lasttexts.end())
{
if(_itltext != _lasttexts.begin())
--_itltext;
else
_itltext = _lasttexts.end();
}
if(_itltext != _lasttexts.end())
{
CEGUI::WindowManager::getSingleton().getWindow("Chat/edit")->setText(
(const unsigned char *)_itltext->c_str());
}
else
{
CEGUI::WindowManager::getSingleton().getWindow("Chat/edit")->setText("");
}
return true;
}
if(we.scancode == CEGUI::Key::ArrowUp || we.scancode == CEGUI::Key::ArrowDown)
return true;
// paste text
if(we.scancode == CEGUI::Key::V && _control_key_on)
{
CEGUI::Editbox * bed = static_cast<CEGUI::Editbox *>
(CEGUI::WindowManager::getSingleton().getWindow("Chat/edit"));
if(bed->isActive())
{
if(_text_copyed != "")
{
size_t selB = bed->getSelectionStartIndex();
size_t selE = bed->getSelectionLength();
CEGUI::String str = bed->getText();
if(selE > 0)
{
str = str.erase(selB, selE);
}
if(str.size() + _text_copyed.size() < bed->getMaxTextLength())
{
size_t idx = bed->getCaratIndex();
str = str.insert(idx, (unsigned char *)_text_copyed.c_str());
bed->setText(str);
bed->setCaratIndex(idx + _text_copyed.size());
}
}
return true;
}
}
}
// copy text
if(we.scancode == CEGUI::Key::C && _control_key_on)
{
CEGUI::Window * actw = _myChat->getActiveChild();
if(actw != NULL)
{
if(actw->getName() == "Chat/edit")
{
CEGUI::Editbox * bed = static_cast<CEGUI::Editbox *> (actw);
size_t selB = bed->getSelectionStartIndex();
size_t selE = bed->getSelectionLength();
if(selE > 0)
{
CEGUI::String str = bed->getText().substr(selB, selE);
_text_copyed = str.c_str();
}
return true;
}
else
{
CEGUI::MultiLineEditbox* txt = static_cast<CEGUI::MultiLineEditbox *>(actw);
size_t selB = txt->getSelectionStartIndex();
size_t selE = txt->getSelectionLength();
if(selE > 0)
{
CEGUI::String str = txt->getText().substr(selB, selE);
_text_copyed = str.c_str();
}
return true;
}
}
}
return false;
}
开发者ID:leloulight,项目名称:lbanet,代码行数:101,代码来源:ChatBox.cpp
示例14: save
void Saver::save(CEGUI::String filename)
{
TiXmlDocument doc;
TiXmlElement * scene = new TiXmlElement( "scene" );
//scene attrib setup
if (!author.empty())
scene->SetAttribute("author",author.c_str());
scene->SetAttribute("formatVersion",MAXVERSION);
//environment entry
TiXmlElement *environment = new TiXmlElement( "environment" ); //TiXmlText * text = new TiXmlText( "World" ); //environment->LinkEndChild( text );
TiXmlElement *skybox = new TiXmlElement( "skyBox" );
TiXmlElement *fog = new TiXmlElement( "fog" );
fog->SetAttribute("mode","none");
skybox->SetAttribute("material","Examples/MorningSkyBox");
environment->LinkEndChild(skybox);
environment->LinkEndChild(fog);
if (assign)
{
TiXmlElement *el = new TiXmlElement("colourAmbient");
el->SetAttribute("r","0.2980392");
el->SetAttribute("g","0.2980392");
el->SetAttribute("b","0.2980392");
environment->LinkEndChild(el);
el = new TiXmlElement("newtonWorld");
el->SetAttribute("x1","-100000");
el->SetAttribute("y1","-100000");
el->SetAttribute("z1","-100000");
el->SetAttribute("x2","100000");
el->SetAttribute("y2","100000");
el->SetAttribute("z2","100000");
environment->LinkEndChild(el);
el = new TiXmlElement("player");
el->SetAttribute("x","0");
el->SetAttribute("y","100");
el->SetAttribute("z","0");
/*el->SetAttribute("x2","100000");
el->SetAttribute("y2","100000");
el->SetAttribute("z2","100000");*/
environment->LinkEndChild(el);
el = new TiXmlElement("fade");
el->SetAttribute("speed","0.5");
el->SetAttribute("duration","3");
el->SetAttribute("overlay","Overlays/FadeInOut");
el->SetAttribute("material","Materials/OverlayMaterial");
el->SetAttribute("startFade","true");
environment->LinkEndChild(el);
}
scene->LinkEndChild(environment);
//nodes entry
TiXmlElement *nodes = new TiXmlElement( "nodes" );
for (i=0; i!=StObjs_s.size(); i++)
{
TiXmlElement *node = new TiXmlElement( "node" );
node->SetAttribute("name",StObjs_s[i]->getName().c_str());
node->SetAttribute("id",rand() % 1000 + 1);
//pos orient scale and what contains
TiXmlElement *pos = new TiXmlElement( "position" );
TiXmlElement *quat = new TiXmlElement( "rotation" );
TiXmlElement *scale = new TiXmlElement( "scale" );
TiXmlElement *entity;
if (StObjs[i]->type!="")
{
entity = new TiXmlElement( StObjs[i]->type.c_str() );
}
else
{
entity=new TiXmlElement("entity");
}
pos->SetAttribute("x",Ogre::StringConverter::toString(StObjs_s[i]->getPosition().x*mScaler).c_str());
pos->SetAttribute("y",Ogre::StringConverter::toString(StObjs_s[i]->getPosition().y*mScaler).c_str());
pos->SetAttribute("z",Ogre::StringConverter::toString(StObjs_s[i]->getPosition().z*mScaler).c_str());
quat->SetAttribute("qw",Ogre::StringConverter::toString(StObjs_s[i]->getOrientation().w).c_str());
quat->SetAttribute("qx",Ogre::StringConverter::toString(StObjs_s[i]->getOrientation().x).c_str());
quat->SetAttribute("qy",Ogre::StringConverter::toString(StObjs_s[i]->getOrientation().y).c_str());
quat->SetAttribute("qz",Ogre::StringConverter::toString(StObjs_s[i]->getOrientation().z).c_str());
scale->SetAttribute("x",Ogre::StringConverter::toString(StObjs_s[i]->getScale().x*mScaler).c_str());
scale->SetAttribute("y",Ogre::StringConverter::toString(StObjs_s[i]->getScale().y*mScaler).c_str());
scale->SetAttribute("z",Ogre::StringConverter::toString(StObjs_s[i]->getScale().z*mScaler).c_str());
entity->SetAttribute("name",StObjs[i]->ent->getName().c_str());
entity->SetAttribute("meshFile",StObjs[i]->ent->getMesh()->getName().c_str());
entity->SetAttribute("castShadows","true");
if (!St_mats[i].empty())
{
entity->SetAttribute("materialFile",St_mats[i].c_str());
entity->SetAttribute("scaleU",Ogre::StringConverter::toString(scaleU[i]).c_str());
entity->SetAttribute("scaleV",Ogre::StringConverter::toString(scaleV[i]).c_str());
entity->SetAttribute("scrollU",Ogre::StringConverter::toString(scrollU[i]).c_str());
entity->SetAttribute("scrollV",Ogre::StringConverter::toString(scrollV[i]).c_str());
}
node->LinkEndChild(pos);
//if (!(StObjs_s[i]->getOrientation()==Quaternion::IDENTITY))
//{
node->LinkEndChild(quat);
//}
//if (!(StObjs_s[i]->getScale()==Vector3(1,1,1)))
//{
node->LinkEndChild(scale);
//}
node->LinkEndChild(entity);
//.........这里部分代码省略.........
开发者ID:Sgw32,项目名称:RunEdit,代码行数:101,代码来源:Saver.cpp
示例15:
inline Ogre::String operator +(const Ogre::String& l,const CEGUI::String& o)
{
return l+o.c_str();
}
开发者ID:JangoOs,项目名称:kbengine_ogre_demo,代码行数:4,代码来源:CompositorDemo_FrameListener.cpp
示例16: textAccepted
bool Dan::textAccepted(const CEGUI::EventArgs&)
{
if(!check())
return false;
CodingFormatInterface * format = _coding->queryInterface<CodingFormatInterface>();
CEGUI::String text = CEGUI::WindowManager::getSingleton().getWindow("Dan/Bg/Text/Putin")->getText();
if(text.empty())
return true;
if(text.size() <= 9)
{
this->warning(L"输入未满9位");
}else
{
format->clear();
LockInterface * lock = _dataServer->queryInterface<LockInterface>();
DataServerInterface * data = _dataServer->queryInterface<DataServerInterface>();
std::string code = lock->getLockCode2();
format->decode10(code, 60);
unsigned int oCheck = format->getCheck8(60);
if(data->loadCodingData())
{
CodingFormatInterface * lockData = _dataServer->queryInterface<CodingFormatInterface>();
unsigned int oId = lockData->getLockID();
if(format->decode10(std::string(text.c_str()),28))
{
if(format->getBackCheck() != oCheck ||format->getBackID() != (oId%128))
{
warning(L"开机码和报账码不匹配,请重新报账");
}else
{
lockData->setLockLeavings(format->getBackLeavingsIndex());
data->saveCodingData();
unsigned int index = format->getBackLeavingsIndex();
unsigned int profits = format->index2Profits(index);
unsigned int levings = data->getLevingsProfits();
data->setLevingsProfits(levings + profits);
data->cleanCostBackTimeCode2();
data->save();
if(check())
{
warning(L"报账成功");
}
}
}
else
{
warning(L"无效开机码");
}
}else
{
warning(L"内部数据错误,请联系开发商!");
}
}
CEGUI::WindowManager::getSingleton().getWindow("Dan/Bg/Text/Putin")->setText("");
return true;
}
开发者ID:dbabox,项目名称:aomi,代码行数:66,代码来源:Dan.cpp
示例17: Parse
CEGUI::String LinkButtonParser::Parse(const CEGUI::String &str)
{
std::string szStr = CEGUIStringToAnsiChar( str );
size_t parentWinPos,IDPos,TextPos,ColorPos,endPos;
parentWinPos = IDPos = TextPos = ColorPos = endPos = CEGUI::String::npos;
char ParentWinName[128] = "";
char LinkID[32] = "";
char LinkText[128] = "";
char ColorVal[32] = "";
parentWinPos = str.find("WIN:");
IDPos = str.find("ID:");
TextPos = str.find("TEXT:");
ColorPos = str.find("COLOR:");
std::string wndName("LinkBtn_"),temp;
static DWORD LinkWndCounter = 0;
wndName += CEGUI::PropertyHelper::intToString(LinkWndCounter++).c_str();
CEGUI::Window *linkWnd = 0;
if (CEGUI::WindowManager::getSingleton().isWindowPresent(wndName) == false)
{
linkWnd = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/Button",wndName);
linkWnd->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&LinkButtonParser::OnLinkBtnClicked,this));
//解析父窗口
if (parentWinPos != CEGUI::String::npos)
{
temp = szStr.substr(parentWinPos+5);
endPos = temp.find("'");
strcpy_s<128>(ParentWinName,temp.substr(0,endPos).c_str());
CEGUI::Window *pParentWnd = CEGUI::WindowManager::getSingleton().getWindow(ParentWinName);
pParentWnd->addChildWindow(linkWnd);
}
//解析ID
if (IDPos != CEGUI::String::npos)
{
temp = szStr.substr(IDPos+3);
endPos = temp.find(" ");
strcpy_s<32>(LinkID,temp.substr(0,endPos).c_str());
LinkMap[linkWnd] = LinkID;
}
//解析链接按钮文本
if (TextPos != CEGUI::String::npos)
{
temp = szStr.substr(TextPos+6);
endPos = temp.find("'");
strcpy_s<128>(LinkText,temp.substr(0,endPos).c_str());
float fWidth = linkWnd->getFont()->getTextExtent(LinkText);
float fheight = linkWnd->getFont()->getFontHeight();
linkWnd->setSize(CEGUI::UVector2(cegui_absdim(fWidth),cegui_absdim(fheight)));
//解析链接按钮文本的颜色
if (ColorPos != CEGUI::String::npos)
{
temp = szStr.substr(ColorPos+6);
endPos = temp.find(" ");
strcpy_s(ColorVal,temp.substr(0,endPos).c_str());
temp = "[COLOR ";
temp += ColorVal;
temp += "]";
temp += CEGUI::String(LinkText).c_str();
linkWnd->setText(ToCEGUIString(temp.c_str()));
}
else
linkWnd->setText(ToCEGUIString(LinkText));
}
}
return wndName;
}
开发者ID:xiongshaogang,项目名称:mmo-resourse,代码行数:67,代码来源:LinkButtonParser.cpp
示例18: SetPlayerShopGoodsItemInfo
// 添加货物列表
void SetPlayerShopGoodsItemInfo(PlayerShop::tagGoodsItem& tgGoodsItem, int index)
{
/// 项目背景图
CEGUI::Window* wnd;
char tempText[256];
char strImageFilePath[128] = "";
char strImageFileName[128] = "";
sprintf(tempText, "PlayerShop/backgrond/Goods%d", index+1);
CEGUI::Window* goodsWnd = GetWndMgr().getWindow(tempText);
goodsWnd->setUserData(tgGoodsItem.pItemGoods);
goodsWnd->setVisible(true);
//根据商店状态设置UI排列
int shopState = GetPlayerShop().GetCurShopState();
if(shopState >= 0 && shopState < PlayerShop::SHOP_STATE)
{
//设置商店
if(shopState == PlayerShop::SET_SHOP)
{
sprintf(tempText, "PlayerShop/backgrond/Goods%d/BuyNum", index+1);
wnd = GetWndMgr().getWindow(tempText);
wnd->setVisible(false);
sprintf(tempText, "PlayerShop/backgrond/Goods%d/AddBuyNum", index+1);
wnd = GetWndMgr().getWindow(tempText);
wnd->setVisible(false);
sprintf(tempText, "PlayerShop/backgrond/Goods%d/SubBuyNum", index+1);
wnd = GetWndMgr().getWindow(tempText);
wnd->setVisible(false);
sprintf(tempText, "PlayerShop/backgrond/Goods%d/Text", index+1);
wnd = GetWndMgr().getWindow(tempText);
wnd->setText(ToCEGUIString("双击重新设置价格"));
}
//开店
else if(shopState == PlayerShop::OPEN_SHOP)
{
sprintf(tempText, "PlayerShop/backgrond/Goods%d/BuyNum", index+1);
wnd = GetWndMgr().getWindow(tempText);
wnd->setVisible(false);
sprintf(tempText, "PlayerShop/backgrond/Goods%d/AddBuyNum", index+1);
wnd = GetWndMgr().getWindow(tempText);
wnd->setVisible(false);
sprintf(tempText, "PlayerShop/backgrond/Goods%d/SubBuyNum", index+1);
wnd = GetWndMgr().getWindow(tempText);
wnd->setVisible(false);
sprintf(tempText, "PlayerShop/backgrond/Goods%d/Text", index+1);
wnd = GetWndMgr().getWindow(tempText);
wnd->setVisible(false);
}
// 逛商店页面
else if( shopState == PlayerShop::SHOPPING_SHOP)
{
sprintf(tempText, "PlayerShop/backgrond/Goods%d/Text", index+1);
wnd = GetWndMgr().getWindow(tempText);
wnd->setVisible(false);
}
}
// 设置物品上架信息
// 物品图片
sprintf(tempText, "PlayerShop/backgrond/Goods%d/Icon", index+1);
CEGUI::DefaultWindow* iconWnd = WDefaultWindow(GetWndMgr().getWindow(tempText));
if(iconWnd && tgGoodsItem.goodsIconId != 0)
{
// 获得当前背包栏对应的物品图标数据,并将该图标设置成对应背包组件的额外图片。
const char *strIconPath = GetGame()->GetPicList()->GetPicFilePathName(CPicList::PT_GOODS_ICON, tgGoodsItem.goodsIconId);
GetFilePath(strIconPath,strImageFilePath);
GetFileName(strIconPath,strImageFileName);
CEGUI::String strImagesetName = "GoodIcon/";
strImagesetName += strImageFileName;
SetBackGroundImage(iconWnd,strImagesetName.c_str(),strImageFilePath,strImageFileName);
// 当物品数大于1的时候才显示数量
if(tgGoodsItem.tradeType==PlayerShop::TT_GROUP && tgGoodsItem.oneGroupNum>=1)
{
char strGoodsNum[32];
sprintf_s(strGoodsNum,"%4d",tgGoodsItem.oneGroupNum);
iconWnd->setText(strGoodsNum);
}
}
// 物品数
sprintf(tempText, "PlayerShop/backgrond/Goods%d/Num", index+1);
wnd = GetWndMgr().getWindow(tempText);
if (wnd)
{
if (tgGoodsItem.tradeType==PlayerShop::TT_SINGLE)
{
sprintf_s(tempText,"剩%d件",tgGoodsItem.groupNum);
}else if (tgGoodsItem.tradeType==PlayerShop::TT_GROUP)
{
sprintf_s(tempText,"剩%d组",tgGoodsItem.groupNum);
//.........这里部分代码省略.........
开发者ID:xiongshaogang,项目名称:mmo-resourse,代码行数:101,代码来源:PlayerShopPage.cpp
示例19: consoleInputBox_KeyUp
bool ConsoleAdapter::consoleInputBox_KeyUp(const CEGUI::EventArgs& args)
{
const CEGUI::KeyEventArgs& keyargs = static_cast<const CEGUI::KeyEventArgs&>(args);
if(keyargs.scancode != CEGUI::Key::Tab)
{
mTabPressed = false;
}
switch(keyargs.scancode)
{
case CEGUI::Key::ArrowUp:
{
if(mBackend->getHistory().getHistoryPosition() == 0)
{
mCommandLine = mInputBox->getText().c_str();
}
else
{
// we are not at the command line but in the history
// => write back the editing
mBackend->getHistory().changeHistory(mBackend->getHistory().getHistoryPosition(), mInputBox->getText().c_str());
}
mBackend->getHistory().moveBackwards();
if(mBackend->getHistory().getHistoryPosition() != 0)
{
mInputBox->setText(mBackend->getHistory().getHistoryString());
}
return true;
}
case CEGUI::Key::ArrowDown:
{
if(mBackend->getHistory().getHistoryPosition() > 0)
{
mBackend->getHistory().changeHistory(mBackend->getHistory().getHistoryPosition(), mInputBox->getText().c_str());
mBackend->getHistory().moveForwards();
if(mBackend->getHistory().getHistoryPosition() == 0)
{
mInputBox->setText(mCommandLine);
}
else
{
mInputBox->setText(mBackend->getHistory().getHistoryString());
}
}
return true;
}
case CEGUI::Key::Tab:
{
std::string sCommand(mInputBox->getText().c_str());
// only process commands
if(sCommand[0] != '/')
{
return true;
}
sCommand = sCommand.substr(1, mInputBox->getCaretIndex() - 1);
if(mTabPressed == true)
{
const std::set< std::string > commands(mBackend->getPrefixes(sCommand));
if(commands.size() > 0)
{
std::set< std::string >::const_iterator iCommand(commands.begin());
std::string sMessage("");
mSelected = (mSelected + 1) % commands.size();
int select(0);
while(iCommand != commands.end())
{
if(select == mSelected)
{
std::string sCommandLine(mInputBox->getText().c_str());
// compose the new command line: old text before the caret + selected command
mInputBox->setText(sCommandLine.substr(0, mInputBox->getCaretIndex()) + iCommand->substr(mInputBox->getCaretIndex() - 1));
mInputBox->setSelection(mInputBox->getCaretIndex(), 0xFFFFFFFF);
}
sMessage += *iCommand + ' ';
++iCommand;
++select;
}
mBackend->pushMessage(sMessage);
}
}
else
{
mTabPressed = true;
mSelected = 0;
const std::set< std::string > commands(mBackend->getPrefixes(sCommand));
if(commands.size() == 0)
{
// TODO: Error reporting?
}
else
//.........这里部分代码省略.........
开发者ID:xyysnybzi,项目名称:ember,代码行数:101,代码来源:ConsoleAdapter.cpp
示例20: ShowLeaderboard
bool SelectorHelper::ShowLeaderboard( const CEGUI::EventArgs &e ) {
CEGUI::WindowManager *wmgr = CEGUI::WindowManager::getSingletonPtr();
CEGUI::Window* leaderboardWindow, *leaderboardName, *leaderboardNextLevel, *leaderboardBackToMenu;
CEGUI::Window* leaderboardWindows[10];
leaderboardWindow = wmgr->getWindow("Leaderboard");
leaderboardName = wmgr->getWindow("Leaderboard/LevelName");
leaderboardNextLevel = wmgr->getWindow("Leaderboard/NextLevel");
leaderboardBackToMenu = wmgr->getWindow("Leaderboard/BackToMenu");
for (int i = 0; i < 10; i++) {
std::stringstream ss;
ss << "Leaderboard/" << i;
leaderboardWindows[i] = wmgr->getWindow(ss.str());
}
CEGUI::System::getSingleton().setGUISheet(leaderboardWindow);
leaderboardBackToMenu->removeEvent(CEGUI::PushButton::EventClicked);
leaderboardBackToMenu->subscribeEvent(CEGUI::PushButton::EventClicked,
&SelectorHelper::SwitchToLevelSelectMenu);
int levelViewerIndex =
*static_cast<const CEGUI::MouseEventArgs*>(&e)->window->getName().rbegin() - '1';
CEGUI::String name = levelViewers[levelViewerIndex]->window->getName();
leaderboardNextLevel->setVisible(false);
/*
leaderboardNextLevel->removeEvent(CEGUI::PushButton::EventClicked);
leaderboardNextLevel
->subscribeEvent(CEGUI::PushButton::EventClicked,
CEGUI::Event::Subscriber(&MenuActivity::awdawd, this));
*/
for (int i = 0; i < 10; i++)
leaderboardWindows[i]->setAlpha(0.0);
Leaderboard leaderboard = Leaderboard:
|
请发表评论