//获取信息 bool CDlgProxyConfig::GetInformation() { //代理类型 BYTE cbProxyType=(BYTE)m_cmProxyType.GetItemData(m_cmProxyType.GetCurSel()); //代理信息 tagProxyServer ProxyServer; ZeroMemory(&ProxyServer,sizeof(ProxyServer)); ProxyServer.wProxyPort=GetDlgItemInt(IDC_PROXY_PORT); GetDlgItemText(IDC_PROXY_USER,ProxyServer.szUserName,CountArray(ProxyServer.szUserName)); GetDlgItemText(IDC_PROXY_PASS,ProxyServer.szPassword,CountArray(ProxyServer.szPassword)); GetDlgItemText(IDC_PROXY_SERVER,ProxyServer.szProxyServer,CountArray(ProxyServer.szProxyServer)); //效验代理 if (cbProxyType!=PROXY_NONE) { //代理地址 if (ProxyServer.szProxyServer[0]==0) { //错误提示 CInformation Information(this); Information.ShowMessageBox(TEXT("代理服务器地址不能为空,请重新输入!"),MB_ICONERROR,30); //设置焦点 m_edProxyServer.SetFocus(); return false; } //代理端口 if (ProxyServer.wProxyPort==0) { //错误提示 CInformation Information(this); Information.ShowMessageBox(TEXT("请输入代理服务器端口号,例如:1080!"),MB_ICONERROR,30); //设置焦点 m_edProxyPort.SetFocus(); return false; } } //变量定义 ASSERT(CParameterGlobal::GetInstance()!=NULL); CParameterGlobal * pParameterGlobal=CParameterGlobal::GetInstance(); //保存配置 pParameterGlobal->m_cbProxyType=cbProxyType; pParameterGlobal->m_ProxyServer=ProxyServer; return true; }
//保存参数 bool CCollocateRoom::SaveParameter() { //获取参数 m_bLimitDetest=(IsDlgButtonChecked(IDC_LIMIT_DETEST)==BST_CHECKED)?true:false; m_bLimitSameIP=(IsDlgButtonChecked(IDC_LIMIT_SAME_IP)==BST_CHECKED)?true:false; m_bTakePassword=(IsDlgButtonChecked(IDC_TAKE_PASSWORD)==BST_CHECKED)?true:false; m_bLimitWinRate=(IsDlgButtonChecked(IDC_LIMIT_WIN_RATE)==BST_CHECKED)?true:false; m_bLimitFleeRate=(IsDlgButtonChecked(IDC_LIMIT_FLEE_RATE)==BST_CHECKED)?true:false; m_bLimitGameScore=(IsDlgButtonChecked(IDC_LIMIT_GAME_SCORE)==BST_CHECKED)?true:false; //最低胜率 TCHAR szBuffer[128]=TEXT(""); GetDlgItemText(IDC_WIN_RATE,szBuffer,CountArray(szBuffer)); m_wMinWinRate=(WORD)(_tstof(szBuffer)*100.0)%10000; //最高逃率 GetDlgItemText(IDC_FLEE_RATE,szBuffer,CountArray(szBuffer)); m_wMaxFleeRate=(WORD)(_tstof(szBuffer)*100.0)%10000; //积分限制 m_lMaxGameScore=GetDlgItemInt(IDC_GAME_SCORE_MAX,NULL,TRUE); m_lMinGameScore=GetDlgItemInt(IDC_GAME_SCORE_MIN,NULL,TRUE); if ((m_bLimitGameScore)&&(m_lMinGameScore>=m_lMaxGameScore)) { //显示消息 CInformation Information(this); Information.ShowMessageBox(TEXT("积分限制范围参数不正确,请正确设置积分限制范围!"),MB_ICONINFORMATION); //设置焦点 GetDlgItem(IDC_GAME_SCORE_MAX)->SetFocus(); return false; } //携带密码 GetDlgItemText(IDC_TABLE_PASSWORD,m_szPassword,CountArray(m_szPassword)); if ((m_bTakePassword==true)&&(m_szPassword[0]==0)) { //显示消息 CInformation Information(this); Information.ShowMessageBox(TEXT("桌子携带密码没有设置,请输入设置桌子携带密码!"),MB_ICONINFORMATION); //设置焦点 GetDlgItem(IDC_TABLE_PASSWORD)->SetFocus(); return false; } return true; }
bool FactorGraph::add_virtual_pose_point(virtual_pose3_point3_t virtual_pose_point){ int id = virtual_pose_point.id; if (DEBUG) cout << "in FactorGraph trying to add virtual pose point at time: " << endl << "t = " << virtual_pose_point.t << endl ; Pose3dTS_Node* pose = find_pose_from_time_and_id(virtual_pose_point.t, id); if (pose == NULL){ cout << "[warning] {add_virtual_pose_point}: no pose for virtual_pose_point measurement at time " << virtual_pose_point.t << " for id " << id << "skipping.. " << endl; return false; } // TODO there is also data association going on here (currently done with ids): Point3dID_Node* point = find_point_from_feature_id(virtual_pose_point.feature_id); if(point == NULL) point = build_point(virtual_pose_point.feature_id); MatrixXd mu,omega; conversions::lcm2eigen(virtual_pose_point.point,mu,omega); Point3d measure(mu); Noise inf = Information(omega); Virtual_Pose3d_Point3d_Factor* virtual_factor = new Virtual_Pose3d_Point3d_Factor(dynamic_cast<Pose3d_Node*>(pose), dynamic_cast<Point3d_Node*>(point), measure, inf); if (DEBUG) cout << "pose point factors: " << *virtual_factor << endl; _slam.add_factor(virtual_factor); if(_lcm_viewer) _virtual_collection->add(_virtual_link_count++,6,pose->unique_id(),3,point->unique_id()); return true; }
int Buddies::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: countOnlineUsers(); break; case 1: setUserStatus(); break; case 2: loginUser(); break; case 3: loginCurrentStatus(); break; case 4: validateUser(); break; case 5: stopifNotConnected(); break; case 6: myexit(); break; case 7: focusTabEdit(); break; case 8: structUser(); break; case 9: startChat(); break; case 10: helpAbout(); break; case 11: getSysInfo(); break; case 12: onlineNotify(); break; case 13: WriteOnWall(); break; case 14: Information(); break; case 15: dbstatus(); break; case 16: openNotes(); break; case 17: setIcon((*reinterpret_cast< int(*)>(_a[1]))); break; case 18: iconActivated((*reinterpret_cast< QSystemTrayIcon::ActivationReason(*)>(_a[1]))); break; case 19: messageClicked(); break; case 20: showMessage(); break; } _id -= 21; } return _id; }
//virtual_pose_pose bool FactorGraph::add_virtual_pose_pose(virtual_pose3_pose3_t virtual_pose_pose){ int id = virtual_pose_pose.id; int64_t start_time = virtual_pose_pose.t[0]; int64_t end_time = virtual_pose_pose.t[1]; if (_poses[id].size()==0){ cout << "Rejecting odometry since no prior" << endl; return false; } Pose3dTS_Node* old_pose = find_pose_from_time_and_id(start_time,id); if (old_pose == NULL){ cout << "[warning] {add_virtual_pose_pose} no node for id " << id << " and time " << start_time << " skipping.." << endl; return false; } // could decompose in the case that start_time does not correspond to the last // pose in the chain but not sure it matters... Pose3dTS_Node* pose = build_pose(end_time,id); MatrixXd mu,omega; conversions::lcm2eigen(virtual_pose_pose.pose,mu,omega); Pose3d measure(mu); Noise inf = Information(omega); Virtual_Pose3d_Pose3d_Factor* vppf = new Virtual_Pose3d_Pose3d_Factor(dynamic_cast<Pose3d_Node*>(old_pose), dynamic_cast<Pose3d_Node*>(pose), measure, inf); if (DEBUG) cout << "adding virtual pose pose factor: " << endl << *vppf << endl; _slam.add_factor(vppf); if(_lcm_viewer) _virtual_collection->add(_virtual_link_count++,6,old_pose->unique_id(),6,pose->unique_id()); return true; }
void FactorGraph::add_global_xy(pos2_t pos2, Pose3dTS_Node* pose){ Vector2d mu; Matrix2d omega; conversions::lcm2eigen(pos2,mu,omega); Noise inf = Information(omega); Pose3d_PartialXY_Factor* global_factor = new Pose3d_PartialXY_Factor(dynamic_cast<Pose3d_Node*>(pose), mu, inf); _slam.add_factor(global_factor); }
Buddies::Buddies(QWidget *parent) : QMainWindow(parent) { ui.setupUi(this); getSysInfo(); createIconGroupBox(); createActions(); createTrayIcon(); countOnlineUsers(); QTimer * counter = new QTimer( this ); connect( counter, SIGNAL(timeout()), this, SLOT(structUser()) ); counter->start( 3000 ); qDebug("=> Starting timer 1sec interval..."); //connect(ui.sendBtn, SIGNAL(clicked()), this, SLOT(showMessage())); // connect(ui.showIconCheckBox, SIGNAL(toggled(bool)), trayIcon, SLOT(setVisible(bool))); connect(ui.iconComboBox, SIGNAL(currentIndexChanged(int)),this, SLOT(setIcon(int))); connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked())); connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason))); ui.iconComboBox->setCurrentIndex(1); trayIcon->show(); setWindowTitle(tr("Buddies")); //resize(400, 300); ui.listWidget->setIconSize(QSize(40, 40)); //showMessage(); //-- timer 5 min for online Users Baloon QTimer * onlinetimer = new QTimer( this ); connect( onlinetimer, SIGNAL(timeout()), this, SLOT(onlineNotify()) ); onlinetimer->start( 300000 ); qDebug("=> Starting timer 5min interval..."); //-- Information on Edit Tab Information(); //-- Database status dbstatus(); }
void FactorGraph::add_global_ypr(rot3_t rot3, Pose3dTS_Node* pose){ Vector3d mu; Matrix3d omega; conversions::lcm2eigen(rot3,mu,omega); Rot3d mu_rot3(mu(0),mu(1),mu(2)); Noise inf = Information(omega); Pose3d_PartialYPR_Factor* global_factor = new Pose3d_PartialYPR_Factor(dynamic_cast<Pose3d_Node*>(pose), mu_rot3, inf); _slam.add_factor(global_factor); }
void FactorGraph::add_global_z(depth_t depth, Pose3dTS_Node* pose){ double mu; MatrixXd omega(1,1); mu = depth.mu; omega(0,0) = depth.omega; Noise inf = Information(omega); Pose3d_PartialZ_Factor* global_factor = new Pose3d_PartialZ_Factor(dynamic_cast<Pose3d_Node*>(pose),mu,inf); _slam.add_factor(global_factor); }
//保存参数 bool CCollocateProxy::SaveParameter() { //代理类型 m_cbProxyType=(BYTE)m_cmProxyType.GetItemData(m_cmProxyType.GetCurSel()); //代理信息 m_ProxyServer.wProxyPort=GetDlgItemInt(IDC_PROXY_PORT); GetDlgItemText(IDC_PROXY_USER,m_ProxyServer.szUserName,CountArray(m_ProxyServer.szUserName)); GetDlgItemText(IDC_PROXY_PASS,m_ProxyServer.szPassword,CountArray(m_ProxyServer.szPassword)); GetDlgItemText(IDC_PROXY_SERVER,m_ProxyServer.szProxyServer,CountArray(m_ProxyServer.szProxyServer)); //效验代理 if (m_cbProxyType!=PROXY_NONE) { //代理地址 if (m_ProxyServer.szProxyServer[0]==0) { //错误提示 CInformation Information(this); Information.ShowMessageBox(TEXT("代理服务器地址不能为空,请重新输入!"),MB_ICONERROR,30); //设置焦点 m_edProxyServer.SetFocus(); return false; } //代理端口 if (m_ProxyServer.wProxyPort==0) { //错误提示 CInformation Information(this); Information.ShowMessageBox(TEXT("请输入代理服务器端口号,例如:1080!"),MB_ICONERROR,30); //设置焦点 m_edProxyPort.SetFocus(); return false; } } return true; }
Appearance::MapType& Appearance::GetFonts(void) { static MapType s_Fonts; if (s_Fonts.empty()) { s_Fonts["font.listing"] = Information("Listing", ""); } return s_Fonts; }
void FactorGraph::add_odom_xy(odom_xy_t odom, Pose3dTS_Node* old_pose, Pose3dTS_Node* new_pose){ Vector2d mu; Matrix2d omega; conversions::lcm2eigen(odom.pos2,mu,omega); Noise inf = Information(omega); Pose3d_Pose3d_PartialXY_Factor* odom_factor = new Pose3d_Pose3d_PartialXY_Factor(dynamic_cast<Pose3d_Node*>(old_pose), dynamic_cast<Pose3d_Node*>(new_pose), mu, inf); _slam.add_factor(odom_factor); }
void FactorGraph::add_prior(pose3_t prior){ Pose3dTS_Node* pose = find_pose_from_time_and_id(prior.t,prior.id); if (pose == NULL){ pose = build_pose(prior.t,prior.id); } MatrixXd mu = MatrixXd::Zero(6,1); MatrixXd omega = MatrixXd::Zero(6,6); conversions::lcm2eigen(prior,mu,omega); Pose3d measure(mu); Noise inf = Information(omega); Pose3d_Factor* prior_factor = new Pose3d_Factor(dynamic_cast<Pose3d_Node*>(pose), measure, inf); _slam.add_factor(prior_factor); if(1) cout << "adding prior factor: " << endl << *prior_factor << endl; batch(); }
void PackageOptions::_close() { if( _d->needRestart ) { Dialog* dlg = Information( ui(), "Note", "Please restart game to apply change" ); dlg->show(); } vfs::Directory screenDir = SETTINGS_VALUE( screenshotDir ).toString(); if( !screenDir.exist() ) vfs::Directory::createByPath( screenDir ); game::Settings::instance().save(); deleteLater(); }
/** Begin the Y-Modem transfer. @param timeout Time in milliseconds to wait receiver to become ready. @return Zero if transfer initialisation was successful, or an error code on failure. */ int QymodemTx::SendInitialise(unsigned timeout) { emit Information("Waiting for Receiver",QymodemTx::InfoSending); if(timeout<SendTimeout) timeout = SendTimeout; while(InChar(-1)>=0) // flush input buffers {} CancelCount = 0; int c; for(;;) { const unsigned timeoutStep = 100; c = InChar(timeoutStep); if(c=='G') { SendCRC = true; WaitForBlockACK = false; break; } else if(c=='C') { SendCRC = true; WaitForBlockACK = true; break; } else if(c==NAK) { SendCRC = false; WaitForBlockACK = true; break; } if(c<0 && c!=ErrorTimeout) return c; if(timeout<timeoutStep) return ErrorTimeout; timeout -= timeoutStep; } ModeChar = c; return 0; }
//关闭事件 bool CDlgCustomFace::OnEventMissionShut(BYTE cbShutReason) { //关闭处理 if (cbShutReason!=SHUT_REASON_NORMAL) { //重试任务 //CMissionManager * pMissionManager=GetMissionManager(); //if (pMissionManager->AvtiveMissionItem(this,true)==true) return true; //显示控件 EnableControl(true); //显示提示 CInformation Information(this); Information.ShowMessageBox(TEXT("由于当前服务器处理繁忙,上传自定义头像失败,请稍后再重试!"),MB_ICONERROR); } return true; }
//关闭事件 bool CEditUnderWrite::OnEventMissionShut(BYTE cbShutReason) { //关闭处理 if (cbShutReason!=SHUT_REASON_NORMAL) { //重试任务 CMissionManager * pMissionManager=GetMissionManager(); if (pMissionManager->AvtiveMissionItem(this,true)==true) return true; //设置控件 CloseUnderWrite(); //显示提示 CInformation Information(m_pParentWnd); Information.ShowMessageBox(TEXT("由于当前服务器处理繁忙,个性签名修改失败,请稍后再重试!"),MB_ICONERROR); } return true; }
bool FactorGraph::add_sidescan_detection(sidescan_detection_t detection){ if (_poses[detection.id].size()==0){ cout << "Rejecting odometry since no prior" << endl; return false; } Pose3dTS_Node* pose = find_pose_from_time_and_id(detection.t,detection.id); if (pose == NULL){ // times might not be exact pick the closest one. cout << "No exact time match find closest" << endl; pose = find_closest_pose_from_time_and_id(detection.t,detection.id); } if (pose == NULL) cout << "Error unable to find pose for time = " << detection.t << " and id " << detection.id << endl; // TODO: decide if it's a detection of previously tracked target. EG do something like nearest neighbor or JCBB. Start with using feature id Point3dID_Node* point = find_point_from_feature_id(detection.feature_id); if (point == NULL) point = build_point(detection.feature_id); // here's the unique thing for a sidescan detection. It is always orthogonal to direction of motion. Therefore take the measurement and put it into "y" direction MatrixXd omega; conversions::lcm2eigen(detection,omega); Point3d measure(0.0,detection.mu,0.0); // TODO deal with depth/z, this sidescan detection should be // its own factor not use Pose3d_Point3d_Factor Noise inf = Information(omega); Pose3d_Point3d_Factor* detection_factor = new Pose3d_Point3d_Factor(dynamic_cast<Pose3d_Node*>(pose), dynamic_cast<Point3d_Node*>(point), measure, inf); if (DEBUG){ cout << "Adding sidescan detection factor: " << *detection_factor << endl; cout << "Between pose with id = " << detection.id << " and time t = " << detection.t << "and point with feature id " << detection.feature_id << endl; } _slam.add_factor(detection_factor); if(_lcm_viewer) _feature_collection->add(_feature_link_count++,2,pose->unique_id(),3,point->unique_id()); return true; }
int QymodemTx::SendY(const char* fileName, size_t size, InStream& in, unsigned timeout) { Use1KBlocks = true; quint8 buffer[128]; int result = MakeBlock0(buffer,fileName,size); if(result<0) return result; result = SendInitialise(timeout); if(result<0 && result!=ErrorBlockRetriesExceded) return result; emit Information("Sending "+QString(fileName),QymodemTx::InfoSending); BlockNumber = 0; result = SendBlock(buffer,sizeof(buffer)); if(result<0) return result; result = InChar(SendTimeout); if(result<0) return result; if(result!=ModeChar) return ErrorReceiverNotBehaving; result = SendAll(in); if(result<0) return result; result = InChar(SendTimeout); if(result<0) return result; if(result!=ModeChar) return ErrorReceiverNotBehaving; memset(buffer,0,sizeof(buffer)); BlockNumber = 0; result = SendBlock(buffer,sizeof(buffer)); if(result<0) return result; emit Percent(100); return 0; }
/** Send the file. */ void QymodemSend::Send() { QymodemFileStream source; int error = source.Open(FileName); if(error) emit Error("Can't open file " + QString(FileName),error); unsigned Timeout=30000; error = SendY(FileName,source.Size(),source,Timeout); if(error) { emit Error("Error during file transfer, error "+QString::number(error),error); } else { emit Information("Sent OK",QymodemSend::InfoSent); } source.Close(); }
bool FactorGraph::add_relative_range(relative_range_t range){ if (_poses[range.send_id].size()==0){ cout << "Rejecting odometry since no prior for sender" << endl; return false; } if (_poses[range.receive_id].size()==0){ cout << "Rejecting odometry since no prior for receiver" << endl; return false; } if (1) cout << "add_range looking for sender pose with time " << range.send_t << " and id " << range.send_id << endl; Pose3dTS_Node* sender_pose = find_pose_from_time_and_id(range.send_t,range.send_id); if (1) cout << "add_range looking for receiver pose with time " << range.receive_t << " and id " << range.receive_id << endl; Pose3dTS_Node* receiver_pose = find_pose_from_time_and_id(range.receive_t,range.receive_id); if (sender_pose == NULL) sender_pose =find_closest_pose_from_time_and_id(range.send_t,range.send_id); if (receiver_pose == NULL) receiver_pose = find_closest_pose_from_time_and_id(range.receive_t,range.receive_id); if (sender_pose == NULL || receiver_pose == NULL){ cout << "unable to find pose" <<endl; return false; } MatrixXd mat(1,1); mat << range.omega; Noise inf = Information(mat); Pose3d_Pose3d_RangeFactor* range_measure = new Pose3d_Pose3d_RangeFactor(sender_pose,receiver_pose,range.mu,inf); _slam.add_factor(range_measure); if(_lcm_viewer) _range_collection->add(_range_link_count++,6,sender_pose->unique_id(),2,receiver_pose->unique_id()); return true; }
// FontSelect /////////////////////////////////////////////////////////////1.00 // フォンとセレクトダイアログを使用して、 // フォントを選択させている。 // フォントが選択されたら、再描画。 int ClassABrowserView::FontSelect() { // CHOOSEFONT構造体の宣言と初期化 CHOOSEFONT cf; { memset(&cf, 0, sizeof(CHOOSEFONT)); cf.lStructSize = sizeof(CHOOSEFONT); cf.hwndOwner = hWnd; cf.lpLogFont = &lf; cf.Flags = CF_FIXEDPITCHONLY | CF_SCREENFONTS | CF_TTONLY | CF_INITTOLOGFONTSTRUCT; } if (ChooseFont(&cf)) { // ウィンドウ情報の再生成 Information(); // ウィンドウの再描画 InvalidateRect(hWnd, NULL, FALSE); } return 0; }
//连接事件 bool CEditUnderWrite::OnEventMissionLink(INT nErrorCode) { //错误判断 if (nErrorCode!=0L) { //错误提示 CInformation Information(m_pParentWnd); Information.ShowMessageBox(TEXT("服务器连接失败,个性签名更新失败!"),MB_ICONERROR,30L); return true; } //设置变量 m_bNeedSend=false; //变量定义 ASSERT(GetMissionManager()!=NULL); CMissionManager * pMissionManager=GetMissionManager(); //用户信息 CGlobalUserInfo * pGlobalUserInfo=CGlobalUserInfo::GetInstance(); tagGlobalUserData * pGlobalUserData=pGlobalUserInfo->GetGlobalUserData(); //变量定义 CMD_GP_ModifyUnderWrite ModifyUnderWrite; ZeroMemory(&ModifyUnderWrite,sizeof(ModifyUnderWrite)); //设置数据 ModifyUnderWrite.dwUserID=pGlobalUserData->dwUserID; lstrcpyn(ModifyUnderWrite.szUnderWrite,m_szUnderWrite,CountArray(ModifyUnderWrite.szUnderWrite)); lstrcpyn(ModifyUnderWrite.szPassword,pGlobalUserData->szPassword,CountArray(ModifyUnderWrite.szPassword)); //发送数据 WORD wHeadSize=sizeof(ModifyUnderWrite)-sizeof(ModifyUnderWrite.szUnderWrite); pMissionManager->SendData(MDM_GP_USER_SERVICE,SUB_GP_MODIFY_UNDER_WRITE,&ModifyUnderWrite,wHeadSize+CountStringBuffer(ModifyUnderWrite.szUnderWrite)); return true; }
// OpenFile ///////////////////////////////////////////////////////////////1.00 // 新しいテキストファイルを開いたり、漢字コードを変えたりする。実際の処 // 理は基本クラスのTextFileに。 int ClassABrowserView::OpenFile(char* szOpenFile, DWORD dwFilter) { HCURSOR hcurOld = GetCursor(); // マウスカーソルを時計に SetCursor(LoadCursor(0, IDC_WAIT)); Open(szOpenFile, dwFilter); // ウィンドウ情報の再生成 Information(); if (dwFilter == CTF_FILTER_AUTO) nLineView = 0; // クエリーのリセット SetOrigin(0, 0); fQueryMode = CTQ_MODE_NORMAL; QueryGenerate(); SetCursor(hcurOld); InvalidateRect(hWnd, NULL, FALSE); return 0; }
// TabChange //////////////////////////////////////////////////////////////1.01 // タブを変えるメソッド。 // 2と8と4でトグル式に切り替えている。 int ClassABrowserView::TabChange() { int nTab = ChangeTabColumn(); switch (nTab) { case 2: nTab = 4; break; default: case 4: nTab = 8; break; case 8: nTab = 2; break; } ChangeTabColumn(nTab); Information(); InvalidateRect(hWnd, NULL, FALSE); return 0; }
//读取事件 bool CEditUnderWrite::OnEventMissionRead(TCP_Command Command, VOID * pData, WORD wDataSize) { //命令处理 if (Command.wMainCmdID==MDM_GP_USER_SERVICE) { switch (Command.wSubCmdID) { case SUB_GP_OPERATE_FAILURE: //操作失败 { //效验参数 CMD_GP_OperateFailure * pOperateFailure=(CMD_GP_OperateFailure *)pData; ASSERT(wDataSize>=(sizeof(CMD_GP_OperateFailure)-sizeof(pOperateFailure->szDescribeString))); if (wDataSize<(sizeof(CMD_GP_OperateFailure)-sizeof(pOperateFailure->szDescribeString))) return false; //关闭连接 CMissionManager * pMissionManager=GetMissionManager(); if (pMissionManager!=NULL) pMissionManager->ConcludeMissionItem(this,false); //设置控件 CloseUnderWrite(); //显示消息 if (pOperateFailure->szDescribeString[0]!=0) { CInformation Information(m_pParentWnd); Information.ShowMessageBox(pOperateFailure->szDescribeString,MB_ICONERROR,60); } return true; } case SUB_GP_OPERATE_SUCCESS: //操作成功 { //变量定义 CMD_GP_OperateSuccess * pOperateSuccess=(CMD_GP_OperateSuccess *)pData; //效验数据 ASSERT(wDataSize>=(sizeof(CMD_GP_OperateSuccess)-sizeof(pOperateSuccess->szDescribeString))); if (wDataSize<(sizeof(CMD_GP_OperateSuccess)-sizeof(pOperateSuccess->szDescribeString))) return false; //关闭连接 CMissionManager * pMissionManager=GetMissionManager(); if (pMissionManager!=NULL) pMissionManager->ConcludeMissionItem(this,false); //设置信息 CGlobalUserInfo * pGlobalUserInfo=CGlobalUserInfo::GetInstance(); tagGlobalUserData * pGlobalUserData=pGlobalUserInfo->GetGlobalUserData(); lstrcpyn(pGlobalUserData->szUnderWrite,m_szUnderWrite,CountArray(pGlobalUserData->szUnderWrite)); //设置控件 CloseUnderWrite(); //发送事件 CPlatformEvent * pPlatformEvent=CPlatformEvent::GetInstance(); if (pPlatformEvent!=NULL) pPlatformEvent->SendPlatformEvent(EVENT_USER_INFO_UPDATE,0L); //显示消息 if (pOperateSuccess->szDescribeString[0]!=0) { CInformation Information(m_pParentWnd); Information.ShowMessageBox(pOperateSuccess->szDescribeString,MB_ICONINFORMATION,60); } return true; } } } //错误断言 ASSERT(FALSE); return true; }
//银行消息 bool CGameFrameView::OnEventInsureMessage(WORD wSubCmdID, VOID * pData, WORD wDataSize) { ASSERT(pData); switch(wSubCmdID) { case SUB_GR_USER_INSURE_INFO: { //效验参数 ASSERT(wDataSize==sizeof(CMD_GR_S_UserInsureInfo)); if (wDataSize<sizeof(CMD_GR_S_UserInsureInfo)) return false; //变量定义 CMD_GR_S_UserInsureInfo * pUserInsureInfo=(CMD_GR_S_UserInsureInfo *)pData; //设定变量 m_DlgInsureGame.m_wRevenueTake = pUserInsureInfo->wRevenueTake; m_DlgInsureGame.m_wRevenueTransfer = pUserInsureInfo->wRevenueTransfer; m_DlgInsureGame.m_lGameGold=pUserInsureInfo->lUserScore; m_DlgInsureGame.m_lStorageGold=pUserInsureInfo->lUserInsure; //更新界面 m_DlgInsureGame.UpdateView(); } break; case SUB_GR_USER_INSURE_SUCCESS: { //变量定义 CMD_GR_S_UserInsureSuccess *pUserInsureSuccess = (CMD_GR_S_UserInsureSuccess *)pData; ASSERT(wDataSize>=(sizeof(CMD_GR_S_UserInsureSuccess)-sizeof(pUserInsureSuccess->szDescribeString))); if (wDataSize<(sizeof(CMD_GR_S_UserInsureSuccess)-sizeof(pUserInsureSuccess->szDescribeString))) return false; //设置变量 m_DlgInsureGame.m_lGameGold=pUserInsureSuccess->lUserScore; m_DlgInsureGame.m_lStorageGold=pUserInsureSuccess->lUserInsure; //显示消息 if (pUserInsureSuccess->szDescribeString[0]!=0) { CInformation Information(this); Information.ShowMessageBox(pUserInsureSuccess->szDescribeString,MB_ICONINFORMATION,60); } } break; case SUB_GR_USER_INSURE_FAILURE: { //变量定义 CMD_GR_S_UserInsureFailure *pUserInsureFailure = (CMD_GR_S_UserInsureFailure *)pData; ASSERT(wDataSize>=(sizeof(CMD_GP_UserInsureFailure)-sizeof(pUserInsureFailure->szDescribeString))); if (wDataSize<(sizeof(CMD_GP_UserInsureFailure)-sizeof(pUserInsureFailure->szDescribeString))) return false; //显示消息 if (pUserInsureFailure->szDescribeString[0]!=0) { CInformation Information(this); Information.ShowMessageBox(pUserInsureFailure->szDescribeString,MB_ICONERROR,60); } } break; } return true; }
/* * Perform fuzzy matching on the given symbol. If exactly one match is * found, a pointer to the real symbol name (in ' quotes) is returned; * the caller is responsible for freeing this memory. In all other cases, * NULL is returned. */ char *MatchFuzzy( const char *entryname ) /***************************************/ { MatchingInfo info; char * retval; char * tmp; unsigned numfound = 0; ListElem * curelem; if( hashtable == NULL ) Zoinks(); /*** Strip quotes from 'entryname' ***/ tmp = DupStrMem( entryname ); if( *tmp == '\'' ) { info.basename = DupStrMem( tmp + 1 ); info.basename[ strlen(info.basename) - 1 ] = '\0'; FreeMem( tmp ); } else { info.basename = tmp; } /*** Check for an exact match ***/ info.findmode = MATCH_MODE_EXACT; info.found = NULL; WalkBucketHash( hashtable, info.basename, matching_callback, &info ); /*** Check for _symbol ***/ if( info.found == NULL ) { info.findmode = MATCH_MODE_UNDERBAR_SYMBOL; WalkBucketHash( hashtable, info.basename, matching_callback, &info ); } /*** Check for symbol_ ***/ if( info.found == NULL ) { info.findmode = MATCH_MODE_SYMBOL_UNDERBAR; WalkBucketHash( hashtable, info.basename, matching_callback, &info ); } /*** Check for _symbol@number ***/ if( info.found == NULL ) { info.findmode = MATCH_MODE_UNDERBAR_SYMBOL_AT_NUMBER; WalkBucketHash( hashtable, info.basename, matching_callback, &info ); } /*** Count how many matches we got ***/ numfound = 0; curelem = info.found; while( curelem != NULL ) { numfound++; curelem = curelem->next; } /*** If there was more than one match, complain ***/ if( numfound > 1 ) { Warning( "Symbol with entry name %s has %u matching internal names:", entryname, numfound ); curelem = info.found; while( curelem != NULL ) { Information( "%s", curelem->buff ); curelem = curelem->next; } Information( "Symbol will be ignored!" ); } /*** Return an appropriate value ***/ if( numfound == 1 ) { retval = DupQuoteStrMem( info.found->buff, '\'' ); } else { retval = NULL; } free_list( info.found ); return( retval ); }
//确定函数 VOID CDlgBuyProperty::OnOK() { //获取信息 CString strNickName; GetDlgItemText(IDC_NICK_NAME,strNickName); strNickName.TrimLeft();strNickName.TrimRight(); //获取数目 UINT wItemCount=GetDlgItemInt(IDC_PROPERTY_COUNT); //昵称判断 if (strNickName.IsEmpty()==true) { //提示信息 CInformation Information(this); Information.ShowMessageBox(TEXT("用户昵称不正确,请重新输入"),MB_ICONERROR); //设置焦点 m_edNickName.SetFocus(); return; } //数目判断 if (wItemCount==0 || wItemCount > m_lCanBuyCount) { //提示信息 CInformation Information(this); Information.ShowMessageBox(TEXT("购买数目不正确,请重新输入"),MB_ICONERROR); //设置焦点 m_edPropertyCount.SetFocus(); return; } //获取信息 ASSERT(m_pGamePropertyItem->GetPropertyAttrib()!=NULL); tagPropertyAttrib * pPropertyAttrib=m_pGamePropertyItem->GetPropertyAttrib(); //购前检查 ASSERT(m_pIGamePropertySink!=NULL); TCHAR szMessage[128]=TEXT(""); if(m_pIGamePropertySink->OnEventBuyPropertyPrep(strNickName,pPropertyAttrib->wIndex,szMessage)==false) { //提示信息 CInformation Information(this); Information.ShowMessageBox(szMessage,MB_ICONERROR); return; } //事件通知 if (m_pIGamePropertySink->OnEventBuyProperty(strNickName,wItemCount,pPropertyAttrib->wIndex)==true) { //关闭窗口 DestroyWindow(); } return; }
//命令函数 BOOL CGameFrameWnd::OnCommand(WPARAM wParam, LPARAM lParam) { //变量定义 UINT nCommandID=LOWORD(wParam); //功能按钮 switch (nCommandID) { case IDC_MIN: //最小按钮 { ShowWindow(SW_MINIMIZE); return TRUE; } case IDC_MAX: //最大按钮 { //窗口控制 if (m_bMaxShow==true) { RestoreWindow(); } else { MaxSizeWindow(); } //更新界面 RedrawWindow(NULL,NULL,RDW_ERASE|RDW_INVALIDATE|RDW_ERASENOW|RDW_UPDATENOW); return TRUE; } case IDC_CLOSE: //关闭按钮 { //获取用户 ASSERT(m_pIClientKernel!=NULL); IClientUserItem * pIClientUserItem=m_pIClientKernel->GetMeUserItem(); //强退提示 if ((pIClientUserItem!=NULL)&&(pIClientUserItem->GetUserStatus()==US_PLAYING)) { //提示消息 CInformation Information(this); if (Information.ShowMessageBox(TEXT("您正在游戏中,强行退出将被扣分,确实要强退吗?"),MB_ICONQUESTION|MB_YESNO,0)!=IDYES) { return TRUE; } } //投递关闭 PostMessage(WM_CLOSE,0,0); return TRUE; } case IDC_OPTION: //选项按钮 { //显示配置 CDlgGameOption DlgGameOption; if (DlgGameOption.CreateGameOption(NULL,0)==true) { return true; } return true; } case IDC_MUTE: { //定义变量 CGlobalUnits *pGlobalUnits=CGlobalUnits::GetInstance(); pGlobalUnits->m_bMuteStatuts=!pGlobalUnits->m_bMuteStatuts; //设置按钮 HINSTANCE hInstance=GetModuleHandle(GAME_FRAME_DLL_NAME); m_btMuteContrl.SetButtonImage((pGlobalUnits->m_bMuteStatuts==false)?IDB_BT_MUTE:IDB_BT_SLIENT,hInstance,true,false); //状态处理 if(pGlobalUnits->m_bMuteStatuts) { pGlobalUnits->StopSound(); } //通知游戏 if(m_pIClientKernel) { m_pIClientKernel->OnGameOptionChange(); } return true; } case IDC_RULE: { try { //创建对象 if (m_pDlgGameRule==NULL) m_pDlgGameRule=new CDlgGameRule; //创建窗口 if (m_pDlgGameRule->m_hWnd==NULL) { AfxSetResourceHandle(GetModuleHandle(GAME_FRAME_DLL_NAME)); m_pDlgGameRule->Create(IDD_GAME_RULE,GetDesktopWindow()); AfxSetResourceHandle(GetModuleHandle(NULL)); } //显示窗口 m_pDlgGameRule->ShowWindow(SW_RESTORE); m_pDlgGameRule->SetForegroundWindow(); return true; } catch (...) { ASSERT(FALSE); return false; } return true; } case IDC_CONTROL: //控制按钮 { //设置变量 m_bShowControl = !m_bShowControl; //更新按钮 HINSTANCE hInstance=GetModuleHandle(GAME_FRAME_DLL_NAME); m_btControl.SetButtonImage(IDB_BT_CONTROL_BACK,(m_bShowControl==false)?TEXT("BT_GAME_LIST_SHOW"):TEXT("BT_GAME_LIST_HIDE"),hInstance,true,false); //调整界面 CRect rcClient; GetClientRect(&rcClient); RectifyControl(rcClient.Width(),rcClient.Height()); return true; } } return __super::OnCommand(wParam,lParam); }