Beispiel #1
0
 /// <summary>
 ///     Renders a key bind option.
 /// </summary>
 private static void RenderKeyBind(string name, KeyCode currentBinding, Action <KeyCode> acceptClicked)
 {
     GUILayout.BeginHorizontal();
     GUILayout.Label(name);
     if (GUILayout.Button(currentBinding.ToString(), HighLogic.Skin.button, GUILayout.Width(100.0f)))
     {
         KeyBindPopup.Show(name, currentBinding, acceptClicked);
     }
     GUILayout.EndHorizontal();
 }
Beispiel #2
0
        /// <summary>
        ///     Shows a key bind popup allowing the user to select a key for binding.
        /// </summary>
        public static void Show(string name, KeyCode currentBinding, Action <KeyCode> acceptClicked)
        {
            if (instance == null)
            {
                instance = new GameObject("SelectKeyBind").AddComponent <KeyBindPopup>();
            }

            instance.Name          = name;
            instance.Binding       = currentBinding;
            instance.AcceptClicked = acceptClicked;
        }
Beispiel #3
0
 /// <summary>
 ///     Called by unity when the component is created.
 /// </summary>
 protected virtual void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         OnCancel();
     }
 }
Beispiel #4
0
        /// <summary>
        ///     Shows a key bind popup allowing the user to select a key for binding.
        /// </summary>
        public static void Show(string name, KeyCode currentBinding, Action<KeyCode> acceptClicked)
        {
            if (instance == null)
            {
                instance = new GameObject("SelectKeyBind").AddComponent<KeyBindPopup>();
            }

            instance.Name = name;
            instance.Binding = currentBinding;
            instance.AcceptClicked = acceptClicked;
        }
Beispiel #5
0
 /// <summary>
 ///     Called by unity when the component is created.
 /// </summary>
 protected virtual void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         OnCancel();
     }
 }