示例#1
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);
            }
        }
示例#2
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?());
            }
        }