📄 llkdlg.cpp
字号:
Mydc2.SelectObject(&TimeLable);
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(255,255,255));
CFont *pOldFont,*font;
font = new CFont;
font->CreateFont(16, 0, 0, 0, FW_NORMAL, FALSE, FALSE,0,0,0,0,0,0, _T("Arial"));
pOldFont = (CFont*)pDC->SelectObject(font);
if (m_nLanguage == 0)
pDC->DrawText(_T("LEFT TIME:"), CRect(13,23,80,45), NULL);
if (m_nLanguage == 1)
pDC->DrawText(_T("剩余时间:"), CRect(13,23,80,45), NULL);
pDC->DrawText(min, CRect(251,23,261,45), NULL);
pDC->DrawText(":", CRect(261,23,266,45), NULL);
pDC->DrawText(sec1, CRect(266,23,276,45), NULL);
pDC->DrawText(sec2, CRect(276,23,286,45), NULL);
pDC->BitBlt(82, 26, 161, 9, &Mydc1, 0, 0, SRCCOPY);
pDC->BitBlt(85, 28, time, 5, &Mydc2, 0, 0, SRCCOPY);
Mydc2.DeleteDC();
Mydc1.DeleteDC();
font->DeleteObject();
pOldFont->DeleteObject();
delete font;
TimeFram.DeleteObject();
TimeLable.DeleteObject();
}
BOOL CLlkDlg::GetInGame() //返回是否游戏
{
return m_bInGame;
}
int CLlkDlg::GetLeft() //取得剩余牌数
{
return m_nLeft;
}
int CLlkDlg::GetLevel() //得到关卡
{
return m_nLevel;
}
BOOL CLlkDlg::GetPause() //得到是否暂停标识
{
return m_bPause;
}
double CLlkDlg::GetPos() //得到时间条当前位置
{
return m_nPos;
}
int CLlkDlg::GetPrompt() //得到提示次数
{
return m_nPrompt;
}
int CLlkDlg::GetScore() //得到分数
{
return m_nScore;
}
int CLlkDlg::GetShuffle() //得到洗牌次数
{
return m_nShuffle;
}
double CLlkDlg::GetSpeed() //得到时间条速度
{
return m_nSpeed;
}
int CLlkDlg::GetTotal() //得到总牌数
{
return m_nTotal;
}
float CLlkDlg::GetUpper() //得到时间条长度
{
return m_nUpper;
}
void CLlkDlg::GoToNextLevel() //进入一下关
{
if (!GetInGame())
return;
if (GetLevel() >= 15)
return;
OnGameAbandon();
SetInGame();
SetLevel(GetLevel() + 1);
StartGame();
SetLeft();
m_nPane_x = 0;
m_nPane_y = 0;
m_nMin = 2;
m_nSec1 = 0;
m_nSec2 = 0;
if (GetLevel() >= 2 && GetLevel() <= 5)
m_nCycle = 7;
if (GetLevel() >= 6 && GetLevel() <= 9)
m_nCycle = 6;
if (GetLevel() >= 10 && GetLevel() <= 14)
m_nCycle = 5;
if (GetLevel() ==15)
m_nCycle = 4;
SetPause(false);
}
BOOL CLlkDlg::IsPicEmpty() //是否消完
{
if (m_nLeft)
return FALSE;
else
return TRUE;
}
void CLlkDlg::MovePic(int x1, int y1, int x2, int y2) //位图移动
{
int i , nMin, nMax;
switch (m_nLevel)
{
case 1:
case 11:
break;
case 2:
case 12: //下移
{
if (y1 == y2)
{
nMin = min(x1, x2);
nMax = max(x1, x2);
for (i = nMin - 1; i > 0; i--)
{
if (GetPicIndex(i, y1) == 0)
break;
ReleasePicPlace(i, y1);
SetValue(i + 1, y1, GetValue(i, y1));
SetValue(i, y1, 0);
AddPicPlace(i + 1, y1);
}
for (i = nMax - 1; i > 0; i--)
{
if (GetPicIndex(i, y1) == 0)
break;
ReleasePicPlace(i, y1);
SetValue(i + 1, y1, GetValue(i, y1));
SetValue(i, y1, 0);
AddPicPlace(i + 1, y1);
}
}
else
{
for (i = x1 - 1; i > 0; i--)
{
if (GetPicIndex(i, y1) == 0)
break;
ReleasePicPlace(i, y1);
SetValue(i + 1, y1, GetValue(i, y1));
SetValue(i, y1, 0);
AddPicPlace(i + 1, y1);
}
for (i = x2 - 1; i > 0; i--)
{
if (GetPicIndex(i, y2) == 0)
break;
ReleasePicPlace(i, y2);
SetValue(i + 1, y2, GetValue(i, y2));
SetValue(i, y2, 0);
AddPicPlace(i + 1, y2);
}
}
}
break;
case 3: //上移
case 13:
{
if (y1 == y2)
{
nMin = min(x1, x2);
nMax = max(x1, x2);
for (i = nMax + 1; i <=ROW_NUMBER; i++)
{
if (GetPicIndex(i, y1) == 0)
break;
ReleasePicPlace(i, y1);
SetValue(i - 1, y1, GetValue(i, y1));
SetValue(i, y1, 0);
AddPicPlace(i - 1, y1);
}
for (i = nMin + 1; i <=ROW_NUMBER; i++)
{
if (GetPicIndex(i, y1) == 0)
break;
ReleasePicPlace(i, y1);
SetValue(i - 1, y1, GetValue(i, y1));
SetValue(i, y1, 0);
AddPicPlace(i - 1, y1);
}
}
else
{
for (i = x1 + 1; i <=ROW_NUMBER; i++)
{
if (GetPicIndex(i, y1) == 0)
break;
ReleasePicPlace(i, y1);
SetValue(i - 1, y1, GetValue(i, y1));
SetValue(i, y1, 0);
AddPicPlace(i - 1, y1);
}
for (i = x2 + 1; i <=ROW_NUMBER; i++)
{
if (GetPicIndex(i, y2) == 0)
break;
ReleasePicPlace(i, y2);
SetValue(i - 1 , y2, GetValue(i, y2));
SetValue(i, y2, 0);
AddPicPlace(i - 1, y2);
}
}
}
break;
case 4: //左移
case 14:
{
if (x1 == x2)
{
nMin = min(y1, y2);
nMax = max(y1, y2);
for (i = nMax + 1; i <=LINE_NUMBER; i++)
{
if (GetPicIndex(x1, i) == 0)
break;
ReleasePicPlace(x1, i);
SetValue(x1, i-1, GetValue(x1, i));
SetValue(x1, i, 0);
AddPicPlace(x1, i-1);
}
for (i = nMin + 1; i<=LINE_NUMBER; i++)
{
if (GetPicIndex(x1,i) == 0)
break;
ReleasePicPlace(x1, i);
SetValue(x1, i-1, GetValue(x1, i));
SetValue(x1, i, 0);
AddPicPlace(x1, i-1);
}
}
else
{
for (i = y1 + 1; i <=LINE_NUMBER; i++)
{
if (GetPicIndex(x1, i) == 0)
break;
ReleasePicPlace(x1, i);
SetValue(x1, i-1, GetValue(x1, i));
SetValue(x1, i, 0);
AddPicPlace(x1, i-1);
}
for (i = y2 + 1; i<=LINE_NUMBER; i++)
{
if (GetPicIndex(x2,i) == 0)
break;
ReleasePicPlace(x2, i);
SetValue(x2, i-1, GetValue(x2, i));
SetValue(x2, i, 0);
AddPicPlace(x2, i-1);
}
}
}
break;
case 8: //右移
case 5:
case 15:
{
if (x1 == x2)
{
nMin = min(y1, y2);
nMax = max(y1, y2);
for (i = nMin - 1; i>0; i--)
{
if (GetPicIndex(x1, i) == 0)
break;
ReleasePicPlace(x1, i);
SetValue(x1, i+1, GetValue(x1, i));
SetValue(x1, i, 0);
AddPicPlace(x1, i+1);
}
for (i = nMax - 1; i>0; i--)
{
if (GetPicIndex(x1,i) == 0)
break;
ReleasePicPlace(x1, i);
SetValue(x1, i+1, GetValue(x1, i));
SetValue(x1, i, 0);
AddPicPlace(x1, i+1);
}
}
else
{
for (i = y1 - 1; i>0; i--)
{
if (GetPicIndex(x1, i) == 0)
break;
ReleasePicPlace(x1, i);
SetValue(x1, i+1, GetValue(x1, i));
SetValue(x1, i, 0);
AddPicPlace(x1, i+1);
}
for (i = y2 - 1; i>0; i--)
{
if (GetPicIndex(x2,i) == 0)
break;
ReleasePicPlace(x2, i);
SetValue(x2, i+1, GetValue(x2, i));
SetValue(x2, i, 0);
AddPicPlace(x2, i+1);
}
}
}
break;
case 9:
case 6: //上、下向中间移
{
if (y1 == y2)
{
nMin = min(x1, x2);
nMax = max(x1, x2);
for (i = nMax + 1; i <=ROW_NUMBER; i++)
{
if (GetPicIndex(i, y1) == 0)
break;
ReleasePicPlace(i, y1);
SetValue(i - 1, y1, GetValue(i, y1));
SetValue(i, y1, 0);
AddPicPlace(i - 1, y1);
}
for (i = nMin - 1; i > 0; i--)
{
if (GetPicIndex(i, y2) == 0)
break;
ReleasePicPlace(i, y2);
SetValue(i + 1, y2, GetValue(i, y2));
SetValue(i, y2, 0);
AddPicPlace(i + 1, y2);
}
}
else
{
for (i = x1 + 1; i <=ROW_NUMBER; i++)
{
if (GetPicIndex(i, y1) == 0)
break;
ReleasePicPlace(i, y1);
SetValue(i - 1, y1, GetValue(i, y1));
SetValue(i, y1, 0);
AddPicPlace(i - 1, y1);
}
for (i = x2 - 1; i > 0; i--)
{
if (GetPicIndex(i, y2) == 0)
break;
ReleasePicPlace(i, y2);
SetValue(i + 1, y2, GetValue(i, y2));
SetValue(i, y2, 0);
AddPicPlace(i + 1, y2);
}
}
}
break;
case 10:
case 7: //左、右向中间移
{
if (x1 == x2)
{
nMin = min(y1, y2);
nMax = max(y1, y2);
for (i = nMax + 1; i <=LINE_NUMBER; i++)
{
if (GetPicIndex(x1, i) == 0)
break;
ReleasePicPlace(x1, i);
SetValue(x1, i-1, GetValue(x1, i));
SetValue(x1, i, 0);
AddPicPlace(x1, i-1);
}
for (i = nMin - 1; i>0; i--)
{
if (GetPicIndex(x2,i) == 0)
break;
ReleasePicPlace(x2, i);
SetValue(x2, i+1, GetValue(x2, i));
SetValue(x2, i, 0);
AddPicPlace(x2, i+1);
}
}
else
{
for (i = y1 + 1; i <=LINE_NUMBER; i++)
{
if (GetPicIndex(x1, i) == 0)
break;
ReleasePicPlace(x1, i);
SetValue(x1, i-1, GetValue(x1, i));
SetValue(x1, i, 0);
AddPicPlace(x1, i-1);
}
for (i = y2 - 1; i>0; i--)
{
if (GetPicIndex(x2,i) == 0)
break;
ReleasePicPlace(x2, i);
SetValue(x2, i+1, GetValue(x2, i));
SetValue(x2, i, 0);
AddPicPlace(x2, i+1);
}
}
}
break;
default:
break;
}
}
void CLlkDlg::Prompt() //提示
{
CRect rect;
LPCJL_PATH pPic = NULL;
LPCJL_PATH pPrev = NULL;
for (int i = m_nTpos; i <= 28; i++)
{
pPic = PIC_PLACE[i];
while (pPic != NULL)
{
pPrev = pPic;
while (pPrev->prev != NULL)
{
pPrev = pPrev->prev;
if (CheckConn(pPic->x, pPic->y, pPrev->x, pPrev->y))
{
UpdateClkState(pPic->x, pPic->y, LS_CLICK);
UpdateClkState(pPrev->x, pPrev->y, LS_CLICK);
if (m_nTpos != 1)
{
UpdateClkState(m_nTpos_x1, m_nTpos_y1, LS_NOCLK);
UpdateClkState(m_nTpos_x2, m_nTpos_y2, LS_NOCLK);
}
m_nTpos_x1 = pPic->x;
m_nTpos_x2 = pPrev->x;
m_nTpos_y1 = pPic->y;
m_nTpos_y2 = pPrev->y;
m_nTpos = i + 1;
m_bTip_ok = true;
return;
}
}
pPic = pPic->prev;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -