feat: numeric slot keys
This commit is contained in:
parent
eb6261d561
commit
b6fa313cba
|
@ -238,6 +238,19 @@ export class App extends decorate(class {}) {
|
|||
case 'e':
|
||||
this.isMenuOpened = !this.isMenuOpened;
|
||||
break;
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
case '0':
|
||||
const slotIndex = (parseInt(key) + 9) % 10;
|
||||
this.setActiveSlotIndex(slotIndex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -342,10 +355,10 @@ export class App extends decorate(class {}) {
|
|||
}
|
||||
const activeSlotIndex = this.selfEntity.activeSlotIndex;
|
||||
if (event.deltaY > 0) {
|
||||
this.selfEntity.activeSlotIndex = (activeSlotIndex + 1) % 10;
|
||||
this.setActiveSlotIndex((activeSlotIndex + 1) % 10);
|
||||
}
|
||||
else if (event.deltaY < 0) {
|
||||
this.selfEntity.activeSlotIndex = (activeSlotIndex + 9) % 10;
|
||||
this.setActiveSlotIndex((activeSlotIndex + 9) % 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -435,6 +448,12 @@ export class App extends decorate(class {}) {
|
|||
ReactDOM.render(DebugUiComponent, this.debugUiNode);
|
||||
}
|
||||
|
||||
setActiveSlotIndex(slotIndex) {
|
||||
if (this.selfEntity) {
|
||||
this.selfEntity.activeSlotIndex = slotIndex;
|
||||
}
|
||||
}
|
||||
|
||||
startProcessingInput() {
|
||||
const config = this.readConfig();
|
||||
// Pointer input.
|
||||
|
|
Loading…
Reference in New Issue
Block a user