spaar / besiege-modloader

spaar's Mod Loader for Besiege - Deprecated
Other
57 stars 14 forks source link

Bugfix (unchanged keys no more reset to Alpha0) #12

Closed ZiMMy closed 9 years ago

L3tum commented 9 years ago

You just moved the System.Enum.GetName to another point and I don't know if it works, since the Enums are saved as Integers and if you say .ToString, does it get the String or the Integer? Also, the KeyCode.Alpha0 was to check if the Keys have changed. But I'm currently rewriting everything and will change it so the Defaults keys are there.

ZiMMy commented 9 years ago

I've tested, everything works as it should.

This is unnecessary overcomplication:

c.ConsoleK1 = Enum.GetName(typeof(KeyCode), keyCode[0]);

So I thought there's no point in storing values in KeyCodes rather than strings.

ToString() returns string, of course.

L3tum commented 9 years ago

The question is: why is there a Enum.GetName if you can say .ToString? But I'll try to implement it and my point was, that it could return the Integer as a String, for example 33. The KeyCode.Alpha0 reset is fixed. I did an if statement in the old saveKeys() but I'm now just setting the KeyCodes to the ones in the file.

Storing them as KeyCodes has to be done, because Unity's key names are different from the Enum names, and there's no method to get them from the Enums. As of that, we have to store the keycodes as String in the file, but need them as keycodes, so somewhere has to be a method to do that. I'll test the .ToString method, everything else is done.

Anyways, I have currently the problem that the KeySettings buttons are only useable once. If you reassign your console keys, and then want to do that again, without restarting Besiege, it doesn't work. There should be no reason for them to not work, so could you take a look? Maybe you'll find something.

ZiMMy commented 9 years ago

Anyways, I have currently the problem that the KeySettings buttons are only useable once. If you reassign your console keys, and then want to do that again, without restarting Besiege, it doesn't work. There should be no reason for them to not work, so could you take a look? Maybe you'll find something.

This is exactly the bug this pull request fixes. Look at the content of the config after reassigning the console keys for example: after changing one key combination, everything is set to Alpha0 there.

L3tum commented 9 years ago

Nevermind the last problem. Don't know why, but it works now. The .ToString works, so I don't know why where is a Enum.GetName method...but I'll implement .ToString

L3tum commented 9 years ago

No, that wasn't it. I changed that before, no Alpha0 anywhere in the code...

ZiMMy commented 9 years ago

I see. Commit your version then, I'll test.

L3tum commented 9 years ago

Yeah, will do. For some reason, the Textfield that says "Please Press[...]" is displayed again each time you click the button. So there are multiple textfields above each other. I'll fix this and then commit