Пример #1
0
 public void addMenuItem(MenuItem menuitem)
 {
     menuitems.Add(menuitem);
 }
Пример #2
0
        public virtual void Update(GameTime gametime)
        {
            if (parent.Players.Count > 0) foreach (Player p in parent.Players)
                {
                    if (current == null) current = menuitems.ElementAt(0);

                    p.Input.Update();
                    if (p.Input.IsMoveUpNewlyPressed()|| p.Input.IsDPadUpNewlyPressed()) current_index--;
                    if (p.Input.IsMoveDownNewlyPressed()|| p.Input.IsDPadDownNewlyPressed()) current_index++;
                    if (p.Input.IsBButtonNewlyPressed()) parent.CloseMenu();
                    if (current_index >= menuitems.Count) current_index = 0;
                    if (current_index < 0) current_index = menuitems.Count - 1;
                    current = menuitems.ElementAt(current_index);
                    if (p.Input.IsAButtonNewlyPressed())
                    {
                        p.Input.Update();
                        current.execute();
                    }

                }
        }