mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-28 07:55:38 -04:00
fix last commit
This commit is contained in:
parent
93b99aa3f0
commit
3384b1aa55
@ -173,7 +173,7 @@ namespace ClassicalSharp.Gui.Screens {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return hotbar.HandlesKeyUp(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenTextInputBar(string text) {
|
public void OpenTextInputBar(string text) {
|
||||||
|
@ -75,6 +75,10 @@ namespace ClassicalSharp.Gui.Screens {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool HandlesKeyUp(Key key) {
|
||||||
|
return game.Gui.hudScreen.hotbar.HandlesKeyUp(key);
|
||||||
|
}
|
||||||
|
|
||||||
void ArrowKeyMove(int delta) {
|
void ArrowKeyMove(int delta) {
|
||||||
int startIndex = selIndex;
|
int startIndex = selIndex;
|
||||||
selIndex += delta;
|
selIndex += delta;
|
||||||
|
@ -98,7 +98,7 @@ namespace ClassicalSharp.Gui.Widgets {
|
|||||||
selTex = new Texture(0, 0, y, hSize, vSize, rec);
|
selTex = new Texture(0, 0, y, hSize, vSize, rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool altHandled;
|
||||||
public override bool HandlesKeyDown(Key key) {
|
public override bool HandlesKeyDown(Key key) {
|
||||||
if (key >= Key.Number1 && key <= Key.Number9) {
|
if (key >= Key.Number1 && key <= Key.Number9) {
|
||||||
int index = (int)key - (int)Key.Number1;
|
int index = (int)key - (int)Key.Number1;
|
||||||
@ -106,18 +106,30 @@ namespace ClassicalSharp.Gui.Widgets {
|
|||||||
if (game.Input.AltDown) {
|
if (game.Input.AltDown) {
|
||||||
// Pick from first to ninth row
|
// Pick from first to ninth row
|
||||||
game.Inventory.Offset = index * Inventory.BlocksPerRow;
|
game.Inventory.Offset = index * Inventory.BlocksPerRow;
|
||||||
|
game.Events.RaiseHeldBlockChanged();
|
||||||
|
altHandled = true;
|
||||||
} else {
|
} else {
|
||||||
game.Inventory.SelectedIndex = index;
|
game.Inventory.SelectedIndex = index;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else if (key == Key.AltLeft || key == Key.AltRight) {
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool HandlesKeyUp(Key key) {
|
||||||
|
// We need to handle these cases:
|
||||||
|
// a) user presses alt then number
|
||||||
|
// b) user presses alt
|
||||||
|
// thus we only do case b) if case a) did not happen
|
||||||
|
if (!(key == Key.AltLeft || key == Key.AltRight)) return false;
|
||||||
|
if (altHandled) { altHandled = false; return true; } // handled already
|
||||||
|
|
||||||
// Alternate between first and second row
|
// Alternate between first and second row
|
||||||
int index = game.Inventory.Offset == 0 ? 1 : 0;
|
int index = game.Inventory.Offset == 0 ? 1 : 0;
|
||||||
game.Inventory.Offset = index * Inventory.BlocksPerRow;
|
game.Inventory.Offset = index * Inventory.BlocksPerRow;
|
||||||
|
game.Events.RaiseHeldBlockChanged();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool HandlesMouseClick(int mouseX, int mouseY, MouseButton button) {
|
public override bool HandlesMouseClick(int mouseX, int mouseY, MouseButton button) {
|
||||||
if (button != MouseButton.Left || !Bounds.Contains(mouseX, mouseY))
|
if (button != MouseButton.Left || !Bounds.Contains(mouseX, mouseY))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user