private void InitAddActionMapButton(InputActionRow uiRow, int playerId, InputAction action, Pole actionAxisContribution, bool assignFullAxis) { uiRow._addButton.onClick.Add(new EventDelegate(delegate { if (this._actionRowMappingCount[uiRow] < this._maxMappingPerAction && UICamera.currentTouchID == -1 && !this.enabled) { this._replaceElementMap = false; this._entry = new InputMappingAction.ElementAssignmentChange(playerId, InputMappingAction.ElementAssignmentChangeType.Add, -1, action.id, actionAxisContribution, action.type, assignFullAxis, false); this._entry.uiRow = uiRow; this.StartPollInput(); } })); }
public ElementAssignmentChange(InputMappingAction.ElementAssignmentChange source) { this.playerId = source.playerId; this.controllerId = source.controllerId; this.controllerType = source.controllerType; this.controllerMap = source.controllerMap; this.changeType = source.changeType; this.actionElementMapId = source.actionElementMapId; this.actionId = source.actionId; this.actionAxisContribution = source.actionAxisContribution; this.actionType = source.actionType; this.assignFullAxis = source.assignFullAxis; this.invert = source.invert; this.pollingInfo = source.pollingInfo; this.modifierKeyFlags = source.modifierKeyFlags; }
private void AddActionAssignmentButton(InputActionRow uiRow, int playerId, InputAction action, Pole actionAxisContribution, ControllerMap controllerMap, bool assignFullAxis, ActionElementMap elementMap, bool showInvert = false) { InputActionButton uiButton; if (!showInvert) { uiButton = UnityEngine.Object.Instantiate <InputActionButton>(this._inputActionButtonPrefab); } else { uiButton = UnityEngine.Object.Instantiate <InputActionButton>(this._inputAxisActionButtonPrefab); } uiButton._label.text = elementMap.elementIdentifierName; uiButton._actionElementMap = elementMap; uiButton._button.onClick.Add(new EventDelegate(delegate { if (!this.enabled && this._nextChangeTimer < Time.realtimeSinceStartup) { if (UICamera.currentTouchID == -1) { this._replaceElementMap = true; this._entry = new InputMappingAction.ElementAssignmentChange(playerId, InputMappingAction.ElementAssignmentChangeType.ReassignOrRemove, elementMap.id, action.id, actionAxisContribution, action.type, assignFullAxis, elementMap.invert); this._entry.controllerMap = controllerMap; this._entry.uiButton = uiButton; this.StartPollInput(); } else if (UICamera.currentTouchID == -2) { this._entry = new InputMappingAction.ElementAssignmentChange(playerId, InputMappingAction.ElementAssignmentChangeType.Remove, elementMap.id, action.id, actionAxisContribution, action.type, assignFullAxis, elementMap.invert); controllerMap.DeleteElementMap(this._entry.actionElementMapId); this._knownActionMaps.Remove(elementMap); UnityEngine.Object.Destroy(uiButton.gameObject); uiRow._actionGrid.repositionNow = true; Dictionary <InputActionRow, int> actionRowMappingCount2; Dictionary <InputActionRow, int> expr_181 = actionRowMappingCount2 = this._actionRowMappingCount; InputActionRow uiRow3; InputActionRow expr_189 = uiRow3 = uiRow; int num2 = actionRowMappingCount2[uiRow3]; expr_181[expr_189] = num2 - 1; this.CheckActionMappingCount(uiRow); this._nextChangeTimer = Time.realtimeSinceStartup + this._interChangeDelay; } } })); if (showInvert) { uiButton._invertAxisToggle.gameObject.SetActive(true); uiButton._invertAxisToggle.value = uiButton._actionElementMap.invert; uiButton._invertAxisToggle.onChange.Add(new EventDelegate(delegate { if (!this.enabled && this._nextChangeTimer < Time.realtimeSinceStartup) { uiButton._actionElementMap.invert = uiButton._invertAxisToggle.value; } })); } uiButton.transform.parent = uiRow._actionGrid.transform; uiButton.transform.localPosition = Vector3.zero; uiButton.transform.localScale = Vector3.one; this._knownActionMaps.Add(elementMap, uiButton); Dictionary <InputActionRow, int> actionRowMappingCount; Dictionary <InputActionRow, int> expr_18C = actionRowMappingCount = this._actionRowMappingCount; InputActionRow uiRow2; InputActionRow expr_194 = uiRow2 = uiRow; int num = actionRowMappingCount[uiRow2]; expr_18C[expr_194] = num + 1; }
private void AddActionAssignmentButton(InputActionRow uiRow, int playerId, InputAction action, Pole actionAxisContribution, ControllerMap controllerMap, bool assignFullAxis, ActionElementMap elementMap, bool showInvert = false) { InputActionButton uiButton; if (!showInvert) { uiButton = UnityEngine.Object.Instantiate<InputActionButton>(this._inputActionButtonPrefab); } else { uiButton = UnityEngine.Object.Instantiate<InputActionButton>(this._inputAxisActionButtonPrefab); } uiButton._label.text = elementMap.elementIdentifierName; uiButton._actionElementMap = elementMap; uiButton._button.onClick.Add(new EventDelegate(delegate { if (!this.enabled && this._nextChangeTimer < Time.realtimeSinceStartup) { if (UICamera.currentTouchID == -1) { this._replaceElementMap = true; this._entry = new InputMappingAction.ElementAssignmentChange(playerId, InputMappingAction.ElementAssignmentChangeType.ReassignOrRemove, elementMap.id, action.id, actionAxisContribution, action.type, assignFullAxis, elementMap.invert); this._entry.controllerMap = controllerMap; this._entry.uiButton = uiButton; this.StartPollInput(); } else if (UICamera.currentTouchID == -2) { this._entry = new InputMappingAction.ElementAssignmentChange(playerId, InputMappingAction.ElementAssignmentChangeType.Remove, elementMap.id, action.id, actionAxisContribution, action.type, assignFullAxis, elementMap.invert); controllerMap.DeleteElementMap(this._entry.actionElementMapId); this._knownActionMaps.Remove(elementMap); UnityEngine.Object.Destroy(uiButton.gameObject); uiRow._actionGrid.repositionNow = true; Dictionary<InputActionRow, int> actionRowMappingCount2; Dictionary<InputActionRow, int> expr_181 = actionRowMappingCount2 = this._actionRowMappingCount; InputActionRow uiRow3; InputActionRow expr_189 = uiRow3 = uiRow; int num2 = actionRowMappingCount2[uiRow3]; expr_181[expr_189] = num2 - 1; this.CheckActionMappingCount(uiRow); this._nextChangeTimer = Time.realtimeSinceStartup + this._interChangeDelay; } } })); if (showInvert) { uiButton._invertAxisToggle.gameObject.SetActive(true); uiButton._invertAxisToggle.value = uiButton._actionElementMap.invert; uiButton._invertAxisToggle.onChange.Add(new EventDelegate(delegate { if (!this.enabled && this._nextChangeTimer < Time.realtimeSinceStartup) { uiButton._actionElementMap.invert = uiButton._invertAxisToggle.value; } })); } uiButton.transform.parent = uiRow._actionGrid.transform; uiButton.transform.localPosition = Vector3.zero; uiButton.transform.localScale = Vector3.one; this._knownActionMaps.Add(elementMap, uiButton); Dictionary<InputActionRow, int> actionRowMappingCount; Dictionary<InputActionRow, int> expr_18C = actionRowMappingCount = this._actionRowMappingCount; InputActionRow uiRow2; InputActionRow expr_194 = uiRow2 = uiRow; int num = actionRowMappingCount[uiRow2]; expr_18C[expr_194] = num + 1; }