Input recognition modification. Hopefully finally works.
This commit is contained in:
parent
1945e7bd4a
commit
fa3c5eb4a7
@ -118,7 +118,7 @@ public class InputBuffer {
|
|||||||
else {frameToCheck = startFrameCount - backCounter;}
|
else {frameToCheck = startFrameCount - backCounter;}
|
||||||
boolean search = true;
|
boolean search = true;
|
||||||
while(ret && search) {
|
while(ret && search) {
|
||||||
if(this.inputList[frameToCheck].containsButtonTab2(command[i])) {
|
if(this.inputList[frameToCheck].equalsButtonTab(command[i])) {
|
||||||
ret = true;
|
ret = true;
|
||||||
search = false;
|
search = false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -70,24 +70,25 @@ public class Inputs {
|
|||||||
* @param bs a number of inputs. Check if those are contained in this
|
* @param bs a number of inputs. Check if those are contained in this
|
||||||
* @return true if all inputs of in are also in this
|
* @return true if all inputs of in are also in this
|
||||||
*/
|
*/
|
||||||
public boolean containsButtonTab2(ButtonIG[] bs) {
|
public boolean equalsButtonTab(ButtonIG[] bs) {
|
||||||
ButtonIG[] directions = {DOWN,FORWARD,UP,BACK};
|
ButtonIG[] directions = {DOWN,FORWARD,UP,BACK};
|
||||||
ButtonIG[] buttons = {A,B,C,D};
|
ButtonIG[] buttons = {A,B,C,D};
|
||||||
|
Inputs inp = new Inputs();
|
||||||
|
for(int i = 0; i < bs.length; i++) {
|
||||||
|
inp.recordOneInput(bs[1]);
|
||||||
|
}
|
||||||
|
if(!this.containsButtonTab(bs)){return false;}
|
||||||
for(ButtonIG d : directions) {
|
for(ButtonIG d : directions) {
|
||||||
if(!this.containsInput(d) && buttonTabContainsButton(bs, d)) { return false;}
|
if(!this.containsInput(d) && inp.containsInput(d)) { return false;}
|
||||||
if(this.containsInput(d) && !buttonTabContainsButton(bs, d)) { return false;}
|
if(this.containsInput(d) && !inp.containsInput(d)) { return false;}
|
||||||
}
|
}
|
||||||
for(ButtonIG d : buttons) {
|
for(ButtonIG d : buttons) {
|
||||||
if(!this.containsInput(d) && buttonTabContainsButton(bs, d)) { return false;}
|
if(!this.containsInput(d) && inp.containsInput(d)) { return false;}
|
||||||
if(this.containsInput(d) && !buttonTabContainsButton(bs, d)) { return false;}
|
if(this.containsInput(d) && !inp.containsInput(d)) { return false;}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean buttonTabContainsButton(ButtonIG[] bs, ButtonIG b) {
|
|
||||||
for (int i = 0; i < bs.length; i++) { if(bs[i] == b) return true; }
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean[] getInputs() {
|
public boolean[] getInputs() {
|
||||||
return this.tab;
|
return this.tab;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user