public BevelledButtonWidget()
        {
            Color     = Color.White;
            BevelSize = 2f;
            XElement node = ContentManager.Get <XElement>("Widgets/BevelledButtonContents");

            LoadChildren(this, node);
            m_rectangleWidget = Children.Find <BevelledRectangleWidget>("BevelledButton.Rectangle");
            m_imageWidget     = Children.Find <RectangleWidget>("BevelledButton.Image");
            m_labelWidget     = Children.Find <LabelWidget>("BevelledButton.Label");
            m_clickableWidget = Children.Find <ClickableWidget>("BevelledButton.Clickable");
            m_labelWidget.VerticalAlignment = WidgetAlignment.Center;
            LoadProperties(this, node);
        }
예제 #2
0
        public override void Overdraw(DrawContext dc)
        {
            Color       color            = new Color(181, 172, 154) * base.GlobalColorTransform;
            float       num              = 0.6f;
            float       directionalLight = 0.4f;
            FlatBatch2D flatBatch2D      = dc.PrimitivesRenderer2D.FlatBatch();
            int         count            = flatBatch2D.TriangleVertices.Count;

            if (Children.Count == 2)
            {
                if (SettingsManager.ScreenLayout2 == ScreenLayout.DoubleVertical || SettingsManager.ScreenLayout2 == ScreenLayout.DoubleOpposite)
                {
                    Vector2 c  = new Vector2(base.ActualSize.X / 2f - m_spacing / 2f, -100f);
                    Vector2 c2 = new Vector2(base.ActualSize.X / 2f + m_spacing / 2f, base.ActualSize.Y + 100f);
                    BevelledRectangleWidget.QueueBevelledRectangle(null, flatBatch2D, c, c2, 0f, m_bevel, color, color, Color.Transparent, num, directionalLight, 0f);
                }
                if (SettingsManager.ScreenLayout2 == ScreenLayout.DoubleHorizontal)
                {
                    Vector2 c3 = new Vector2(-100f, base.ActualSize.Y / 2f - m_spacing / 2f);
                    Vector2 c4 = new Vector2(base.ActualSize.X + 100f, base.ActualSize.Y / 2f + m_spacing / 2f);
                    BevelledRectangleWidget.QueueBevelledRectangle(null, flatBatch2D, c3, c4, 0f, m_bevel, color, color, Color.Transparent, num, directionalLight, 0f);
                }
            }
            else if (Children.Count == 3)
            {
                if (SettingsManager.ScreenLayout3 == ScreenLayout.TripleVertical || SettingsManager.ScreenLayout3 == ScreenLayout.TripleOpposite)
                {
                    float x  = -100f;
                    float x2 = base.ActualSize.X / 2f - m_spacing / 2f + m_bevel;
                    float x3 = base.ActualSize.X / 2f + m_spacing / 2f - m_bevel;
                    float x4 = base.ActualSize.X + 100f;
                    float y  = -100f;
                    float y2 = base.ActualSize.Y / 2f - m_spacing / 2f + m_bevel;
                    float y3 = base.ActualSize.Y / 2f + m_spacing / 2f - m_bevel;
                    float y4 = base.ActualSize.Y + 100f;
                    BevelledRectangleWidget.QueueBevelledRectangle(null, flatBatch2D, new Vector2(x, y), new Vector2(x2, y4), 0f, 0f - m_bevel, Color.Transparent, color, Color.Transparent, num, directionalLight, 0f);
                    BevelledRectangleWidget.QueueBevelledRectangle(null, flatBatch2D, new Vector2(x3, y), new Vector2(x4, y2), 0f, 0f - m_bevel, Color.Transparent, color, Color.Transparent, num, directionalLight, 0f);
                    BevelledRectangleWidget.QueueBevelledRectangle(null, flatBatch2D, new Vector2(x3, y3), new Vector2(x4, y4), 0f, 0f - m_bevel, Color.Transparent, color, Color.Transparent, num, directionalLight, 0f);
                    Color color2 = color * new Color(num, num, num, 1f);
                    flatBatch2D.QueueQuad(new Vector2(x2, y), new Vector2(x3, y4), 0f, color2);
                    flatBatch2D.QueueQuad(new Vector2(x3, y2), new Vector2(x4, y3), 0f, color2);
                }
                if (SettingsManager.ScreenLayout3 == ScreenLayout.TripleHorizontal)
                {
                    float x5 = -100f;
                    float x6 = base.ActualSize.X / 2f - m_spacing / 2f + m_bevel;
                    float x7 = base.ActualSize.X / 2f + m_spacing / 2f - m_bevel;
                    float x8 = base.ActualSize.X + 100f;
                    float y5 = -100f;
                    float y6 = base.ActualSize.Y / 2f - m_spacing / 2f + m_bevel;
                    float y7 = base.ActualSize.Y / 2f + m_spacing / 2f - m_bevel;
                    float y8 = base.ActualSize.Y + 100f;
                    BevelledRectangleWidget.QueueBevelledRectangle(null, flatBatch2D, new Vector2(x5, y5), new Vector2(x8, y6), 0f, 0f - m_bevel, Color.Transparent, color, Color.Transparent, num, directionalLight, 0f);
                    BevelledRectangleWidget.QueueBevelledRectangle(null, flatBatch2D, new Vector2(x5, y7), new Vector2(x6, y8), 0f, 0f - m_bevel, Color.Transparent, color, Color.Transparent, num, directionalLight, 0f);
                    BevelledRectangleWidget.QueueBevelledRectangle(null, flatBatch2D, new Vector2(x7, y7), new Vector2(x8, y8), 0f, 0f - m_bevel, Color.Transparent, color, Color.Transparent, num, directionalLight, 0f);
                    Color color3 = color * new Color(num, num, num, 1f);
                    flatBatch2D.QueueQuad(new Vector2(x5, y6), new Vector2(x8, y7), 0f, color3);
                    flatBatch2D.QueueQuad(new Vector2(x6, y7), new Vector2(x7, y8), 0f, color3);
                }
                if (SettingsManager.ScreenLayout3 == ScreenLayout.TripleEven)
                {
                    float x9  = -100f;
                    float x10 = base.ActualSize.X / 2f - m_spacing / 2f + m_bevel;
                    float x11 = base.ActualSize.X / 2f + m_spacing / 2f - m_bevel;
                    float x12 = base.ActualSize.X + 100f;
                    float x13 = base.ActualSize.X / 4f;
                    float x14 = base.ActualSize.X * 3f / 4f;
                    float y9  = -100f;
                    float y10 = base.ActualSize.Y / 2f - m_spacing / 2f + m_bevel;
                    float y11 = base.ActualSize.Y / 2f + m_spacing / 2f - m_bevel;
                    float y12 = base.ActualSize.Y + 100f;
                    BevelledRectangleWidget.QueueBevelledRectangle(null, flatBatch2D, new Vector2(x9, y9), new Vector2(x10, y10), 0f, 0f - m_bevel, Color.Transparent, color, Color.Transparent, num, directionalLight, 0f);
                    BevelledRectangleWidget.QueueBevelledRectangle(null, flatBatch2D, new Vector2(x11, y9), new Vector2(x12, y10), 0f, 0f - m_bevel, Color.Transparent, color, Color.Transparent, num, directionalLight, 0f);
                    BevelledRectangleWidget.QueueBevelledRectangle(null, flatBatch2D, new Vector2(x13, y11), new Vector2(x14, y12), 0f, 0f - m_bevel, Color.Transparent, color, Color.Transparent, num, directionalLight, 0f);
                    Color color4 = color * new Color(num, num, num, 1f);
                    flatBatch2D.QueueQuad(new Vector2(x10, y9), new Vector2(x11, y10), 0f, color4);
                    flatBatch2D.QueueQuad(new Vector2(x9, y10), new Vector2(x12, y11), 0f, color4);
                    flatBatch2D.QueueQuad(new Vector2(x9, y11), new Vector2(x13, y12), 0f, color4);
                    flatBatch2D.QueueQuad(new Vector2(x14, y11), new Vector2(x12, y12), 0f, color4);
                }
            }
            else if (Children.Count == 4)
            {
                float x15 = -100f;
                float x16 = base.ActualSize.X / 2f - m_spacing / 2f + m_bevel;
                float x17 = base.ActualSize.X / 2f + m_spacing / 2f - m_bevel;
                float x18 = base.ActualSize.X + 100f;
                float y13 = -100f;
                float y14 = base.ActualSize.Y / 2f - m_spacing / 2f + m_bevel;
                float y15 = base.ActualSize.Y / 2f + m_spacing / 2f - m_bevel;
                float y16 = base.ActualSize.Y + 100f;
                BevelledRectangleWidget.QueueBevelledRectangle(null, flatBatch2D, new Vector2(x15, y13), new Vector2(x16, y14), 0f, 0f - m_bevel, Color.Transparent, color, Color.Transparent, num, directionalLight, 0f);
                BevelledRectangleWidget.QueueBevelledRectangle(null, flatBatch2D, new Vector2(x17, y13), new Vector2(x18, y14), 0f, 0f - m_bevel, Color.Transparent, color, Color.Transparent, num, directionalLight, 0f);
                BevelledRectangleWidget.QueueBevelledRectangle(null, flatBatch2D, new Vector2(x15, y15), new Vector2(x16, y16), 0f, 0f - m_bevel, Color.Transparent, color, Color.Transparent, num, directionalLight, 0f);
                BevelledRectangleWidget.QueueBevelledRectangle(null, flatBatch2D, new Vector2(x17, y15), new Vector2(x18, y16), 0f, 0f - m_bevel, (Children.Count == 3) ? color : Color.Transparent, color, Color.Transparent, num, directionalLight, 0f);
                Color color5 = color * new Color(num, num, num, 1f);
                flatBatch2D.QueueQuad(new Vector2(x16, y13), new Vector2(x17, y16), 0f, color5);
                flatBatch2D.QueueQuad(new Vector2(x15, y14), new Vector2(x18, y15), 0f, color5);
            }
            else if (Children.Count > 4)
            {
                throw new InvalidOperationException("Too many GameWidgets.");
            }
            flatBatch2D.TransformTriangles(base.GlobalTransform, count);
        }
예제 #3
0
        public InventorySlotWidget()
        {
            base.Size = new Vector2(72f, 72f);
            WidgetsList children = Children;

            Widget[] array = new Widget[7];
            BevelledRectangleWidget obj = new BevelledRectangleWidget
            {
                BevelSize        = -2f,
                DirectionalLight = 0.15f,
                CenterColor      = Color.Transparent
            };
            BevelledRectangleWidget bevelledRectangleWidget = obj;

            m_rectangleWidget = obj;
            array[0]          = bevelledRectangleWidget;
            RectangleWidget obj2 = new RectangleWidget
            {
                FillColor    = Color.Transparent,
                OutlineColor = Color.Transparent
            };
            RectangleWidget rectangleWidget = obj2;

            m_highlightWidget = obj2;
            array[1]          = rectangleWidget;
            BlockIconWidget obj3 = new BlockIconWidget
            {
                HorizontalAlignment = WidgetAlignment.Center,
                VerticalAlignment   = WidgetAlignment.Center,
                Margin = new Vector2(2f, 2f)
            };
            BlockIconWidget blockIconWidget = obj3;

            m_blockIconWidget = obj3;
            array[2]          = blockIconWidget;
            LabelWidget obj4 = new LabelWidget
            {
                Font                = ContentManager.Get <BitmapFont>("Fonts/Pericles"),
                FontScale           = 1f,
                HorizontalAlignment = WidgetAlignment.Far,
                VerticalAlignment   = WidgetAlignment.Far,
                Margin              = new Vector2(6f, 2f)
            };
            LabelWidget labelWidget = obj4;

            m_countWidget = obj4;
            array[3]      = labelWidget;
            ValueBarWidget obj5 = new ValueBarWidget
            {
                LayoutDirection     = LayoutDirection.Vertical,
                HorizontalAlignment = WidgetAlignment.Near,
                VerticalAlignment   = WidgetAlignment.Far,
                BarsCount           = 3,
                FlipDirection       = true,
                LitBarColor         = new Color(32, 128, 0),
                UnlitBarColor       = new Color(24, 24, 24, 64),
                BarSize             = new Vector2(12f, 12f),
                BarSubtexture       = ContentManager.Get <Subtexture>("Textures/Atlas/ProgressBar"),
                Margin = new Vector2(4f, 4f)
            };
            ValueBarWidget valueBarWidget = obj5;

            m_healthBarWidget = obj5;
            array[4]          = valueBarWidget;
            StackPanelWidget obj6 = new StackPanelWidget
            {
                Direction           = LayoutDirection.Horizontal,
                HorizontalAlignment = WidgetAlignment.Far,
                Margin = new Vector2(3f, 3f)
            };
            WidgetsList     children2 = obj6.Children;
            RectangleWidget obj7      = new RectangleWidget
            {
                Subtexture   = ContentManager.Get <Subtexture>("Textures/Atlas/InteractiveItemOverlay"),
                Size         = new Vector2(13f, 14f),
                FillColor    = new Color(160, 160, 160),
                OutlineColor = Color.Transparent
            };

            rectangleWidget            = obj7;
            m_interactiveOverlayWidget = obj7;
            children2.Add(rectangleWidget);
            WidgetsList     children3 = obj6.Children;
            RectangleWidget obj8      = new RectangleWidget
            {
                Subtexture   = ContentManager.Get <Subtexture>("Textures/Atlas/EditItemOverlay"),
                Size         = new Vector2(12f, 14f),
                FillColor    = new Color(160, 160, 160),
                OutlineColor = Color.Transparent
            };

            rectangleWidget     = obj8;
            m_editOverlayWidget = obj8;
            children3.Add(rectangleWidget);
            WidgetsList     children4 = obj6.Children;
            RectangleWidget obj9      = new RectangleWidget
            {
                Subtexture   = ContentManager.Get <Subtexture>("Textures/Atlas/FoodItemOverlay"),
                Size         = new Vector2(11f, 14f),
                FillColor    = new Color(160, 160, 160),
                OutlineColor = Color.Transparent
            };

            rectangleWidget     = obj9;
            m_foodOverlayWidget = obj9;
            children4.Add(rectangleWidget);
            array[5] = obj6;
            LabelWidget obj10 = new LabelWidget
            {
                Text  = "Split",
                Font  = ContentManager.Get <BitmapFont>("Fonts/Pericles"),
                Color = new Color(255, 64, 0),
                HorizontalAlignment = WidgetAlignment.Near,
                VerticalAlignment   = WidgetAlignment.Near,
                Margin = new Vector2(2f, 0f)
            };

            labelWidget        = obj10;
            m_splitLabelWidget = obj10;
            array[6]           = labelWidget;
            children.Add(array);
        }