public AxisBinding(BindingSet bs, ConfigNode node) { int ind; if (int.TryParse(node.GetValue("index"), out ind)) { index = ind; } binding = AI_FlightControl.GetAxisBinding(node); bool b; if (bool.TryParse(node.GetValue("invert"), out b)) { invert = b; } float c; if (float.TryParse(node.GetValue("curve"), out c)) { curve = c; } bindingSet = bs; prevValue = bindingSet.AxisValue(index, invert); }
void ParseConfig(ConfigNode node) { defaultBindings = new BindingSet(this, node); foreach (ConfigNode n in node.nodes) { switch (n.name) { case "BindingSet": var bs = new BindingSet(this, n); bindingSets[bs.name] = bs; break; } } }
public Device(InputLibWrapper.Device dev) { rawDevice = dev; bindingSets = new Dictionary <string, BindingSet> (); activeBindingSets = new List <BindingSet> (); defaultBindings = new BindingSet(this); AI_Database.DeviceNames.TryGetValue(dev.name, out devNames); ConfigNode node; if (AI_Database.DeviceConfigs.TryGetValue(dev.name, out node)) { ParseConfig(node); } }
public ButtonBinding(BindingSet bs, ConfigNode node) { int ind; if (int.TryParse(node.GetValue("index"), out ind)) { index = ind; } binding = AI_FlightControl.GetButtonBinding(node); bindingSet = bs; prevState = bindingSet.ButtonState(index); }
void UpdateRecipe(BindingSet bs, int axis, int dz, int mz, bool inv, bool bal) { var r = bs.axisRecipes[axis]; if ((dz != r.deadzone || mz != r.maxzone || inv != r.inverted || bal != r.balanced) && r == BindingSet.defaultRecipe) { bs.axisRecipes[axis] = new AxisRecipe(); r = bs.axisRecipes[axis]; } r.deadzone = dz; r.maxzone = mz; r.inverted = inv; r.balanced = bal; }