protected virtual void InitializeFocusGroup()
        {
            if (m_PanelLayer != null)
            {
                var v_materialKeyFocus = m_PanelLayer.GetComponent <MaterialFocusGroup>();
                if (m_UseFocusGroup && v_materialKeyFocus == null)
                {
                    v_materialKeyFocus = m_PanelLayer.AddComponent <MaterialFocusGroup>();

                    var v_cancelTrigger = new MaterialFocusGroup.KeyTriggerData();
                    v_cancelTrigger.Name        = "Escape KeyDown";
                    v_cancelTrigger.Key         = KeyCode.Escape;
                    v_cancelTrigger.TriggerType = MaterialFocusGroup.KeyTriggerData.KeyTriggerType.KeyDown;
#if UNITY_EDITOR
                    UnityEditor.Events.UnityEventTools.AddPersistentListener(v_cancelTrigger.OnCallTrigger, Close);
#else
                    v_cancelTrigger.OnCallTrigger.AddListener(Close);
#endif

                    v_materialKeyFocus.KeyTriggers = new System.Collections.Generic.List <MaterialFocusGroup.KeyTriggerData> {
                        v_cancelTrigger
                    };
                }

                if (v_materialKeyFocus != null)
                {
                    v_materialKeyFocus.enabled = m_UseFocusGroup;
                }
            }
        }
Beispiel #2
0
        protected virtual void ValidateKeyTriggers(MaterialFocusGroup p_materialKeyFocus)
        {
            if (p_materialKeyFocus != null)
            {
                var v_cancelTrigger = new MaterialFocusGroup.KeyTriggerData();
                v_cancelTrigger.Name        = "Escape KeyDown";
                v_cancelTrigger.Key         = KeyCode.Escape;
                v_cancelTrigger.TriggerType = MaterialFocusGroup.KeyTriggerData.KeyTriggerType.KeyDown;
                AddEventListener(v_cancelTrigger.OnCallTrigger, Hide);

                p_materialKeyFocus.KeyTriggers = new System.Collections.Generic.List <MaterialFocusGroup.KeyTriggerData> {
                    v_cancelTrigger
                };
            }
        }
Beispiel #3
0
        protected override void ValidateKeyTriggers(MaterialFocusGroup p_materialKeyFocus)
        {
            if (p_materialKeyFocus != null)
            {
                var v_affirmativeTrigger = new MaterialFocusGroup.KeyTriggerData();
                v_affirmativeTrigger.Name        = "Return KeyDown";
                v_affirmativeTrigger.Key         = KeyCode.Return;
                v_affirmativeTrigger.TriggerType = MaterialFocusGroup.KeyTriggerData.KeyTriggerType.KeyDown;
                MaterialActivity.AddEventListener(v_affirmativeTrigger.OnCallTrigger, AffirmativeButtonClicked);

                var v_cancelTrigger = new MaterialFocusGroup.KeyTriggerData();
                v_cancelTrigger.Name        = "Escape KeyDown";
                v_cancelTrigger.Key         = KeyCode.Escape;
                v_cancelTrigger.TriggerType = MaterialFocusGroup.KeyTriggerData.KeyTriggerType.KeyDown;
                MaterialActivity.AddEventListener(v_cancelTrigger.OnCallTrigger, DismissiveButtonClicked);

                p_materialKeyFocus.KeyTriggers = new System.Collections.Generic.List <MaterialFocusGroup.KeyTriggerData> {
                    v_affirmativeTrigger, v_cancelTrigger
                };
            }
        }