void UpdateBindings(ulong updateTick, float deltaTime) { var lastInputType = LastInputType; var lastInputTypeChangedTick = LastInputTypeChangedTick; var lastUpdateTick = UpdateTick; var lastDeviceClass = LastDeviceClass; var lastDeviceStyle = LastDeviceStyle; var bindingCount = regularBindings.Count; for (var i = bindingCount - 1; i >= 0; i--) { var binding = regularBindings[i]; if (binding.BoundTo != this) { regularBindings.RemoveAt(i); visibleBindings.Remove(binding); } else { var value = binding.GetValue(Device); if (UpdateWithValue(value, updateTick, deltaTime)) { lastInputType = binding.BindingSourceType; lastInputTypeChangedTick = updateTick; lastDeviceClass = binding.DeviceClass; lastDeviceStyle = binding.DeviceStyle; } } } Commit(); Enabled = Owner.Enabled; if (lastInputTypeChangedTick > LastInputTypeChangedTick) { if (lastInputType != BindingSourceType.MouseBindingSource || Utility.Abs(LastValue - Value) >= MouseBindingSource.JitterThreshold) { var triggerEvent = lastInputType != LastInputType; LastInputType = lastInputType; LastInputTypeChangedTick = lastInputTypeChangedTick; LastDeviceClass = lastDeviceClass; LastDeviceStyle = lastDeviceStyle; if (OnLastInputTypeChanged != null && triggerEvent) { OnLastInputTypeChanged.Invoke(lastInputType); } } } if (UpdateTick > lastUpdateTick) { activeDevice = LastInputTypeIsDevice ? Device : null; } }
private void UpdateBindings(ulong updateTick, float deltaTime) { bool flag = IsListeningForBinding || (Owner.IsListeningForBinding && Owner.PreventInputWhileListeningForBinding); BindingSourceType bindingSourceType = LastInputType; ulong num = LastInputTypeChangedTick; ulong updateTick2 = base.UpdateTick; InputDeviceClass lastDeviceClass = LastDeviceClass; InputDeviceStyle lastDeviceStyle = LastDeviceStyle; int count = regularBindings.Count; for (int num2 = count - 1; num2 >= 0; num2--) { BindingSource bindingSource = regularBindings[num2]; if (bindingSource.BoundTo != this) { regularBindings.RemoveAt(num2); visibleBindings.Remove(bindingSource); } else if (!flag) { float value = bindingSource.GetValue(Device); if (UpdateWithValue(value, updateTick, deltaTime)) { bindingSourceType = bindingSource.BindingSourceType; num = updateTick; lastDeviceClass = bindingSource.DeviceClass; lastDeviceStyle = bindingSource.DeviceStyle; } } } if (flag || count == 0) { UpdateWithValue(0f, updateTick, deltaTime); } Commit(); Enabled = Owner.Enabled; if (num > LastInputTypeChangedTick && (bindingSourceType != BindingSourceType.MouseBindingSource || Utility.Abs(base.LastValue - base.Value) >= MouseBindingSource.JitterThreshold)) { bool flag2 = bindingSourceType != LastInputType; LastInputType = bindingSourceType; LastInputTypeChangedTick = num; LastDeviceClass = lastDeviceClass; LastDeviceStyle = lastDeviceStyle; if (this.OnLastInputTypeChanged != null && flag2) { this.OnLastInputTypeChanged(bindingSourceType); } } if (base.UpdateTick > updateTick2) { activeDevice = ((!LastInputTypeIsDevice) ? null : Device); } }
internal void Update(ulong updateTick, float deltaTime) { InputDevice device = Device ?? FindActiveDevice(); BindingSourceType lastInputType = LastInputType; ulong lastInputTypeChangedTick = LastInputTypeChangedTick; InputDeviceClass lastDeviceClass = LastDeviceClass; InputDeviceStyle lastDeviceStyle = LastDeviceStyle; int count = actions.Count; for (int i = 0; i < count; i++) { PlayerAction playerAction = actions[i]; playerAction.Update(updateTick, deltaTime, device); if (playerAction.UpdateTick > UpdateTick) { UpdateTick = playerAction.UpdateTick; activeDevice = playerAction.ActiveDevice; } if (playerAction.LastInputTypeChangedTick > lastInputTypeChangedTick) { lastInputType = playerAction.LastInputType; lastInputTypeChangedTick = playerAction.LastInputTypeChangedTick; lastDeviceClass = playerAction.LastDeviceClass; lastDeviceStyle = playerAction.LastDeviceStyle; } } int count2 = oneAxisActions.Count; for (int j = 0; j < count2; j++) { oneAxisActions[j].Update(updateTick, deltaTime); } int count3 = twoAxisActions.Count; for (int k = 0; k < count3; k++) { twoAxisActions[k].Update(updateTick, deltaTime); } if (lastInputTypeChangedTick > LastInputTypeChangedTick) { bool flag = lastInputType != LastInputType; LastInputType = lastInputType; LastInputTypeChangedTick = lastInputTypeChangedTick; LastDeviceClass = lastDeviceClass; LastDeviceStyle = lastDeviceStyle; if (this.OnLastInputTypeChanged != null && flag) { this.OnLastInputTypeChanged(lastInputType); } } }
internal void Update(ulong updateTick, float deltaTime) { var device = Device ?? FindActiveDevice(); var lastInputType = LastInputType; var lastInputTypeChangedTick = LastInputTypeChangedTick; var lastDeviceClass = LastDeviceClass; var lastDeviceStyle = LastDeviceStyle; var actionsCount = actions.Count; for (var i = 0; i < actionsCount; i++) { var action = actions[i]; action.Update(updateTick, deltaTime, device); if (action.UpdateTick > UpdateTick) { UpdateTick = action.UpdateTick; activeDevice = action.ActiveDevice; } if (action.LastInputTypeChangedTick > lastInputTypeChangedTick) { lastInputType = action.LastInputType; lastInputTypeChangedTick = action.LastInputTypeChangedTick; lastDeviceClass = action.LastDeviceClass; lastDeviceStyle = action.LastDeviceStyle; } } var oneAxisActionsCount = oneAxisActions.Count; for (var i = 0; i < oneAxisActionsCount; i++) { oneAxisActions[i].Update(updateTick, deltaTime); } var twoAxisActionsCount = twoAxisActions.Count; for (var i = 0; i < twoAxisActionsCount; i++) { twoAxisActions[i].Update(updateTick, deltaTime); } if (lastInputTypeChangedTick > LastInputTypeChangedTick) { var triggerEvent = lastInputType != LastInputType; LastInputType = lastInputType; LastInputTypeChangedTick = lastInputTypeChangedTick; LastDeviceClass = lastDeviceClass; LastDeviceStyle = lastDeviceStyle; if (OnLastInputTypeChanged != null && triggerEvent) { OnLastInputTypeChanged.Invoke(lastInputType); } } }