bool OnPlayerShopShowGoodsInfo(const CEGUI::EventArgs& e) { CEGUI::Window* wnd = WEArgs(e).window; if(!wnd) return false; CGoods* goods = static_cast<CGoods*>(wnd->getUserData()); if (!goods) return false; CEGUI::DefaultWindow* iconWnd = WDefaultWindow(GetWndMgr().getWindow("PlayerShop/backgrond/GoodsInfo/Icon")); CEGUI::Window* nameWnd = GetWndMgr().getWindow("PlayerShop/backgrond/GoodsInfo/Name"); CEGUI::Window* oneGroupNumWnd = GetWndMgr().getWindow("PlayerShop/backgrond/GoodsInfo/OneGroupNum"); CEGUI::Window* priceWnd = GetWndMgr().getWindow("PlayerShop/backgrond/GoodsInfo/Price"); CEGUI::Window* averagePriceWnd = GetWndMgr().getWindow("PlayerShop/backgrond/GoodsInfo/AveragePrice"); if (!iconWnd || !nameWnd || !oneGroupNumWnd || !priceWnd || !averagePriceWnd) return false; char tempText[256]; char strImageFilePath[128] = ""; char strImageFileName[128] = ""; PlayerShop::tagGoodsItem* pGoodsItem = GetPlayerShop().FindtagGoods(goods); if (pGoodsItem!=NULL) { // 物品名字 DWORD dwNameSize = (DWORD)strlen(pGoodsItem->strGoodsName.c_str()); if (dwNameSize>20) { _snprintf(tempText,21,"%s", pGoodsItem->strGoodsName.c_str()); sprintf((tempText+20),"..."); }else sprintf(tempText,"%s", pGoodsItem->strGoodsName.c_str()); nameWnd->setText(ToCEGUIString(tempText)); // 物品图片 const char *strIconPath = GetGame()->GetPicList()->GetPicFilePathName(CPicList::PT_GOODS_ICON, pGoodsItem->goodsIconId); GetFilePath(strIconPath,strImageFilePath); GetFileName(strIconPath,strImageFileName); CEGUI::String strImagesetName = "GoodIcon/"; strImagesetName += strImageFileName; SetBackGroundImage(iconWnd,strImagesetName.c_str(),strImageFilePath,strImageFileName); // 物品单组个数 sprintf(tempText,"%d",pGoodsItem->oneGroupNum); oneGroupNumWnd->setText(ToCEGUIString(tempText)); // 物品售价 sprintf(tempText,"%d", pGoodsItem->price); priceWnd->setText(ToCEGUIString(tempText)); // 物品单个均价 char strGoodsPrice[64] = "",strNumLen[64] = ""; sprintf(strNumLen,"%d",pGoodsItem->price/pGoodsItem->oneGroupNum); float fPrice = static_cast<float>(pGoodsItem->price)/static_cast<float>(pGoodsItem->oneGroupNum); sprintf(strGoodsPrice,"%*.2f",(int)strlen(strNumLen)+2,fPrice); averagePriceWnd->setText(ToCEGUIString(strGoodsPrice)); } return true; }
//更新委托求购界面提示 bool UpdateAgentBuyUIDate(const CEGUI::EventArgs& e) { CEGUI::WindowManager& mgr = GetWndMgr(); CEGUI::Window* wnd = NULL; //求购数量 CEGUI::Editbox* edb = WEditBox(mgr.getWindow("Auction/Tab/Agent/Buy/EditNum")); uint cnt = CEGUI::PropertyHelper::stringToInt(edb->getText()); //求购单价 edb = WEditBox(mgr.getWindow("Auction/Tab/Agent/Buy/EditPrice")); uint price = CEGUI::PropertyHelper::stringToInt(edb->getText()); if(cnt == 0 || price == 0)//如何一个为0,直接返回 { wnd = mgr.getWindow("Auction/Tab/Agent/Buy/subGold"); wnd->setText("");//手续费 wnd = mgr.getWindow("Auction/Tab/Agent/Buy/Text");//总共支付 wnd->setText(""); return false; } //设置委托购买位面总价提示 wnd = mgr.getWindow("Auction/Tab/Agent/Buy/subNum"); uint sumPrice = price * cnt; wnd->setText(CEGUI::PropertyHelper::intToString(sumPrice)); float extreCust = price * cnt * AGENT_EXTRACUST;//手续费 wnd = mgr.getWindow("Auction/Tab/Agent/Buy/subGold"); wnd->setText(CEGUI::PropertyHelper::intToString((int)extreCust)); wnd = mgr.getWindow("Auction/Tab/Agent/Buy/Text");//总共支付 wnd->setText(CEGUI::PropertyHelper::intToString((sumPrice + (int)extreCust))); return true; }
bool OpenSaleUI() { CEGUI::WindowManager& wndmgr = GetWndMgr(); //获取出售订单ID CEGUI::MultiColumnList* mcl = WMCL(wndmgr.getWindow("Auction/Tab/BuySale/BuyMCL")); if(!mcl) return false; CEGUI::ListboxItem* lbi = mcl->getFirstSelectedItem(); if(!lbi) { //MessageBox(g_hWnd,AppFrame::GetText("AU_100"),"ERROR",MB_OK); GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_100"),NULL,NULL,true); return false; } CEGUI::Window* wnd = wndmgr.getWindow("Auction/SaleWnd"); wnd->setVisible(true); wnd->setAlwaysOnTop(true); CEGUI::Editbox* editbox = WEditBox(wnd->getChildRecursive("Auction/SaleWnd/saleNum"));//出售界面编辑框激活 editbox->activate(); AHdata& ah = GetInst(AHdata); uint ID = lbi->getID(); ah.SetCanSaleID(ID); return true; }
//更新寄售UI提示 bool UpdateAgentSaleUIDate(const CEGUI::EventArgs& e) { CEGUI::WindowManager& mgr = GetWndMgr(); CEGUI::Window* wnd = NULL; CEGUI::Editbox* edb = WEditBox(mgr.getWindow("Auction/Tab/Agent/sale/EditNum"));//寄售数量 uint cnt = CEGUI::PropertyHelper::stringToInt(edb->getText()); edb = WEditBox(mgr.getWindow("Auction/Tab/Agent/sale/EditPrice"));//寄售单价 uint price = CEGUI::PropertyHelper::stringToInt(edb->getText()); if(cnt == 0 || price == 0)//任意一个为0,则直接返回,不更新UI { //设置支付手续费提示 wnd = mgr.getWindow("Auction/Tab/Agent/sale/subGold"); wnd->setText(""); return false; } //设置支付位面提示 wnd = mgr.getWindow("Auction/Tab/Agent/sale/subNum"); wnd->setText(CEGUI::PropertyHelper::intToString(cnt * ORDER_PER_NUM)); //设置支付手续费提示 wnd = mgr.getWindow("Auction/Tab/Agent/sale/subGold"); float extraCust = cnt * price * AGENT_EXTRACUST ; wnd->setText(CEGUI::PropertyHelper::intToString((int)extraCust)); return true; }
//更新左搜索(导购)菜单 bool OnSearchLeftMenuUpdate(const CEGUI::EventArgs& e) { CEGUI::Combobox* cbbox = WComboBox(WEArgs(e).window); cbbox->clearAllSelections(); cbbox->resetList(); cbbox->getEditbox()->setText(""); //由索引关联商城类型 SCGData::eSCType eCityType = GetShopCityTypeByTabContentSelIndex(); SCGData* dt = GetInst(ShopCityMsgMgr).GetShopCityGoodsData(); SCGData::MapGuideDataA& mapGuide = dt->GetGuideList(); //根据索引获取导购数据 SCGData::MapStrGGDTPA& mapGuideDTA = mapGuide[eCityType]; CEGUI::Combobox* cbboxRight = WComboBox(GetWndMgr().getWindow(SHOPCITY_SEARCH_RIGHTWND_NAME)); if(cbboxRight) { CEGUI::ListboxItem* lbi = cbboxRight->getSelectedItem(); size_t idx = 0; if(lbi) idx = cbboxRight->getItemIndex(lbi); SCGData::MapStrGGDTPA::iterator iter = mapGuideDTA.begin(); for(; iter != mapGuideDTA.end() ; ++iter) { //添加导购菜单 string menuStr = iter->first; //CEGUI::ListboxItem* lbi = new CEGUI::ListboxTextItem(menuStr.c_str()); CEGUI::ListboxItem* lbi = new CEGUI::ListboxTextItem(ToCEGUIString(menuStr.c_str())); lbi->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME); if(iter == mapGuideDTA.begin())//默认让第一个为选中 lbi->setSelected(true); cbbox->addItem(lbi); } } return true; }
bool UpdateSaleUIDate( const CEGUI::EventArgs& e ) { CEGUI::WindowManager& mgr = GetWndMgr(); CEGUI::Window* weimian = mgr.getWindow("Auction/SaleWnd/Text61"); weimian->setText(""); CEGUI::Window* gold = mgr.getWindow("Auction/SaleWnd/Text6"); gold->setText(""); //获取输入的出售数目 CEGUI::Editbox* edb = WEditBox(mgr.getWindow("Auction/SaleWnd/saleNum")); if(!edb) return false; uint saleNum = CEGUI::PropertyHelper::stringToInt(edb->getText()); if(saleNum==0) return false; //设置支付位面数 weimian->setText(edb->getText()); AHdata& ah = GetInst(AHdata); uint orderID = ah.GetCanSaleID();//获取要出售的订单ID uint price = ah.GetPriceByCanSaleID(orderID);//单价 //计算价格 uint subCust = saleNum * price; //设置需要支付金币 gold->setText(CEGUI::PropertyHelper::intToString(subCust)); return true; }
bool OnReturnExit(const CEGUI::EventArgs &args) { CGame::s_bExit = true; GetWndMgr().getWindow("GameExit")->setVisible(false); GetInst(UIManager).CloseAllPage(); PostQuitMessage(0); return true; }
bool OnAgentSaleSubmit(const CEGUI::EventArgs& e) { //得到委托出售数目和单价 AH::OrderRaw or; CEGUI::Editbox* edb = WEditBox(GetWndMgr().getWindow("Auction/Tab/Agent/sale/EditNum")); if(!edb) return false; or.id = -1;//-1标识 id不会用到 //单数 or.cnt = CEGUI::PropertyHelper::stringToInt(edb->getText()); if(or.cnt == 0) { GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_109"),NULL,NULL,true); return false; } edb = WEditBox(GetWndMgr().getWindow("Auction/Tab/Agent/sale/EditPrice")); if(!edb) return false; //单价 or.price = CEGUI::PropertyHelper::stringToInt(edb->getText()); if(or.price == 0) { GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_110"),NULL,NULL,true); return false; } //检查玩家身上位面是否满足数目 CPlayer* player = GetGame()->GetMainPlayer(); long cnt = player->GetGoodsAmount(CGlobeSetup::GetSetup()->strWeiMianName); if(cnt < or.cnt * 100 ) //玩家身上数量小于出售数量 { GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_111"),NULL,NULL,true); return false; } //检查玩家身上的金币是否满足委托收取的手续费 long money = player->GetMoney(); float custm = or.cnt * or.price * AGENT_EXTRACUST;//算上手续费 if ( custm > money ) { GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_112"),NULL,NULL,true); return false; } //提交委托出售订单 AHdata& ah = GetInst(AHdata); ah.Send_AH_ADD_AGENT(or,AH::OT_SELL); return true; }
bool OnAgentBuySubmit(const CEGUI::EventArgs& e) { //得到委托购买数目和单价 AH::OrderRaw or; CEGUI::Editbox* edb = WEditBox(GetWndMgr().getWindow("Auction/Tab/Agent/Buy/EditNum")); if(!edb) return false; or.id = -1 ;// -1标识ID不会用到 //数目 or.cnt = CEGUI::PropertyHelper::stringToInt(edb->getText());//单位为:百个 if(or.cnt == 0) { GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_106"),NULL,NULL,true); return false; } edb = WEditBox(GetWndMgr().getWindow("Auction/Tab/Agent/Buy/EditPrice")); if(!edb) return false; //单价 or.price = CEGUI::PropertyHelper::stringToInt(edb->getText());// 金币/100位面 if(or.price == 0) { GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_107"),NULL,NULL,true); } //检查玩家身上金币是否满足购买条件 CPlayer* player = GetGame()->GetMainPlayer(); long money = player->GetMoney(); float custm = or.price * or.cnt * AGENT_EXTRACUST ;//算上手续费 if( custm > money) { GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_108"),NULL,NULL,true); return false; } //提交委托购买订单 AHdata& ah = GetInst(AHdata); ah.Send_AH_ADD_AGENT(or,AH::OT_BUY); return true; }
////提交购买请求 bool OnBuySubmit(const CEGUI::EventArgs& e) { CEGUI::WindowManager& wndmgr = GetWndMgr(); CEGUI::Editbox* edb = WEditBox(wndmgr.getWindow("Auction/Buy/buyNum")); AHdata& ah = GetInst(AHdata); //获取购买数量 uint buyNum = CEGUI::PropertyHelper::stringToInt(edb->getText()); uint canbuyNum = ah.GetCountByCanBuyID(ah.GetCanBuyID()); if(buyNum== 0 || buyNum > canbuyNum) { GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_103"),NULL,NULL,true); return false; } ah.Send_AH_BUY(buyNum);//发送购买请求前要设置购买的订单ID return true; }
//提交出售请求 bool OnSaleSubmit(const CEGUI::EventArgs& e) { CEGUI::WindowManager& wndmgr = GetWndMgr(); CEGUI::Editbox* edb = WEditBox(wndmgr.getWindow("Auction/SaleWnd/saleNum")); AHdata& ah = GetInst(AHdata); //获取出售数量 uint saleNum = CEGUI::PropertyHelper::stringToInt(edb->getText()); uint cansaleNum = ah.GetCountByCanSaleID(ah.GetCanSaleID()); if(saleNum == 0 || saleNum > cansaleNum ) { GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_101"),NULL,NULL,true); return false; } ah.Send_AH_SEL(cansaleNum);//发送出售请求前要设置出售的订单ID return true; }
void ResetHairColorDateOnHairChanged() { CEGUI::WindowManager& mgr = GetWndMgr(); CEGUI::Combobox* hairColor = WComboBox(mgr.getWindow(CREATEROLE_SEL_HAIRCOLOR_CCB)); if(hairColor) { hairColor->resetList(); //清空发色类型文本 hairColor->getEditbox()->setText(""); for(short i = 0 ; i < CREvent::GetHairColorNum(CREvent::GetSelectSex(),(WORD)CREvent::GetHair()) ; ++i) { CEGUI::ListboxTextItem* lti = new CEGUI::ListboxTextItem(CEGUI::PropertyHelper::intToString(i)); lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME); lti->setID(i);//ID和HairColorIndex关联 hairColor->addItem(lti); } } }
//撤销委托订单事件 bool OnCancelAgentOrder(const CEGUI::EventArgs& e) { CEGUI::WindowManager& mgr = GetWndMgr(); CEGUI::MultiColumnList* mcl = WMCL(mgr.getWindow("Auction/Tab/Query/MCL")); //获得选中Item对应的订单ID CEGUI::ListboxItem* li = mcl->getFirstSelectedItem(); if(!li) { /***********************************************************************/ /* zhaohang fix 2010-9-3 /* 修改消息框形式,采用封装的MsgEventManager,以及新的字符资源加载方式Appframe /***********************************************************************/ GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_113"),NULL,NULL,true); return false; } uint orderID = li->getID(); AHdata& ah = GetInst(AHdata); ah.Send_AH_REMOVE_AGENT(orderID); return true; }
bool OpenBuyUI() { CEGUI::WindowManager& wndmgr = GetWndMgr(); CEGUI::MultiColumnList* mcl = WMCL(wndmgr.getWindow("Auction/Tab/BuySale/SaleMCL")); if(!mcl) return false; CEGUI::ListboxItem* lbi = mcl->getFirstSelectedItem(); if(!lbi) { GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_102"),NULL,NULL,true); return false; } CEGUI::Window* wnd = wndmgr.getWindow("Auction/BuyWnd"); wnd->setVisible(true); wnd->setAlwaysOnTop(true); CEGUI::Editbox* editbox = WEditBox(wnd->getChildRecursive("Auction/Buy/buyNum"));//购买界面编辑框激活 editbox->activate(); AHdata& ah = GetInst(AHdata); //界面获取购买订单ID uint ID = lbi->getID(); ah.SetCanBuyID(ID);//保存要购买的订单ID return true; }
void ResetDataBySexSelChanged() { CEGUI::WindowManager& mgr = GetWndMgr(); CEGUI::Combobox* SelFac = WComboBox(mgr.getWindow(CREATEROLE_SEL_FAC_CCB)); uint SelSex = (uint)CREvent::GetSelectSex(); if(SelFac) { SelFac->resetList(); //更改性别后,修改默认Face和HairStyle时,对应修改文本显示 SelFac->getEditbox()->setText(CEGUI::PropertyHelper::intToString(0)); for(short i = 0 ; i < CREvent::GetFaceNum(SelSex) ; ++i) { CEGUI::ListboxTextItem* lti = new CEGUI::ListboxTextItem(CEGUI::PropertyHelper::intToString(i)); lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME); lti->setID(i);//ID和FacIndex关联 if(0==i) //更改性别后,修改默认Face和HairStyle时,对应修改ItemList选中状态 lti->setSelected(true); SelFac->addItem(lti); } } CEGUI::Combobox* SelHair = WComboBox(mgr.getWindow(CREATEROLE_SEL_HAIR_CCB)); if(SelHair) { SelHair->resetList(); //更改性别后,修改默认Face和HairStyle时,对应修改文本显示 SelHair->getEditbox()->setText(CEGUI::PropertyHelper::intToString(0)); for(short i = 0 ; i < CREvent::GetHairNum(SelSex) ; ++i) { CEGUI::ListboxTextItem* lti = new CEGUI::ListboxTextItem(CEGUI::PropertyHelper::intToString(i)); lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME); lti->setID(i);// ID和HairIndex关联 if(0 == i)//更改性别后,修改默认Face和HairStyle时,对应修改ItemList选中状态 lti->setSelected(true); SelHair->addItem(lti); } } }
bool OnPlayerShopSubBuyNum(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); int num = atoi(buyNumWnd->getText().c_str()); if (num<=0) { sprintf(str,"%d",0); wnd->disable(); } else sprintf(str,"%d",num--); buyNumWnd->setText(ToCEGUIString(str)); pGoodsItem->readyTradeNum = num; } } return true; }
// 添加货物列表 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); } wnd->setText(ToCEGUIString(tempText)); } // 物品名 sprintf(tempText, "PlayerShop/backgrond/Goods%d/Name", index+1); wnd = GetWndMgr().getWindow(tempText); if (wnd) { char strGoodsName[32] = ""; DWORD dwNameSize = (DWORD)strlen(tgGoodsItem.strGoodsName.c_str()); if (tgGoodsItem.tradeType==PlayerShop::TT_SINGLE&&dwNameSize>18) { _snprintf(strGoodsName,19,"%s",tgGoodsItem.strGoodsName.c_str()); sprintf((strGoodsName+18),"..."); }else if (tgGoodsItem.tradeType==PlayerShop::TT_GROUP&&dwNameSize>10) { _snprintf(strGoodsName,11,"%s",tgGoodsItem.strGoodsName.c_str()); sprintf((strGoodsName+10),"..."); } else sprintf(strGoodsName,"%s",tgGoodsItem.strGoodsName.c_str()); wnd->setText(ToCEGUIString(strGoodsName)); wnd->setTooltipText(tgGoodsItem.strGoodsName); } // 交易方式 sprintf(tempText, "PlayerShop/backgrond/Goods%d/TradeType", index+1); wnd = GetWndMgr().getWindow(tempText); if (wnd) { if (tgGoodsItem.tradeType==PlayerShop::TT_SINGLE) { wnd->setText(ToCEGUIString("单个贩卖")); //CEGUI::FreeTypeFont * font = static_cast<CEGUI::FreeTypeFont*>( wnd->getFont() ); //font->setPointSize(8); } else if (tgGoodsItem.tradeType==PlayerShop::TT_GROUP) { wnd->setText(ToCEGUIString("成组贩卖")); } } // 价格 sprintf(tempText, "PlayerShop/backgrond/Goods%d/Price", index+1); wnd = GetWndMgr().getWindow(tempText); if (wnd) { sprintf(tempText,"%d",tgGoodsItem.price); wnd->setText(tempText); } }