bool UpdateCanSaleMCLDate(const CEGUI::EventArgs& e) { AHdata& ah = GetInst(AHdata); AHdata::vecOrderRaw listOR = ah.m_CanSaleOrder;//可出售列表 CEGUI::MultiColumnList* mcl = WMCL(WEArgs(e).window); if(!mcl) return false; mcl->resetList(); AHdata::vecOrderRaw::iterator it = listOR.begin(); for (uint i = 0 ; i < listOR.size() ; ++i,++it) { mcl->addRow(); CEGUI::ListboxTextItem* lti = new CEGUI::ListboxTextItem(ToCEGUIString(AppFrame::GetText("AU_104")),it->id);//第二个参数与订单ID关联 lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME); mcl->setItem(lti,0,i); lti = new CEGUI::ListboxTextItem(CEGUI::PropertyHelper::intToString(it->price)); lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME); mcl->setItem(lti,1,i); lti = new CEGUI::ListboxTextItem(CEGUI::PropertyHelper::intToString(it->cnt)); lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME); mcl->setItem(lti,2,i); } return true; }
bool OnPlayerShopPageOpen(const CEGUI::EventArgs& e) { CEGUI::Window* wnd = WEArgs(e).window; if(!wnd) return false; PlayerShop& playerShop = GetPlayerShop(); // 打开个人商店前关闭其他界面(卡片镶嵌、制作、TalkBox、NPC商店、交易、仓库、装备、魔化等) // 打开背包 playerShop.SetIsOpenShop(true); // 打开留言板界面 FireUIEvent("PlayerShopMessageBoard", "Opened"); // 更新操作界面按钮状态 FireUIEvent("PlayerShop", "UpdateOperBtn"); // 更新货币统计信息 FireUIEvent("PlayerShop", "UpdateMoneyInfo"); playerShop.UpdataPlayerShopGoodsList(); return true; }
bool OnShopCityContentSelChanged(const CEGUI::EventArgs& e) { CEGUI::TabControl* tbs = WTabControl(WEArgs(e).window); if(tbs) { CEGUI::Window* tbcontent = tbs->getTabContentsAtIndex(tbs->getSelectedTabIndex()); if(tbcontent) { tbcontent->addChildWindow(GetWindow(SHOPCITY_CHILD_PAGE_NAME));//把唯一ShopCityChild加到当前选中tbcontent上 //更新ItemSet的显示 FireUIEvent(SHOPCITY_ITEMSET_PAGE_NAME,SHOPCITY_ITEMSET_EVENT_UPDATE); //更新最近购买 FireUIEvent(SHOPCITY_LATESTBUY_NAME,SHOPCITY_PAGE_EVENT_UPDATE_LATESTBUY); //更新推荐 FireUIEvent(SHOPCITY_TWITTER_NAME,SHOPCITY_TWITTER_EVENT_NAME); //更新左搜索(导购)菜单 FireUIEvent(SHOPCITY_SEARCH_LEFTWND_NAME,SHOPCITY_SEARCHLEFT_EVENT_MENUUPDATE_NAME); //更新右搜索(筛选)菜单 FireUIEvent(SHOPCITY_SEARCH_RIGHTWND_NAME,SHOPCITY_SEARCHRIGHT_EVENT_MENUUPDATE_NAME); //设置更新源类型 ShopCityMsgMgr& msgMgr = GetInst(ShopCityMsgMgr); msgMgr.SetStateUpdateUIByType(0);//由选中的商城商店类型来更新 } } return true; }
//新品推荐 bool OnUpdateTwitter(const CEGUI::EventArgs& e) { CEGUI::Window* twitter = WEArgs(e).window; CEGUI::Listbox* lb = WListBox(twitter->getChildRecursive(SHOPCITY_TWITTER_CHILDLISTBOX_NAME)); #ifdef _DEBUG OutputDebugStr(lb->getName().c_str()); OutputDebugStr("\n"); OutputDebugStr(twitter->getChildAtIdx(0)->getName().c_str()); OutputDebugStr("n"); #endif //清空 lb->resetList(); //由索引关联商城类型 SCGData::eSCType eCityType = GetShopCityTypeByTabContentSelIndex(); SCGData* dt = GetInst(ShopCityMsgMgr).GetShopCityGoodsData(); //新品推荐显示 SCGData::MapNewestA& resdta = dt->GetNewestVec(); SCGData::VecGDPTA& vecDTA = resdta[eCityType]; for(uint i = 0 ; i < vecDTA.size() ; ++i) { CGoodsList::tagGoods2* ptg2 = CGoodsList::GetProperty(vecDTA[i].index); if(ptg2) { string str = ptg2->BaseProperty.strName.c_str(); //CEGUI::ListboxTextItem* lti = new CEGUI::ListboxTextItem(str.c_str(),vecDTA[i].index);//索引关联Item ID CEGUI::ListboxTextItem* lti = new CEGUI::ListboxTextItem(ToCEGUIString(str.c_str()),vecDTA[i].index);//索引关联Item ID lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME); lb->addItem(lti); } } return true; }
bool OnPlayerShopBuyNumChange(const CEGUI::EventArgs& e) { CEGUI::Window* wnd = WEArgs(e).window; if(!wnd) return false; CEGUI::String buyNum = wnd->getText(); char str[32] = ""; 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) { ulong num = atoi(buyNum.c_str()); if (num>=pGoodsItem->groupNum) { sprintf(str,"%d",pGoodsItem->groupNum); } else if (num<=0) { sprintf(str,"%d",0); } sprintf(str,"%d",num); wnd->setText(ToCEGUIString(str)); pGoodsItem->readyTradeNum = num; } } return true; }
//更新右搜索(筛选)菜单 bool OnSearchRightMenuUpdate(const CEGUI::EventArgs& e) { CEGUI::Combobox* cbbox = WComboBox(WEArgs(e).window); cbbox->clearAllSelections(); cbbox->resetList(); cbbox->getEditbox()->setText(""); //由索引关联商城类型 SCGData::eSCType eShopCityType = GetShopCityTypeByTabContentSelIndex(); //由索引关联商店类型,tabControl的索引0单独对应热销商品 SCGData::eSType shoptype = GetShopTypeByTabContentSelIndex(); if(shoptype == SCGData::TABTYPE_HOT)//热销没有筛选项 return true; //根据商城和商店类型获取筛选数据 SCGData* dt = GetInst(ShopCityMsgMgr).GetShopCityGoodsData(); SCGData::MapFLDTA& mapSel = dt->GetFilterList(); SCGData::MapUFLDTPA& mapUSel = mapSel[eShopCityType]; SCGData::MapStrFilDTPA& mapStrSel = mapUSel[shoptype]; SCGData::MapStrFilDTPA::iterator iter = mapStrSel.begin(); for( ; iter != mapStrSel.end() ; ++iter) { //初始化筛选菜单 string str = (*iter).first; //CEGUI::ListboxItem* lbi = new CEGUI::ListboxTextItem(str.c_str()); CEGUI::ListboxItem* lbi = new CEGUI::ListboxTextItem(ToCEGUIString(str.c_str())); lbi->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME); if(iter == mapStrSel.begin() )//默认让第一个为选中项 lbi->setSelected(true); cbbox->addItem(lbi); } 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 OnPlayerShopResetGoods(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; CPlayer *pPlayer = GetGame()->GetMainPlayer(); CMainPlayerHand* pHand = GetGame()->GetMainPlayerHand(); if (!pPlayer || !pHand) return false; int shopState = GetPlayerShop().GetCurShopState(); if (shopState==PlayerShop::SET_SHOP) { GetPlayerShop().ReMoveShopGoods(goods->GetIndex(),goods->GetExID()); wnd->setUserData(NULL); int index = GetPlayerShop().GetCurGoodsNum(); GetPlayerShop().OnOrderPageOpen(goods, index); FireUIEvent("PlayerShop","ClearGoodsInfo"); FireUIEvent("PlayerShop","UpdateMoneyInfo"); return true; } return false; }
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 OnPlayerShopPageClose(const CEGUI::EventArgs& e) { CEGUI::Window* wnd = WEArgs(e).window; if(!wnd) return false; GetPlayerShop().OnCloseShop(); return true; }
bool OnStrengthenPetAffirm(const CEGUI::EventArgs& e) { CEGUI::PushButton* pAffirmBtn = WPushButton(WEArgs(e).window); if (!pAffirmBtn) return false; return true; }
bool OnHairColorChanged(const CEGUI::EventArgs& e) { CEGUI::Combobox* cbb = WComboBox(WEArgs(e).window); CEGUI::ListboxItem* lti = cbb->getSelectedItem(); if(lti) CREvent::SetHairColor(lti->getID()); else CREvent::SetHairColor(0); return true; }
bool OnCountryChanged(const CEGUI::EventArgs& e) { CEGUI::Combobox* cbb = WComboBox(WEArgs(e).window); CEGUI::ListboxItem* lti = cbb->getSelectedItem(); if(lti) CREvent::SetSelectCountry(lti->getID()); else CREvent::SetSelectCountry(1);//range由Data/CountryList.xml 配置决定,这里根据配置设置默认国家ID为1 return true; }
bool OnPlayerShopUpdateMoneyInfo(const CEGUI::EventArgs& e) { // 目前个人商店只支持金币一种货币类型@todo CEGUI::Window* wnd = WEArgs(e).window; if(!wnd) return false; CPlayer* pPlayer = GetGame()->GetMainPlayer(); if (!pPlayer) return false; CEGUI::Window* tradeGoldsWnd = wnd->getChildRecursive("PlayerShop/backgrond/SumUp/TradeGolds"); CEGUI::Window* haveGoldsWnd = wnd->getChildRecursive("PlayerShop/backgrond/SumUp/HaveGolds"); if (!tradeGoldsWnd || !haveGoldsWnd) return false; int curShopState = GetPlayerShop().GetCurShopState(); ulonglong tradeGolds = GetPlayerShop().GetTradeGold(); char str[256]; if(curShopState==PlayerShop::SET_SHOP || curShopState==PlayerShop::OPEN_SHOP) { // 获得金币 if (tradeGolds>=2000000000) { wsprintf(str,"+ %d",2000000000); }else wsprintf(str,"+ %d",tradeGolds); tradeGoldsWnd->setText(ToCEGUIString(str)); // 持有金币 if (pPlayer->GetMoney()>=2000000000) { wsprintf(str,"%d",2000000000); }else wsprintf(str,"%d",pPlayer->GetMoney()); haveGoldsWnd->setText(ToCEGUIString(str)); } else if(curShopState==PlayerShop::SHOPPING_SHOP) { // 花费金币 if (tradeGolds>=2000000000) { wsprintf(str,"- %d",2000000000); }else wsprintf(str,"- %d",tradeGolds); tradeGoldsWnd->setText(ToCEGUIString(str)); // 持有金币 if (pPlayer->GetMoney()>=2000000000) { wsprintf(str,"%d",2000000000); }else wsprintf(str,"%d",pPlayer->GetMoney()); haveGoldsWnd->setText(ToCEGUIString(str)); } return true; }
bool UpdatePickUPUIDate(const CEGUI::EventArgs& e) { CEGUI::Window* pageWnd = WEArgs(e).window; CEGUI::Editbox* edb = WEditBox(pageWnd->getChildRecursive("Auction/Pickup/EditGold")); AHdata& ah = GetInst(AHdata); edb->setText(CEGUI::PropertyHelper::intToString(ah.GetNumGoldCanPickUp())); edb = WEditBox(pageWnd->getChildRecursive("Auction/Pickup/EditWeimian")); edb->setText(CEGUI::PropertyHelper::intToString(ah.GetNumWeimianCanPickUp())); return true; }
//双击推荐列表,打开购买页面 bool OnShopCityTwitterMouseDoubleClicked(const CEGUI::EventArgs& e) { CEGUI::Listbox* twitterList = WListBox(WEArgs(e).window); CEGUI::ListboxItem* lbi = twitterList->getFirstSelectedItem(); if(lbi) { uint index = lbi->getID();//获取索引,索引关联物品索引 CEGUI::Window* buyPage = GetWindow(SHOPCITY_BUY_PAGE_NAME); buyPage->setID(index);//购买界面ID与物品索引关联 //打开购买界面 FireUIEvent(SHOPCITY_BUY_PAGE_NAME,EVENT_OPEN); } return true; }
bool OnBeginStopPlayerShop(const CEGUI::EventArgs& e) { CEGUI::Window* wnd = WEArgs(e).window; if(!wnd) return false; CPlayer* pPlayer = GetGame()->GetMainPlayer(); if (!pPlayer) return false; int curShopState = GetPlayerShop().GetCurShopState(); // 开始摆摊 if (curShopState==PlayerShop::SET_SHOP) { /// 判断玩家周围5*5的范围内是否有别的玩家已经在开店了,如果有则不容许开店 if (pPlayer->CheckIsAnyBodyShopOpenedOnRange(2)) { GetChatListPage().AddChatWords(AppFrame::GetText("Shop_16") //已经有玩家在您周围开店,请您重新选择开店地址 , 0xffffffff, 0, 0xff000000,"", eNOTIFYPOS_CENTER); FireUIEvent("PlayerShop", "Closed"); return false; } // 发送摆摊消息 //GetGame()->GetAudioList()->Play2DSound("SOUNDS\\interfaces\\i-03.wav"); if (!pPlayer->IsRecruitingTeam()) { GetPlayerShop().SetbSetTrue(true); GetPlayerShop().SendOpenShopMes(); }else GetChatListPage().AddChatWords(AppFrame::GetText("Shop_12") //招募状态下不能开店 , 0xffffffff, 0, 0xff000000,"", eNOTIFYPOS_CENTER); } // 取消摆摊 else if (curShopState==PlayerShop::OPEN_SHOP) { GetPlayerShop().SendCloseShopMes(); } // 购买 else if (curShopState==PlayerShop::SHOPPING_SHOP) { // 发送交易消息 GetPlayerShop().SendBuyGoodsMes(); //GetGame()->GetAudioList()->Play2DSound("SOUNDS\\interfaces\\i-03.wav"); } return true; }
bool OnClearMoneyEdboxes(const CEGUI::EventArgs& e) { CEGUI::Window* pageWnd = WEArgs(e).window; //星钻 CEGUI::Window* temp = pageWnd->getChildRecursive(SHOPCITY_XINGZUAN_EDBOX_NAME); if(temp) temp->setText(""); //点券 temp = pageWnd->getChildRecursive(SHOPCITY_DIANJUAN_EDBOX_NAME); if(temp) temp->setText(""); //位面 temp = pageWnd->getChildRecursive(SHOPCITY_WEIMIAN_EDBOX_NAME); if(temp) temp->setText(""); return true; }
bool UpdatePerMCLDate(const CEGUI::EventArgs& e) { AHdata& ah = GetInst(AHdata); //AHdata::listSubOrderRaw listSubOR = ah.m_AgentOrder; AHdata::MapSubOrderRaw mapSubOR = ah.m_AgentOrder; CEGUI::MultiColumnList* mcl = WMCL(WEArgs(e).window); if(!mcl) return false; mcl->resetList(); AHdata::MapSubOrderRaw::iterator it = mapSubOR.begin(); for (int i = 0 ; it != mapSubOR.end(); ++it,++i) { mcl->addRow(); CEGUI::ListboxTextItem* lti = NULL; lti = new CEGUI::ListboxTextItem(CEGUI::PropertyHelper::intToString(it->first),it->first);//控件ID与订单ID关联 lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME); mcl->setItem(lti,0,i); AH::SubOrderRaw& mapOr = it->second; if(mapOr.type == AH::OT_BUY) lti = new CEGUI::ListboxTextItem(ToCEGUIString(AppFrame::GetText("AU_104"))); else if(mapOr.type == AH::OT_SELL) lti = new CEGUI::ListboxTextItem(ToCEGUIString(AppFrame::GetText("AU_105"))); lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME); mcl->setItem(lti,1,i); lti = new CEGUI::ListboxTextItem(CEGUI::PropertyHelper::intToString(mapOr.cnt)); lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME); mcl->setItem(lti,2,i); lti = new CEGUI::ListboxTextItem(CEGUI::PropertyHelper::intToString(mapOr.price)); lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME); mcl->setItem(lti,3,i); ///////////////////////////////////////////////// // zhaohang 2010/5/12 // 时间UI未处理 ///////////////////////////////////////////////// uint subtime = mapOr.gentime / 60 / 60; lti = new CEGUI::ListboxTextItem(CEGUI::PropertyHelper::intToString(subtime)); lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME); mcl->setItem(lti,4,i); } return false; }
//更新三个付费券的UI数据 bool OnShopCityUpdateMoneyEdboxes(const CEGUI::EventArgs& e) { ShopCityMsgMgr& mgr = GetInst(ShopCityMsgMgr); CEGUI::Window* pgWnd = WEArgs(e).window; CEGUI::Window* temp = pgWnd->getChildRecursive(SHOPCITY_XINGZUAN_EDBOX_NAME); if(temp) { temp->setText(CEGUI::PropertyHelper::intToString(mgr.GetPlayerXinZuan())); } temp = pgWnd->getChildRecursive(SHOPCITY_WEIMIAN_EDBOX_NAME); if(temp) temp->setText(CEGUI::PropertyHelper::intToString(mgr.GetPlayerWeiMian())); temp = pgWnd->getChildRecursive(SHOPCITY_DIANJUAN_EDBOX_NAME); if(temp) temp->setText(CEGUI::PropertyHelper::intToString(mgr.GetPlayerDianQuan())); return true; }
bool OnUpdateLatestBuy(const CEGUI::EventArgs& e) { CEGUI::Window* wnd = WEArgs(e).window; //先把图片清掉 ,默认为十个条目 char name[256] = ""; for(uint i = 0 ; i < 10 ; ++i) { sprintf(name,SHOPCITY_LATESTBUY_ITME_NAME_D,i); CEGUI::Window* temp = wnd->getChild(name); if(temp) { temp->setProperty("Image",""); OutputDebugStr(temp->getName().c_str()); OutputDebugStr("\n"); } } //由索引关联商城类型 SCGData::eSCType eCityType = GetShopCityTypeByTabContentSelIndex(); SCGData* dt = GetInst(ShopCityMsgMgr).GetShopCityGoodsData(); SCGData::MapSBT10& personal = dt->GetSelfBuyTop10(); SCGData::VecGDPTA perDTA = personal[eCityType]; size_t count = perDTA.size(); for(size_t i = 0 ; i < count ; ++i) { char name[256] = ""; sprintf(name,SHOPCITY_LATESTBUY_ITME_NAME_D,i); CEGUI::Window* temp = wnd->getChild(name); if(temp) { CGoodsList::tagGoods2* tg2 = CGoodsList::GetProperty(perDTA[i].index); if(tg2) { char imagesetname[256]; sprintf(imagesetname,GOODS_PREFIXID,tg2->BaseProperty.dwIconId); CEGUI::String imagename = CEGUI::PropertyHelper::intToString(tg2->BaseProperty.dwIconId)+".jpg"; SetBackGroundImage(WGUISheet(temp),imagesetname,GOODS_ICON_PATH,imagename.c_str()); } } } return true; }
bool OnSexChanged(const CEGUI::EventArgs& e) { CEGUI::Combobox* cbb = WComboBox(WEArgs(e).window); CEGUI::ListboxItem* lti = cbb->getSelectedItem(); if(lti) { CREvent::SetSelectSex(lti->getID()); //更改性别后,修改默认Face和HairStyle,使得模型能够正常显示 CREvent::SetFace(0); CREvent::SetHairStyle(0); } else { CREvent::SetSelectSex(0); //更改性别后,修改默认Face和HairStyle,使得模型能够正常显示 CREvent::SetFace(0); CREvent::SetHairStyle(0); } ResetDataBySexSelChanged(); return true; }
// 清空商品详情中的显示 bool OnPlayerShopClearGoodsInfo(const CEGUI::EventArgs& e) { CEGUI::Window* wnd = WEArgs(e).window; if(!wnd) return false; CEGUI::Window* iconWnd = wnd->getChildRecursive("PlayerShop/backgrond/GoodsInfo/Icon"); CEGUI::Window* nameWnd = wnd->getChildRecursive("PlayerShop/backgrond/GoodsInfo/Name"); CEGUI::Window* oneGroupNumWnd = wnd->getChildRecursive("PlayerShop/backgrond/GoodsInfo/OneGroupNum"); CEGUI::Window* priceWnd = wnd->getChildRecursive("PlayerShop/backgrond/GoodsInfo/Price"); CEGUI::Window* averagePriceWnd = wnd->getChildRecursive("PlayerShop/backgrond/GoodsInfo/AveragePrice"); if (!iconWnd || !nameWnd || !oneGroupNumWnd || !priceWnd || !averagePriceWnd) return false; iconWnd->setProperty("Image",""); nameWnd->setText(""); oneGroupNumWnd->setText(""); priceWnd->setText(""); averagePriceWnd->setText(""); return true; }
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; }
bool OnHideShowPlayerShop(const CEGUI::EventArgs& e) { CEGUI::Window* wnd = WEArgs(e).window; if(!wnd) return false; int curShopState = GetPlayerShop().GetCurShopState(); if (curShopState==PlayerShop::SET_SHOP) { } else if (curShopState==PlayerShop::SHOPPING_SHOP) { // 确定要交易的物品 if (!GetPlayerShop().GetbSetTrue()) { if(!GetPlayerShop().IsTradeItemReady()) return false; GetPlayerShop().CalcTradeGolds(); FireUIEvent("PlayerShop", "UpdateMoneyInfo"); GetPlayerShop().SetbSetTrue(true); FireUIEvent("PlayerShop", "UpdateOperBtn"); //GetGame()->GetAudioList()->Play2DSound("SOUNDS\\interfaces\\i-03.wav"); } // 取消要交易的物品 else if (GetPlayerShop().GetbSetTrue()) { GetPlayerShop().CancelAllTrade(); FireUIEvent("PlayerShop", "UpdateMoneyInfo"); GetPlayerShop().SetbSetTrue(false); FireUIEvent("PlayerShop", "UpdateOperBtn"); //GetGame()->GetAudioList()->Play2DSound("SOUNDS\\interfaces\\i-03.wav"); } } return true; }
// 更新界面操作按钮状态 bool OnPlayerShopOperBtnUpdate(const CEGUI::EventArgs& e) { CEGUI::Window* mainPage = WEArgs(e).window; if(!mainPage) return false; CEGUI::Window* messageBoardBtn = mainPage->getChildRecursive("PlayerShop/backgrond/Messageboard"); CEGUI::Window* HideShowBtn = mainPage->getChildRecursive("PlayerShop/backgrond/HideShowBtn"); CEGUI::Window* beginStopBtn = mainPage->getChildRecursive("PlayerShop/backgrond/BeginStopBtn"); CEGUI::Window* closeBtn = mainPage->getChildRecursive("PlayerShop/backgrond/CloseBtn"); if (!messageBoardBtn || !HideShowBtn || !beginStopBtn || !closeBtn) return false; PlayerShop& playerShop = GetPlayerShop(); int shopState = playerShop.GetCurShopState(); bool shopSetSure = playerShop.GetbSetTrue(); if(shopState < 0 || shopState >= PlayerShop::SHOP_STATE) return false; vector<PlayerShop::tagGoodsItem>& myShopGoods = playerShop.GetMyShopGoods(); // 设置商店 if(shopState == PlayerShop::SET_SHOP) { if (!myShopGoods.empty()) { // 如果商店中有物品就把开始摆摊显示出来 beginStopBtn->setVisible(true); beginStopBtn->enable(); beginStopBtn->setText(ToCEGUIString(AppFrame::GetText("开始贩卖"))); }else { // 如果商店中有物品就让开始摆摊不显示出来 beginStopBtn->setVisible(false); } HideShowBtn->setVisible(false); } // 打开商店 else if(shopState == PlayerShop::OPEN_SHOP) { // 停止摆摊 & 隐藏商店显示出来 beginStopBtn->setVisible(true); beginStopBtn->enable(); beginStopBtn->setText(ToCEGUIString(AppFrame::GetText("停止贩卖"))); HideShowBtn->setVisible(true); HideShowBtn->enable(); HideShowBtn->setText(ToCEGUIString(AppFrame::GetText("隐藏商店"))); } // 购买状态 else if(shopState == PlayerShop::SHOPPING_SHOP) { if (shopSetSure) { // 重设 & 购买显示出来 beginStopBtn->setVisible(true); beginStopBtn->enable(); beginStopBtn->setText(ToCEGUIString(AppFrame::GetText("购买"))); HideShowBtn->setVisible(true); HideShowBtn->enable(); HideShowBtn->setText(ToCEGUIString(AppFrame::GetText("重设"))); } else { // 确定 & 购买显示出来 beginStopBtn->setVisible(true); beginStopBtn->disable(); beginStopBtn->setText(ToCEGUIString(AppFrame::GetText("购买"))); HideShowBtn->setVisible(true); HideShowBtn->enable(); HideShowBtn->setText(ToCEGUIString(AppFrame::GetText("确定"))); } } return true; }
bool OnPlayerShopOrderGoods(const CEGUI::EventArgs& e) { CEGUI::Window* wnd = WEArgs(e).window; if(!wnd) return false; CPlayer* pPlayer = GetGame()->GetMainPlayer(); CMainPlayerHand* pHand = GetGame()->GetMainPlayerHand(); if (!pPlayer || !pHand) return false; PlayerShop& playShop = GetPlayerShop(); ChatListPage& chatListPage = GetChatListPage(); int curShopState = playShop.GetCurShopState(); int index = -1; FireUIEvent("PlayerShop", "ClearGoodsInfo"); CGoods* pHandGoods = pHand->GetPGoodsOfMainPlayerHand(); CPlayer::tagGoods* psTagGoods = pHand->GetTGoodsOfMainPlayerHand(); // 如果手上有物品 if (pHandGoods!=NULL && curShopState==PlayerShop::SET_SHOP && !playShop.GetbSetTrue()) { if (pHand->GetTGoodsOfMainPlayerHand()->lType > DEPOT_CONTAINER_TYPE_BEGIN_VALUE && pHand->GetTGoodsOfMainPlayerHand()->lType < DEPOT_CONTAINER_TYPE_END_VALUE ) { chatListPage.AddChatWords(AppFrame::GetText("Shop_13") //仓库中的物品不能直接出售! ,0xffffffff, 0, 0xff000000,"", eNOTIFYPOS_CENTER); return false; } if (pHand->GetTGoodsOfMainPlayerHand()->lType==PEI_EQUIPMENT) { chatListPage.AddChatWords(AppFrame::GetText("Package_6") //您得到了物品:%s , 0xffffffff, 0, 0xff000000,"", eNOTIFYPOS_CENTER); return false; } if (pHand->GetTGoodsOfMainPlayerHand()->lType==PEI_SUBPACK) { chatListPage.AddChatWords(AppFrame::GetText("Package_16") //正在使用的子背包不能出售! , 0xffffffff, 0, 0xff000000,"", eNOTIFYPOS_CENTER); return false; } //如果是勋章,不能放入 if(pHandGoods->GetProperty()->dwType == GBT_MEDAL) return false; long lFreezeVal = pHandGoods->GetEffectVal(GAP_FREEZE,1); long lBindVal = pHandGoods->GetEffectVal(GAP_BIND,1); //冻结的物品不能放入个人商店进行交易 if (lFreezeVal!=eFT_UnFrost&&lFreezeVal!=eFT_CantFrost) { GetInst(MsgEventManager).PushEvent(Msg_Ok, AppFrame::GetText("Goods_156")); //该物品处于冻结状态,不能出售! pHandGoods->SetHaveShadowState(false); // @todo 背包 /*if (pItemPage!=NULL) { pItemPage->UpdateGoodsShowByCGoods(pHandGoods); }*/ pHand->ClearMainPlayerHand(); return false; } //绑定的物品不能放入个人商店进行交易 if (lBindVal==1||lBindVal==3) { GetInst(MsgEventManager).PushEvent(Msg_Ok, AppFrame::GetText("Goods_157"));//该物品处于绑定状态,不能出售! pHandGoods->SetHaveShadowState(false); // @todo 背包 //if (pItemPage!=NULL) //{ // pItemPage->UpdateGoodsShowByCGoods(pHandGoods); // //pItemPage->UpdataAllItems(); // //pItemPage->UpdataAllSubPack(); //} pHand->ClearMainPlayerHand(); return false; } // 不可交易的不能放入个人商店中贩卖 if (pHandGoods->GetEffectVal(GAP_PARTICULAR_ATTRIBUTE,1)&32) { chatListPage.AddChatWords(AppFrame::GetText("Shop_11") //不可交易物品不能贩卖! , 0xffffffff, 0, 0xff000000,"", eNOTIFYPOS_CENTER); return false; } // 打开商品贩卖清单界面 if (index == -1 || (playShop.GetCurGoodsNum()<playShop.GetShopGridNum())) { index = playShop.GetCurGoodsNum(); } playShop.OnOrderPageOpen(pHandGoods,index); pHand->ClearMainPlayerHand(); } return true; }
bool OnBuyUIClosed(const CEGUI::EventArgs& e) { CEGUI::Window* wnd = WEArgs(e).window; wnd->setVisible(false); return true; }