Esempio n. 1
0
 // Token: 0x060010BC RID: 4284 RVA: 0x004062E8 File Offset: 0x004044E8
 public void GotoAchievement(Achievement achievement)
 {
     this._achievementsList.Goto(delegate(UIElement element)
     {
         UIAchievementListItem uIAchievementListItem = element as UIAchievementListItem;
         return(uIAchievementListItem != null && uIAchievementListItem.GetAchievement() == achievement);
     });
 }
Esempio n. 2
0
 public void GotoAchievement(Achievement achievement)
 {
     this._achievementsList.Goto((UIList.ElementSearchMethod)(element =>
     {
         UIAchievementListItem achievementListItem = element as UIAchievementListItem;
         if (achievementListItem == null)
         {
             return(false);
         }
         return(achievementListItem.GetAchievement() == achievement);
     }));
 }
Esempio n. 3
0
        public void InitializePage()
        {
            this.RemoveAllChildren();
            this._categoryButtons.Clear();
            this._achievementElements.Clear();
            this._achievementsList = (UIList)null;
            bool      largeForOtherLanguages = true;
            int       num      = largeForOtherLanguages.ToInt() * 100;
            UIElement element1 = new UIElement();

            element1.Width.Set(0.0f, 0.8f);
            element1.MaxWidth.Set(800f + (float)num, 0.0f);
            element1.MinWidth.Set(600f + (float)num, 0.0f);
            element1.Top.Set(220f, 0.0f);
            element1.Height.Set(-220f, 1f);
            element1.HAlign      = 0.5f;
            this._outerContainer = element1;
            this.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((UIElement)uiPanel);
            this._achievementsList = new UIList();
            this._achievementsList.Width.Set(-25f, 1f);
            this._achievementsList.Height.Set(-50f, 1f);
            this._achievementsList.Top.Set(50f, 0.0f);
            this._achievementsList.ListPadding = 5f;
            uiPanel.Append((UIElement)this._achievementsList);
            UITextPanel <LocalizedText> uiTextPanel1 = new UITextPanel <LocalizedText>(Language.GetText("UI.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((UIElement)uiTextPanel1);
            UITextPanel <LocalizedText> uiTextPanel2 = new UITextPanel <LocalizedText>(Language.GetText("UI.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(this.FadedMouseOver);
            uiTextPanel2.OnMouseOut  += new UIElement.MouseEvent(this.FadedMouseOut);
            uiTextPanel2.OnClick     += new UIElement.MouseEvent(this.GoBackClick);
            element1.Append((UIElement)uiTextPanel2);
            this._backpanel = (UIElement)uiTextPanel2;
            List <Achievement> achievementsList = Main.Achievements.CreateAchievementsList();

            for (int index = 0; index < achievementsList.Count; ++index)
            {
                UIAchievementListItem achievementListItem = new UIAchievementListItem(achievementsList[index], largeForOtherLanguages);
                this._achievementsList.Add((UIElement)achievementListItem);
                this._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);
            this._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);
            Asset <Texture2D> texture = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Achievement_Categories", (AssetRequestMode)1);

            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(this.FilterList);
                this._categoryButtons.Add(uiToggleImage);
                element2.Append((UIElement)uiToggleImage);
            }
            uiPanel.Append(element2);
        }
Esempio n. 4
0
        // Token: 0x060010BA RID: 4282 RVA: 0x00405D28 File Offset: 0x00403F28
        public void InitializePage()
        {
            base.RemoveAllChildren();
            this._categoryButtons.Clear();
            this._achievementElements.Clear();
            this._achievementsList = null;
            bool      flag      = true;
            int       num       = flag.ToInt() * 100;
            UIElement uIElement = new UIElement();

            uIElement.Width.Set(0f, 0.8f);
            uIElement.MaxWidth.Set(800f + (float)num, 0f);
            uIElement.MinWidth.Set(600f + (float)num, 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 <LocalizedText> uITextPanel = new UITextPanel <LocalizedText>(Language.GetText("UI.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 <LocalizedText> uITextPanel2 = new UITextPanel <LocalizedText>(Language.GetText("UI.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);
            this._backpanel = uITextPanel2;
            List <Achievement> list = Main.Achievements.CreateAchievementsList();

            for (int i = 0; i < list.Count; i++)
            {
                UIAchievementListItem item = new UIAchievementListItem(list[i], flag);
                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);
        }
Esempio n. 5
0
        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;
            _outerContainer  = uIElement;
            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);
            _achievementsList = new UIList();
            _achievementsList.Width.Set(-25f, 1f);
            _achievementsList.Height.Set(-50f, 1f);
            _achievementsList.Top.Set(50f, 0f);
            _achievementsList.ListPadding = 5f;
            uIPanel.Append(_achievementsList);
            UITextPanel uITextPanel = new UITextPanel("Achievements", 1f, large: 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, large: 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 += FadedMouseOver;
            uITextPanel2.OnMouseOut  += FadedMouseOut;
            uITextPanel2.OnClick     += GoBackClick;
            uIElement.Append(uITextPanel2);
            List <Achievement> list = Main.Achievements.CreateAchievementsList();

            for (int i = 0; i < list.Count; i++)
            {
                UIAchievementListItem item = new UIAchievementListItem(list[i]);
                _achievementsList.Add(item);
                _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);
            _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(j * 36 + 8, 0f);
                uIToggleImage.SetState(value: true);
                uIToggleImage.OnClick += FilterList;
                _categoryButtons.Add(uIToggleImage);
                uIElement2.Append(uIToggleImage);
            }
            uIPanel.Append(uIElement2);
        }
Esempio n. 6
0
        private void DrawCustomAchievements(On.Terraria.GameContent.UI.Elements.UIAchievementListItem.orig_DrawSelf orig, UIAchievementListItem self, SpriteBatch spriteBatch)
        {
            if (self is ModAchievement)
            {
                Type       typ = typeof(UIAchievementListItem);
                FieldInfo  unlockSpriteInfo = typ.GetField("_iconFrameUnlocked", BindingFlags.NonPublic | BindingFlags.Instance);
                FieldInfo  lockSpriteInfo   = typ.GetField("_iconFrameLocked", BindingFlags.NonPublic | BindingFlags.Instance);
                MethodInfo updateInfo       = typ.GetMethod("UpdateIconFrame", BindingFlags.NonPublic | BindingFlags.Instance);
                updateInfo.Invoke(self, null);
                unlockSpriteInfo.SetValue(self, new Rectangle(999, 999, 0, 0));
                lockSpriteInfo.SetValue(self, new Rectangle(999, 999, 0, 0));

                (self as ModAchievement).DrawEntry(self.GetDimensions().Position(), (int)self.GetDimensions().Width, spriteBatch);
                (self as ModAchievement).PostDraw(spriteBatch, self.GetDimensions().Position());

                return;
            }
            orig(self, spriteBatch);
        }
Esempio n. 7
0
        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);
        }