You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This includes generation of profile data, saving and loading. Also needs to consider allowing no-profile games
FXGLMenu, use profile name instead of "./" to save/load data. Perhaps we can add a setting "saveDir" and save there?
FXGLDefaultMenu should be updated too
Input serialization:
override fun save(profile: UserProfile) {
log.debug("Saving data to profile")
val bundle = Bundle("input")
bindings.forEach { bundle.put(it.key.toString(), it.value.toString()) }
bundle.log()
profile.putBundle(bundle)
}
override fun load(profile: UserProfile) {
log.debug("Loading data from profile")
val bundle = profile.getBundle("input")
bundle.log()
for (binding in bindings) {
val action = binding.key
// if binding is not present in bundle, then we added some new binding thru code
// it will be saved on next serialization and will be found in bundle
var triggerName: String? = bundle.get<String>("$action")
if (triggerName == null)
continue
var modifierName = "NONE"
val plusIndex = triggerName.indexOf("+")
if (plusIndex != -1) {
modifierName = triggerName.substring(0, plusIndex)
triggerName = triggerName.substring(plusIndex + 1)
}
// if triggerName was CTRL+A, we end up with:
// triggerName = A
// modifierName = CTRL
try {
val key = KeyCode.getKeyCode(triggerName)
rebind(action, key, InputModifier.valueOf(modifierName))
} catch (ignored: Exception) {
try {
val btn = MouseTrigger.buttonFromString(triggerName)
rebind(action, btn, InputModifier.valueOf(modifierName))
} catch (e: Exception) {
log.warning("Undefined trigger name: " + triggerName)
throw IllegalArgumentException("Corrupt or incompatible user profile: " + e.message)
}
}
}
}
This includes generation of profile data, saving and loading. Also needs to consider allowing no-profile games
FXGLMenu, use profile name instead of "./" to save/load data. Perhaps we can add a setting "saveDir" and save there?
FXGLDefaultMenu should be updated too
Input serialization:
Legacy profile code
The text was updated successfully, but these errors were encountered: