//=========================NghiaLP--20140204--PARTY============================ //Nhan vao Button de thuc hien void CEventHandler::AddMemberParty(CWndControl* sender, CMainDlg* parent) { CWndDlg* dlgCtrlContainer = parent->m_controlDlg; CCharacter* m_char = parent->m_clsCurChar; if(m_char==NULL) return; CWndListBox * lstMember = static_cast<CWndListBox*> (dlgCtrlContainer->GetControl(L"lstMemberParty")); if(lstMember->GetCount()>=6){ m_char->ShowMessage(L"Party da du thanh vien"); return; } CWndTextBox * txtAddMember = static_cast<CWndTextBox*> (dlgCtrlContainer->GetControl(L"txtAddMember")); CString sMemName = txtAddMember->GetText(); if(sMemName==L"") return; txtAddMember->SetText(L""); std::vector<CString>::iterator item; for(item= m_char->m_vMemberParty.begin(); item != m_char->m_vMemberParty.end(); item ++){ if(item->Trim() == sMemName){ m_char->ShowMessage(L"Thanh vien nay da co trong danh sach"); return; } } //INV_PARTY swMem; //swMem._nameMember = m_char->m_swNameMember; m_char->m_vMemberParty.push_back(sMemName); lstMember->AddItem(sMemName); //m_char->m_swNameMember = L""; }
void CEventHandler::RemoveMemberParty(CWndControl* sender, CMainDlg* parent) { //xóa thành viên khỏi danh sách mời CWndDlg* dlgCtrlContainer = parent->m_controlDlg; CCharacter* m_char = parent->m_clsCurChar; if(m_char==NULL) return; CWndListBox * lstMmeber = static_cast<CWndListBox*> (dlgCtrlContainer->GetControl(L"lstMemberParty")); if(lstMmeber->GetSelectedIndex()==-1) return; m_char->m_vMemberParty.erase(m_char->m_vMemberParty.begin()+lstMmeber->GetSelectedIndex()); lstMmeber->ClearItems(); std::vector<CString>::iterator item; for(item= m_char->m_vMemberParty.begin(); item != m_char->m_vMemberParty.end(); item ++){ lstMmeber->AddItem(item->Trim()); } }
void CEventHandler::RemoveMonsterCoor(CWndControl* sender,CMainDlg* parent){ //xóa tọa độ khỏi danh sách CWndDlg* dlgCtrlContainer = parent->m_controlDlg; CCharacter* m_char = parent->m_clsCurChar; if(m_char==NULL) return; CWndListBox * lstMonster = static_cast<CWndListBox*> (dlgCtrlContainer->GetControl(L"lstMonsterCoor")); if(lstMonster->GetSelectedIndex()==-1) return; m_char->m_lMonsters.erase(m_char->m_lMonsters.begin()+lstMonster->GetSelectedIndex()); lstMonster->ClearItems(); std::vector<COOR>::iterator item; for(item= m_char->m_lMonsters.begin(); item != m_char->m_lMonsters.end(); item ++){ CString sCoor; sCoor.Format(L"%d,%d",item->_iX ,item->_iY); lstMonster->AddItem(sCoor); } }
//////////////////////////////////////Tab bãi quái ////////////////////////////////////////////////////////// void CEventHandler::AddMonsterCoor(CWndControl* sender,CMainDlg* parent){ //Thêm tọa độ vào danh sách CWndDlg* dlgCtrlContainer = parent->m_controlDlg; CCharacter* m_char = parent->m_clsCurChar; if(m_char==NULL) return; CWndListBox * lstMonster = static_cast<CWndListBox*> (dlgCtrlContainer->GetControl(L"lstMonsterCoor")); COOR cCoor; cCoor._iX = m_char->m_iTdX; cCoor._iY = m_char->m_iTdY; m_char->m_lMonsters.push_back( cCoor); CString sCoor; sCoor.Format(L"%d,%d",cCoor._iX ,cCoor._iY); lstMonster->AddItem(sCoor); }