Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Form form = new Form();

            form.AddControl(new InformationZone("Name"));
            form.AddControl(new InformationZone("Last Name"));

            PopUpMenu menu = new PopUpMenu("Co-prestario");

            menu.AddOption("sin co-prestario");
            menu.AddOption("con co-prestario");

            form.AddControl(menu);
            form.MenuCo = menu;

            Button button = new Button("OK");

            form.AddControl(button);
            form.OkButton = button;

            form.AddControlCo(new InformationZone("Nombre del co-prestador"));
            form.AddControlCo(new InformationZone("Apellidos del co-prestador"));

            form.Inform();

            Console.ReadKey();
        }
Ejemplo n.º 2
0
 public float OnGUI(Rect rect)
 {
     if ((rect.width >= this.m_WidthOfButtons) && (rect.width > this.m_MinWidthOfPopup))
     {
         Rect position = rect;
         foreach (ItemData data in this.m_Items)
         {
             position.width = data.m_Width;
             EditorGUI.BeginChangeCheck();
             EditorGUI.BeginDisabledGroup(!data.m_Enabled);
             GUI.Toggle(position, data.m_On, data.m_GUIContent, data.m_Style);
             EditorGUI.EndDisabledGroup();
             if (EditorGUI.EndChangeCheck())
             {
                 this.SelectionChanged(data);
                 GUIUtility.ExitGUI();
             }
             position.x += data.m_Width + this.m_ItemSpacing;
         }
         return(this.m_WidthOfButtons);
     }
     if (this.m_WidthOfPopup < rect.width)
     {
         rect.width = this.m_WidthOfPopup;
     }
     if (EditorGUI.ButtonMouseDown(rect, this.m_PopupButtonData.m_GUIContent, FocusType.Passive, this.m_PopupButtonData.m_Style))
     {
         PopUpMenu.Show(rect, this.m_Items, this);
     }
     return(this.m_WidthOfPopup);
 }
Ejemplo n.º 3
0
        public void GetPopupMenuItems()
        {
            Window.Get <ListBox>("listBox").RightClick();
            PopUpMenu popup = Window.Popup;

            Assert.AreEqual(1, popup.Items.Count);
        }
 public static List <Menu> menus(this PopUpMenu popUpMenu)
 {
     if (popUpMenu.notNull())
     {
         return((from menu in popUpMenu.Items
                 select menu).toList());
     }
     return(new List <Menu>());
 }
Ejemplo n.º 5
0
        private bool TryGetPopupMenu(AutomationSearchCondition[] searchConditions, IActionListener actionListener, out PopUpMenu popUpMenu)
        {
            var element = Retry.For(() => Finder.Child(searchConditions), CoreAppXmlConfiguration.Instance.PopupTimeout(), TimeSpan.FromMilliseconds(100));

            if (element == null)
            {
                popUpMenu = null;
                return(false);
            }
            popUpMenu = new PopUpMenu(element, actionListener);
            return(true);
        }
Ejemplo n.º 6
0
        public float OnGUI(Rect rect)
        {
            if (rect.width >= m_WidthOfButtons && rect.width > m_MinWidthOfPopup)
            {
                Rect buttonRect = rect;

                // Show as buttons
                foreach (var item in m_Items)
                {
                    buttonRect.width  = item.m_Width;
                    buttonRect.y      = rect.y + (rect.height - item.m_Height) / 2;
                    buttonRect.height = item.m_Height;

                    EditorGUI.BeginChangeCheck();

                    using (new EditorGUI.DisabledScope(!item.m_Enabled))
                    {
                        GUI.Toggle(buttonRect, item.m_On, item.m_GUIContent, item.m_Style);
                    }

                    if (EditorGUI.EndChangeCheck())
                    {
                        SelectionChanged(item);
                        GUIUtility.ExitGUI(); // To make sure we can survive if m_Buttons are reallocated in the callback we exit gui
                    }

                    buttonRect.x += item.m_Width + m_ItemSpacing;
                }

                return(m_WidthOfButtons);
            }
            else
            {
                var dropDownRect = rect;

                // Show as popup
                if (m_PopupButtonSize.x < rect.width)
                {
                    dropDownRect.width = m_PopupButtonSize.x;
                }

                dropDownRect.height = m_PopupButtonSize.y;
                dropDownRect.y      = rect.y + (rect.height - dropDownRect.height) / 2;

                //if (GUI.Button (rect, m_PopupButtonData.m_GUIContent, m_PopupButtonData.m_Style))
                if (EditorGUI.DropdownButton(dropDownRect, m_PopupButtonData.m_GUIContent, FocusType.Passive, m_PopupButtonData.m_Style))
                {
                    PopUpMenu.Show(dropDownRect, m_Items, this);
                }

                return(m_PopupButtonSize.x);
            }
        }
Ejemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     loginText           = string.Empty;
     enterDown           = false;
     connected           = false;
     pum                 = GameObject.Find("PopUpMenu").GetComponent <PopUpMenu> ();
     am                  = GameObject.Find("AudioManager").GetComponent <AudioManager>();
     process             = GameObject.Find("GameProcess").GetComponent <GameProcess>();
     userName            = string.Empty;
     password            = string.Empty;
     reEnteredPassword   = string.Empty;
     ip                  = string.Empty;
     showReEnterPassword = false;
     buttonText          = "Create Account";
 }
        private bool TryGetPopupMenu(AutomationSearchCondition[] searchConditions, ActionListener actionListener, out PopUpMenu popUpMenu)
        {
            var clock = new Clock(CoreAppXmlConfiguration.Instance.PopupTimeout, 100);

            Clock.Do      @do     = () => finder.Child(searchConditions);
            Clock.Matched matched = obj => obj != null;
            var           element = (AutomationElement)clock.Perform(@do, matched, () => null);

            if (element == null)
            {
                popUpMenu = null;
                return(false);
            }
            popUpMenu = new PopUpMenu(element, actionListener);
            return(true);
        }
Ejemplo n.º 9
0
        public override void Load()
        {
            levels = new Level[]
            {
                new LevelEditor(),
                new Level_01()
            };

            CurrentLevel = levels[0];
            Player       = new Player();
            Player.Spawn(CurrentLevel.SpawnPoint);

            pauseButton = new Button(new Vector2(Game.Screen.X - 100, BlackBarHeight / 2), 0.3f, "PAUSE", () => Paused = true);

            pausePopUp = new PopUpMenu(Helper.RectangleFromPosition(new Vector2(Game.Screen.X / 2, Game.Screen.Y / 2), Game.Screen.X / 5, Game.Screen.Y / 6))
            {
                Color = Color.Black * 0.7f
            };
            restartPopUp = new PopUpMenu(Helper.RectangleFromPosition(new Vector2(Game.Screen.X / 2, Game.Screen.Y / 2), Game.Screen.X / 5, Game.Screen.Y / 6))
            {
                Color = Color.Black * 0.7f
            };

            var resumeButton = new Button(new Vector2(Game.Screen.X / 2, Game.Screen.Y / 2 - 20), 0.3f, "RESUME", () => Paused = false);
            var menuButton   = new Button(new Vector2(Game.Screen.X / 2, Game.Screen.Y / 2 + 20), 0.3f, "MENU", MenuButtonPressed);

            var restartButton = new Button(new Vector2(Game.Screen.X / 2, Game.Screen.Y / 2 - 20), 0.3f, "RESTART", RestartButtonPressed);

            pausePopUp.Components.Add(resumeButton);
            pausePopUp.Components.Add(menuButton);

            restartPopUp.Components.Add(restartButton);
            restartPopUp.Components.Add(menuButton);

            Game.Camera.Zoom = 1.1f;
        }
 public static Menu menu(this PopUpMenu popUpMenu, string menuToFind)
 {
     return(popUpMenu.menus().menu(menuToFind));
 }
 //Menu
 public static List <Menu> items(this PopUpMenu popUpMenu)
 {
     return(popUpMenu.menus());
 }
        public float OnGUI(Rect rect)
        {
            // To ensure we allocate a consistent amount of controlIDs on every OnGUI we preallocate before any logic
            if (m_Items.Count > 0 && (m_ItemControlIDs == null || m_ItemControlIDs.Length != m_Items.Count))
            {
                m_ItemControlIDs = new int[m_Items.Count];
            }
            for (int i = 0; i < m_Items.Count; ++i)
            {
                m_ItemControlIDs[i] = GUIUtility.GetControlID(s_ItemHash, FocusType.Passive);
            }
            m_DropDownButtonControlID = GUIUtility.GetControlID(m_DropDownButtonHash, FocusType.Passive);

            if (rect.width >= widthOfButtonsAndLabel && rect.width > m_MinWidthOfPopup)
            {
                // Show as buttons

                if (hasLabel)
                {
                    Rect labelRect = rect;
                    labelRect.width = m_WidthOfLabel;
                    if (rightAligned)
                    {
                        labelRect.x = rect.xMax - widthOfButtonsAndLabel;
                    }

                    GUI.Label(labelRect, m_Label, EditorStyles.boldLabel);
                    rect.xMin += (m_WidthOfLabel + m_SpacingLabelToButton);
                }

                Rect buttonRect = rect;
                buttonRect.width = widthOfButtonsAndLabel;
                if (rightAligned)
                {
                    buttonRect.x = rect.xMax - m_WidthOfButtons;
                }

                for (int i = 0; i < m_Items.Count; ++i)
                {
                    var item = m_Items[i];
                    buttonRect.width  = item.m_Width;
                    buttonRect.y      = rect.y + (rect.height - item.m_Height) / 2;
                    buttonRect.height = item.m_Height;

                    EditorGUI.BeginChangeCheck();

                    using (new EditorGUI.DisabledScope(!item.m_Enabled))
                    {
                        GUI.Toggle(buttonRect, m_ItemControlIDs[i], item.m_On, item.m_GUIContent, item.m_Style);
                    }

                    if (EditorGUI.EndChangeCheck())
                    {
                        SelectionChanged(item);
                        GUIUtility.ExitGUI(); // To make sure we can survive if m_Buttons are reallocated in the callback we exit gui
                    }

                    buttonRect.x += item.m_Width + m_ItemSpacing;
                }

                return(widthOfButtonsAndLabel);
            }
            else
            {
                // Show as popup

                var dropDownRect = rect;
                if (hasLabel)
                {
                    Rect labelRect = dropDownRect;
                    labelRect.width = m_WidthOfLabel;
                    if (rightAligned)
                    {
                        labelRect.x = rect.xMax - widthOfPopupAndLabel;
                    }

                    GUI.Label(labelRect, m_Label, EditorStyles.boldLabel);
                    dropDownRect.x = labelRect.x + (m_WidthOfLabel + m_SpacingLabelToButton);
                }
                else
                {
                    if (rightAligned)
                    {
                        dropDownRect.x = rect.xMax - dropDownRect.width;
                    }
                }

                dropDownRect.width  = Mathf.Clamp(dropDownRect.width, 0, m_PopupButtonSize.x);
                dropDownRect.height = m_PopupButtonSize.y;
                dropDownRect.y      = rect.y + (rect.height - dropDownRect.height) / 2;

                if (EditorGUI.DropdownButton(m_DropDownButtonControlID, dropDownRect, m_PopupButtonData.m_GUIContent, m_PopupButtonData.m_Style))
                {
                    PopUpMenu.Show(dropDownRect, m_Items, this);
                }

                return(widthOfPopupAndLabel);
            }
        }
Ejemplo n.º 13
0
        public virtual bool TryGetPopupMenu(ActionListener actionListener, out PopUpMenu popUpMenu)
        {
            var searchConditions = new[] { AutomationSearchCondition.ByControlType(ControlType.Menu).OfName("DropDown") };

            return(TryGetPopupMenu(searchConditions, actionListener, out popUpMenu));
        }
Ejemplo n.º 14
0
        public static RibbonAppMenuBuilder Menu(this RibbonAppMenuBuilder b, PopUpMenu p)
        {
            b.CurrentRibbon.RibbonAppMenu.Menu = p;

            return b;
        }