增加技能演示选项
This commit is contained in:
+98
-4
@@ -197,6 +197,30 @@ static RECT GetHelpOptionRect(HWND hWnd, int index)
|
||||
return rect;
|
||||
}
|
||||
|
||||
static RECT GetHelpSkillDemoItemRect(HWND hWnd, int index)
|
||||
{
|
||||
LayoutMetrics metrics = GetLayoutMetrics(hWnd);
|
||||
RECT rulesCard = GetRulesCardRect(hWnd);
|
||||
RECT contentRect =
|
||||
{
|
||||
rulesCard.left + ScaleValue(metrics, 36),
|
||||
rulesCard.top + ScaleValue(metrics, 126),
|
||||
rulesCard.right - ScaleValue(metrics, 36),
|
||||
rulesCard.bottom - ScaleValue(metrics, 86)
|
||||
};
|
||||
int itemHeight = ScaleValue(metrics, 58);
|
||||
int itemGap = ScaleValue(metrics, 10);
|
||||
int itemTop = contentRect.top + ScaleValue(metrics, 8) - helpScrollOffset;
|
||||
RECT rect =
|
||||
{
|
||||
contentRect.left,
|
||||
itemTop + index * (itemHeight + itemGap),
|
||||
contentRect.right,
|
||||
itemTop + index * (itemHeight + itemGap) + itemHeight
|
||||
};
|
||||
return rect;
|
||||
}
|
||||
|
||||
static RECT GetHelpBackHintRect(HWND hWnd)
|
||||
{
|
||||
LayoutMetrics metrics = GetLayoutMetrics(hWnd);
|
||||
@@ -744,6 +768,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
switch (wmId)
|
||||
{
|
||||
case IDM_SKILL_DEMO:
|
||||
OpenSkillDemoScreen();
|
||||
InvalidateRect(hWnd, nullptr, FALSE);
|
||||
break;
|
||||
case IDM_ABOUT:
|
||||
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
|
||||
break;
|
||||
@@ -1005,8 +1033,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
helpState.selectedIndex = i;
|
||||
if (i == 3)
|
||||
{
|
||||
StartRogueSkillDemo();
|
||||
ResetGameTimer(hWnd);
|
||||
helpState.currentPage = 5;
|
||||
helpState.selectedIndex = 0;
|
||||
helpScrollOffset = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1023,6 +1052,31 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
InvalidateRect(hWnd, nullptr, FALSE);
|
||||
}
|
||||
}
|
||||
else if (helpState.currentPage == 5)
|
||||
{
|
||||
if (IsPointInRect(GetHelpBackHintRect(hWnd), mouseX, mouseY))
|
||||
{
|
||||
helpState.currentPage = 0;
|
||||
helpState.selectedIndex = 3;
|
||||
helpScrollOffset = 0;
|
||||
InvalidateRect(hWnd, nullptr, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
int demoCount = GetRogueSkillDemoCount();
|
||||
for (int i = 0; i < demoCount; i++)
|
||||
{
|
||||
if (IsPointInRect(GetHelpSkillDemoItemRect(hWnd, i), mouseX, mouseY))
|
||||
{
|
||||
helpState.selectedIndex = i;
|
||||
StartRogueSkillDemoAt(i);
|
||||
ResetGameTimer(hWnd);
|
||||
InvalidateRect(hWnd, nullptr, FALSE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (IsPointInRect(GetHelpBackHintRect(hWnd), mouseX, mouseY))
|
||||
{
|
||||
if (helpState.currentPage == 4)
|
||||
@@ -1256,6 +1310,19 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
ChangeCreditPage(-1);
|
||||
InvalidateRect(hWnd, nullptr, FALSE);
|
||||
}
|
||||
else if (helpState.currentPage == 5)
|
||||
{
|
||||
helpState.selectedIndex--;
|
||||
if (helpState.selectedIndex < 0)
|
||||
{
|
||||
helpState.selectedIndex = GetRogueSkillDemoCount() - 1;
|
||||
}
|
||||
if (helpState.selectedIndex * 68 < helpScrollOffset)
|
||||
{
|
||||
helpScrollOffset = helpState.selectedIndex * 68;
|
||||
}
|
||||
InvalidateRect(hWnd, nullptr, FALSE);
|
||||
}
|
||||
break;
|
||||
case VK_DOWN:
|
||||
case VK_RIGHT:
|
||||
@@ -1275,6 +1342,20 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
ChangeCreditPage(1);
|
||||
InvalidateRect(hWnd, nullptr, FALSE);
|
||||
}
|
||||
else if (helpState.currentPage == 5)
|
||||
{
|
||||
helpState.selectedIndex++;
|
||||
if (helpState.selectedIndex >= GetRogueSkillDemoCount())
|
||||
{
|
||||
helpState.selectedIndex = 0;
|
||||
helpScrollOffset = 0;
|
||||
}
|
||||
else if (helpState.selectedIndex * 68 > helpScrollOffset + 360)
|
||||
{
|
||||
helpScrollOffset = helpState.selectedIndex * 68 - 360;
|
||||
}
|
||||
InvalidateRect(hWnd, nullptr, FALSE);
|
||||
}
|
||||
break;
|
||||
case VK_RETURN:
|
||||
case VK_SPACE:
|
||||
@@ -1282,8 +1363,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (helpState.selectedIndex == 3)
|
||||
{
|
||||
StartRogueSkillDemo();
|
||||
ResetGameTimer(hWnd);
|
||||
helpState.currentPage = 5;
|
||||
helpState.selectedIndex = 0;
|
||||
helpScrollOffset = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1292,6 +1374,12 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
InvalidateRect(hWnd, nullptr, FALSE);
|
||||
}
|
||||
else if (helpState.currentPage == 5)
|
||||
{
|
||||
StartRogueSkillDemoAt(helpState.selectedIndex);
|
||||
ResetGameTimer(hWnd);
|
||||
InvalidateRect(hWnd, nullptr, FALSE);
|
||||
}
|
||||
break;
|
||||
case VK_ESCAPE:
|
||||
case VK_BACK:
|
||||
@@ -1304,6 +1392,12 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
ReturnToMainMenu();
|
||||
}
|
||||
else if (helpState.currentPage == 5)
|
||||
{
|
||||
helpState.currentPage = 0;
|
||||
helpState.selectedIndex = 3;
|
||||
helpScrollOffset = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
helpState.currentPage = 0;
|
||||
|
||||
Reference in New Issue
Block a user