Exemple #1
0
        private void AddInfoToList(BestiaryEntry entry, ExtraBestiaryInfoPageInformation extraInfo)
        {
            BestiaryUICollectionInfo uiCollectionInfo = this.GetUICollectionInfo(entry, extraInfo);
            IOrderedEnumerable <IGrouping <UIBestiaryEntryInfoPage.BestiaryInfoCategory, IBestiaryInfoElement> > orderedEnumerable = new List <IBestiaryInfoElement>((IEnumerable <IBestiaryInfoElement>)entry.Info).GroupBy <IBestiaryInfoElement, UIBestiaryEntryInfoPage.BestiaryInfoCategory>(new Func <IBestiaryInfoElement, UIBestiaryEntryInfoPage.BestiaryInfoCategory>(this.GetBestiaryInfoCategory)).OrderBy <IGrouping <UIBestiaryEntryInfoPage.BestiaryInfoCategory, IBestiaryInfoElement>, UIBestiaryEntryInfoPage.BestiaryInfoCategory>((Func <IGrouping <UIBestiaryEntryInfoPage.BestiaryInfoCategory, IBestiaryInfoElement>, UIBestiaryEntryInfoPage.BestiaryInfoCategory>)(x => x.Key));
            UIElement uiElement1 = (UIElement)null;

            foreach (IGrouping <UIBestiaryEntryInfoPage.BestiaryInfoCategory, IBestiaryInfoElement> source in (IEnumerable <IGrouping <UIBestiaryEntryInfoPage.BestiaryInfoCategory, IBestiaryInfoElement> >)orderedEnumerable)
            {
                if (source.Count <IBestiaryInfoElement>() != 0)
                {
                    bool flag = false;
                    foreach (IBestiaryInfoElement bestiaryInfoElement in (IEnumerable <IBestiaryInfoElement>)source)
                    {
                        UIElement uiElement2 = bestiaryInfoElement.ProvideUIElement(uiCollectionInfo);
                        if (uiElement2 != null)
                        {
                            this._list.Add(uiElement2);
                            flag = true;
                        }
                    }
                    if (flag)
                    {
                        UIHorizontalSeparator horizontalSeparator1 = new UIHorizontalSeparator(2, true);
                        horizontalSeparator1.Width = StyleDimension.FromPixelsAndPercent(0.0f, 1f);
                        horizontalSeparator1.Color = new Color(89, 116, 213, (int)byte.MaxValue) * 0.9f;
                        UIHorizontalSeparator horizontalSeparator2 = horizontalSeparator1;
                        this._list.Add((UIElement)horizontalSeparator2);
                        uiElement1 = (UIElement)horizontalSeparator2;
                    }
                }
            }
            this._list.Remove(uiElement1);
        }
Exemple #2
0
        private void AddInfoToList(BestiaryEntry entry, ExtraBestiaryInfoPageInformation extraInfo)
        {
            BestiaryUICollectionInfo uICollectionInfo = GetUICollectionInfo(entry, extraInfo);
            IOrderedEnumerable <IGrouping <BestiaryInfoCategory, IBestiaryInfoElement> > orderedEnumerable = from x in new List <IBestiaryInfoElement>(entry.Info).GroupBy(GetBestiaryInfoCategory)
                                                                                                             orderby x.Key
                                                                                                             select x;
            UIElement item = null;

            foreach (IGrouping <BestiaryInfoCategory, IBestiaryInfoElement> item2 in orderedEnumerable)
            {
                if (item2.Count() == 0)
                {
                    continue;
                }
                bool flag = false;
                foreach (IBestiaryInfoElement item3 in item2)
                {
                    UIElement uIElement = item3.ProvideUIElement(uICollectionInfo);
                    if (uIElement != null)
                    {
                        _list.Add(uIElement);
                        flag = true;
                    }
                }
                if (flag)
                {
                    UIHorizontalSeparator uIHorizontalSeparator = new UIHorizontalSeparator
                    {
                        Width = StyleDimension.FromPixelsAndPercent(0f, 1f),
                        Color = new Color(89, 116, 213, 255) * 0.9f
                    };
                    _list.Add(uIHorizontalSeparator);
                    item = uIHorizontalSeparator;
                }
            }
            _list.Remove(item);
        }
Exemple #3
0
        public EmotesGroupListItem(LocalizedText groupTitle, int groupIndex, int maxEmotesPerRow, params int[] emotes)
        {
            maxEmotesPerRow = 14;
            SetPadding(0f);
            _groupIndex      = groupIndex;
            _maxEmotesPerRow = maxEmotesPerRow;
            _tempTex         = Main.Assets.Request <Texture2D>("Images/UI/ButtonFavoriteInactive", (AssetRequestMode)1);
            int num = emotes.Length / _maxEmotesPerRow;

            if (emotes.Length % _maxEmotesPerRow != 0)
            {
                num++;
            }
            Height.Set(30 + 36 * num, 0f);
            Width.Set(0f, 1f);
            UIElement uIElement = new UIElement
            {
                Height = StyleDimension.FromPixels(30f),
                Width  = StyleDimension.FromPixelsAndPercent(-20f, 1f),
                HAlign = 0.5f
            };

            uIElement.SetPadding(0f);
            Append(uIElement);
            UIHorizontalSeparator element = new UIHorizontalSeparator
            {
                Width  = StyleDimension.FromPixelsAndPercent(0f, 1f),
                VAlign = 1f,
                HAlign = 0.5f,
                Color  = Color.Lerp(Color.White, new Color(63, 65, 151, 255), 0.85f) * 0.9f
            };

            uIElement.Append(element);
            UIText element2 = new UIText(groupTitle)
            {
                VAlign = 1f,
                HAlign = 0.5f,
                Top    = StyleDimension.FromPixels(-6f)
            };

            uIElement.Append(element2);
            float num2 = 6f;

            for (int i = 0; i < emotes.Length; i++)
            {
                int emoteIndex = emotes[i];
                int num3       = i / _maxEmotesPerRow;
                int num4       = i % _maxEmotesPerRow;
                int num5       = emotes.Length % _maxEmotesPerRow;
                if (emotes.Length / _maxEmotesPerRow != num3)
                {
                    num5 = _maxEmotesPerRow;
                }
                if (num5 == 0)
                {
                    num5 = _maxEmotesPerRow;
                }
                float num6 = 36f * ((float)num5 / 2f);
                num6 -= 16f;
                num6  = -16f;
                EmoteButton emoteButton = new EmoteButton(emoteIndex)
                {
                    HAlign = 0f,
                    VAlign = 0f,
                    Top    = StyleDimension.FromPixels((float)(30 + num3 * 36) + num2),
                    Left   = StyleDimension.FromPixels((float)(36 * num4) - num6)
                };
                Append(emoteButton);
                emoteButton.SetSnapPoint("Group " + groupIndex, i);
            }
        }
Exemple #4
0
        public EmotesGroupListItem(
            LocalizedText groupTitle,
            int groupIndex,
            int maxEmotesPerRow,
            params int[] emotes)
        {
            maxEmotesPerRow = 14;
            this.SetPadding(0.0f);
            this._groupIndex      = groupIndex;
            this._maxEmotesPerRow = maxEmotesPerRow;
            this._tempTex         = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/ButtonFavoriteInactive", (AssetRequestMode)1);
            int num1 = emotes.Length / this._maxEmotesPerRow;

            if (emotes.Length % this._maxEmotesPerRow != 0)
            {
                ++num1;
            }
            this.Height.Set((float)(30 + 36 * num1), 0.0f);
            this.Width.Set(0.0f, 1f);
            UIElement element = new UIElement()
            {
                Height = StyleDimension.FromPixels(30f),
                Width  = StyleDimension.FromPixelsAndPercent(-20f, 1f),
                HAlign = 0.5f
            };

            element.SetPadding(0.0f);
            this.Append(element);
            UIHorizontalSeparator horizontalSeparator1 = new UIHorizontalSeparator(2, true);

            horizontalSeparator1.Width  = StyleDimension.FromPixelsAndPercent(0.0f, 1f);
            horizontalSeparator1.VAlign = 1f;
            horizontalSeparator1.HAlign = 0.5f;
            horizontalSeparator1.Color  = Color.Lerp(Color.White, new Color(63, 65, 151, (int)byte.MaxValue), 0.85f) * 0.9f;
            UIHorizontalSeparator horizontalSeparator2 = horizontalSeparator1;

            element.Append((UIElement)horizontalSeparator2);
            UIText uiText1 = new UIText(groupTitle, 1f, false);

            uiText1.VAlign = 1f;
            uiText1.HAlign = 0.5f;
            uiText1.Top    = StyleDimension.FromPixels(-6f);
            UIText uiText2 = uiText1;

            element.Append((UIElement)uiText2);
            float num2 = 6f;

            for (int id = 0; id < emotes.Length; ++id)
            {
                int emote = emotes[id];
                int num3  = id / this._maxEmotesPerRow;
                int num4  = id % this._maxEmotesPerRow;
                int num5  = emotes.Length % this._maxEmotesPerRow;
                if (emotes.Length / this._maxEmotesPerRow != num3)
                {
                    num5 = this._maxEmotesPerRow;
                }
                if (num5 == 0)
                {
                    num5 = this._maxEmotesPerRow;
                }
                float       num6         = (float)(36.0 * ((double)num5 / 2.0)) - 16f;
                float       num7         = -16f;
                EmoteButton emoteButton1 = new EmoteButton(emote);
                emoteButton1.HAlign = 0.0f;
                emoteButton1.VAlign = 0.0f;
                emoteButton1.Top    = StyleDimension.FromPixels((float)(30 + num3 * 36) + num2);
                emoteButton1.Left   = StyleDimension.FromPixels((float)(36 * num4) - num7);
                EmoteButton emoteButton2 = emoteButton1;
                this.Append((UIElement)emoteButton2);
                emoteButton2.SetSnapPoint("Group " + (object)groupIndex, id, new Vector2?(), new Vector2?());
            }
        }