void Start() { #if UNITY_ANDROID gameObject.SetActive(false); return; #endif elements = new List <KeyBindElement>(); elementGroupIndices = new int[elementGroups.Length]; foreach (var item in InputManager.keybindsRead) { var element = Instantiate(elementPrefab, elementParent); if (item.group >= 0 && item.group < elementGroups.Length) { var groupParent = elementGroups[item.group]; elementGroupIndices[item.group]++; element.transform.SetSiblingIndex(groupParent.GetSiblingIndex() + elementGroupIndices[item.group]); } element.visualName = item.visualName; element.keybindName = item.name; element.onBind1ButtonPressed += OnKeyBind1Pressed; element.onBind2ButtonPressed += OnKeyBind2Pressed; elements.Add(element); if (element.keybindName == "EscapeMenu") { escapeMenuElement = element; } } }
public void Open(KeyBindElement element, bool isBind1) { this.element = element; this.isBind1 = isBind1; panel.SetActive(true); EventSystem.current.SetSelectedGameObject(null); checkForKeyUp = false; text.text = string.Format(element.visualName); }
void OnKeyBind2Pressed(KeyBindElement element) { keybindPopup.Open(element, false); }
void OnKeyBind1Pressed(KeyBindElement element) { keybindPopup.Open(element, true); }