// ------------------ public void Enable() { for (InputBindingBase b = this; b != null; b = b.parent) { b.enabled = true; } }
// ------------------ public ScrollDeltaBinding(string axisName, bool enabled = false, InputBindingBase parent = null) : base(parent) { this.enabled = enabled; this.deltaBinding = new AxisBinding(axisName, enabled, this); this.positiveDigitalBinding = new DigitalBinding(this); this.negativeDigitalBinding = new DigitalBinding(this); }
// ------------------ public JoystickStateBinding(InputBindingBase parent = null) : base(parent) { this.enabled = false; this.horzAxisBinding = new AxisBinding(this); this.vertAxisBinding = new AxisBinding(this); this.dirBinding = new DirectionBinding(this); }
// ----------------------- public AxisBinding(string singleName, bool enabled, InputBindingBase parent = null) : base(parent) { this.BasicConstructor(); this.AddTarget().SetSingleAxis(singleName, false); if (enabled) { this.Enable(); } }
// ----------------- public DigitalBinding(KeyCode key, bool enabled, InputBindingBase parent = null) : base(parent) { this.BasicConstructor(); if (enabled) { this.Enable(); } if (key != KeyCode.None) { this.AddKey(key); } }
// ---------------- public bool IsEnabledInHierarchy() { InputBindingBase binding = this; do { if (!binding.enabled) { return(false); } } while ((binding = binding.parent) != null); return(true); }
// ------------------ public DirectionBinding(InputBindingBase parent = null) : base(parent) { //this.enabled = false; this.bindDiagonals = true; this.dirBindingN = new DigitalBinding(this); this.dirBindingAny = new DigitalBinding(this); this.dirBindingU = new DigitalBinding(this); this.dirBindingUR = new DigitalBinding(this); this.dirBindingR = new DigitalBinding(this); this.dirBindingDR = new DigitalBinding(this); this.dirBindingD = new DigitalBinding(this); this.dirBindingDL = new DigitalBinding(this); this.dirBindingL = new DigitalBinding(this); this.dirBindingUL = new DigitalBinding(this); }
// ------------------ public TouchGestureStateBinding(InputBindingBase parent = null) : base(parent) { this.enabled = false; this.rawPressBinding = new DigitalBinding(this); this.longPressBinding = new DigitalBinding(this); this.normalPressBinding = new DigitalBinding(this); //this.releasedBinding = new DigitalBinding(this); this.tapBinding = new DigitalBinding(this); this.doubleTapBinding = new DigitalBinding(this); this.longTapBinding = new DigitalBinding(this); this.normalPressSwipeHorzAxisBinding = new AxisBinding(this); this.normalPressSwipeVertAxisBinding = new AxisBinding(this); this.longPressSwipeHorzAxisBinding = new AxisBinding(this); this.longPressSwipeVertAxisBinding = new AxisBinding(this); this.normalPressScrollHorzBinding = new ScrollDeltaBinding(this); this.normalPressScrollVertBinding = new ScrollDeltaBinding(this); this.longPressScrollHorzBinding = new ScrollDeltaBinding(this); this.longPressScrollVertBinding = new ScrollDeltaBinding(this); this.rawPressEmuTouchBinding = new EmuTouchBinding(this); this.normalPressEmuTouchBinding = new EmuTouchBinding(this); this.longPressEmuTouchBinding = new EmuTouchBinding(this); this.rawPressMousePosBinding = new MousePositionBinding(10, false, this); this.normalPressMousePosBinding = new MousePositionBinding(20, false, this); this.longPressMousePosBinding = new MousePositionBinding(20, false, this); this.tapMousePosBinding = new MousePositionBinding(30, false, this); this.doubleTapMousePosBinding = new MousePositionBinding(30, false, this); this.longTapMousePosBinding = new MousePositionBinding(30, false, this); this.normalPressSwipeMousePosBinding = new MousePositionBinding(20, false, this); this.longPressSwipeMousePosBinding = new MousePositionBinding(20, false, this); this.normalPressSwipeDirBinding = new DirectionBinding(this); this.longPressSwipeDirBinding = new DirectionBinding(this); this.normalPressSwipeJoyBinding = new JoystickStateBinding(this); this.longPressSwipeJoyBinding = new JoystickStateBinding(this); }
// ----------------- public void Add( InputBindingBase binding, string name, string menuPath, Object undoObject) { BindingDescription.BindingType bindingType = (binding is AxisBinding) ? BindingDescription.BindingType.Axis : (binding is DigitalBinding) ? BindingDescription.BindingType.Digital : (binding is DirectionBinding) ? BindingDescription.BindingType.Direction : (binding is EmuTouchBinding) ? BindingDescription.BindingType.EmuTouch : (binding is JoystickStateBinding) ? BindingDescription.BindingType.JoystickState : (binding is MousePositionBinding) ? BindingDescription.BindingType.MousePos : (binding is TouchGestureStateBinding) ? BindingDescription.BindingType.GestureState : BindingDescription.BindingType.All; if (bindingType == BindingDescription.BindingType.All) { return; } string nameFormatted = ((this.menuNameFormatter != null) ? this.menuNameFormatter(binding, name) : name); if ((bindingType & this.typeMask) == bindingType) { BindingDescription desc = new BindingDescription(); desc.type = bindingType; desc.name = name; desc.nameFormatted = nameFormatted; desc.menuPath = menuPath; desc.undoObject = undoObject; desc.binding = binding; this.Add(desc); } // Format menu path... menuPath = menuPath + nameFormatted + "/"; binding.GetSubBindingDescriptions(this, undoObject, menuPath); }
// ----------------- public DigitalBinding(KeyCode key, string axisName, bool enabled, InputBindingBase parent = null) : base(parent) { this.BasicConstructor(); if (enabled) { this.Enable(); } if (key != KeyCode.None) { this.AddKey(key); } if (!string.IsNullOrEmpty(axisName)) { this.AddAxis().SetAxis(axisName, true); } }
// ------------------- public AxisBinding(InputBindingBase parent = null) : base(parent) { this.BasicConstructor(); }
// ---------------------- public MousePositionBinding(int prio, bool enabled, InputBindingBase parent = null) : base(parent) { this.enabled = enabled; this.priority = prio; }
// ---------------------- public MousePositionBinding(InputBindingBase parent = null) : base(parent) { this.enabled = false; this.priority = 0; }
// ------------------ public InputBindingBase(InputBindingBase parent) { this.enabled = false; this.parent = parent; }
// ---------------------- public EmuTouchBinding(InputBindingBase parent = null) : base(parent) { this.enabled = false; this.emuTouchId = -1; }
// ------------------ public ScrollDeltaBinding(InputBindingBase parent = null) : base(parent) { this.deltaBinding = new AxisBinding(InputRig.DEFAULT_VERT_SCROLL_WHEEL_NAME, false, this); this.positiveDigitalBinding = new DigitalBinding(this); this.negativeDigitalBinding = new DigitalBinding(this); }