修复第三列选不了的问题 快捷键帮助
This commit is contained in:
+27
-14
@@ -366,21 +366,31 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
if (currentScreen == SCREEN_UPGRADE)
|
||||
{
|
||||
int upgradeColumnCount = upgradeUiState.optionCount <= 3 ? upgradeUiState.optionCount : 3;
|
||||
if (upgradeColumnCount < 1)
|
||||
{
|
||||
upgradeColumnCount = 1;
|
||||
}
|
||||
|
||||
switch (wParam)
|
||||
{
|
||||
case VK_LEFT:
|
||||
case 'A':
|
||||
if (upgradeUiState.optionCount > 1)
|
||||
{
|
||||
if ((upgradeUiState.selectedIndex % 2) == 1)
|
||||
int rowStart = upgradeUiState.selectedIndex - (upgradeUiState.selectedIndex % upgradeColumnCount);
|
||||
if (upgradeUiState.selectedIndex > rowStart)
|
||||
{
|
||||
upgradeUiState.selectedIndex--;
|
||||
}
|
||||
else
|
||||
{
|
||||
upgradeUiState.selectedIndex = (upgradeUiState.selectedIndex + 1 < upgradeUiState.optionCount)
|
||||
? upgradeUiState.selectedIndex + 1
|
||||
: upgradeUiState.selectedIndex;
|
||||
int rowEnd = rowStart + upgradeColumnCount - 1;
|
||||
if (rowEnd >= upgradeUiState.optionCount)
|
||||
{
|
||||
rowEnd = upgradeUiState.optionCount - 1;
|
||||
}
|
||||
upgradeUiState.selectedIndex = rowEnd;
|
||||
}
|
||||
}
|
||||
InvalidateRect(hWnd, nullptr, FALSE);
|
||||
@@ -389,34 +399,37 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
case 'D':
|
||||
if (upgradeUiState.optionCount > 1)
|
||||
{
|
||||
if ((upgradeUiState.selectedIndex % 2) == 0 && upgradeUiState.selectedIndex + 1 < upgradeUiState.optionCount)
|
||||
int rowStart = upgradeUiState.selectedIndex - (upgradeUiState.selectedIndex % upgradeColumnCount);
|
||||
int rowEnd = rowStart + upgradeColumnCount - 1;
|
||||
if (rowEnd >= upgradeUiState.optionCount)
|
||||
{
|
||||
rowEnd = upgradeUiState.optionCount - 1;
|
||||
}
|
||||
|
||||
if (upgradeUiState.selectedIndex < rowEnd)
|
||||
{
|
||||
upgradeUiState.selectedIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
upgradeUiState.selectedIndex--;
|
||||
if (upgradeUiState.selectedIndex < 0)
|
||||
{
|
||||
upgradeUiState.selectedIndex = 0;
|
||||
}
|
||||
upgradeUiState.selectedIndex = rowStart;
|
||||
}
|
||||
}
|
||||
InvalidateRect(hWnd, nullptr, FALSE);
|
||||
break;
|
||||
case VK_UP:
|
||||
case 'W':
|
||||
if (upgradeUiState.optionCount > 2 && upgradeUiState.selectedIndex >= 2)
|
||||
if (upgradeUiState.selectedIndex >= upgradeColumnCount)
|
||||
{
|
||||
upgradeUiState.selectedIndex -= 2;
|
||||
upgradeUiState.selectedIndex -= upgradeColumnCount;
|
||||
}
|
||||
InvalidateRect(hWnd, nullptr, FALSE);
|
||||
break;
|
||||
case VK_DOWN:
|
||||
case 'S':
|
||||
if (upgradeUiState.optionCount > 2 && upgradeUiState.selectedIndex + 2 < upgradeUiState.optionCount)
|
||||
if (upgradeUiState.selectedIndex + upgradeColumnCount < upgradeUiState.optionCount)
|
||||
{
|
||||
upgradeUiState.selectedIndex += 2;
|
||||
upgradeUiState.selectedIndex += upgradeColumnCount;
|
||||
}
|
||||
InvalidateRect(hWnd, nullptr, FALSE);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user