public override void OnInitialize() { UIElement uIElement = new UIElement(); uIElement.Width.Set(0f, 0.8f); uIElement.MaxWidth.Set(800f, 0f); uIElement.MinWidth.Set(600f, 0f); uIElement.Top.Set(220f, 0f); uIElement.Height.Set(-220f, 1f); uIElement.HAlign = 0.5f; this._outerContainer = uIElement; base.Append(uIElement); UIPanel uIPanel = new UIPanel(); uIPanel.Width.Set(0f, 1f); uIPanel.Height.Set(-110f, 1f); uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f; uIPanel.PaddingTop = 0f; uIElement.Append(uIPanel); this._achievementsList = new UIList(); this._achievementsList.Width.Set(-25f, 1f); this._achievementsList.Height.Set(-50f, 1f); this._achievementsList.Top.Set(50f, 0f); this._achievementsList.ListPadding = 5f; uIPanel.Append(this._achievementsList); UITextPanel uITextPanel = new UITextPanel("Achievements", 1f, true); uITextPanel.HAlign = 0.5f; uITextPanel.Top.Set(-33f, 0f); uITextPanel.SetPadding(13f); uITextPanel.BackgroundColor = new Color(73, 94, 171); uIElement.Append(uITextPanel); UITextPanel uITextPanel2 = new UITextPanel("Back", 0.7f, true); uITextPanel2.Width.Set(-10f, 0.5f); uITextPanel2.Height.Set(50f, 0f); uITextPanel2.VAlign = 1f; uITextPanel2.HAlign = 0.5f; uITextPanel2.Top.Set(-45f, 0f); uITextPanel2.OnMouseOver += new UIElement.MouseEvent(this.FadedMouseOver); uITextPanel2.OnMouseOut += new UIElement.MouseEvent(this.FadedMouseOut); uITextPanel2.OnClick += new UIElement.MouseEvent(this.GoBackClick); uIElement.Append(uITextPanel2); List<Achievement> list = Main.Achievements.CreateAchievementsList(); for (int i = 0; i < list.Count; i++) { UIAchievementListItem item = new UIAchievementListItem(list[i]); this._achievementsList.Add(item); this._achievementElements.Add(item); } UIScrollbar uIScrollbar = new UIScrollbar(); uIScrollbar.SetView(100f, 1000f); uIScrollbar.Height.Set(-50f, 1f); uIScrollbar.Top.Set(50f, 0f); uIScrollbar.HAlign = 1f; uIPanel.Append(uIScrollbar); this._achievementsList.SetScrollbar(uIScrollbar); UIElement uIElement2 = new UIElement(); uIElement2.Width.Set(0f, 1f); uIElement2.Height.Set(32f, 0f); uIElement2.Top.Set(10f, 0f); Texture2D texture = TextureManager.Load("Images/UI/Achievement_Categories"); for (int j = 0; j < 4; j++) { UIToggleImage uIToggleImage = new UIToggleImage(texture, 32, 32, new Point(34 * j, 0), new Point(34 * j, 34)); uIToggleImage.Left.Set((float)(j * 36 + 8), 0f); uIToggleImage.SetState(true); uIToggleImage.OnClick += new UIElement.MouseEvent(this.FilterList); this._categoryButtons.Add(uIToggleImage); uIElement2.Append(uIToggleImage); } uIPanel.Append(uIElement2); }
public override void OnInitialize() { UIElement element1 = new UIElement(); element1.Width.Set(0.0f, 0.8f); element1.MaxWidth.Set(800f, 0.0f); element1.MinWidth.Set(600f, 0.0f); element1.Top.Set(220f, 0.0f); element1.Height.Set(-220f, 1f); element1.HAlign = 0.5f; _outerContainer = element1; Append(element1); UIPanel uiPanel = new UIPanel(); uiPanel.Width.Set(0.0f, 1f); uiPanel.Height.Set(-110f, 1f); uiPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f; uiPanel.PaddingTop = 0.0f; element1.Append(uiPanel); _achievementsList = new UIList(); _achievementsList.Width.Set(-25f, 1f); _achievementsList.Height.Set(-50f, 1f); _achievementsList.Top.Set(50f, 0.0f); _achievementsList.ListPadding = 5f; uiPanel.Append(_achievementsList); UITextPanel uiTextPanel1 = new UITextPanel("Achievements", 1f, true); uiTextPanel1.HAlign = 0.5f; uiTextPanel1.Top.Set(-33f, 0.0f); uiTextPanel1.SetPadding(13f); uiTextPanel1.BackgroundColor = new Color(73, 94, 171); element1.Append(uiTextPanel1); UITextPanel uiTextPanel2 = new UITextPanel("Back", 0.7f, true); uiTextPanel2.Width.Set(-10f, 0.5f); uiTextPanel2.Height.Set(50f, 0.0f); uiTextPanel2.VAlign = 1f; uiTextPanel2.HAlign = 0.5f; uiTextPanel2.Top.Set(-45f, 0.0f); uiTextPanel2.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver); uiTextPanel2.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut); uiTextPanel2.OnClick += new UIElement.MouseEvent(GoBackClick); element1.Append(uiTextPanel2); List<Achievement> achievementsList = Main.Achievements.CreateAchievementsList(); for (int index = 0; index < achievementsList.Count; ++index) { UIAchievementListItem achievementListItem = new UIAchievementListItem(achievementsList[index]); _achievementsList.Add((UIElement)achievementListItem); _achievementElements.Add(achievementListItem); } UIScrollbar scrollbar = new UIScrollbar(); scrollbar.SetView(100f, 1000f); scrollbar.Height.Set(-50f, 1f); scrollbar.Top.Set(50f, 0.0f); scrollbar.HAlign = 1f; uiPanel.Append((UIElement)scrollbar); _achievementsList.SetScrollbar(scrollbar); UIElement element2 = new UIElement(); element2.Width.Set(0.0f, 1f); element2.Height.Set(32f, 0.0f); element2.Top.Set(10f, 0.0f); Texture2D texture = TextureManager.Load("Images/UI/Achievement_Categories"); for (int index = 0; index < 4; ++index) { UIToggleImage uiToggleImage = new UIToggleImage(texture, 32, 32, new Point(34 * index, 0), new Point(34 * index, 34)); uiToggleImage.Left.Set((float)(index * 36 + 8), 0.0f); uiToggleImage.SetState(true); uiToggleImage.OnClick += new UIElement.MouseEvent(FilterList); _categoryButtons.Add(uiToggleImage); element2.Append((UIElement)uiToggleImage); } uiPanel.Append(element2); }