示例#1
0
        /// <summary>
        /// Helper method that binds all controller listeners for interaction with the GUI.
        /// </summary>
        public static void BindControllerListeners()
        {
            if (SelectedButton != null)
                SelectedButton.IsDown = false;

            SelectedButton = null;

            InputManager.DPadDownListener = DPadDownListener;
            InputManager.DPadUpListener = DPadUpListener;
            InputManager.DPadLeftListener = DPadLeftListener;
            InputManager.DPadRightListener = DPadRightListener;
            InputManager.AButtonListener = AButtonListener;
        }
示例#2
0
        /// <summary>
        /// Sets a GUI to be active by its name.
        /// </summary>
        /// <param name="name">
        /// The name of the GUI to become active.
        /// </param>
        public static void SetGUI(String name)
        {
            if (GUIInstances.ContainsKey(name))
            {
                GUI newGUI = GUIInstances[name];

                if (newGUI == CurrentGUI)
                    return;

                if (SelectedButton != null)
                    SelectedButton.IsDown = false;

                SelectedButton = null;
                ActiveGUIName = name;

                if (CurrentGUI == null) 
                {
                    CurrentGUI = newGUI;
                    CurrentGUI.OnWake();
                }
                else if (CurrentGUI != newGUI)
                {
                    CurrentGUI.OnSleep();
                    CurrentGUI = newGUI;
                    CurrentGUI.OnWake();
                }
            }
            else if (name == null)
            {
                ActiveGUIName = "<NONE>";
                CurrentGUI = null;
            }
        }
示例#3
0
        /// <summary>
        /// Listener method to be called when the Directional Pad up is pressed.
        /// </summary>
        /// <param name="pressed">
        /// A boolean representing the current state of the DPad button. It is called once for
        /// each state transition: Up & Down.
        /// </param>
        public static void DPadUpListener(bool pressed)
        {
            if (pressed)
            {
                Elements.Button nextButton = NextButton(true);

                if (nextButton != null)
                {
                    if (SelectedButton != null)
                        SelectedButton.IsDown = false;

                    nextButton.IsDown = true;
                    SelectedButton = nextButton;
                }
            }
        }