A game framework written with osu! in mind.
at master 1.5 kB view raw
1// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. 2// See the LICENCE file in the repository root for full licence text. 3 4using System; 5using osu.Framework.Allocation; 6using osu.Framework.Graphics; 7using osu.Framework.Graphics.Containers; 8using osu.Framework.Graphics.Shapes; 9 10namespace osu.Framework.Testing.Drawables 11{ 12 internal class TestSubButton : TestButtonBase 13 { 14 private readonly int indentLevel; 15 16 private Container boxContainer; 17 private const float left_box_width = LEFT_TEXT_PADDING / 2; 18 19 public TestSubButton(Type test, int indentLevel = 0) 20 : base(test) 21 { 22 this.indentLevel = indentLevel; 23 } 24 25 [BackgroundDependencyLoader] 26 private void load() 27 { 28 Add(boxContainer = new Container 29 { 30 RelativeSizeAxes = Axes.Both, 31 Padding = new MarginPadding { Left = indentLevel * left_box_width, Right = left_box_width }, 32 Alpha = 0, 33 Child = new Box 34 { 35 Colour = FrameworkColour.YellowGreen, 36 RelativeSizeAxes = Axes.Both, 37 }, 38 }); 39 } 40 41 public override bool Current 42 { 43 set 44 { 45 base.Current = value; 46 boxContainer.FadeTo(value ? 1 : 0, TRANSITION_DURATION); 47 } 48 } 49 } 50}