示例#1
0
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);
		}
	}
}
示例#2
0
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);//
		}
	}
}
示例#3
0
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");
}
示例#4
0
ATOME GetLeftLex(int skipEOL) {
  int identKeyword = 0;

  curChar=fgetc(inputStream) ;
  while (isspace(curChar) || GetComment()) {
    if (curChar == '\n') {
      lineNo++ ;
      if (!skipEOL)
	return LINEN ;
    }
    curChar=fgetc(inputStream) ;
  }
  switch (curChar) {
  case ':':
    DEBUG_PRINTF("%s",":") ;
    return COLUMN ;
  case ',':
    DEBUG_PRINTF("%s",",") ;
    return COMMA ;
  case '*':
    DEBUG_PRINTF("%s","*") ;
    return STAR ;
  case EOF:
    DEBUG_PRINTF("%s","<EOF>") ;
    return FILEN ;
  case '{': 
    DEBUG_PRINTF("%s","{") ;
    return OPENACC;
  case '}': 
    DEBUG_PRINTF("%s","}") ;
    return CLOSACC;
  case '.':
    DEBUG_PRINTF("%s",".") ;
    curChar=fgetc(inputStream) ;
    identKeyword = 1;
    break ;
  }
  if (IsIdent ()) {
    if (identKeyword)
      return IdentKeyWord() ;
    return IDNTER;
  }
	
  if (isdigit(curChar)) {
    GetNumString() ;
    return NUMVAL ;
  }
  utilsPrintError(GENSYN_ERROR_INVALIDIDF,curChar);
  return LEXERR;	
}
示例#5
0
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);
		}
	}
}
示例#6
0
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);
}
示例#7
0
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();

}
示例#8
0
ATOME GetRightLex () {
  int isSPACE ;
  int identAction = 0;
  int getExpression = 0;
  unsigned int maxVal, minVal ;

  curChar=fgetc(inputStream) ;
  if (curChar == EOF)
    return FILEN ;

  switch (curChar) {
  case '[': 
    return OPENBRA;
  case ']': 
    return CLOSBRA;
  case '\n':
    lineNo++;
    return LINEN;
  case '<':
    identAction = 1;
    curChar=fgetc(inputStream) ;	    
    break ;			
  }

  if (identAction) {
    ATOME retLex ;
    retLex = LEXERR ;
    
    switch (curChar) {
    case '#':
      curChar=fgetc(inputStream) ;
#ifdef _FOR_GAS
      retLex = UCSTEXP ;
      GetIdent();
      break;
#else
      switch (tolower(curChar))	{
      case 'r':
	/* Range between a and b is expected here */
	curChar=fgetc(inputStream) ;
	GetNumString() ;
	if (NomLu[0]=='\0') {
	  retLex = LEXERR ;
	  break ;
	}
	minVal = atoi (NomLu) ;
	curChar=fgetc(inputStream) ;
	if (curChar == ':') {
	  curChar=fgetc(inputStream) ;
	  GetNumString() ;
	}
	if (NomLu[0]=='\0') {
	  retLex = LEXERR ;
	  break ;
	}
	maxVal = atoi (NomLu) ;
	sprintf (NomLu, "0x%x", minVal<<16|maxVal) ;
	retLex = RANGE;
	break ;
      case 'i':
	/* n bit range is expected here */
	curChar=fgetc(inputStream) ;
	GetNumString() ;
	retLex = RANGE ;
	maxVal = atoi (NomLu) ;
	sprintf (NomLu, "0x%x", (1<<maxVal)-1) ;
	retLex = RANGE ;			            
	break ;			            
      case 'u':
	/* unsigned constant expression is expected here */
	retLex = UCSTEXP ;
	curChar=fgetc(inputStream) ;
	GetNumString() ;
	break ;
      case 's':
	/* signed constant expression is expected here */
	retLex = SCSTEXP ;
	curChar=fgetc(inputStream) ;
	GetNumString() ;
	break ;			            
      }
#endif
      if (NomLu[0]=='\0') {
	retLex = LEXERR ;
      }
      break ;
    case '$':
      curChar=fgetc(inputStream) ;
      if (IsIdent ()) {
	retLex = LEXEM ;
      }
      break ;
#ifdef _FOR_GAS
    case '<':
      curChar=fgetc(inputStream) ;
#if 0
      printf("%s: EXPR: inputStream: %c\n",__FUNCTION__,curChar);
#endif
      if (IsIdent ()) {
	retLex = EXPR;
      }
#if 0
      printf("%s: EXPR: inputStream: %c\n",__FUNCTION__,curChar);
#endif
      getExpression = 1;
      break ;
#endif
    default:
      if (IsIdent ()) {
	retLex = IDNTER ;
      }
    }
    if (retLex != LEXERR) {
      curChar=fgetc(inputStream) ;
      if (curChar != '>')
	retLex = LEXERR;
      if(getExpression) {
      curChar=fgetc(inputStream) ;
      if (curChar != '>')
	retLex = LEXERR;
      }
    }
    return retLex;
  }

  isSPACE = 0;
  if ((curChar == ' ') || (curChar == '\t')) {
    if (curChar == '\t')
      isSPACE = 1;
    curChar=fgetc(inputStream) ;
    while ((curChar == ' ') || (curChar == '\t')) {
      if (curChar == '\t')
	isSPACE = 1;
      curChar=fgetc(inputStream) ;
    }
    if (curChar == '\n') {
      lineNo++ ;
      return LINEN ;
    }
    ungetc(curChar, inputStream) ;
    if (isSPACE) {
      return SPACE ;
    }
    else {
      return AND ;
    }
  }
	
  GetTermString() ;
  return ELTER;
}
示例#9
0
void CMsgBoxResult::OnPaint()
{
    CPaintDC dc(this);
    CGameImageHelper help(&m_bkImg);
    CDC srcDC;
    srcDC.CreateCompatibleDC(&dc);
    CBitmap *pOldBmp = srcDC.SelectObject(help);
    ::TransparentBlt(dc.GetSafeHdc(),0,0,m_bkImg.GetWidth(),m_bkImg.GetHeight(),
                     srcDC.GetSafeHdc(),0,0,m_bkImg.GetWidth(),m_bkImg.GetHeight(),srcDC.GetPixel(0,0));
    srcDC.SelectObject(pOldBmp);


    CRect ClientRect;
    GetClientRect(&ClientRect);
    //int x=24;//ClientRect.left+20;
    //int y=ClientRect.Height()/2 - 34;

    CRect rect;
    TCHAR sz[100];
    CFont Font;
    Font.CreateFont(14,0,0,0,0,0,0,0,134,3,2,1,2,TEXT("宋体"));
    CFont *OldFont=dc.SelectObject(&Font);
    dc.SetTextColor(RGB(255,255,255));
    dc.SetBkMode(TRANSPARENT);

    //int StartX = 222;
    //int StartY = 78;
    for(int i = 0; i < PLAY_COUNT; i ++)
    {
        if(strlen(m_iFinish.name[i]) <= 0)
            continue;
        if(m_iFinish.iWardPoint[i] > 0||m_iFinish.iMoney[i]>0)
        {
            dc.SetTextColor(RGB(255,0,0));
        }
        else
        {
            dc.SetTextColor(RGB(0,0,0));
        }

        wsprintf(sz,"%s",m_iFinish.name[i]);
        rect.left=m_iGameEndX;
        rect.right=rect.left+80;
        rect.top=m_iGameEndY+33*i;
        rect.bottom=rect.top+33;
        dc.DrawText(sz,lstrlen(sz),&rect,DT_LEFT|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS);

        wsprintf(sz,TEXT("%d"), m_iFinish.iWardPoint[i]);
        rect.left=225;
        rect.right=rect.left+70;
        rect.top=m_iGameEndY+33*i;
        rect.bottom=rect.top+33;
        dc.DrawText(sz,lstrlen(sz),&rect,DT_CENTER|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS);

        CString strMoney;
        GetNumString(m_iFinish.iMoney[i],strMoney,m_nPowerOfGold,false);
        wsprintf(sz,TEXT("%s"),strMoney);

        rect.left=306;
        rect.right=rect.left+70;
        rect.top=m_iGameEndY+33*i;
        rect.bottom=rect.top+33;
        dc.DrawText(sz,lstrlen(sz),&rect,DT_CENTER|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS);

        if(m_iFinish.iWardPoint[i] > 0||m_iFinish.iMoney[i]>0)
            wsprintf(sz,".\\image\\win.bmp");
        else if(m_iFinish.iWardPoint[i] == 0 && m_iFinish.iMoney[i] == 0)
            wsprintf(sz,".\\image\\equal.bmp");
        else
            wsprintf(sz,".\\image\\lost.bmp");
        m_Flag.SetLoadInfo(sz,false);
        CGameImageHelper flag(&m_Flag);
        CDC srcDC;
        srcDC.CreateCompatibleDC(&dc);
        srcDC.SelectObject(flag);
        //flag.BitBlt(dc.GetSafeHdc(),StartX,StartY+33*i,SRCCOPY);
        ::TransparentBlt(dc.GetSafeHdc(),m_iGameEndWinLostX+6,m_iGameEndWinLostY+ 33* i,flag.GetWidth(),flag.GetHeight(),
                         srcDC.GetSafeHdc(),0,0,m_Flag.GetWidth(),m_Flag.GetHeight(),srcDC.GetPixel(0,0));
    }


    dc.DeleteDC();
}