Exemplo n.º 1
0
    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;
            }
        }
    }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
 void OnKeyBind2Pressed(KeyBindElement element)
 {
     keybindPopup.Open(element, false);
 }
Exemplo n.º 4
0
 void OnKeyBind1Pressed(KeyBindElement element)
 {
     keybindPopup.Open(element, true);
 }