void CShowScore::OnPaint() { CPaintDC dc(this); dc.SetBkMode(TRANSPARENT); CFont font; font.CreateFont(-12,0,0,0,400,NULL,NULL,NULL,134,3,2,1,2,TEXT("宋体")); dc.SelectObject(&font); dc.SetTextColor(m_textcr); CGameImageHelper handle(&m_bk); handle.BitBlt(dc.GetSafeHdc(),0,0); TCHAR sz[100]; CRect rect; for(int i = 0; i < MAX_PEOPLE; i ++) { if(m_pUserItem[i] == NULL) continue; wsprintf(sz,"%s",m_pUserItem[i]->GameUserInfo.nickName); rect.left=m_listx; rect.right=rect.left+m_w1; rect.top=m_listy+i*(m_itemh+w); rect.bottom=rect.top+m_itemh; dc.DrawText(sz,lstrlen(sz),&rect,DT_CENTER|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS); wsprintf(sz,"%d",m_lastscore[i]); rect.left=m_listx+m_w1+w; rect.right=rect.left+m_w2; rect.top=m_listy+i*(m_itemh+w); rect.bottom=rect.top+m_itemh; dc.DrawText(sz,lstrlen(sz),&rect,DT_CENTER|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS); wsprintf(sz,"%d",m_allscore[i]); rect.left=m_listx+m_w1+w*2+m_w3-5; rect.right=rect.left+m_w3; rect.top=m_listy+i*(m_itemh+w); rect.bottom=rect.top+m_itemh; dc.DrawText(sz,lstrlen(sz),&rect,DT_CENTER|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS); //if(m_ucomtype==TY_MONEY_GAME) { TCHAR szNum[128]; GetNumString(szNum, m_lastmoney[i], Glb().m_nPowerOfGold,Glb().m_bUseSpace, Glb().m_strSpaceChar); wsprintf(sz,"%s",szNum); rect.left=m_listx+m_w1+m_w2+m_w3+w*3-2; rect.right=rect.left+m_w4; rect.top=m_listy+i*(m_itemh+w); rect.bottom=rect.top+m_itemh; dc.DrawText(sz,lstrlen(sz),&rect,DT_CENTER|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS); //wsprintf(sz,"%d",m_allmoney[i]); GetNumString(szNum, m_allmoney[i], Glb().m_nPowerOfGold,Glb().m_bUseSpace, Glb().m_strSpaceChar); wsprintf(sz,"%s",szNum); rect.left=m_listx+m_w1+m_w2+m_w3+w+m_w4; rect.right=rect.left+m_w5; rect.top=m_listy+i*(m_itemh+w); rect.bottom=rect.top+m_itemh; dc.DrawText(sz,lstrlen(sz),&rect,DT_CENTER|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS); } } }
void CPropPannel::OnGivenProp(_TAG_PROP_GIVE_FOR * propGiveFor) { _TAG_PROP_GIVE * propGive=(_TAG_PROP_GIVE*)&propGiveFor->propGiveInfo; _TAG_USERPROP * userProp=(_TAG_USERPROP*)&propGiveFor->propInfo; if(userProp->nPropID==curPropID) { UpdateData(); m_nHoldCount=userProp->nHoldCount; UpdateData(FALSE); } //需要修改本地金币 CString stip; TCHAR szNum[128]; GetNumString(szNum, propGive->iPropValue, Glb().m_nPowerOfGold,Glb().m_bUseSpace, Glb().m_strSpaceChar); CBcfFile fMsg(CBcfFile::GetAppPath()+"ClientMessage.bcf"); CString strMessage = fMsg.GetKeyVal("PropPanelDlg","PlayerGiveTool","玩家 %s 送给您 %d 个 %s 道具,价值 %s 金币。"); stip.Format(strMessage,propGive->szUser,propGive->nGiveCount,userProp->szPropName,szNum); CMainRoomEx *pWnd=(CMainRoomEx*)pParentWnd; for(int i = 0; i < MAX_GAME_ROOM; i ++) { if(pWnd->m_RoomInfo[i].pGameRoomWnd != NULL) { pWnd->m_RoomInfo[i].pGameRoomWnd->PostMessage(WM_USER+151,0,0); pWnd->m_RoomInfo[i].pRoomInfoWnd->PostMessage(WM_USER+151,0,0); ((CGameRoomEx*)pWnd->m_RoomInfo[i].pGameRoomWnd)->InsertSystemMessageWithGame(stip);// } } }
//功能按钮 我的家园 void CGameFrame::OnBnClickedButton3() { CString urlStr; urlStr.Format("%s%s", Glb().m_MainHomeUrl, Glb().m_MemberUrl); m_DlgControlBar.WebBrowse(TEXT(urlStr),true); return; }
void CPropPannel::OnBnClickedUse() { int nPropIndex=-1; int propCount=Glb().userPropLibrary.GetCount(); _TAG_USERPROP * userProp=NULL; for(int i=0;i<propCount;i++) { userProp=Glb().userPropLibrary.GetAt(i); if(userProp->nPropID==curPropID) { nPropIndex=i; break; } } CMainRoomEx *pWnd=(CMainRoomEx*)pParentWnd; if(userProp->attribAction & 0x80 || userProp->attribAction &0x100) {//大喇叭和小喇叭 for(int i = 0; i < MAX_GAME_ROOM; i ++) if(pWnd->m_RoomInfo[i].pGameRoomWnd != NULL) { //pWnd->m_RoomInfo[i].pGameRoomWnd->PostMessage(WM_USER+156,nPropIndex,0); pWnd->m_RoomInfo[i].pGameRoomWnd->PostMessage(WM_USER+156,(WPARAM)userProp,0); this->ShowWindow(SW_HIDE); } return; } if(userProp->attribAction&0x1 && m_nOpenFrom==1) { //AFCMessageBox("对不起,该道具只能在游戏中使用!","提示"); CMainRoomEx *pWnd=(CMainRoomEx*)pParentWnd; for(int i = 0; i < MAX_GAME_ROOM; i ++) { if(pWnd->m_RoomInfo[i].pGameRoomWnd != NULL) { CBcfFile fMsg(CBcfFile::GetAppPath()+"ClientMessage.bcf"); CString strMessage = fMsg.GetKeyVal("PropPanelDlg","BeUsedOnlyInGame","对不起,该道具只能在游戏中使用!"); ((CGameRoomEx*)pWnd->m_RoomInfo[i].pGameRoomWnd)->InsertSystemMessageWithGame(strMessage.GetBuffer());// } } return; } if(nPropIndex==-1) return; for(int i = 0; i < MAX_GAME_ROOM; i ++) if(pWnd->m_RoomInfo[i].pGameRoomWnd != NULL) { if(m_nOpenFrom==0) pWnd->m_RoomInfo[i].pGameRoomWnd->PostMessage(WM_USER+152,nPropIndex,0); else pWnd->m_RoomInfo[i].pRoomInfoWnd->PostMessage(WM_USER+152,nPropIndex,0); this->ShowWindow(SW_HIDE); } }
void CPropPannel::processLocalProp() { int propCount=Glb().userPropLibrary.GetCount(); _TAG_USERPROP * userProp=NULL; bool bFoundProp=false; for(int i=0;i<propCount;i++) { userProp=Glb().userPropLibrary.GetAt(i); if(userProp->nPropID==curPropID) { bFoundProp=true; break; } } CMainRoomEx *pWnd=(CMainRoomEx*)pParentWnd; CString stime; stime.Format("%d",CTime::GetCurrentTime()); long curtime=atol(stime); int nPrice=curPropPrice; if(pWnd->m_PlaceUserInfo.iVipTime>curtime) nPrice=curPropVipPrice; m_bnUse.EnableWindow(FALSE); m_bnGive.EnableWindow(FALSE); m_ctlGiveUser.EnableWindow(FALSE); m_ctlGiveCount.EnableWindow(FALSE); if(bFoundProp) { m_nHoldCount=userProp->nHoldCount; if(m_nHoldCount>0) { m_bnUse.EnableWindow(TRUE); m_ctlGiveUser.EnableWindow(TRUE); CString rString; m_ctlGiveUser.GetWindowText(rString); if(rString.Trim()!="") { m_bnGive.EnableWindow(TRUE); m_ctlGiveCount.EnableWindow(TRUE); } } } else m_nHoldCount=0; m_nBuyCount=1; TCHAR szNum[128]; GetNumString(szNum, nPrice*m_nBuyCount, Glb().m_nPowerOfGold,Glb().m_bUseSpace, Glb().m_strSpaceChar); CBcfFile fMsg(CBcfFile::GetAppPath()+"ClientMessage.bcf"); CString strMessage = fMsg.GetKeyVal("PropPanelDlg","NeedCoins","(您是%s,需要 %s 金币)"); m_strBuyMoney.Format(strMessage,(pWnd->m_PlaceUserInfo.iVipTime>curtime)? fMsg.GetKeyVal("PropPanelDlg","VIPMember","VIP会员"): fMsg.GetKeyVal("PropPanelDlg","NormalUser","普通用户"),szNum); UpdateData(FALSE); m_ctlGiveCount.SetWindowText("1"); }
///查询 void CBankDlg::OnBnClickedQuery() { CString s=CBcfFile::GetAppPath();/////本地路径 CBcfFile f( s + "..\\bzgame.bcf"); CString key="BZW"; CString url; TCHAR szUrl[20]; wsprintf(szUrl,"bankurl_Query"); url=f.GetKeyVal(key,szUrl,Glb().m_CenterServerPara.m_strHomeADDR); TCHAR surl[512]; wsprintf( surl, "%s?userid=%d&token=%s", url, m_pMeUserInfo->GameUserInfo.dwUserID, Glb().m_TML_SN); ShellExecute(NULL,"open",surl,NULL,NULL,SW_MAXIMIZE|SW_SHOW); return; }
void CPropSelUser::loadSkin(void) { CString s; s.Format("%s\\image\\client\\%s\\dialog\\dialog.bmp",CBcfFile::GetAppPath(true),Glb().m_skin); #ifndef BZ_ZLIB imgDialog=Image::FromFile(s.AllocSysString()); #else CUnZipRes unZipRes; IStream * pStream=NULL; TCHAR *pchar=s.GetBuffer(s.GetLength()+1); pStream=unZipRes.LoadFileResFromZip(pchar); imgDialog=new Image(pStream); if(pStream!=NULL) { pStream->Release(); pStream=NULL; } #endif TCHAR path[MAX_PATH]; wsprintf(path,"%s\\image\\client\\%s\\dialog\\log_exit_bt.bmp",CBcfFile::GetAppPath(true),Glb().m_skin);//win_close.bmp m_bnClose.LoadButtonBitmap(path,false); CRect rc; GetClientRect(&rc); GetDlgItem(IDC_CLOSE)->MoveWindow(rc.Width()-25,5,17,17); }
void CPropPannel::OnGetPropInformation(_TAG_USERPROP* userProp) { // 此处是从服务器传来的消息,与本地的数据有可能不一致 if(userProp->nPropID==curPropID) { UpdateData(); m_nHoldCount=userProp->nHoldCount; UpdateData(FALSE); } CBcfFile fMsg(CBcfFile::GetAppPath()+"ClientMessage.bcf"); //需要修改本地金币 CMainRoomEx *pWnd=(CMainRoomEx*)pParentWnd; CString stip; pWnd->m_PlaceUserInfo.i64Bank-=userProp->dwCost;//由ZXD修改 TCHAR szNum[128]; GetNumString(szNum, pWnd->m_PlaceUserInfo.i64Bank, Glb().m_nPowerOfGold,Glb().m_bUseSpace, Glb().m_strSpaceChar); CString strMessage = fMsg.GetKeyVal("PropPanelDlg","BuyToolsWithCoin","购买道具使用的是您银行中的金币,您现在银行中有 %s 金币。"); stip.Format(strMessage, szNum); //stip.Format("购买道具使用的是您银行中的金币,您现在银行中有 %d 金币。",pWnd->m_PlaceUserInfo.dwBank); m_ctlTip.SetWindowText(stip); for(int i = 0; i < MAX_GAME_ROOM; i ++) { if(pWnd->m_RoomInfo[i].pGameRoomWnd != NULL) { pWnd->m_RoomInfo[i].pGameRoomWnd->PostMessage(WM_USER+151,userProp->dwCost,0); pWnd->m_RoomInfo[i].pRoomInfoWnd->PostMessage(WM_USER+151,userProp->dwCost,0); // ((CGameRoomEx*)pWnd->m_RoomInfo[i].pGameRoomWnd)->InsertSystemMessageWithGame(stip);// } } if(m_nHoldCount>0) { m_bnUse.EnableWindow(TRUE); m_ctlGiveUser.EnableWindow(TRUE); CString rString; m_ctlGiveUser.GetWindowText(rString); if(rString.Trim()!="") { m_bnGive.EnableWindow(TRUE); m_ctlGiveCount.EnableWindow(TRUE); } } }
void CPropPannel::OnEnChangeBuycount() { CString rString; m_ctlBuyCount.GetWindowText(rString); if(atoi(rString)==0) m_ctlBuyCount.SetWindowText("1"); UpdateData(); CBcfFile fMsg(CBcfFile::GetAppPath()+"ClientMessage.bcf"); CString strMessage; if(m_nBuyCount>255) m_nBuyCount=255; //wushuqun 2009.9.3 //不允许购买负道具 if (m_nBuyCount < 0) { strMessage = fMsg.GetKeyVal("PropPanelDlg","ErrorToolNumber","您好,您的输入道具数量不正确,请重新输入!"); //AFCMessageBox(strMessage); DUIMessageBox(m_hWnd,MB_ICONINFORMATION|MB_OK,"系统提示",false,strMessage); return; } CMainRoomEx *pWnd=(CMainRoomEx*)pParentWnd; CString stime; stime.Format("%d",CTime::GetCurrentTime()); long curtime=atol(stime); int nPrice=curPropPrice; if(pWnd->m_PlaceUserInfo.iVipTime>curtime) nPrice=curPropVipPrice; TCHAR szNum[128]; GetNumString(szNum, nPrice*m_nBuyCount, Glb().m_nPowerOfGold,Glb().m_bUseSpace, Glb().m_strSpaceChar); // m_strBuyMoney.Format("(您是%s,需要 %s 金币)",(pWnd->m_PlaceUserInfo.iVipTime>curtime)?"VIP会员":"普通用户",szNum); strMessage = fMsg.GetKeyVal("PropPanelDlg","NeedCoins","(您是%s,需要 %s 金币)"); m_strBuyMoney.Format(strMessage,(pWnd->m_PlaceUserInfo.iVipTime>curtime)? fMsg.GetKeyVal("PropPanelDlg","VIPMember","VIP会员"): fMsg.GetKeyVal("PropPanelDlg","NormalUser","普通用户"),szNum); UpdateData(FALSE); if(nPrice*m_nBuyCount>pWnd->m_PlaceUserInfo.i64Bank) m_bnBuy.EnableWindow(FALSE); else m_bnBuy.EnableWindow(TRUE); }
void CVipTipDlg::OnBnClickedOk() { CString s=CBcfFile::GetAppPath ();/////本地路径 CBcfFile f( s + "bzgame.bcf"); CString url; url=f.GetKeyVal("BZW","BuyVipURL","/Manage/VipApply.aspx "); url = Glb().m_CenterServerPara.m_strWebRootADDR + url; ShellExecute(NULL,"open",url,NULL,NULL,SW_MAXIMIZE|SW_SHOW); OnOK(); }
//左键单击 void __cdecl CPlazaViewItem::OnTreeLeftClick(CListItem *pListItem, HTREEITEM hTreeItem, CTreeCtrl * pTreeCtrl) { //效验参数 if (pListItem==NULL) { return; } //消息处理 switch (pListItem->GetItemGenre()) { case ItemGenre_Inside: { //变量定义 CListInside * pListInside=(CListInside *)pListItem; tagGameInside * pGameInside=pListInside->GetItemInfo(); WebBrowse(TEXT(Glb().m_MainHomeUrl),false); return; } case ItemGenre_Kind: //游戏类型 { //变量定义 CListKind * pListKind=(CListKind *)pListItem; tagGameKind * pGameKind=pListKind->GetItemInfo(); //连接规则 TCHAR szRuleUrl[256]=TEXT(""); // _snprintf(szRuleUrl,sizeof(szRuleUrl),TEXT("%sGameRule.asp?KindID=%ld"), HOME_WEB_URL, pGameKind->wKindID); _snprintf(szRuleUrl,sizeof(szRuleUrl),TEXT("%s%d"), Glb().m_HelpUrlAddr, pGameKind->wKindID); //_snprintf(szRuleUrl,sizeof(szRuleUrl),TEXT("http://61.187.55.150/"),pGameKind->wKindID); WebBrowse(szRuleUrl,true); return; } } return; }
void CPropPannel::openPannel(int openFrom,CString strGiveUser, int propID) { CMainRoomEx *pWnd=(CMainRoomEx*)pParentWnd; CBcfFile fMsg(CBcfFile::GetAppPath()+"ClientMessage.bcf"); CString strMessage; if(!pParentWnd) { for(int i = 0; i < MAX_GAME_ROOM; i ++) { if(pWnd->m_RoomInfo[i].pGameRoomWnd != NULL) { strMessage = fMsg.GetKeyVal("PropPanelDlg","ErrorOpenToolBox","对不起,打开道具箱出错"); ((CGameRoomEx*)pWnd->m_RoomInfo[i].pGameRoomWnd)->InsertSystemMessageWithGame(strMessage.GetBuffer()); } } return ; } if(openFrom!=-1) m_nOpenFrom=openFrom; CString stip; TCHAR szNum[128]; GetNumString(szNum, pWnd->m_PlaceUserInfo.i64Bank, Glb().m_nPowerOfGold,Glb().m_bUseSpace, Glb().m_strSpaceChar); strMessage = fMsg.GetKeyVal("PropPanelDlg","BuyToolsWithCoin","购买道具使用的是您银行中的金币,您现在银行中有 %s 金币。"); stip.Format(strMessage, szNum); m_ctlTip.SetWindowText(stip); m_ctlGiveUser.SetWindowText(strGiveUser); CenterWindow(); this->ShowWindow(SW_SHOW); CString surl; //surl.Format("%s?userid=%d&bgcolor=%X%X%X",m_strPropUrl,pWnd->m_PlaceUserInfo.dwUserID,m_bkcolor&0xFF,(m_bkcolor&0xFF00)>>8,m_bkcolor>>16); surl.Format("%s?propid=%d&bgcolor=%X%X%X",m_strPropUrl,propID,m_bkcolor_R,m_bkcolor_G,m_bkcolor_B); m_ie.Navigate(surl,0,0,0,0); m_ctlBuyCount.SetFocus(); }
void CBankDlg::UpdateUserMoney(int OptType, long nMoney) { if( OptType == 0 ) //取出 { m_BankMoney -= nMoney; m_RoomMoney +=nMoney; } else //存入 { m_BankMoney += nMoney; m_RoomMoney -= nMoney; } if( GetSafeHwnd() != NULL ) { CString strBank, strRoom; TCHAR szNum[128]; GlbGetNumString(szNum, m_BankMoney, Glb().m_nPowerOfGold/*, true*/, Glb().m_bUseSpace, Glb().m_strSpaceChar); strBank.Format("%s", szNum); GlbGetNumString(szNum, m_RoomMoney, Glb().m_nPowerOfGold/*, true*/, Glb().m_bUseSpace, Glb().m_strSpaceChar); strRoom.Format("%s", szNum); GetDlgItem(IDC_EDIT_MONEY)->SetWindowText(strBank); GetDlgItem(IDC_EDIT_MONEY_ROOM)->SetWindowText(strRoom); } }
BOOL CCheckPSW::OnInitDialog() { CDialog::OnInitDialog(); // TODO: 在此添加额外的初始化 CString s=CBcfFile::GetAppPath() + "..\\"; //本地路径的上一层目录 CBcfFile f( s + "skin.bcf"); CString key=Glb().m_skin; TCHAR path[MAX_PATH]; CString skinfolder; skinfolder.Format("%s%s", "..\\", f.GetKeyVal(key,"skinfolder","image\\client\\skin0\\")); wsprintf(path,"%slogon\\check_psw.bmp",skinfolder); m_bk.SetLoadInfo(path,TRUE); CenterWindow(); CGameImageHelper help(&m_bk); HRGN hRgn; hRgn = AFCBmpToRgn(help,m_bk.GetPixel(0,0),RGB(1,1,1)); if(hRgn) SetWindowRgn(hRgn,TRUE); ((CEdit*)GetDlgItem(IDC_EDIT_TWOPSW))->SetLimitText(20); ((CEdit*)GetDlgItem(IDC_EDIT_TWOPSW))->MoveWindow(130,67,80,16); CGameImage m_bt; wsprintf(path,"%slogon\\button.bmp",skinfolder); m_BtCancel.LoadButtonBitmap(path,false); m_bt.SetLoadInfo(path,CGameImageLink::m_bAutoLock); CGameImageHelper bthelp(&m_bt); HRGN hRgn2; hRgn2=AFCBmpToRgn(bthelp,m_bt.GetPixel(0,0),RGB(1,1,1)); if(hRgn2) m_BtCancel.SetWindowRgn(hRgn2,true); wsprintf(path,"%slogon\\button.bmp",skinfolder); m_BtOk.LoadButtonBitmap(path,false); m_bt.SetLoadInfo(path,CGameImageLink::m_bAutoLock); hRgn2=AFCBmpToRgn(bthelp,m_bt.GetPixel(0,0),RGB(1,1,1)); if(hRgn2) m_BtOk.SetWindowRgn(hRgn2,true); m_BtOk.ShowWindow(SW_SHOW); m_BtCancel.ShowWindow(SW_SHOW); return TRUE; // return TRUE unless you set the focus to a control // 异常: OCX 属性页应返回 FALSE }
void CCheckPSW::OnOK() { // TODO: 在此添加专用代码和/或调用基类 GetDlgItemText(IDC_EDIT_TWOPSW, m_szScrPass, sizeof(m_szScrPass)); if(strlen(m_szScrPass) == 0|| strlen(m_szScrPass) > 32) { AFCMessageBox("请输入取款密码","提示"); return; } //wushuqun 2009.6.1 //修改支持MD5 和SHA 加密方式 CenterServerMsg& par=Glb().m_CenterServerPara; //md5方式 if( par.m_nEncryptType == 1) { unsigned char szMDTemp[16]; MD5_CTX Md5; Md5.MD5Update((unsigned char *)m_szScrPass,lstrlen(m_szScrPass)); Md5.MD5Final(szMDTemp); for (int i = 0; i < 16; i ++) wsprintf(&m_szMD5Pass[i * 2], "%02x", szMDTemp[i] ); } //sha加密方式 if(par.m_nEncryptType == 2) { unsigned szMDTemp[5]={0}; CString strSha=m_szScrPass; SHA1 sha; sha.Reset(); sha<<strSha; sha.Result(szMDTemp); CString strSingle; strSha=""; for (int i=0;i<5;i++) { strSingle.Format("%.8x",szMDTemp[i]); strSha+=strSingle; } wsprintf(m_szMD5Pass,"%s",strSha); } ////////////////////////// CDialog::OnOK(); }
//初始化函数 BOOL CPlazaViewItem::OnInitDialog() { __super::OnInitDialog(); //设置接口 m_Splitter.SetSplitterSink(this); g_pControlBar->SetPlazaViewItem(this); //创建控件 m_pHtmlBrower = new CHtmlBrower; m_pHtmlBrower->Create(NULL,NULL,WS_VISIBLE|WS_CHILD,CRect(0,0,0,0),this,20,NULL); char myUrlStr[50] = "http://www.jiauu.com"; // memcpy( (char *)szStationPage,(char *)myUrlStr ,sizeof(myUrlStr)); //Doctor m_pHtmlBrower->Navigate(szStationPage); m_pHtmlBrower->Navigate(TEXT(Glb().m_MainHomeUrl)); //创建按钮 m_WEB_BEFORE.Create(NULL,WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_WEB_BEFORE); m_WEB_BRUSH.Create(NULL,WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_WEB_BRUSH); m_WEB_HOME.Create(NULL,WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_WEB_HOME); m_WEB_NEXT.Create(NULL,WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_WEB_NEXT); m_WEB_STOP.Create(NULL,WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_WEB_STOP); //设置按钮 m_WEB_BEFORE.SetButtonImage(IDB_BT_WEB_BEFORE,AfxGetInstanceHandle(),false); m_WEB_BRUSH.SetButtonImage(IDB_BT_WEB_BRUSH,AfxGetInstanceHandle(),false); m_WEB_HOME.SetButtonImage(IDB_BT_WEB_HOME,AfxGetInstanceHandle(),false); m_WEB_NEXT.SetButtonImage(IDB_BT_WEB_NEXT,AfxGetInstanceHandle(),false); m_WEB_STOP.SetButtonImage(IDB_BT_WEB_STOP,AfxGetInstanceHandle(),false); //设置控件 m_ServerItemView.InitServerItemView(this); g_GlobalUnits.m_ServerListManager.InitServerListManager(&m_ServerItemView); //登陆广场 SendLogonMessage(); //设置变量 m_bInitDialog=true; return TRUE; }
BOOL CGetPoint::OnInitDialog() { CDialog::OnInitDialog(); CString s=CBcfFile::GetAppPath ();/////本地路径 CINIFile f( s + Glb().m_skin); CString key=TEXT("config"); TCHAR path[MAX_PATH]; CString skinfolder; skinfolder=f.GetKeyVal(key,"skinfolder","image\\game\\"); skinfolder=s+"\\"+skinfolder; wsprintf(path,"%sgame\\point\\getpoint_bk.bmp",skinfolder); CGameImage m_bt; m_bkimage.SetLoadInfo(path,CGameImageLink::m_bAutoLock); CGameImageHelper ImageHandle(&m_bkimage); int cx,cy; HRGN hRgn=AFCBmpToRgn(ImageHandle,RGB(255, 0, 255),RGB(1,1,1)); if (hRgn!=NULL) { SetWindowRgn(hRgn,TRUE); ///{{ Added by zxd 20100709 释放区域对象 DeleteObject(hRgn); ///Added by zxd 20100709 释放区域对象}} } cx=ImageHandle.GetWidth(); cy=ImageHandle.GetHeight(); SetWindowPos(NULL,0,0,cx,cy,SWP_NOMOVE|SWP_NOZORDER); wsprintf(path,"%sgame\\point\\ok_bt.bmp",skinfolder); m_btok.LoadButtonBitmap(path,false); wsprintf(path,"%sgame\\point\\cancel_bt.bmp",skinfolder); m_btcancel.LoadButtonBitmap(path,false); m_bkBrush = CreateSolidBrush(m_bkimage.GetPixel(145,35)); return TRUE; // return TRUE unless you set the focus to a control // 异常: OCX 属性页应返回 FALSE }
//左键双击 void __cdecl CPlazaViewItem::OnTreeLeftDBClick(CListItem *pListItem, HTREEITEM hTreeItem, CTreeCtrl *pTreeCtrl) { //效验参数 if(pListItem==NULL) { return ; } //消息处理 switch (pListItem->GetItemGenre()) { //游戏类型 case ItemGenre_Kind: { CListKind *pListKind = (CListKind *)pListItem; tagGameKind *pGameKind = pListKind->GetItemInfo(); //Add by doctor 20071014 //大类型ID int gameTypeInt = pGameKind->wTypeID ; CString gameExeStr; gameExeStr.Format("%s", pGameKind->szProcessName ); if ( IsTimeOut()) {} else { //是否为单机,FLASH游戏 switch (gameTypeInt) { //单机游戏 case 5: { CString lpszFileName ; CString gamePath; CString applicationPath; CFileFind fFind; //获得应用程序路径 int nPos; GetModuleFileName(NULL,applicationPath.GetBufferSetLength (MAX_PATH+1),MAX_PATH); applicationPath.ReleaseBuffer(); nPos = applicationPath.ReverseFind('\\'); applicationPath = applicationPath.Left(nPos); gamePath = applicationPath + "\\LocalGame"; lpszFileName = gamePath +"\\"+gameExeStr;//这里修改成你的调用应用程序的文件名称 //启动单机游戏 if(!fFind.FindFile(lpszFileName)) { AfxMessageBox("没有找到调用的应用程序!"+ lpszFileName); return ; } else { CString cmdLine; cmdLine.Format("-%s", "FlyGame2007"); // ShellExecute(NULL,"open", gameExeStr, cmdLine ,NULL,SW_SHOW); ShellExecute(NULL,"open", gameExeStr, cmdLine ,gamePath,SW_SHOW); // ShellExecute(NULL,NULL,_T(gameExeStr),NULL, gamePath,NULL); } return; } break; //flash游戏 case 6: { //启动FLASH游戏 //连接规则 TCHAR szRuleUrl[256]=TEXT(""); _snprintf(szRuleUrl,sizeof(szRuleUrl),TEXT("%sPlayGame.asp?KindID=%ld"), Glb().m_MainHomeUrl, pGameKind->wKindID); WebBrowse(szRuleUrl,true); return; } break; default: {} } //End add }//End if //安装判断 if (pListKind->m_bInstall==false) { TCHAR szBuffer[512]=TEXT(""); _snprintf(szBuffer,sizeof(szBuffer),TEXT("【%s】还没有安装,现在是否下载?"),pGameKind->szKindName); int nResult = ShowMessageBox(szBuffer, MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON1); if(nResult == IDYES) { g_GlobalAttemper.DownLoadClient(pGameKind->szKindName, pGameKind->wKindID, true); } } return; } //进程类型 case ItemGenre_Process: { CListProcess *pListProcess = (CListProcess *)pListItem; tagGameProcess *pGameProcess= pListProcess->GetItemInfo(); //构造命令行 CString strCommonLine; tagGlobalUserData & UserData=g_GlobalUnits.GetGolbalUserData(); strCommonLine.Format(TEXT("%s /UserToken:%ld#%s#%s /KindID:%ld /WndPlaza:%ld"), pGameProcess->szProcessName, UserData.dwUserID, UserData.szAccounts, UserData.szPassWord, pGameProcess->wKindID, m_hWnd); //启动游戏客户端 STARTUPINFO StartInfo; PROCESS_INFORMATION ProcessInfo; memset(&StartInfo,0,sizeof(StartInfo)); memset(&ProcessInfo,0,sizeof(ProcessInfo)); StartInfo.cb=sizeof(StartInfo); StartInfo.wShowWindow=SW_SHOWMAXIMIZED; BOOL bSuccess=CreateProcess(NULL,strCommonLine.GetBuffer(),NULL,NULL,FALSE,CREATE_DEFAULT_ERROR_MODE,NULL,NULL,&StartInfo,&ProcessInfo); strCommonLine.ReleaseBuffer(); if(bSuccess == FALSE) { //下载询问 TCHAR szBuffer[512]=TEXT(""); _snprintf(szBuffer,sizeof(szBuffer),TEXT("【%s】还没有安装,现在是否下载?"),pGameProcess->szKindName); int nResult=ShowMessageBox(szBuffer,MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON1); if (nResult==IDYES) g_GlobalAttemper.DownLoadClient(pGameProcess->szKindName,pGameProcess->wKindID,true); } else { CloseHandle(ProcessInfo.hThread); CloseHandle(ProcessInfo.hProcess); } return; } //游戏房间 case ItemGenre_Server: { CListServer * pListServer=(CListServer *)pListItem; g_pControlBar->CreateRoomViewItem(pListServer); return; } }//End switch (pListItem->GetItemGenre()) return; }
//建立消息 int CGameFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (__super::OnCreate(lpCreateStruct)==-1) return -1; //设置属性 ModifyStyle(WS_CAPTION|WS_BORDER,0,0); //设置图标 HICON hIcon=LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_MAINFRAME)); SetIcon(hIcon,TRUE); SetIcon(hIcon,FALSE); //设置标题 CString strTitle; strTitle.LoadString(AfxGetInstanceHandle(),IDS_MAIN_TITLE); SetWindowText(strTitle); //创建广告 m_pAdBrower = new CHtmlBrower; m_pAdBrower->Create(NULL,NULL,WS_VISIBLE|WS_CHILD,CRect(0,0,0,0),this,20,NULL); // m_pAdBrower->Navigate(TEXT("http://61.187.55.150/AD/FrameAD.htm"));] CString urlStr; urlStr.Format("%sAD/FrameAD.htm", Glb().m_MainHomeUrl); m_pAdBrower->Navigate(TEXT(urlStr)); m_pAdBrower->EnableBrowser(true); //创建按钮 m_btMin.Create(NULL,WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_BT_MIN); m_btClose.Create(NULL,WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_BT_CLOSE); m_btButton1.Create(TEXT(""),WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_BT_BUTTON_1); m_btButton2.Create(TEXT(""),WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_BT_BUTTON_2); m_btButton3.Create(TEXT(""),WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_BT_BUTTON_3); m_btButton4.Create(TEXT(""),WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_BT_BUTTON_4); m_btButton5.Create(TEXT(""),WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_BT_BUTTON_5); //m_btButton6.Create(TEXT(""),WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_BT_BUTTON_6); //m_btButton7.Create(TEXT(""),WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_BT_BUTTON_7); //设置图片 m_btMin.SetButtonImage(IDB_FRAME_MIN,AfxGetInstanceHandle(),false); m_btClose.SetButtonImage(IDB_FRAME_CLOSE,AfxGetInstanceHandle(),false); m_btButton1.SetButtonImage(IDB_FRAME_BT_BUTTON_1,AfxGetInstanceHandle(),false); m_btButton2.SetButtonImage(IDB_FRAME_BT_BUTTON_2,AfxGetInstanceHandle(),false); m_btButton3.SetButtonImage(IDB_FRAME_BT_BUTTON_3,AfxGetInstanceHandle(),false); m_btButton4.SetButtonImage(IDB_FRAME_BT_BUTTON_4,AfxGetInstanceHandle(),false); m_btButton5.SetButtonImage(IDB_FRAME_BT_BUTTON_5,AfxGetInstanceHandle(),false); //m_btButton6.SetButtonImage(IDB_FRAME_BT_BUTTON_6,AfxGetInstanceHandle(),false); //m_btButton7.SetButtonImage(IDB_FRAME_BT_BUTTON_7,AfxGetInstanceHandle(),false); //建立提示控件 m_ToolTipCtrl.Create(this); m_ToolTipCtrl.Activate(TRUE); m_ToolTipCtrl.AddTool(GetDlgItem(IDC_BT_MIN),TEXT("最小化游戏广场")); m_ToolTipCtrl.AddTool(GetDlgItem(IDC_BT_CLOSE),TEXT("退出游戏广场")); //创建控件 m_DlgControlBar.Create(IDD_CONTROL_BAR,this); m_DlgGamePlaza.Create(IDD_GAME_PLAZA,this); m_DlgControlBar.ActivePlazaViewItem(); m_DlgControlBar.ShowWindow(SW_SHOW); //显示窗口 CRect rcRect; SystemParametersInfo(SPI_GETWORKAREA,0,&rcRect,SPIF_SENDCHANGE); SetWindowPos(&wndTop,rcRect.left,rcRect.top,rcRect.Width(),rcRect.Height(),SWP_DRAWFRAME|SWP_SHOWWINDOW); return 0; }
afx_msg void CPlazaViewItem::OnBnClickedHOME() { m_pHtmlBrower->Navigate(Glb().m_MainHomeUrl); }
//初始化函数 BOOL CGamePlaceApp::InitInstance() { //TODO: call AfxInitRichEdit2() to initialize richedit2 library. Glb().m_release=false;//是否发布版 Glb().m_weblogon=false; //是否互联星空登录 Glb().m_autoreg=false; //不用设置,此变量程序自动改变 #ifndef MY_DEBUG Glb().m_release=true;//是否发布版 // try #endif { //定义变量 #ifndef MY_DEBUG CBcfFile _f(CBcfFile::GetAppPath()+"bzgame.bcf"); CString _mutexId = _f.GetKeyVal("BZW","mutexid","GamePlaceChangeed10001000"); CMutex Mutex(FALSE, _mutexId, NULL);////互斥 if (Mutex.Lock(0)==FALSE) return FALSE; SetUnhandledExceptionFilter(ExceptionFilter); #endif #ifdef BZ_ZLIB ///<读取资源文件 ///<先获取密码 add by wxx CBcfFile fMsg(CBcfFile::GetAppPath()+"bzgame.bcf"); CString strPassWord; strPassWord = fMsg.GetKeyVal("BZW","LoginIP1","www.szbzw.com"); char *password = strPassWord.GetBuffer(strPassWord.GetLength()+1); ///<读取文件 CUnZipRes unZipRes; char * pPW=new char[strlen(password)+1]; memcpy(pPW,password,strlen(password)+1); unZipRes.SetPassWord(pPW); if(!CBcfFile::IsFileExist("image.r"))///add by wxx 0712 { MessageBox(NULL,"资源文件有损!","提示",MB_OK); return FALSE; } CString strPackage = CBcfFile::GetAppPath() + "image.r"; BzDui::CPaintManagerUI::SetResourcePackage(strPackage.GetBuffer(),password); unZipRes.ReadFile("image.r",(unsigned char*)pPW); delete []pPW; #endif //初始化 InitCommonControls(); CWinApp::InitInstance(); #ifndef MY_DEV // 初始BzCrashRpt BzCrash_Initiation(); BzCrash_DisableSetUnhandledExceptionFilter(); BzCrash_SetProjectName("D平台大厅"); BzCrash_SetEmailSender("*****@*****.**"); BzCrash_SetEmailReceiver("*****@*****.**"); BzCrash_SetSmtpServer("smtp.sina.com"); BzCrash_SetSmtpUser("bzbugrev"); BzCrash_SetSmtpPassword("1122334455"); BzCrash_DeleteSended(false); #endif //初始化 SOCKET if (!AfxSocketInit()) { AfxMessageBox(IDP_SOCKETS_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); SetRegistryKey(IDS_REG_KEY); //设置程序路径 TCHAR szModuleName[MAX_PATH]; DWORD dwLength=GetModuleFileName(AfxGetInstanceHandle(),szModuleName,sizeof(szModuleName)); szModuleName[dwLength-lstrlen(m_pszExeName)-lstrlen(TEXT(".EXE"))-1]=0; SetCurrentDirectory(szModuleName); CreateDirectory("CustomFace",NULL); CString str; int len=strlen(szModuleName); szModuleName[len]='\\'; szModuleName[len+1]='\0'; AfxGetApp()->WriteProfileString(TEXT("LogonInfo"),TEXT("Path"),szModuleName); Glb().m_Path=szModuleName; //初始化全局资源 AfxInitRichEdit(); CGameImageLink::InitResource(); // 加载钩子 DetourFunctionWithTrampoline((PBYTE)SetScrollInfoT, (PBYTE)SetScrollInfoD); DetourFunctionWithTrampoline((PBYTE)GetScrollInfoT, (PBYTE)GetScrollInfoD); DetourFunctionWithTrampoline((PBYTE)SetScrollPosT, (PBYTE)SetScrollPosD); DetourFunctionWithTrampoline((PBYTE)GetScrollPosT, (PBYTE)GetScrollPosD); DetourFunctionWithTrampoline((PBYTE)SetScrollRangeT, (PBYTE)SetScrollRangeD); DetourFunctionWithTrampoline((PBYTE)GetScrollRangeT, (PBYTE)GetScrollRangeD); DetourFunctionWithTrampoline((PBYTE)ShowScrollBarT, (PBYTE)ShowScrollBarD); DetourFunctionWithTrampoline((PBYTE)EnableScrollBarT, (PBYTE)EnableScrollBarD); //引入DirectUI支持,初始化DirectUI BzDui::CPaintManagerUI::SetInstance(m_hInstance); CString s = CBcfFile::GetAppPath ();/////本地路径 CString strSkin = m_skinmgr.GetSkinBcfFileName(); CBcfFile f(s + strSkin); TCHAR szUIPath[MAX_PATH]; CString skinfolder = f.GetKeyVal(m_skinmgr.GetKeyVal(strSkin),"skinfolder",m_skinmgr.GetSkinPath()); wsprintf(szUIPath,"%s",skinfolder); BzDui::CPaintManagerUI::SetResourcePath(szUIPath); //建立对话框 CGamePlaceDlg dlg; m_pMainWnd=&dlg; //BZUIInitial(); dlg.DoModal(); /////////////////////////////////////////////////////////// ///Kylin 20090107 添加最近游戏列表 //CString s=CBcfFile::GetAppPath (false);/////本地路径 //CBcfFile f( s + "bzgame.bcf"); //CString temp=""; //try //{ // for(int i=0;i<Glb().m_baFavorSave.GetCount();i++) // { // temp.Format("%s%i;",temp,Glb().m_baFavorSave[i]); // } // f.SetKeyValString(Glb().m_key,"Favor",temp); //} //catch (...) //{ // return FALSE; //} /////////////////////////////////////////////////////////// //BZUIShutDown(); } #ifndef MY_DEBUG //catch (...) //{ // //重新启动游戏 // STARTUPINFO StartInfo; // PROCESS_INFORMATION Info; // ::memset(&Info,0,sizeof(Info)); // ::memset(&StartInfo,0,sizeof(StartInfo)); // StartInfo.cb=sizeof(StartInfo); // StartInfo.wShowWindow=SW_SHOWMAXIMIZED; // CreateProcess(NULL,TEXT("BZW.exe"),NULL,NULL,TRUE,CREATE_DEFAULT_ERROR_MODE,NULL,NULL,&StartInfo,&Info); //} #endif return FALSE; }
//设置自己的位置 void CGameFrameDlg::SetMyselfAVClientPostion() { CString strFile,strTemp; CTime tmCur = CTime::GetCurrentTime(); CString strTime = tmCur.Format("%m%d"); strFile.Format("log\\%sSetMyselfAVClientPostion.log",strTime); strTemp.Format("into SetMyselfAVClientPostion"); WriteLog(strFile, strTemp); CString avServerIPStr, userIDStr, roomIDStr, tableIDStr, deskIDStr; char avServerIP[50]; char *p; int roomID; int tableID; int deskID; WORD wChairID=GetMeChairID(); const tagUserData * pUserInfo=GetUserData(wChairID); if (pUserInfo!=NULL) { userIDStr.Format("%d", pUserInfo->dwUserID);// deskID = wChairID;//椅子位置 tableID = pUserInfo->wTableID;//桌子号码 } else { return ; } //房间编号 ASSERT(m_ClientKernelHelper.GetInterface()!=NULL); const tagServerAttribute * pServer = m_ClientKernelHelper->GetServerAttribute(); roomID = pServer->wServerID; avServerIPStr= Glb().m_CenterServerIPAddr;//"192.168.1.10";//采用中心服务器IP CString showMsg; showMsg.Format("userid=%s, roomid=%s, tableIDStr=%s, deskIDStr=%s,avServerIPStr=%s", userIDStr, roomIDStr,tableIDStr, deskIDStr, avServerIPStr ); //AfxMessageBox(showMsg); // strTemp.Format("into SetupVideoDLL %s", showMsg); // WriteLog(strFile, strTemp); p= avServerIPStr.GetBuffer(avServerIPStr.GetLength()); strcpy( avServerIP, p); FlySetAVClientPostionValue( roomID, tableID, deskID ); strTemp.Format("%d %d %d", roomID, tableID, deskID); WriteLog(strFile, strTemp); }
////////////////////////////////////////////////////////////////////////// //功能:调用视频DLL //输入: //返回: void CGameFrameDlg::SetupVideoDLL() { CString strFile,strTemp; CTime tmCur = CTime::GetCurrentTime(); CString strTime = tmCur.Format("%m%d"); strFile.Format("log\\%sSetupVideoDLL.log",strTime); strTemp.Format("into SetupVideoDLL"); WriteLog(strFile, strTemp); myhinstDLL = AfxLoadLibrary("FlyGameAVClient.dll"); if (myhinstDLL) {} else { AfxMessageBox("视频组件调用失败!"); isHaveSetupAV = 2;//调用失败 return ; }//End if //StopAVClient if ( myhinstDLL ) { StopAVClient Proc; Proc = (StopAVClient) GetProcAddress( myhinstDLL, "StopAVClient"); int iTemp = Proc(); // FreeLibrary( hinstDLL ); } else { // AfxMessageBox("Not found dll !"); }//End if if ( myhinstDLL ) { CString avServerIPStr, userIDStr, roomIDStr, tableIDStr, deskIDStr; char avServerIP[50]; char *p; WORD wChairID=GetMeChairID(); const tagUserData * pUserInfo=GetUserData(wChairID); if (pUserInfo!=NULL) { userIDStr.Format("%d", pUserInfo->dwUserID);// deskIDStr.Format("%d", wChairID);//椅子位置 tableIDStr.Format("%d", pUserInfo->wTableID );//桌子号码 } //房间编号 ASSERT(m_ClientKernelHelper.GetInterface()!=NULL); const tagServerAttribute * pServer = m_ClientKernelHelper->GetServerAttribute(); roomIDStr.Format("%d", pServer->wServerID); CString myIPStr ; myIPStr = Glb().m_CenterServerIPAddr; myIPStr.Replace("http://", ""); strTemp.Format("myIPStr %s", myIPStr); WriteLog(strFile, strTemp); avServerIPStr.Format("%s", myIPStr );//采用中心服务器IP CString showMsg; showMsg.Format("userid=%s, roomid=%s, tableIDStr=%s, deskIDStr=%s,avServerIPStr=%s", userIDStr, roomIDStr,tableIDStr, deskIDStr, avServerIPStr ); //AfxMessageBox(showMsg); strTemp.Format("into SetupVideoDLL %s", showMsg); WriteLog(strFile, strTemp); p= avServerIPStr.GetBuffer(avServerIPStr.GetLength()); strcpy( avServerIP, p); HWND myhWnd = m_showSelfVideo.m_hWnd; StartAVClient Proc; Proc = (StartAVClient) GetProcAddress( myhinstDLL, "StartAVClient"); int iTemp = Proc(myhWnd /*myCwnd this*/, avServerIP, UDP_SOCKET_REG_PORT , atoi(userIDStr), atoi(roomIDStr), atoi(tableIDStr), atoi(deskIDStr) ); // FreeLibrary( hinstDLL ); } else { //AfxMessageBox("Not found dll !"); }//End if HWND hRemoteWnd[REMOTE_VIDEO_MAX_NUM]; hRemoteWnd[0] = m_showRemoteVideo.m_hWnd; hRemoteWnd[1] = m_showRemoteVideo1.m_hWnd; hRemoteWnd[2] = m_showRemoteVideo2.m_hWnd; hRemoteWnd[3] = m_showRemoteVideo3.m_hWnd; for (int i=0; i <REMOTE_VIDEO_MAX_NUM ; i++) { SetOneRemoteShowHWND( hRemoteWnd[i], i); } /* if ( myhinstDLL ) { AVClientSendRegMsg Proc; Proc = (AVClientSendRegMsg) GetProcAddress( myhinstDLL, "AVClientSendRegMsg"); int iTemp = Proc(); // FreeLibrary( hinstDLL ); } else { AfxMessageBox("Not found dll !"); } if ( myhinstDLL ) { GetOneTablePlayerList Proc; Proc = (GetOneTablePlayerList) GetProcAddress( myhinstDLL, "GetOneTablePlayerList"); int iTemp = Proc(); // FreeLibrary( hinstDLL ); } else { AfxMessageBox("Not found dll !"); } */ FlyAVClientSendRegMsg(); FlyGetOneTablePlayerList(); isHaveSetupAV = 1;//调用成功 }
//初始化函数 BOOL CShortMessage::OnInitDialog() { __super::OnInitDialog(); //设置控件 m_RecvMessage.Init(); m_SendMessage.SetFocus(); // TCHAR szCaption[100]; // if (m_iGmID == 0) // wsprintf(szCaption,"与 %s 聊天中",m_strTargerName); // else // wsprintf(szCaption,"系统消息:管理员%s",m_strTargerName); // //建立提示控件 m_ToolTip.Create(this); m_ToolTip.Activate(TRUE); m_ToolTip.AddTool(GetDlgItem(IDC_SEND_SHORT),TEXT("发送信息")); m_ToolTip.AddTool(GetDlgItem(IDC_EXPRESSION),TEXT("选择表情头像")); m_ToolTip.AddTool(GetDlgItem(IDC_CLOSESM),TEXT("关闭短信息窗口")); // m_ToolTip.AddTool(GetDlgItem(IDC_HISTORY),TEXT("查看聊天历史记录")); //加载位图 ASSERT(m_pTargetUserItem!=NULL); int r,g,b; CString s=CBcfFile::GetAppPath();//本地路径 CBcfFile f( s + "skin0.bcf"); CString key=TEXT("ShortMessage"); TCHAR path[MAX_PATH]; CString skinfolder; CGameImage bt; skinfolder=f.GetKeyVal(Glb().m_skin,"skinfolder","image\\client\\skin0\\"); wsprintf(path,"%sdialog\\sendmessage_bk.bmp",skinfolder); m_bk.SetLoadInfo(path,CGameImageLink::m_bAutoLock); CGameImageHelper ImageHandle(&m_bk); HRGN hRgn=AFCBmpToRgn(ImageHandle,(m_bk.GetPixel(0,0)),RGB(1,1,1)); if (hRgn!=NULL) { SetWindowRgn(hRgn,TRUE); DeleteObject(hRgn); } CRect btnRc; wsprintf(path,"%sdialog\\log_exit_bt.bmp",skinfolder);//win_close.bmp m_BtClose.LoadButtonBitmap(path,false); m_BtClose.GetClientRect(&btnRc); int iCloseWidth = btnRc.Width(); m_BtClose.MoveWindow(m_bk.GetWidth()-iCloseWidth,0,btnRc.Width(),btnRc.Height()); wsprintf(path,"%sdialog\\top_min_bt.bmp",skinfolder); m_BtMin.LoadButtonBitmap(path,false); m_BtMin.GetClientRect(&btnRc); bt.SetLoadInfo(path,CGameImageLink::m_bAutoLock); m_BtMin.MoveWindow(m_bk.GetWidth()-btnRc.Width()-iCloseWidth,0,bt.GetWidth()/4,bt.GetHeight()); m_BtMin.ShowWindow(SW_HIDE); wsprintf(path,"%sdialog\\face03.bmp",skinfolder); m_BtExpression.LoadButtonBitmap(path,false);//表情选择的 bt.SetLoadInfo(path,CGameImageLink::m_bAutoLock); m_BtExpression.MoveWindow(9, 259, bt.GetWidth()/4,bt.GetHeight()); wsprintf(path,"%sdialog\\close_bt.bmp",skinfolder); m_BtClose2.LoadButtonBitmap(path,false); bt.SetLoadInfo(path,CGameImageLink::m_bAutoLock); m_BtClose2.MoveWindow(260, 400, bt.GetWidth()/4,bt.GetHeight()); wsprintf(path,"%sdialog\\send_bt.bmp",skinfolder); m_BtSend.LoadButtonBitmap(path,false); bt.SetLoadInfo(path,CGameImageLink::m_bAutoLock); m_BtSend.MoveWindow(330, 400, bt.GetWidth()/4,bt.GetHeight()); m_RecvMessage.MoveWindow(3, 30, 394, 229); m_SendMessage.MoveWindow(3, 283, 394, 107); r=f.GetKeyVal(key,"talkbkr",0); g=f.GetKeyVal(key,"talkbkg",0); b=f.GetKeyVal(key,"talkbkb",0); m_colorresource.m_crTalkBkColor=RGB(r,g,b); m_RecvMessage.m_bkColor=RGB(r,g,b); m_RecvMessage.SetBackgroundColor(false,RGB(r,g,b)); r=f.GetKeyVal(key,"talknamer",255); g=f.GetKeyVal(key,"talknameg",255); b=f.GetKeyVal(key,"talknameb",255); m_colorresource.m_crTalkNameColor=RGB(r,g,b); r=f.GetKeyVal(key,"systemr",255); g=f.GetKeyVal(key,"systemg",255); b=f.GetKeyVal(key,"systemb",255); m_colorresource.m_crSystemTxColor=RGB(r,g,b); r=f.GetKeyVal(key,"systembdr",255); g=f.GetKeyVal(key,"systembdg",0); b=f.GetKeyVal(key,"systembdb",0); m_colorresource.m_crSystemBdColor=RGB(r,g,b); r=f.GetKeyVal(key,"talknormalr",255); g=f.GetKeyVal(key,"talknormalg",255); b=f.GetKeyVal(key,"talknormalb",255); m_colorresource.m_crNormalTxColor=RGB(r,g,b); //////////////////////////////////// ////Kylin 20090117 聊天信息颜色设置 r=f.GetKeyVal(key,"talkr",255); g=f.GetKeyVal(key,"talkg",255); b=f.GetKeyVal(key,"talkb",255); m_colorresource.m_crTalkTxColor=RGB(r,g,b); //////////////////////////////////// r=f.GetKeyVal(key,"senttextr",0); g=f.GetKeyVal(key,"senttextg",0); b=f.GetKeyVal(key,"senttextb",255); m_colorresource.m_crSentTxColor=RGB(r,g,b); r=f.GetKeyVal(key,"receivedtextr",255); g=f.GetKeyVal(key,"receivedtextg",0); b=f.GetKeyVal(key,"receivedtextb",0); m_colorresource.m_crReceivedTxColor=RGB(r,g,b); m_MessageHandle.SetColor(m_colorresource); //绘画界面 CRect ClientRect; GetClientRect(&ClientRect); this->MapWindowPoints(this->GetParent(),&ClientRect); // DrawBackFace(&dc,0,0,ClientRect.Width(),ClientRect.Height()); CGameImageHelper help(&m_bk); this->MoveWindow(ClientRect.left,ClientRect.top,help.GetWidth(),help.GetHeight()); m_bkBrush=CreateSolidBrush(m_bk.GetPixel(267,289)); CString szMsg = f.GetKeyVal(key,"xtgg","欢迎您来到面对面游戏中心,请不要在聊天框中透露帐号和密码,切记不要相信聊天框中的任何活动或中奖信息。拒绝虚拟货币交易,加强自我防范意识。警惕上当受骗,后果自负。一切活动以官方网站首页公告为准。"); m_MessageHandle.InsertSystemBoard(szMsg.GetBuffer(szMsg.GetLength())); { CString s=CBcfFile::GetAppPath ();/////本地路径 CBcfFile f( s + "skin0.bcf"); TCHAR path[MAX_PATH]; CString skinfolder; skinfolder = f.GetKeyVal(Glb().m_skin,"skinfolder","image\\client\\skin0\\"); wsprintf(path,"%sDialog\\scroll.bmp",skinfolder); HBITMAP hbmScorll = (HBITMAP)LoadImage(NULL, path, IMAGE_BITMAP, 0,0, LR_LOADFROMFILE); SkinSB_Uninit(m_SendMessage.GetSafeHwnd()); SkinSB_Uninit(m_RecvMessage.GetSafeHwnd()); SkinSB_Init(m_SendMessage.GetSafeHwnd(), hbmScorll); SkinSB_Init(m_RecvMessage.GetSafeHwnd(), hbmScorll); } SetWindowPos(&CWnd::wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); return false; }
BOOL CDlgDIYChat::OnInitDialog() { __super::OnInitDialog(); m_listBox=(CListBox*)GetDlgItem(IDC_LIST_CHAT); ReadTalkINI(); //贴图 CString s=CBcfFile::GetAppPath ();/////本地路径 CBcfFile f( s + "skin0.bcf"); CString key=Glb().m_skin; TCHAR path[MAX_PATH]; CString skinfolder; skinfolder=f.GetKeyVal(key,"skinfolder","image\\client\\skin0\\"); CGameImage m_bt; /*// 2012.12.17 yyf 屏蔽 wsprintf(path,"%sdialog\\DIYChat.bmp",skinfolder); m_bkimage.SetLoadInfo(path,CGameImageLink::m_bAutoLock); CGameImageHelper ImageHandle(&m_bkimage); int cx,cy; HRGN hRgn=AFCBmpToRgn(ImageHandle,m_bkimage.GetPixel(0,0),RGB(1,1,1)); if (hRgn!=NULL) { SetWindowRgn(hRgn,TRUE); ///{{ Added by zxd 20100709 释放区域对象 DeleteObject(hRgn); ///Added by zxd 20100709 释放区域对象}} } cx=ImageHandle.GetWidth(); cy=ImageHandle.GetHeight();*/ //*-------初始化 m_configDlg--------- 2012.10.17 yyf TCHAR pathConfig[MAX_PATH]; TCHAR PathDefault[MAX_PATH]; wsprintf(pathConfig,"%s%sdialog\\configDlg\\CDlgDIYChatConfig\\configDlg.bcf",s,skinfolder);// wsprintf(PathDefault,"%s%s",s,skinfolder); m_configDlg.LoadConfig(pathConfig,PathDefault); int cx,cy; cx=m_configDlg.GetDlgWide(); cy=m_configDlg.GetDlgHigh(); //-----------------------------------------------------*/ SetWindowPos(NULL,0,0,cx,cy,SWP_NOMOVE|SWP_NOZORDER); //取消 wsprintf(path,"%sdialog\\cancel_bt.BMP",skinfolder); m_bt.SetLoadInfo(path,true); m_btcancel.LoadButtonBitmap(path,false); m_btcancel.SetWindowPos(NULL,0,0,m_bt.GetWidth()/4,m_bt.GetHeight(),SWP_NOMOVE|SWP_NOZORDER); //ok wsprintf(path,"%sdialog\\ok_bt.bmp",skinfolder); m_bt.SetLoadInfo(path,true); m_btOk.LoadButtonBitmap(path,false); m_btOk.SetWindowPos(NULL,0,0,m_bt.GetWidth()/4,m_bt.GetHeight(),SWP_NOMOVE|SWP_NOZORDER); //增加 wsprintf(path,"%sdialog\\Add_bt.bmp",skinfolder); m_bt.SetLoadInfo(path,true); m_btAdd.LoadButtonBitmap(path,false); m_btAdd.SetWindowPos(NULL,0,0,m_bt.GetWidth()/4,m_bt.GetHeight(),SWP_NOMOVE|SWP_NOZORDER); //删除 wsprintf(path,"%sdialog\\Delete_bt.bmp",skinfolder); m_bt.SetLoadInfo(path,true); m_btDelete.LoadButtonBitmap(path,false); m_btDelete.SetWindowPos(NULL,0,0,m_bt.GetWidth()/4,m_bt.GetHeight(),SWP_NOMOVE|SWP_NOZORDER); //修改 wsprintf(path,"%sdialog\\Modify_bt.bmp",skinfolder); m_bt.SetLoadInfo(path,true); m_btModify.LoadButtonBitmap(path,false); m_btModify.SetWindowPos(NULL,0,0,m_bt.GetWidth()/4,m_bt.GetHeight(),SWP_NOMOVE|SWP_NOZORDER); m_bkBrush = CreateSolidBrush(m_configDlg.GetBKImageEX().GetPixel(32,55));//m_bkimage SetWndRgn();// 设置窗口圆角2012.10.17 yyf return true; }
//加载皮肤 void CAppealDlg::LoadSkin() { CString s=CBcfFile::GetAppPath ();/////本地路径 CString strSkin = m_skinmgr.GetSkinBcfFileName(); CBcfFile f( s + strSkin); TCHAR path[MAX_PATH]; CString skinfolder; if ("skin0.bcf" == strSkin) skinfolder = f.GetKeyVal("skin0","skinfolder",m_skinmgr.GetSkinPath()); else skinfolder = f.GetKeyVal("skin1","skinfolder",m_skinmgr.GetSkinPath()); /*// 2012.12.16 yyf 屏蔽 sprintf_s(path,sizeof(path),"%sdialog\\appealdlgbk.bmp",skinfolder); m_imgDlgBk.SetLoadInfo(path,CGameImageLink::m_bAutoLock); CGameImageHelper ImageHandle(&m_imgDlgBk); HRGN hRgn=AFCBmpToRgn(ImageHandle,m_imgDlgBk.GetPixel(0,0),RGB(1,1,1)); if (hRgn!=NULL) { SetWindowRgn(hRgn,TRUE); DeleteObject(hRgn); }*/ //*-------初始化 m_configDlg--------- 2012.10.16 yyf TCHAR pathConfig[MAX_PATH]; TCHAR PathDefault[MAX_PATH]; wsprintf(pathConfig,"%s%sdialog\\configDlg\\CAppealDlgConfig\\configDlg.bcf",s,skinfolder);// wsprintf(PathDefault,"%s%s",s,skinfolder); m_configDlg.LoadConfig(pathConfig,PathDefault); int iwith,iHeight; iwith=m_configDlg.GetDlgWide(); iHeight=m_configDlg.GetDlgHigh(); //-----------------------------------------------------*/ sprintf_s(path,sizeof(path),"%sdialog\\normal_bt.BMP",skinfolder); m_btnOk.LoadButtonBitmap(path,false); sprintf_s(path,sizeof(path),"%sdialog\\normal_bt.BMP",skinfolder); m_btnCancle.LoadButtonBitmap(path,false); /*// 2012.12.16 yyf 屏蔽 int iwith = m_imgDlgBk.GetWidth(); int iHeight = m_imgDlgBk.GetHeight(); MoveWindow(0,0,m_imgDlgBk.GetWidth(),m_imgDlgBk.GetHeight());*/ MoveWindow(0,0,iwith,iHeight);// 2012.12.16 yyf CenterWindow(GetParent()); //使对话框居中显示 CString strPath = CBcfFile::GetAppPath(); DWORD dwHandle = cfgOpenFile(strPath + "bzgame.bcf"); if ( dwHandle >= 0x10) { m_strFtpAddress = cfgGetValue(dwHandle,Glb().m_key,"FtpAddress",""); m_strFtpUserName = cfgGetValue(dwHandle,Glb().m_key,"FtpUsrName",""); m_strFtpPwd = cfgGetValue(dwHandle,Glb().m_key,"FtpPwd",""); cfgClose(dwHandle); } CRect rc; GetWindowRect(&rc); m_bnClose.MoveWindow(rc.Width()-36,0,17,17); wsprintf(path,"%s\\%sdialog\\log_exit_bt.bmp",CBcfFile::GetAppPath(true),m_skinmgr.GetSkinPath());//win_close.bmp m_bnClose.LoadButtonBitmap(path,false); { CString s=CBcfFile::GetAppPath ();/////本地路径 CString strSkin = m_skinmgr.GetSkinBcfFileName(); CBcfFile f( s + strSkin); TCHAR path[MAX_PATH]; CString skinfolder; if ("skin0.bcf" == strSkin) skinfolder = f.GetKeyVal("skin0","skinfolder",m_skinmgr.GetSkinPath()); else skinfolder = f.GetKeyVal("skin1","skinfolder",m_skinmgr.GetSkinPath()); wsprintf(path,"%sDialog\\scroll.bmp",skinfolder); HBITMAP hbmScorll = (HBITMAP)LoadImage(NULL, path, IMAGE_BITMAP, 0,0, LR_LOADFROMFILE); SkinSB_Uninit(m_FileListCtrl.GetSafeHwnd()); SkinSB_Uninit(GetDlgItem(IDC_EDIT_APPEAL_CONTENT)->GetSafeHwnd()); SkinSB_Init(m_FileListCtrl.GetSafeHwnd(), hbmScorll); SkinSB_Init(GetDlgItem(IDC_EDIT_APPEAL_CONTENT)->GetSafeHwnd(), hbmScorll); } ::SetWindowPos(m_hWnd,CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE); SetWndRgn();// 设置窗口圆角2012.10.16 yyf }
void CPropPannel::OnNetMessage(NetMessageHead * pNetHead, void * pNetData, UINT uDataSize) { CBcfFile fMsg(CBcfFile::GetAppPath()+"ClientMessage.bcf"); CString strMessage; //从服务器返回购买/赠送VIP消息 if( pNetHead->bAssistantID == ASS_PROP_BUY_VIP ) { switch (pNetHead->bHandleCode) { case DTK_GR_VIP_GIVE_SUCCESS: { MSG_PROP_S_BUYVIP *propVIP = (MSG_PROP_S_BUYVIP *)pNetData; CMainRoomEx *pWnd=(CMainRoomEx*)pParentWnd; for(int i = 0; i < MAX_GAME_ROOM; i ++) { if(pWnd->m_RoomInfo[i].pGameRoomWnd != NULL) { CString stip; strMessage = fMsg.GetKeyVal("PropPanelDlg","GIVEVIPSUC", "成功赠送VIP给玩家[%s]"); stip.Format(strMessage, propVIP->szTargetUser); ((CGameRoomEx*)pWnd->m_RoomInfo[i].pGameRoomWnd)->InsertSystemMessageWithGame(stip.GetBuffer()); } } } break; case DTK_GP_VIP_BUY_NOMONEY: { MSG_PROP_S_BUYVIP *propVIP = (MSG_PROP_S_BUYVIP *)pNetData; CMainRoomEx *pWnd=(CMainRoomEx*)pParentWnd; for(int i = 0; i < MAX_GAME_ROOM; i ++) { if(pWnd->m_RoomInfo[i].pGameRoomWnd != NULL) { CString stip; strMessage = fMsg.GetKeyVal("PropPanelDlg","GIVEVIPNOMONEY", "赠送VIP失败,您的金币不够!"); ((CGameRoomEx*)pWnd->m_RoomInfo[i].pGameRoomWnd)->InsertSystemMessageWithGame(strMessage.GetBuffer()); } } } break; case DTK_GR_VIP_BUY_NOUSER: { MSG_PROP_S_BUYVIP *propVIP = (MSG_PROP_S_BUYVIP *)pNetData; CMainRoomEx *pWnd=(CMainRoomEx*)pParentWnd; for(int i = 0; i < MAX_GAME_ROOM; i ++) { if(pWnd->m_RoomInfo[i].pGameRoomWnd != NULL) { CString stip; strMessage = fMsg.GetKeyVal("PropPanelDlg","GIVEVIPSUCNOUSER", "赠送VIP失败,赠送的玩家不存在!"); ((CGameRoomEx*)pWnd->m_RoomInfo[i].pGameRoomWnd)->InsertSystemMessageWithGame(strMessage.GetBuffer()); } } } break; case DTK_GP_VIP_BUY_ERROR: { MSG_PROP_S_BUYVIP *propVIP = (MSG_PROP_S_BUYVIP *)pNetData; CMainRoomEx *pWnd=(CMainRoomEx*)pParentWnd; for(int i = 0; i < MAX_GAME_ROOM; i ++) { if(pWnd->m_RoomInfo[i].pGameRoomWnd != NULL) { CString stip; strMessage = fMsg.GetKeyVal("PropPanelDlg","GIVEERR", "赠送VIP失败"); ((CGameRoomEx*)pWnd->m_RoomInfo[i].pGameRoomWnd)->InsertSystemMessageWithGame(strMessage.GetBuffer()); } } } break; case DTK_GR_VIP_BUY_SUCCEED: { MSG_PROP_S_BUYVIP *propVIP = (MSG_PROP_S_BUYVIP *)pNetData; CMainRoomEx *pWnd=(CMainRoomEx*)pParentWnd; for(int i = 0; i < MAX_GAME_ROOM; i ++) { if(pWnd->m_RoomInfo[i].pGameRoomWnd != NULL) { CString stip; strMessage = fMsg.GetKeyVal("PropPanelDlg","BUYSUC", "成功购买VIP"); ((CGameRoomEx*)pWnd->m_RoomInfo[i].pGameRoomWnd)->InsertSystemMessageWithGame(strMessage.GetBuffer()); } } } break; default: { break; } } } //从服务器返回了用户的道具 if((pNetHead->bAssistantID==ASS_PROP_BUY || pNetHead->bAssistantID==ASS_PROP_BUY_NEW) && pNetHead->bHandleCode!=DTK_GP_PROP_BUY_SUCCEED && pNetHead->bHandleCode!=DTK_GP_PROP_BUYANDUSE_SUCCEED) { //{{Modify By Zxd,取消弹出对话框的表现形式 //AFCMessageBox("购买道具失败!您的游戏银行帐号中金币不足,请充值或存入足够的金币到银行后再购买!"); if (pNetHead->bHandleCode == DTK_GP_PROP_BUY_NOMONEY) { CMainRoomEx *pWnd=(CMainRoomEx*)pParentWnd; for(int i = 0; i < MAX_GAME_ROOM; i ++) { if(pWnd->m_RoomInfo[i].pGameRoomWnd != NULL) { strMessage = fMsg.GetKeyVal("PropPanelDlg","BuyErrorRechargeCoin", "购买道具失败!您的游戏银行帐号中金币不足,请充值或存入足够的金币到银行后再购买!"); BZSoundPlay(this, "music/错误提示.mp3", 0); CString csTemp = strMessage; // 在发送表情的时候会改变csTemp的内容 CGameRoomEx* _p = ((CGameRoomEx*)pWnd->m_RoomInfo[i].pGameRoomWnd); _p->m_pRightWnd->m_MessageHandle.InsertSystemMessageM(csTemp.GetBuffer()); csTemp.ReleaseBuffer(); if (_p->m_IGameFrame!=NULL) { csTemp = strMessage; // 重新初始化数据 _p->m_IGameFrame->ShowMsgInGame(csTemp.GetBuffer(), 3); csTemp.ReleaseBuffer(); } } } } else { CMainRoomEx *pWnd=(CMainRoomEx*)pParentWnd; for(int i = 0; i < MAX_GAME_ROOM; i ++) { if(pWnd->m_RoomInfo[i].pGameRoomWnd != NULL) { strMessage = fMsg.GetKeyVal("PropPanelDlg","BuyPropOtherError", "购买道具失败!"); BZSoundPlay(this, "music/错误提示.mp3", 0); CString csTemp = strMessage; // 在发送表情的时候会改变csTemp的内容 CGameRoomEx* _p = ((CGameRoomEx*)pWnd->m_RoomInfo[i].pGameRoomWnd); _p->m_pRightWnd->m_MessageHandle.InsertSystemMessageM(csTemp.GetBuffer()); csTemp.ReleaseBuffer(); if (_p->m_IGameFrame!=NULL) { csTemp = strMessage; // 重新初始化数据 _p->m_IGameFrame->ShowMsgInGame(csTemp.GetBuffer(), 3); csTemp.ReleaseBuffer(); } //((CGameRoomEx*)pWnd->m_RoomInfo[i].pGameRoomWnd)->InsertSystemMessageWithGame(strMessage.GetBuffer()); } } } //Modify By Zxd}} return; } if((pNetHead->bAssistantID==ASS_PROP_BUY || pNetHead->bAssistantID==ASS_PROP_BUY_NEW) && pNetHead->bHandleCode == DTK_GP_PROP_BUY_SUCCEED) { CMainRoomEx *pWnd=(CMainRoomEx*)pParentWnd; for(int i = 0; i < MAX_GAME_ROOM; i ++) { if(pWnd->m_RoomInfo[i].pGameRoomWnd != NULL) { strMessage = fMsg.GetKeyVal("PropPanelDlg","BuyPropSuc", "购买道具成功!"); ((CGameRoomEx*)pWnd->m_RoomInfo[i].pGameRoomWnd)->InsertSystemMessageWithGame(strMessage.GetBuffer()); } } } if(pNetHead->bAssistantID==ASS_PROP_GETUSERPROP || pNetHead->bAssistantID==ASS_PROP_BUY) { MSG_PROP_S_GETPROP * msg=(MSG_PROP_S_GETPROP*)pNetData; //DebugPrintf("用户[%d]道具[%d]数量[%d]花费[%d]", msg->dwUserID, msg->nPropID, msg->nHoldCount, msg->dwCost); int propCount=Glb().userPropLibrary.GetCount(); _TAG_USERPROP *userProp=NULL; bool bPropExist=false; for(int i=0;i<propCount;i++) { userProp=Glb().userPropLibrary.GetAt(i); if(userProp->nPropID==msg->nPropID) { bPropExist=true; break; } } //{{Modified by ZXD 原先购买道具数量和单价是根据大厅道具面板的数值来的,在用 // EXE形式游戏客户端时,游戏中道具面板与大厅不一致,会造成误算银行余额,为此 // 在结构中加入一个变量成员dwCost,用来传递本次购买实际花费的钱 if(!bPropExist) { userProp=new _TAG_USERPROP; memcpy(userProp,msg,sizeof(_TAG_USERPROP)); Glb().userPropLibrary.Add(userProp); } else { userProp->nHoldCount=msg->nHoldCount; userProp->dwCost = msg->dwCost; } if(pNetHead->bAssistantID==ASS_PROP_BUY) OnGetPropInformation(userProp); //Modified by ZXD}} } if(pNetHead->bAssistantID==ASS_PROP_BUY_NEW) { MSG_PROP_S_GETPROP * msg=(MSG_PROP_S_GETPROP*)pNetData; int propCount=Glb().userPropLibrary.GetCount(); _TAG_USERPROP *userProp=NULL; bool bPropExist=false; int iPropIndex = 0; for(int i=0;i<propCount;i++) { userProp=Glb().userPropLibrary.GetAt(i); if(userProp->nPropID==msg->nPropID) { bPropExist=true; iPropIndex = i; break; } } if(true == bPropExist) // 找到 { userProp->nHoldCount=msg->nHoldCount; userProp->dwCost = msg->dwCost; // 本次购买实际花费的钱 } // 更新 OnGetPropInformation(userProp); // 操作属性此处不需要,使用这个值区分道具是在房间还是游戏端购买的 // 0表示在房间购买,1表示在游戏端购买 CMainRoomEx *pWnd=(CMainRoomEx*)pParentWnd; if(0 == msg->attribAction) // 房间功能 { for(int i = 0; i < MAX_GAME_ROOM; i ++) { if(pWnd->m_RoomInfo[i].pGameRoomWnd != NULL && true == bPropExist) { if (pNetHead->bHandleCode == DTK_GP_PROP_BUYANDUSE_SUCCEED) pWnd->m_RoomInfo[i].pRoomInfoWnd->UserProp_Buy(iPropIndex); else pWnd->m_RoomInfo[i].pRoomInfoWnd->UserProp(iPropIndex); } } } else if(1 == msg->attribAction) // 游戏端功能 { CGameRoomEx* pGameRoomEx = NULL; for(int i = 0; i < MAX_GAME_ROOM; i ++) { if(pWnd->m_RoomInfo[i].pGameRoomWnd != NULL && true == bPropExist) { pGameRoomEx = dynamic_cast<CGameRoomEx*>(pWnd->m_RoomInfo[i].pGameRoomWnd); pGameRoomEx->SendDataToGame(userProp, sizeof(_TAG_USERPROP), MDM_GR_ROOM2GAME, ASS_GR_R2G_USEPROP, pNetHead->bHandleCode); } } } } //赠送道具 if(pNetHead->bAssistantID==ASS_PROP_GIVE) { //有人赠送给自己 if(pNetHead->bHandleCode==DTK_GP_PROP_GIVE_SUCCEED_BEGIVER) { _TAG_PROP_GIVE_FOR* propGiveFor=(_TAG_PROP_GIVE_FOR*)pNetData; _TAG_USERPROP * msg=(_TAG_USERPROP*)&propGiveFor->propInfo; int propCount=Glb().userPropLibrary.GetCount(); _TAG_USERPROP *userProp=NULL; bool bPropExist=false; for(int i=0;i<propCount;i++) { userProp=Glb().userPropLibrary.GetAt(i); if(userProp->nPropID==msg->nPropID) { bPropExist=true; break; } } if(!bPropExist) { userProp=new _TAG_USERPROP; memcpy(userProp,msg,sizeof(_TAG_USERPROP)); Glb().userPropLibrary.Add(userProp); } else userProp->nHoldCount=msg->nHoldCount; OnGivenProp(propGiveFor); } else if(pNetHead->bHandleCode==DTK_GP_PROP_GIVE_SUCCEED_GIVER)//赠送成功 { _TAG_PROP_GIVE* propGive=(_TAG_PROP_GIVE*)pNetData; int propCount=Glb().userPropLibrary.GetCount(); _TAG_USERPROP *userProp=NULL; for(int i=0;i<propCount;i++) { userProp=Glb().userPropLibrary.GetAt(i); if(userProp->nPropID==propGive->nPropID) { userProp->nHoldCount-=propGive->nGiveCount; if(userProp->nHoldCount < 0)userProp->nHoldCount = 0; //if(userProp->nHoldCount<1) // PengJiLin, 2010-10-14, 新的道具系统数量可以为0,屏蔽 //{ // Glb().userPropLibrary.RemoveAt(i); // delete userProp; // userProp=NULL; //} //AFCMessageBox("成功赠送道具给其它玩家","提示"); //Modify By Zxd,取消弹出对话框的表现形式 CString stip; strMessage = fMsg.GetKeyVal("PropPanelDlg","SuccessGive","成功赠送道具给玩家[%s]"); stip.Format(strMessage, propGive->szTargetUser); CMainRoomEx *pWnd=(CMainRoomEx*)pParentWnd; for(int i = 0; i < MAX_GAME_ROOM; i ++) { if(pWnd->m_RoomInfo[i].pGameRoomWnd != NULL) { pWnd->m_RoomInfo[i].pGameRoomWnd->PostMessage(WM_USER+151,0,0); pWnd->m_RoomInfo[i].pRoomInfoWnd->PostMessage(WM_USER+151,0,0); //{{Add By Zxd 用来代替上面的AFCMessageBox ((CGameRoomEx*)pWnd->m_RoomInfo[i].pGameRoomWnd)->InsertSystemMessageWithGame(stip); //Add By Zxd}} } } if(curPropID==propGive->nPropID) { if(userProp) { m_nHoldCount=userProp->nHoldCount; } else { m_nHoldCount=0; m_bnUse.EnableWindow(FALSE); m_ctlGiveUser.EnableWindow(FALSE); } UpdateData(FALSE); } break; } } } else//赠送失败 { CString stip; if(pNetHead->bHandleCode==DTK_GP_PROP_GIVE_NOTARGETUSER) stip = fMsg.GetKeyVal("PropPanelDlg","PlayerNotExist","对不起,您要赠送的玩家不存在"); else stip = fMsg.GetKeyVal("PropPanelDlg","ErrorGive","对不起,赠送道具失败!"); //{{Modify By Zxd,取消弹出对话框的表现形式 //AFCMessageBox(stip,"提示"); { CMainRoomEx *pWnd=(CMainRoomEx*)pParentWnd; for(int i = 0; i < MAX_GAME_ROOM; i ++) { if(pWnd->m_RoomInfo[i].pGameRoomWnd != NULL) { ((CGameRoomEx*)pWnd->m_RoomInfo[i].pGameRoomWnd)->InsertSystemMessageWithGame(stip); } } } //Modify By Zxd}} } } if (pNetHead->bAssistantID==ASS_PROP_BIG_BOARDCASE) {//大喇叭,如果成功,都要减少道具数量 _TAG_BOARDCAST *boardCast=(_TAG_BOARDCAST*)pNetData; //add xqm 20010-11-23 BZSoundPlay(this, "image\\prop\\Prop5A.mp3", 0); CMainRoomEx *pWnd=(CMainRoomEx*)pParentWnd; if(pNetHead->bHandleCode!=DTK_GR_PROP_USE_SUCCEED && boardCast->dwUserID==pWnd->m_PlaceUserInfo.dwUserID) { CMainRoomEx *pWnd=(CMainRoomEx*)pParentWnd; for(int i = 0; i < MAX_GAME_ROOM; i ++) { if(pWnd->m_RoomInfo[i].pGameRoomWnd != NULL) { CBcfFile fMsg(CBcfFile::GetAppPath()+"ClientMessage.bcf"); CString strMessage = fMsg.GetKeyVal("PropPanelDlg","ErrorOpenToolBox","对不起,打开道具箱出错"); ((CGameRoomEx*)pWnd->m_RoomInfo[i].pGameRoomWnd)->InsertSystemMessageWithGame(strMessage.GetBuffer()); } } return; } if(boardCast->dwUserID==pWnd->m_PlaceUserInfo.dwUserID) {//减少道具数量 int propCount=Glb().userPropLibrary.GetCount(); _TAG_USERPROP *userProp=NULL; for(int i=0;i<propCount;i++) { userProp=Glb().userPropLibrary.GetAt(i); if(userProp->nPropID==boardCast->nPropID) { userProp->nHoldCount-=1; if(userProp->nHoldCount < 0)userProp->nHoldCount = 0; //if(userProp->nHoldCount <=0) // PengJiLin, 2010-10-14, 新的道具系统数量可以为0,屏蔽 //{ // userProp->nHoldCount = 0; // Glb().userPropLibrary.RemoveAt(i); // delete userProp; // userProp=NULL; //} for(int i = 0; i < MAX_GAME_ROOM; i ++) { if(pWnd->m_RoomInfo[i].pGameRoomWnd != NULL) { pWnd->m_RoomInfo[i].pGameRoomWnd->PostMessage(WM_USER+151,0,0); pWnd->m_RoomInfo[i].pRoomInfoWnd->PostMessage(WM_USER+151,0,0); } } if(curPropID==boardCast->nPropID) { if(userProp) m_nHoldCount=userProp->nHoldCount; else m_nHoldCount=0; UpdateData(FALSE); } break; } } } //将大喇叭消息显示出来 for(int i = 0; i < MAX_GAME_ROOM; i ++) { if(pWnd->m_RoomInfo[i].pGameRoomWnd != NULL) ((CGameRoomEx*)pWnd->m_RoomInfo[i].pGameRoomWnd)->Dudu(boardCast, pNetHead->bAssistantID==ASS_PROP_BIG_BOARDCASE); } } }
//初始化函数 BOOL CBankDlg::OnInitDialog() { __super::OnInitDialog(); TCHAR buffer[128], szTip[128]; //贴图 CString s=CBcfFile::GetAppPath ();/////本地路径 CBcfFile f( s + "skin.bcf"); CString key=Glb().m_skin; TCHAR path[MAX_PATH]; CString skinfolder; //skinfolder=f.GetKeyVal(key,"skinfolder","image\\client\\skin0\\"); skinfolder.Format("%s%s", "..\\", f.GetKeyVal(key,"skinfolder","image\\client\\skin0\\")); CGameImage m_bt; wsprintf(path,"%sdialog\\msg_bk.bmp",skinfolder); m_bkimage.SetLoadInfo(path,CGameImageLink::m_bAutoLock); CGameImageHelper ImageHandle(&m_bkimage); int cx,cy; HRGN hRgn=AFCBmpToRgn(ImageHandle,m_bkimage.GetPixel(0,0),RGB(1,1,1)); if (hRgn!=NULL) { SetWindowRgn(hRgn,TRUE); } cx=ImageHandle.GetWidth(); cy=ImageHandle.GetHeight(); SetWindowPos(NULL,0,0,cx,cy,SWP_NOMOVE|SWP_NOZORDER); //wsprintf(path,"%sdialog\\WalletCancle_bt.BMP",skinfolder); //m_bt.SetLoadInfo(path,true); //m_btcancel.LoadButtonBitmap(path,false); // CGameImage m_bt; HRGN hRgn2; wsprintf(path,"%sdialog\\win_close.bmp",skinfolder); m_BtCancel.LoadButtonBitmap(path,false); m_bt.SetLoadInfo(path,CGameImageLink::m_bAutoLock); //hRgn2=AFCBmpToRgn(m_bt,m_bt.GetPixel(0,0),RGB(1,1,1)); //if(hRgn2) // m_BtCancel.SetWindowRgn(hRgn2,true); m_BtCancel.SetWindowPos(NULL,0,0,m_bt.GetWidth()/4,m_bt.GetHeight(),SWP_NOMOVE|SWP_NOZORDER); //wsprintf(path,"%sdialog\\OutMoney_bt.bmp",skinfolder); //m_bt.SetLoadInfo(path,true); wsprintf(path,"%slogon\\button.bmp",skinfolder); m_bt.SetLoadInfo(path,CGameImageLink::m_bAutoLock); // CGameImageHelper bthelp(&m_bt); hRgn2=AFCBmpToRgn(m_bt,m_bt.GetPixel(0,0),RGB(1,1,1)); m_btCheckOut.LoadButtonBitmap(path,false); if(hRgn2) m_btCheckOut.SetWindowRgn(hRgn2,true); //m_btCheckOut.SetWindowPos(NULL,0,0,m_bt.GetWidth()/4,m_bt.GetHeight(),SWP_NOMOVE|SWP_NOZORDER); //wsprintf(path,"%sdialog\\InMoney_bt.bmp",skinfolder); //m_bt.SetLoadInfo(path,true); //m_btCheckIn.LoadButtonBitmap(path,false); //if(hRgn2) // m_btCheckIn.SetWindowRgn(hRgn2,true); m_btQuery.LoadButtonBitmap(path,false); if(hRgn2) m_btQuery.SetWindowRgn(hRgn2,true); //m_btCheckIn.SetWindowPos(NULL,0,0,m_bt.GetWidth()/4,m_bt.GetHeight(),SWP_NOMOVE|SWP_NOZORDER); m_btTransfer.LoadButtonBitmap(path,false); if(hRgn2) m_btTransfer.SetWindowRgn(hRgn2,true); //m_btTransfer.SetWindowPos(NULL,0,0,m_bt.GetWidth()/4,m_bt.GetHeight(),SWP_NOMOVE|SWP_NOZORDER); ZeroMemory(buffer,sizeof(buffer)); GlbGetNumString(buffer, m_BankMoney, Glb().m_nPowerOfGold/*, true*/, Glb().m_bUseSpace, Glb().m_strSpaceChar); SetDlgItemTextA(IDC_EDIT_MONEY,buffer); GlbGetNumString(buffer, m_RoomMoney, Glb().m_nPowerOfGold/*, true*/, Glb().m_bUseSpace, Glb().m_strSpaceChar); SetDlgItemTextA(IDC_EDIT_MONEY_ROOM,buffer); ZeroMemory(buffer,sizeof(buffer)); switch(Glb().m_nPowerOfGold) { case 1: _tcscat( buffer, TEXT("十")); break; case 2: _tcscat( buffer, TEXT("百")); break; case 3: _tcscat( buffer, TEXT("千")); break; case 4: _tcscat( buffer, TEXT("万")); break; } _tcscpy(szTip, "存取最小单位:"); _tcscat(szTip, buffer); _tcscat( buffer, TEXT("金币")); SetDlgItemTextA(IDC_STATIC_TIP, szTip); m_bkBrush=CreateSolidBrush(m_bkimage.GetPixel(32,55)); //_tcscpy( buffer, TEXT("1")); //for (int i=0; i<Glb().m_nPowerOfGold; ++i) //{ // _tcscat( buffer, TEXT("0")); //} //wsprintf( szTip, "X %s", buffer); //SetDlgItemTextA(IDC_UNIT, szTip); return true; }
void CAppealDlg::Init() { CString s=CBcfFile::GetAppPath ();/////本地路径 CString strSkin = m_skinmgr.GetSkinBcfFileName(); CBcfFile f( s + strSkin); TCHAR path[MAX_PATH]; CString skinfolder; if ("skin0.bcf" == strSkin) skinfolder = f.GetKeyVal("skin0","skinfolder",m_skinmgr.GetSkinPath()); else skinfolder = f.GetKeyVal("skin1","skinfolder",m_skinmgr.GetSkinPath()); /* // 2012.12.16 yyf 屏蔽 sprintf_s(path,sizeof(path),"%sdialog\\appealdlgbk.bmp",skinfolder); m_imgDlgBk.SetLoadInfo(path,CGameImageLink::m_bAutoLock); CGameImageHelper ImageHandle(&m_imgDlgBk); HRGN hRgn=AFCBmpToRgn(ImageHandle,m_imgDlgBk.GetPixel(0,0),RGB(1,1,1)); if (hRgn!=NULL) { SetWindowRgn(hRgn,TRUE); DeleteObject(hRgn); }*/ sprintf_s(path,sizeof(path),"%sdialog\\normal_bt.BMP",skinfolder); m_btnOk.LoadButtonBitmap(path,false); sprintf_s(path,sizeof(path),"%sdialog\\normal_bt.BMP",skinfolder); m_btnCancle.LoadButtonBitmap(path,false); //*-------初始化 m_configDlg--------- 2012.10.16 yyf TCHAR pathConfig[MAX_PATH]; TCHAR PathDefault[MAX_PATH]; wsprintf(pathConfig,"%s%sdialog\\configDlg\\CAppealDlgConfig\\configDlg.bcf",s,skinfolder);// wsprintf(PathDefault,"%s%s",s,skinfolder); m_configDlg.LoadConfig(pathConfig,PathDefault); int iwith,iHeight; iwith=m_configDlg.GetDlgWide(); iHeight=m_configDlg.GetDlgHigh(); //-----------------------------------------------------*/ // 2012.12.16 yyf 屏蔽 //int iwith = m_imgDlgBk.GetWidth(); //int iHeight = m_imgDlgBk.GetHeight(); //MoveWindow(0,0,m_imgDlgBk.GetWidth(),m_imgDlgBk.GetHeight()); MoveWindow(0,0,iwith,iHeight);// 2012.12.16 yyf CenterWindow(GetParent()); //使对话框居中显示 CBcfFile fMsg(CBcfFile::GetAppPath()+"ClientMessage.bcf"); CString str; str = fMsg.GetKeyVal("AppealDlg","GameName","游戏名称"); m_FileListCtrl.InsertColumn(0,str,LVCFMT_LEFT,60); str = fMsg.GetKeyVal("AppealDlg","GameTime","游戏时间"); m_FileListCtrl.InsertColumn(1,str,LVCFMT_LEFT,83); str = fMsg.GetKeyVal("AppealDlg","FileName","文件名称"); m_FileListCtrl.InsertColumn(2,str,LVCFMT_LEFT,180); m_FileListCtrl.SetRedraw(true); m_FileListCtrl.SetExtendedStyle((m_FileListCtrl.GetStyle() | LVS_EX_FULLROWSELECT) & ~LVS_EX_CHECKBOXES); //m_FileListCtrl.SetBkColor(RGB(255,0,0)); str = fMsg.GetKeyVal("AppealDlg","Tip", "提示:1.双击列表中的一行可以播放该录像文件\n 2.请选中您认为有疑问的一局游戏记录后提交!"); SetDlgItemText(IDC_STATIC_TIP,str); str = fMsg.GetKeyVal("AppealDlg","BTNOK","提 交"); SetDlgItemText(IDOK,str); str = fMsg.GetKeyVal("AppealDlg","BTNCANCEL","取 消"); SetDlgItemText(IDCANCEL,str); CString strPath = CBcfFile::GetAppPath(); DWORD dwHandle = cfgOpenFile(strPath + "bzgame.bcf"); if ( dwHandle >= 0x10) { m_strFtpAddress = cfgGetValue(dwHandle,Glb().m_key,"FtpAddress",""); m_strFtpUserName = cfgGetValue(dwHandle,Glb().m_key,"FtpUsrName",""); m_strFtpPwd = cfgGetValue(dwHandle,Glb().m_key,"FtpPwd",""); cfgClose(dwHandle); } CRect rc; GetWindowRect(&rc); m_bnClose.MoveWindow(rc.Width()-36,0,17,17); wsprintf(path,"%s\\%sdialog\\log_exit_bt.bmp",CBcfFile::GetAppPath(true),m_skinmgr.GetSkinPath());//win_close.bmp m_bnClose.LoadButtonBitmap(path,false); //m_FileListCtrl. { CString s=CBcfFile::GetAppPath ();/////本地路径 CString strSkin = m_skinmgr.GetSkinBcfFileName(); CBcfFile f( s + strSkin); TCHAR path[MAX_PATH]; CString skinfolder; if ("skin0.bcf" == strSkin) skinfolder = f.GetKeyVal("skin0","skinfolder",m_skinmgr.GetSkinPath()); else skinfolder = f.GetKeyVal("skin1","skinfolder",m_skinmgr.GetSkinPath()); wsprintf(path,"%sDialog\\scroll.bmp",skinfolder); HBITMAP hbmScorll = (HBITMAP)LoadImage(NULL, path, IMAGE_BITMAP, 0,0, LR_LOADFROMFILE); SkinSB_Init(m_FileListCtrl.GetSafeHwnd(), hbmScorll); SkinSB_Init(GetDlgItem(IDC_EDIT_APPEAL_CONTENT)->GetSafeHwnd(), hbmScorll); } ::SetWindowPos(m_hWnd,CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE); SetWndRgn();// 设置窗口圆角2012.10.17 yyf }
//功能按钮 void CGameFrame::OnBnClickedButton1() { m_DlgControlBar.WebBrowse(TEXT(Glb().m_MainHomeUrl),true); return; }