예제 #1
0
/////////////////////////////////////////////////////////////////////////////
// startup
/////////////////////////////////////////////////////////////////////////////
BOOL CTradeOfferDialog::OnInitDialog() 
{
	int i;
	CHoverStatic *pStatic;
	CButtonST *pButton;
	CDC *dc;
	HDC hDC;

	CHelpDialog::OnInitDialog();

	//help system
	m_strHelp = HELP_TRADEOFFER;

	//get the device context
	dc = GetDC();
	hDC = dc->GetSafeHdc();
	
	//set up all the hoverstatics
	for(i = 0; i < 31; i++)
	{
		//get the static
		pStatic = &m_Trade1Text + i;

		//set up values
		pStatic->SetFont(Tahoma12);
		pStatic->SetCenter();
	}

	//set up all the inhand statics
	for(i = 0; i < 5; i++)
	{
		//get the button
		pStatic = &m_Inhand1Text + i;
		pStatic->SetText(VIEW->getResName(i));

		//get the button
		pStatic = &m_OHand1Text + i;
		pStatic->SetText(VIEW->getResName(i));

		//update the buttons
		pButton = &m_InHand1Button + i;
		pButton->SetBitmaps(VIEW->getResImage(i, hDC), COLOR_TRANSP, VIEW->getResImage(i, hDC), COLOR_TRANSP);

		//update the buttons
		pButton = &m_OHand1Button + i;
		pButton->SetBitmaps(VIEW->getResImage(i, hDC), COLOR_TRANSP, VIEW->getResImage(i, hDC), COLOR_TRANSP);
	}

	//release the device context
	ReleaseDC(dc);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
예제 #2
0
/////////////////////////////////////////////////////////////////////////////
// update the current player data
/////////////////////////////////////////////////////////////////////////////
void CTradeOfferDialog::updatePlayer()
{
	int i;
	int iPlayer;
	CButtonST *pButton;
	CHoverStatic *pText;
	CHoverStatic *pQty;
	CString str;

	//get this player
	iPlayer = GAME->m_iIndex;

	//go through and set up this players cards
	for(i = 0; i < 5; i++)
	{
		//get the controls
		pButton = &m_OHand1Button + i;
		pText = &m_OHand1Text + i;
		pQty = &m_Inhand1Qty + i;

		//add cards if they have them
		if(GAME->m_players[iPlayer].m_iRes[i])
		{
			//set the button
			pButton->ShowWindow(SW_SHOW);

			//set the text
			pText->ShowWindow(SW_SHOW);

			//enable windows
			pQty->EnableWindow();
			pQty->ShowWindow(SW_SHOW);

			//set the quantity
			str.Format("%d", GAME->m_players[iPlayer].m_iRes[i]);
			pQty->SetText(str);
		}
		else
		{
			pButton->ShowWindow(SW_HIDE);
			pText->ShowWindow(SW_HIDE);
			pQty->SetText("");
		}
	}
}
예제 #3
0
/////////////////////////////////////////////////////////////////////////////
// update other player trade data
/////////////////////////////////////////////////////////////////////////////
void CTradeOfferDialog::updateOTrade(BOOL bNew, int iPlace)
{
	CButtonST *pButton;
	CHoverStatic *pText;
	CHoverStatic *pQty;
	CString str;
	CDC *dc;
	HDC hDC;

	//get the device context
	dc = GetDC();
	hDC = dc->GetSafeHdc();

	//set the quantity pointer
	pQty = &m_OTrade1Qty + iPlace;

	//set the quantity
	str.Format("%d", m_iOTrade[m_iOTradePlace[iPlace]]);
	pQty->SetText(str);

	//see if we need to add a new card
	if(TRUE == bNew)
	{
		//set the bitmaps and unhide
		pButton = &m_OTrade1Button + iPlace;
		pText = &m_OTrade1Text + iPlace;

		//set the bitmaps
		pButton->SetBitmaps(VIEW->getResImage(m_iOTradePlace[iPlace], hDC), COLOR_TRANSP, VIEW->getResImage(m_iOTradePlace[iPlace], hDC), COLOR_TRANSP);
		pButton->ShowWindow(SW_SHOW);

		//set the text
		pText->SetText(VIEW->getResName(m_iOTradePlace[iPlace]));
		pText->ShowWindow(SW_SHOW);

		//show quantity
		pQty->ShowWindow(SW_SHOW);
	}

	//release the device context
	ReleaseDC(dc);
}
예제 #4
0
/////////////////////////////////////////////////////////////////////////////
// update the incoming trader players cards
/////////////////////////////////////////////////////////////////////////////
void CTradeOfferDialog::updateOPlayer()
{
	int i;
	CButtonST *pButton;
	CHoverStatic *pText;

	//go through and set up this players cards
	for(i = 0; i < 5; i++)
	{
		//get the controls
		pButton = &m_InHand1Button + i;
		pText = &m_Inhand1Text + i;
	
		//set the button
		pButton->ShowWindow(SW_SHOW);

		//set the text
		pText->ShowWindow(SW_SHOW);
	}
}
예제 #5
0
BOOL CDlgMatrixTag::CreateMatrixs()
{
	CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd();
    //int nBtnWidth(48+10), nBtnHeight(70), nWidthGap(10), nHightGap(10);
    int nBtnWidth(39), nBtnHeight(41), nWidthGap(10), nHightGap(10);
    int nLeftMargin(10), nTopMargin(40);
	 
    int nButtonSize=0;
	if (!m_bSetStyle)
	{
		if (CNVRBk::GetBkObject()->isNVRType())
			nButtonSize=sizeof(nID)/ sizeof(int);
		else
			nButtonSize=sizeof(nIDAll)/ sizeof(int);
	}
	else
	{
		if (CNVRBk::GetBkObject()->isNVRType())
			nButtonSize= sizeof(nIDSetting)/ sizeof(int);
		else
			nButtonSize=sizeof(nIDSettingAll)/ sizeof(int);
	}

    CRect rect;
    GetClientRect(rect);
	
	if (rect.IsRectEmpty())
	{
		return false;
	}


    int nColumn = (rect.Width() - nLeftMargin*2) / (nBtnWidth +nWidthGap);
	//int nRow = (rect.Height() - nTopMargin) / nColumn + (((rect.Height() - nTopMargin) % nColumn ) ?  1 : 0);
	int nRow=	  210	/  (nBtnHeight + nHightGap);				  //CMainFrame::CreateMatrixPane() is set 210
	if (!m_bSetStyle)
	{
		nTopMargin=60;
		nColumn++;
	}
  

    DWORD dwStyle = BS_PUSHBUTTON |BS_NOTIFY |WS_VISIBLE;//BS_PUSHBUTTON |BS_NOTIFY |WS_VISIBLE |WS_CHILD|WS_VISIBLE|BS_OWNERDRAW ;
	COLORREF clBG = RGB(0,0,0);
    int nHoveOver = (int)BTNST_AUTO_GRAY;

	m_btnAutioScanSetting.SetBitmaps(IDB_EMAPSETU, clBG ,nHoveOver);
    CRect rect2;
	CRect rtAutoSetting;
	m_ButtonAutoScan.GetWindowRect(rtAutoSetting);
	ScreenToClient(rtAutoSetting);
    m_btnAutioScanSetting.GetClientRect(rect2);
    //ScreenToClient(rect2);
    m_btnAutioScanSetting.MoveWindow(rtAutoSetting.right+5, 10, 24,24);

    
    for (int cj = 0; cj < nRow; cj++)
    {    
        for (int ci = 0; ci < nColumn; ci++)
        {
            if ((cj* nColumn + ci) < nButtonSize)
            {
                int nX0 = nLeftMargin + (nBtnWidth +nWidthGap)* ci;
				if (!m_bSetStyle && cj == 0)
					nX0 -=  (nBtnWidth +nWidthGap);
                int nX1 = nX0 +nBtnWidth;
                int nY0 = nTopMargin + (nBtnHeight +nHightGap)* cj;
                int nY1 = nY0 +nBtnHeight;
                CButtonST* pBtn = new CButtonST;

				if (cj == 0 && ci == 0 && !m_bSetStyle)
				{
					//if (CNVRBk::GetBkObject()->isNVRType())
					//{
					//		if (nID[0] == IDB_BITMAP_FULL)
					//		{
					//			nX0 = nLeftMargin;
					//			nX1 = nX0 +nBtnWidth;
					//			nY0 = rtAutoSetting.top;
					//			nY1 = nY0 +nBtnHeight;
					//		}
					//}
					//else
					//{
						if (nIDAll[0] == IDB_BITMAP_FULL)
						{
							nX0 = nLeftMargin;
							nX1 = nX0 +nBtnWidth;
							nY0 = rtAutoSetting.top-5;
							nY1 = nY0 +nBtnHeight;
						}
					//}
				}
				
				
				if (!m_bSetStyle)
				{	
					if (CNVRBk::GetBkObject()->isNVRType())
					{
						pBtn->Create(NULL, dwStyle, CRect(nX0, nY0, nX1, nY1), this, nID[nColumn* cj +ci]);              
						if(mapTable[nID[nColumn* cj +ci]] == pMain->m_OrgLayoutIdx)
						{
							pBtn->SetBitmaps(nIDHot[nColumn* cj +ci], clBG);
							g_uIDBtnMatrix = nID[nColumn* cj +ci];
						}
						else
						{
							pBtn->SetBitmaps(nIDHot[nColumn* cj +ci], clBG ,nHoveOver,  nID[nColumn* cj +ci]);
						}
					}
					else
					{
						pBtn->Create(NULL, dwStyle, CRect(nX0, nY0, nX1, nY1), this, nIDAll[nColumn* cj +ci]);              
						if(mapTable[nIDAll[nColumn* cj +ci]] == pMain->m_OrgLayoutIdx)
						{
							pBtn->SetBitmaps(nIDHotAll[nColumn* cj +ci], clBG);
							g_uIDBtnMatrix = nIDAll[nColumn* cj +ci];
						}
						else
						{
							pBtn->SetBitmaps(nIDHotAll[nColumn* cj +ci], clBG ,nHoveOver,  nIDAll[nColumn* cj +ci]);
						}
					}
					
				}
				else
				{
					if (CNVRBk::GetBkObject()->isNVRType())
					{
						pBtn->Create(NULL, dwStyle, CRect(nX0, nY0, nX1, nY1), this, nIDSetting[nColumn* cj +ci]);              
						if(mapTable[nIDSetting[nColumn* cj +ci]] == pMain->m_OrgLayoutIdx)
						{
							pBtn->SetBitmaps(nIDHotSetting[nColumn* cj +ci], clBG);
							//g_uIDBtnMatrix = nID[nColumn* cj +ci];
						}
						else
						{
							pBtn->SetBitmaps(nIDHotSetting[nColumn* cj +ci], clBG ,nHoveOver,  nIDHotSetting[nColumn* cj +ci]);
						}
					}
					else
					{
						pBtn->Create(NULL, dwStyle, CRect(nX0, nY0, nX1, nY1), this, nIDSettingAll[nColumn* cj +ci]);              
						if(mapTable[nIDSettingAll[nColumn* cj +ci]] == pMain->m_OrgLayoutIdx)
						{
							pBtn->SetBitmaps(nIDHotSettingAll[nColumn* cj +ci], clBG);
							//g_uIDBtnMatrix = nID[nColumn* cj +ci];
						}
						else
						{
							pBtn->SetBitmaps(nIDHotSettingAll[nColumn* cj +ci], clBG ,nHoveOver,  nIDHotSettingAll[nColumn* cj +ci]);
						}
					}					
				}


				m_vtBtnMatrixs.push_back(pBtn);
			}
        }
    }
    
    return true;    
}
예제 #6
0
/////////////////////////////////////////////////////////////////////////////
// handle a click on a card currently in the trade queue
/////////////////////////////////////////////////////////////////////////////
void CTradeOfferDialog::HandleTradeClick(UINT nID)
{
	int i;
	int iQty;
	int iRes;
	int iPlace;
	int iPlayer;
	CString str;
	CButtonST *pButton;
	CHoverStatic *pText;
	CHoverStatic *pQty;

	//get the current place
	iPlace = (nID - IDC_TRADE1_BUTTON);

	//get the current player
	iPlayer = VIEW->getPlayer();

	//get the resource in question
	iRes = m_iTradePlace[iPlace];

	//subtract one from the amounts being traded
	m_iTrade[iRes]--;

	//get the quantity button
	pQty = &m_Trade1Qty + iPlace;

	//if it's a zero, remove this card from the trade stack
	if(m_iTrade[iRes] == 0)
	{
		//get the buttons
		pButton = &m_Trade1Button + iPlace;
		pText = &m_Trade1Text + iPlace;

		//hide them
		pButton->ShowWindow(SW_HIDE);
		pText->SetText("");
		pQty->SetText("");

		//set this value to empty
		m_iTradePlace[iPlace] = -1;

		//enable the other side
		pButton = &m_OHand1Button + iRes;
		pButton->EnableWindow();

		pText = &m_OHand1Text + iRes;
		pText->EnableWindow();

		pQty = &m_Inhand1Qty + iRes;
		pQty->EnableWindow();
	}
	else
	{
		//set the new quantity
		str.Format("%d", m_iTrade[iRes]);
		pQty->SetText(str);
	}

	//get the new in hand quantity
	iQty = MAP->m_iBankRes - m_iTrade[iRes];

	//if it's 1, then we need to re show this window and text
	if(iQty == 1)
	{
		//get the buttons
		pButton = &m_InHand1Button + iRes;
		pText = &m_Inhand1Text + iRes;

		//show them
		pButton->ShowWindow(SW_SHOW);
		pText->ShowWindow(SW_SHOW);
	}

	//check to see if we're not all empty
	for(i = 0, m_iNumTrade = 0; i < 4; i++)
	{
		if(m_iTradePlace[i] != -1)
		{
			m_iNumTrade++;
			break;
		}
	}

	//see if we can trade
	enableTrade();

	//set the changed flag
	m_bChanged = TRUE;

	//set the focus to the view
	VIEW->SetFocus();
}
예제 #7
0
/////////////////////////////////////////////////////////////////////////////
// handle a click on another player's card
/////////////////////////////////////////////////////////////////////////////
void CTradeOfferDialog::HandleOHandClick(UINT nID)
{
	int i;
	int iRes;
	int iQty;
	int iPlayer;
	BOOL bNew = FALSE;
	BOOL bInList = FALSE;
	CString str;
	CButtonST *pButton;
	CHoverStatic *pText;
	CHoverStatic *pQty;

	//get the resource type
	iRes = (nID - IDC_OHAND1_BUTTON);

	//get who we are
	iPlayer = GAME->m_iIndex;

	//search for it in the list
	for(i = 0; i < 4; i++)
	{
		//if we find it, or a -1, break;
		if(m_iOTradePlace[i] == iRes)
		{
			bInList = TRUE;
			break;
		}
	}

	if(FALSE == bInList)
	{
		for(i = 0; i < 4; i++)
		{
			//it's a new card
			if(m_iOTradePlace[i] == -1)
			{
				//set the place
				bNew = TRUE;
				m_iOTradePlace[i] = iRes;

				//disable this card on the other side
				pButton = &m_InHand1Button + iRes;
				pButton->EnableWindow(FALSE);

				pText = &m_Inhand1Text + iRes;
				pText->EnableWindow(FALSE);
				break;
			}
		}
	}

	//increase the number of cards being traded
	m_iOTrade[iRes]++;

	//get the onhand quantity
	iQty = GAME->m_players[iPlayer].m_iRes[iRes] - m_iOTrade[iRes];

	//get quantity pointer
	pQty = &m_Inhand1Qty + iRes;

	//if it's zero, remove this card
	if(iQty == 0)
	{
		//get the other pointers
		pButton = &m_OHand1Button + iRes;
		pText = &m_OHand1Text + iRes;

		//remove the texts
		pText->ShowWindow(SW_HIDE);
		pButton->ShowWindow(SW_HIDE);
		pQty->ShowWindow(SW_HIDE);
	}
	else
	{
		//set the new text
		str.Format("%d", iQty);
		pQty->SetText(str);
	}

	//update the trade data
	updateOTrade(bNew, i);

	//set the trade bool
	m_iNumOTrade++;

	//see if we can trade
	enableTrade();

	//set the changed flag
	m_bChanged = TRUE;

	//set the focus to the view
	VIEW->SetFocus();
}
예제 #8
0
/////////////////////////////////////////////////////////////////////////////
// show everything
/////////////////////////////////////////////////////////////////////////////
void CTradeOfferDialog::OnCounterButton() 
{
	int i;
	int iRes;
	int iPlayer;
	int iCount = 4;
	int nQty;
	CRect rect;
	CString str;
	CButtonST *pButton;
	CHoverStatic *pText;
	CHoverStatic *pQty;

	//kill the timer
	stopTimer();

	//send the reply
	VIEW->clientReplyOffer(m_uiTradeID, TRADE_COUNTER);

	//set new texts
	str.Format("Ask %s for these cards...", GAME->m_players[VIEW->getPlayer()].m_player.getName());
	m_PlayerStatic.SetWindowText(str);

	//set our text
	m_OPlayerStatic.SetWindowText("in exchange for these cards");

	//get who we are
	iPlayer = GAME->m_iIndex;

	//go through what the trader wants from us and weed out anything that
	//we don't have
	for(i = 0; i < 4; i++)
	{	
		//enable all other player trade windows
		pButton = &m_Trade1Button + i;
		pButton->EnableWindow();

		//disable this side, if necessary
		if(-1 != m_iTradePlace[i])
		{
			iRes = m_iTradePlace[i];

			pButton = &m_OHand1Button + iRes;
			pButton->EnableWindow(FALSE);

			pText = &m_OHand1Text + iRes;
			pText->EnableWindow(FALSE);

			pQty = &m_Inhand1Qty + iRes;
			pQty->EnableWindow(FALSE);
		}

		//skip ones that aren't there
		if(-1 == m_iOTradePlace[i])
		{
			iCount--;
			continue;
		}

		//get the res
		iRes = m_iOTradePlace[i];

		//get button
		pButton = &m_OTrade1Button + i;

		//enable window for trading
		pButton->EnableWindow();

		//determine if we have enough to match what they want
		if(GAME->m_players[iPlayer].m_iRes[iRes] < m_iOTrade[iRes])
		{
			//reset counter spot
			m_iOTradePlace[i] = -1;
			m_iOTrade[iRes] = 0;

			pText = &m_OTrade1Text + i;
			pQty = &m_OTrade1Qty + i;

			//hide all
			pText->ShowWindow(SW_HIDE);
			pQty->ShowWindow(SW_HIDE);
			pButton->ShowWindow(SW_HIDE);

			//we've changed the trade already
			m_bChanged = TRUE;

			//decrement counter
			iCount--;
		}
		else
		{
			//disable opposing side
			pButton = &m_InHand1Button + iRes;
			pButton->EnableWindow(FALSE);

			pText = &m_Inhand1Text + iRes;
			pText->EnableWindow(FALSE);

			//now correctly set how many cards should appear below

			//get the onhand quantity
			nQty = GAME->m_players[iPlayer].m_iRes[iRes] - m_iOTrade[iRes];

			//get quantity pointer
			pQty = &m_Inhand1Qty + iRes;

			//if it's zero, remove this card
			if(nQty == 0)
			{
				//get the other pointers
				pButton = &m_OHand1Button + iRes;
				pText = &m_OHand1Text + iRes;

				//remove the texts
				pText->ShowWindow(SW_HIDE);
				pButton->ShowWindow(SW_HIDE);
				pQty->ShowWindow(SW_HIDE);
			}
			else
			{
				//set the new text
				str.Format("%d", nQty);
				pQty->SetText(str);
			}
		}
	}

	//get screen rect
	GetWindowRect(&rect);

	//disable this button
	m_CounterButton.EnableWindow(FALSE);

	//disable the accept button so they dont' accidently press it
	m_OKButton.EnableWindow(FALSE);

	//show all
	SetWindowPos(&wndTop, 0, 0, rect.Width(), 260, SWP_NOMOVE | SWP_NOZORDER);

	//set the trade flag
	m_iNumOTrade = iCount;

	//enable/disable the offer button
	enableTrade();

	//set the focus to the view
	VIEW->SetFocus();
}
예제 #9
0
/////////////////////////////////////////////////////////////////////////////
// set offer data
/////////////////////////////////////////////////////////////////////////////
void CTradeOfferDialog::setOffer(int *iTo, int *iFor, UINT uiID)
{
	int i, j, k;
	int iRes;
	int iPlayer;
	BOOL bCanTrade = TRUE;
	BOOL bAnyTrade = FALSE;
	CRect rect;
	CRect rectClient;
	CString str;
	CDC *dc;
	HDC hDC;
	CHoverStatic *pStatic;
	CHoverStatic *pText;
	CButtonST *pButton;

	//reset trade counter
	m_iNumTrade = 0;

	//reset the changed flag
	m_bChanged = FALSE;

	//get the device context
	dc = GetDC();
	hDC = dc->GetSafeHdc();
	
	//get screen rect
	GetWindowRect(&rect);

	//get client rect
	GetClientRect(&rectClient);

	//enable counter button
	m_CounterButton.EnableWindow();

	//set data
	memcpy(m_iTrade, iTo, sizeof(m_iTrade));
	memcpy(m_iOTrade, iFor, sizeof(m_iOTrade));

	//reset trade places
	memset(m_iTradePlace, -1, sizeof(m_iTradePlace));
	memset(m_iOTradePlace, -1, sizeof(m_iOTradePlace));

	//set trade places
	for(i = 0, j = 0, k = 0; i < 5; i++)
	{
		if(0 < m_iTrade[i])
		{
			m_iTradePlace[j++] = i;		
		}
		if(0 < m_iOTrade[i])
		{
			m_iOTradePlace[k++] = i;
		}
	}

	//trade id
	m_uiTradeID = uiID;

	//set various text
	iPlayer = VIEW->getPlayer();

	//set title text
	str.Format("%s wants to trade!", GAME->m_players[iPlayer].m_player.getName());
	SetWindowText(str);

	//set static text
	str.Format("%s is offering these cards", GAME->m_players[iPlayer].m_player.getFirstName());
	m_PlayerStatic.SetWindowText(str);

	//set player to who we are
	iPlayer = GAME->m_iIndex;

	//update statics
	for(i = 0; i < 4; i++)
	{
		//get controls
		pText = &m_Trade1Text + i;
		pStatic = &m_Trade1Qty + i;
		pButton = &m_Trade1Button + i;

		//get the res
		iRes = m_iTradePlace[i];

		//show/hide from trader
		if(-1 != iRes)
		{
			m_iNumTrade++;
			pText->SetText(VIEW->getResName(iRes));
			pText->ShowWindow(SW_SHOW);
			pButton->SetBitmaps(VIEW->getResImage(iRes, dc->GetSafeHdc()), COLOR_TRANSP, VIEW->getResImage(iRes, dc->GetSafeHdc()), COLOR_TRANSP);
			pButton->ShowWindow(SW_SHOW);
			pButton->EnableWindow(FALSE);
			str.Format("%d", m_iTrade[iRes]);
			pStatic->SetText(str);
			pStatic->ShowWindow(SW_SHOW);
		}
		else
		{
			pText->ShowWindow(SW_HIDE);
			pButton->ShowWindow(SW_HIDE);
			pStatic->ShowWindow(SW_HIDE);
		}

		//get controls
		pText = &m_OTrade1Text + i;
		pStatic = &m_OTrade1Qty + i;
		pButton = &m_OTrade1Button + i;

		//get the res
		iRes = m_iOTradePlace[i];

		//show/hide
		if(-1 != iRes)
		{
			pText->SetText(VIEW->getResName(iRes));
			pText->ShowWindow(SW_SHOW);
			pButton->SetBitmaps(VIEW->getResImage(iRes, dc->GetSafeHdc()), COLOR_TRANSP, VIEW->getResImage(iRes, dc->GetSafeHdc()), COLOR_TRANSP);
			pButton->ShowWindow(SW_SHOW);
			pButton->EnableWindow(FALSE);
			str.Format("%d", m_iOTrade[iRes]);
			pStatic->SetText(str);
			pStatic->ShowWindow(SW_SHOW);
		}
		else
		{
			pText->ShowWindow(SW_HIDE);
			pButton->ShowWindow(SW_HIDE);
			pStatic->ShowWindow(SW_HIDE);
		}

		//see if they can even do this trade
		if(GAME->m_players[iPlayer].m_iRes[iRes] < m_iOTrade[iRes])
		{
			bCanTrade = FALSE;
		}
	}

	//reset the counteroffer buttons to be on (turned off in OnCounter)
	for(i = 0; i < 5; i++)
	{
		pButton = &m_OHand1Button + i;
		pButton->EnableWindow();

		pButton = &m_InHand1Button + i;
		pButton->EnableWindow();

		pText = &m_OHand1Text + i;
		pText->EnableWindow();

		pText = &m_Inhand1Text + i;
		pText->EnableWindow();

		pText = &m_Inhand1Qty + i;
		pText->EnableWindow();

		//see if we even have the ability to counteroffer
		if(0 < GAME->m_players[iPlayer].m_iRes[i])
		{
			bAnyTrade = TRUE;
		}
	}

	//enable/disable ability to trade
	m_OKButton.EnableWindow(bCanTrade);
	m_CounterButton.EnableWindow(bAnyTrade);

	//update the current player
	updatePlayer();	

	//update other player
	updateOPlayer();

	//set auto-reject timer
	m_iTime = GetPrivateProfileInt(INI_GENERAL, INI_TRADE_TIMEOUT, 15, INI_FILE);
	m_uiReject = SetTimer(TIMER_REJECT_TRADE, 1000, NULL);

	//set window pos sans counter	
	SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height() - rectClient.Height() + 105, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);

	//show ourselves
	ShowWindow(SW_SHOWNOACTIVATE);

	//release context
	ReleaseDC(dc);

	//set the focus to the view
	VIEW->SetFocus();
}
예제 #10
0
/////////////////////////////////////////////////////////////////////////////
// setup
/////////////////////////////////////////////////////////////////////////////
BOOL CTradeJungleDialog::OnInitDialog() 
{
	int i;
	int nRes = 0;
	int nChoice = 0;
	BOOL bSingles;
	CDC *dc;
	CString str;
	CHoverStatic *pStatic;
	CButtonST *pButton;
	HDC hDC;

	CHelpDialog::OnInitDialog();

	//get the device context
	dc = GetDC();
	hDC = dc->GetSafeHdc();

	//set up all the statics and bitmaps
	for(i = 0; i < 9; i++)
	{
		//get the res
		switch(i / 3)
		{
		case 0: nRes = RES_WHEAT; break;
		case 1: nRes = RES_SHEEP; break;
		case 2: nRes = RES_ORE; break;
		}

		//bitmaps
		pButton = &m_W2Button + i;

		//set the bitmaps
		pButton->SetBitmaps(VIEW->getResImage(nRes, hDC), COLOR_TRANSP, VIEW->getResImage(nRes, hDC), COLOR_TRANSP);
		pButton->EnableWindow(FALSE);

		//statics
		pStatic = &m_W2Static + i;

		//set the properties
		pStatic->SetFont(Tahoma12);
		pStatic->SetCenter();

		//set the text
		pStatic->SetText(VIEW->getResName(nRes));
	}
	
	//release the device context
	ReleaseDC(dc);

	//determine if we show single cards or not
	bSingles = (1 == (m_nJungles - m_nNeeded));

	//set top text
	str.Format("Which card%s would you like to keep?", bSingles ? "" : "s");
	SetWindowText(str);

	//show or hide the single options
	showSingles(bSingles);

	//if we've got singles and 2 jungles, it means we have to hide the one card
	//choice they don't have
	if((TRUE == bSingles) && (2 == m_nJungles))
	{
		//look at the player's res count for each
		if(0 == GAME->m_players[m_nPlayer].m_iRes[RES_WHEAT])
		{
			m_WButton.ShowWindow(SW_HIDE);
			m_WStatic.ShowWindow(SW_HIDE);
			m_1Radio.ShowWindow(SW_HIDE);
			nChoice = 1;
		}
		else if(0 == GAME->m_players[m_nPlayer].m_iRes[RES_ORE])
		{
			m_OButton.ShowWindow(SW_HIDE);
			m_OStatic.ShowWindow(SW_HIDE);
			m_2Radio.ShowWindow(SW_HIDE);
		}
		else
		{
			m_SButton.ShowWindow(SW_HIDE);
			m_SStatic.ShowWindow(SW_HIDE);
			m_3Radio.ShowWindow(SW_HIDE);
		}
	}

	//initial set radio selection
	switch(nChoice)
	{
	case 0:	m_1Radio.SetCheck(TRUE); break;
	case 1: m_2Radio.SetCheck(TRUE); break;
	case 2: m_3Radio.SetCheck(TRUE); break;
	}

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}