Пример #1
0
        public void AddItem(string text, ListItemStyle ListItemStyle)
        {
            ListItem NewItem = new ListItem(ListItemStyle, text);
            NewItem.Width = ListStyle.Width - ((int)ListStyle.ItemOffset.X * 2);

            Vector2 Pos = new Vector2();
            Pos.X = Position.X - ListStyle.Origin.X/2 + ListStyle.ItemOffset.X;
            Pos.Y = Position.Y - ListStyle.Origin.Y/2 + ListStyle.ItemOffset.Y + (ListItems.Count * NewItem.Height);

            NewItem.Position = Pos;
            ListItems.Add(NewItem);
        }
Пример #2
0
 public void RemoveItem(ListItem Item)
 {
     ListItems.Remove(Item);
 }
Пример #3
0
 public List(ListStyle ListStyle)
 {
     this.ListStyle = ListStyle;
     ListItems = new List<ListItem>();
     selectedItem = null;
 }
Пример #4
0
        public void Update(MenuScreen screen, GameTime gameTime)
        {
            oldState = currState;
            currState = Mouse.GetState();

            mousePos.X = Mouse.GetState().Position.X;
            mousePos.Y = Mouse.GetState().Position.Y;

            foreach (ListItem Item in ListItems)
                Item.Update(this, screen, gameTime);

            //selectedItem = null;

            for (int i = 0; i < ListItems.Count; i++)
            {
                if (ListItems[i].Selected)
                    selectedItem = ListItems[i];
            }
        }