Esempio n. 1
0
        private void BuildChildren()
        {
            StyleDimension left   = StyleDimension.FromPixels(77f);
            StyleDimension top    = StyleDimension.FromPixels(4f);
            UIText         uIText = new UIText(ResourcePack.Name)
            {
                Left = left,
                Top  = top
            };

            Append(uIText);
            top.Pixels += uIText.GetOuterDimensions().Height + 6f;
            UIText uIText2 = new UIText(Language.GetTextValue("UI.Author", ResourcePack.Author), 0.7f)
            {
                Left = left,
                Top  = top
            };

            Append(uIText2);
            top.Pixels += uIText2.GetOuterDimensions().Height + 10f;
            Asset <Texture2D> val     = Main.Assets.Request <Texture2D>("Images/UI/Divider", Main.content, (AssetRequestMode)1);
            UIImage           uIImage = new UIImage(val)
            {
                Left       = StyleDimension.FromPixels(72f),
                Top        = top,
                Height     = StyleDimension.FromPixels(val.Height()),
                Width      = StyleDimension.FromPixelsAndPercent(-80f, 1f),
                ScaleToFit = true
            };

            Recalculate();
            Append(uIImage);
            top.Pixels += uIImage.GetOuterDimensions().Height + 5f;
            UIElement uIElement = new UIElement
            {
                Left   = left,
                Top    = top,
                Height = StyleDimension.FromPixels(92f - top.Pixels),
                Width  = StyleDimension.FromPixelsAndPercent(0f - left.Pixels, 1f)
            };

            Append(uIElement);
            ContentPanel = uIElement;
        }
Esempio n. 2
0
        private void BuildChildren()
        {
            StyleDimension styleDimension1 = StyleDimension.FromPixels(77f);
            StyleDimension styleDimension2 = StyleDimension.FromPixels(4f);
            UIText         uiText1         = new UIText(this.ResourcePack.Name, 1f, false);

            uiText1.Left = styleDimension1;
            uiText1.Top  = styleDimension2;
            UIText uiText2 = uiText1;

            this.Append((UIElement)uiText2);
            styleDimension2.Pixels += uiText2.GetOuterDimensions().Height + 6f;
            UIText uiText3 = new UIText(Language.GetTextValue("UI.Author", (object)this.ResourcePack.Author), 0.7f, false);

            uiText3.Left = styleDimension1;
            uiText3.Top  = styleDimension2;
            UIText uiText4 = uiText3;

            this.Append((UIElement)uiText4);
            styleDimension2.Pixels += uiText4.GetOuterDimensions().Height + 10f;
            Asset <Texture2D> asset    = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Divider", (AssetRequestMode)1);
            UIImage           uiImage1 = new UIImage(asset);

            uiImage1.Left       = StyleDimension.FromPixels(72f);
            uiImage1.Top        = styleDimension2;
            uiImage1.Height     = StyleDimension.FromPixels((float)asset.Height());
            uiImage1.Width      = StyleDimension.FromPixelsAndPercent(-80f, 1f);
            uiImage1.ScaleToFit = true;
            UIImage uiImage2 = uiImage1;

            this.Recalculate();
            this.Append((UIElement)uiImage2);
            styleDimension2.Pixels += uiImage2.GetOuterDimensions().Height + 5f;
            UIElement element = new UIElement()
            {
                Left   = styleDimension1,
                Top    = styleDimension2,
                Height = StyleDimension.FromPixels(92f - styleDimension2.Pixels),
                Width  = StyleDimension.FromPixelsAndPercent(-styleDimension1.Pixels, 1f)
            };

            this.Append(element);
            this.ContentPanel = element;
        }