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; }
void CREvent::OnPageLoad(GamePage *pPage) { pPage->LoadPageWindow(); CEGUI::Window *pPageWin = pPage->GetPageWindow(); CEGUI::PushButton* pCreateBtn = static_cast<CEGUI::PushButton*>(pPageWin->getChild("CreateRole")); pCreateBtn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&CREvent::OnCreateRoleBtn, this)); CEGUI::PushButton* pGoBackBtn = static_cast<CEGUI::PushButton*>(pPageWin->getChildRecursive("BackToSelRol")); pGoBackBtn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&CREvent::GoBackBtn,this)); SetCreateRoleInitProperty(pPageWin); m_bRoleLeftRotate = false; //向左旋转 m_bRoleRightRotate = false; //向右旋转 if (m_SelectSence == NULL) { m_SelectSence = new GameScene(); m_SelectSence->CreateSence("model/interface/selectchar/map", "model/interface/selectchar/map/camera_end", "model/interface/selectchar/map/envcreature", "model/interface/selectchar/map/enveffect"); } CRFile* prfile = rfOpen("data/CreateRolePos.ini"); if (prfile) { stringstream stream; prfile->ReadToStream(stream); rfClose(prfile); stream >> s_RolePos[0] >> s_RolePos[1] >> s_RolePos[2] >> s_RolePos[3]; } if(m_pPlayer == NULL) m_pPlayer = new CPlayer; m_pPlayer->SetGraphicsID(CREvent::GetSelectSex()+1); LoadFaceHairIni(); m_pPlayer->SetDisplayModel(); m_pPlayer->SetDisplayModelGroup(); }
//新品推荐 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 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 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 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 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 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 SubscriberAHEvent(CEGUI::Window* pageWnd) { pageWnd->subscribeEvent(EVENT_OPEN,CEGUI::Event::Subscriber(OnOpenedUpdate));//绑定打开界面刷新数据事件 pageWnd->subscribeEvent("UpdatePickUpUI",CEGUI::Event::Subscriber(UpdatePickUPUIDate));//更新提取界面UI CEGUI::PushButton* btn = WPushButton(pageWnd->getChildRecursive("Auction/Tab/BuySale/BtnBuyWeimian")); btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnBuyWeimianBtnClicked));//点击按钮购买位面 btn = WPushButton(pageWnd->getChildRecursive("Auction/Tab/BuySale/BtnSalWeimian")); btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnSaleWeimianBtnClicked));//点击按钮出售位面 btn = WPushButton(pageWnd->getChildRecursive("Auction/Pickup/BtnGold")); btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnPickUpGold));//提取金币 btn = WPushButton(pageWnd->getChildRecursive("Auction/Pickup/BtnWeimian")); btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnPickUpWeimian));//提取位面 CEGUI::MultiColumnList* mcl = WMCL(pageWnd->getChildRecursive("Auction/Tab/BuySale/SaleMCL")); mcl->subscribeEvent(CEGUI::MultiColumnList::EventSelectionChanged,CEGUI::Event::Subscriber(OnSaleMCLSelChanged));//位面可购买条目选中事件 mcl->subscribeEvent("UpdateCanBuyMCL",CEGUI::Event::Subscriber(UpdateCanBuyMCLDate));//更新可购买出售列表 mcl->subscribeEvent(CEGUI::Window::EventMouseDoubleClick,CEGUI::Event::Subscriber(OnBuyWeimianBtnClicked));//双击可购买Item,事件响应 mcl = WMCL(pageWnd->getChildRecursive("Auction/Tab/BuySale/BuyMCL")); mcl->subscribeEvent(CEGUI::MultiColumnList::EventSelectionChanged,CEGUI::Event::Subscriber(OnBuyMCLSelChanged));//位面可出售条目选中事件 mcl->subscribeEvent("UpdateBuyMCL",CEGUI::Event::Subscriber(UpdateCanSaleMCLDate));//更新可出售列表 mcl->subscribeEvent(CEGUI::Window::EventMouseDoubleClick,CEGUI::Event::Subscriber(OnSaleWeimianBtnClicked));//双击可出售Item,事件响应 mcl = WMCL(pageWnd->getChildRecursive("Auction/Tab/Query/MCL")); mcl->subscribeEvent(CEGUI::MultiColumnList::EventSelectionChanged,CEGUI::Event::Subscriber(OnPerMCLSelChanged));//个人挂单条目选中事件 mcl->subscribeEvent("UpdatePerMCL",CEGUI::Event::Subscriber(UpdatePerMCLDate));//更新个人挂单列表 CEGUI::Window* wnd = pageWnd->getChildRecursive("Auction/SaleWnd"); wnd->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked,CEGUI::Event::Subscriber(OnSaleUIClosed));//出售界面关闭 btn = WPushButton(wnd->getChildRecursive("Auction/SaleWnd/Submit")); btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnSaleSubmit));//提交出售请求 wnd = pageWnd->getChildRecursive("Auction/BuyWnd"); wnd->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked,CEGUI::Event::Subscriber(OnBuyUIClosed));//购买界面关闭 btn = WPushButton(wnd->getChildRecursive("Auction/Buy/Submit")); btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnBuySubmit));//提交购买请求 CEGUI::Editbox* edb = WEditBox(pageWnd->getChildRecursive("Auction/Buy/buyNum"));// edb->subscribeEvent(CEGUI::Window::EventTextChanged,CEGUI::Event::Subscriber(UpdateBuyUIDate));//购买界面UI更新 edb = WEditBox(pageWnd->getChildRecursive("Auction/SaleWnd/saleNum")); edb->subscribeEvent(CEGUI::Window::EventTextChanged,CEGUI::Event::Subscriber(UpdateSaleUIDate));//出售界面UI更新 btn = WPushButton(pageWnd->getChildRecursive("Auction/Tab/Agent/sale/Submit")); btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnAgentSaleSubmit));//委托出售挂单提交 btn = WPushButton(pageWnd->getChildRecursive("Auction/Tab/Agent/Buy/Submit")); btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnAgentBuySubmit));//委托求购挂单提交 edb = WEditBox(pageWnd->getChildRecursive("Auction/Tab/Agent/sale/EditNum")); edb->subscribeEvent(CEGUI::Window::EventTextChanged,CEGUI::Event::Subscriber(UpdateAgentSaleUIDate));//委托出售挂单UI更新 edb = WEditBox(pageWnd->getChildRecursive("Auction/Tab/Agent/sale/EditPrice")); edb->subscribeEvent(CEGUI::Window::EventTextChanged,CEGUI::Event::Subscriber(UpdateAgentSaleUIDate));//委托出售挂单UI更新 edb = WEditBox(pageWnd->getChildRecursive("Auction/Tab/Agent/Buy/EditNum")); edb->subscribeEvent(CEGUI::Window::EventTextChanged,CEGUI::Event::Subscriber(UpdateAgentBuyUIDate));//委托求购UI更新 edb = WEditBox(pageWnd->getChildRecursive("Auction/Tab/Agent/Buy/EditPrice")); edb->subscribeEvent(CEGUI::Window::EventTextChanged,CEGUI::Event::Subscriber(UpdateAgentBuyUIDate));//委托求购UI更新 btn = WPushButton(pageWnd->getChildRecursive("Auction/Tab/Query/Cancel"));//个人委托撤销挂单 btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnCancelAgentOrder)); // btn = WPushButton(pageWnd->getChildRecursive("Auction/Tab/Query/Refresh"));//发送请求更新个人挂单列表 btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnRefreshPerMCL)); btn = WPushButton(pageWnd->getChildRecursive("Auction/Tab/BuySale/RefreshSale")); btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnRefreshSaleMCL));//发送请求更新出售委托挂单列表 btn = WPushButton(pageWnd->getChildRecursive("Auction/Tab/BuySale/RefreshBuy")); btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnRefreshBuyMCL));//发送请求更新求购委托挂单列表 }
// 更新界面操作按钮状态 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; }