// Update Input Fields public void UpdateFields() { if (aUIInputRows == null) { return; } for (int i = 0; i < aUIInputRows.Length; i++) { UIInputRow row = aUIInputRows[i]; row.UpdateRow(aElementMaps[row.PrimaryActionID], aAltElementMaps[row.SecondaryActionID], bUnassigned); } }
// Opens the Assignment Window private void OpenAssignmentWindow(int fieldID) { if (bActive || bUnassigned) { return; } goPreAssignPanelSelection = EventSystem.current.currentSelectedGameObject; goAssignPanel.SetActive(true); bAssignWindowOpen = true; bActive = true; UIMenuManager.bOverrideCancelFunction = true; currentActiveMapper = this; // Get the current input field and check if it needs to be replaced currentUIInputRow = aUIInputRows[fieldID]; CheckReplaceInput(); }
// Initialize Input Fields public void InitializeFields() { aUIInputRows = new UIInputRow[aInputActionsData.aInputActions.Length]; // Loop through each field and assign each field's text for (int i = 0; i < aUIInputRows.Length; i++) { InputAction inputData = aInputActionsData.aInputActions[i]; ActionElementMap map = null; ActionElementMap altMap = null; int mapID = -1; int altMapID = -1; if (!bUnassigned) { map = GetActionMap(inputData, false, out mapID); altMap = GetActionMap(inputData, true, out altMapID); } int index = i; UIInputRow row = Instantiate(goInputRowPrefab, rtInputRowParent).GetComponent <UIInputRow>(); row.InitializeRow(inputData.sName, map, altMap, mapID, altMapID, controlType, buttonImageData, bUnassigned); row.primaryButton.onClick.AddListener(() => { OpenWindowForPrimary(index); }); row.secondaryButton.onClick.AddListener(() => { OpenWindowForSecondary(index); }); aUIInputRows[i] = row; } // Loop through and add navigation for (int j = 0; j < aUIInputRows.Length; j++) { Navigation primNav = new Navigation(); Navigation secNav = new Navigation(); primNav.mode = Navigation.Mode.Explicit; secNav.mode = Navigation.Mode.Explicit; if (j != 0) { primNav.selectOnUp = aUIInputRows[j - 1].primaryButton; secNav.selectOnUp = aUIInputRows[j - 1].secondaryButton; } if (j != aUIInputRows.Length - 1) { primNav.selectOnDown = aUIInputRows[j + 1].primaryButton; secNav.selectOnDown = aUIInputRows[j + 1].secondaryButton; } else { primNav.selectOnDown = downSelectable; secNav.selectOnDown = downSelectable; } primNav.selectOnRight = aUIInputRows[j].secondaryButton; secNav.selectOnLeft = aUIInputRows[j].primaryButton; aUIInputRows[j].primaryButton.navigation = primNav; aUIInputRows[j].secondaryButton.navigation = secNav; } Navigation nav = downSelectable.navigation; nav.selectOnUp = aUIInputRows.Last().primaryButton; downSelectable.navigation = nav; }