LRESULT RtsForm::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { if (uMsg == WM_KEYDOWN && wParam == VK_ESCAPE) { OnBtnClose(); return 0; } return __super::HandleMessage(uMsg, wParam, lParam); }
void GameMainDlg::OnClose() { OnBtnClose(); }
bool RtsForm::OnClicked(ui::EventArgs* arg) { std::wstring name = arg->pSender->GetName(); if(name == L"btn_accept") { need_ack_ = false; nim::Rts::Ack(session_id_, type_, true, nbase::Bind(&RtsForm::OnAckCallback, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4)); } else if (name == L"btn_reject") { need_ack_ = false; nim::Rts::Ack(session_id_, type_, false, nim::Rts::AckCallback()); DelayClose(); } else if (name == L"btn_cancel") { nim::Rts::Hangup(session_id_, nim::Rts::HangupCallback()); DelayClose(); } else if (name == L"btn_undo") { board_->MyUndo(); } else if (name == L"btn_clear") { DrawOpInfo info; info.draw_op_type_ = DrawOpClear; info.x_ = 0; info.y_ = 0; OnDrawCallback(info); board_->ReleaseAllDrawUnits(ShowOpMine); board_->PaintContent(); } else if (name == L"btn_close") { OnBtnClose(); } else if (name == L"btn_showtype") { if (talking_) { switch (show_type_) { case ShowOpAll: show_type_ = ShowOpMine; ((Button*)(arg->pSender))->SetText(L"显示自己"); break; case ShowOpMine: show_type_ = ShowOpOther; ((Button*)(arg->pSender))->SetText(L"显示对方"); break; case ShowOpOther: show_type_ = ShowOpAll; ((Button*)(arg->pSender))->SetText(L"显示全部"); break; } board_->SetShowType(show_type_); } } return true; }