示例#1
0
        public override void PostProcess()
        {
            base.PostProcess();

            // trigger again to update note playfield alpha.
            notePlayfieldAlpha.TriggerChange();
        }
示例#2
0
        public TestCaseScrollingHitObjects()
        {
            OsuSpriteText             timeRangeText;
            SpeedAdjustmentCollection adjustmentCollection;

            timeRangeBindable = new BindableDouble(2000)
            {
                MinValue = 200,
                MaxValue = 4000,
            };

            SliderBar <double> timeRange;

            Add(timeRange = new BasicSliderBar <double>
            {
                Size           = new Vector2(200, 20),
                SelectionColor = Color4.Pink,
                KeyboardStep   = 100
            });

            Add(timeRangeText = new OsuSpriteText
            {
                X        = 210,
                TextSize = 16,
            });

            timeRange.Current.BindTo(timeRangeBindable);
            timeRangeBindable.ValueChanged += v => timeRangeText.Text = $"Visible Range: {v:#,#.#}";
            timeRangeBindable.ValueChanged += v => bottomLabel.Text = $"t minus {v:#,#}";

            AddRange(new Drawable[]
            {
                new Container
                {
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.Centre,
                    Size     = new Vector2(100, 500),
                    Children = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Alpha            = 0.25f
                        },
                        adjustmentCollection = new SpeedAdjustmentCollection(Axes.Y)
                        {
                            RelativeSizeAxes = Axes.Both,
                            VisibleTimeRange = timeRangeBindable,
                            Masking          = true,
                        },
                        new OsuSpriteText
                        {
                            Text     = "t minus 0",
                            Margin   = new MarginPadding(2),
                            TextSize = 14,
                            Anchor   = Anchor.TopRight,
                        },
                        bottomLabel = new OsuSpriteText
                        {
                            Text     = "t minus x",
                            Margin   = new MarginPadding(2),
                            TextSize = 14,
                            Anchor   = Anchor.BottomRight,
                            Origin   = Anchor.BottomLeft,
                        },
                        topTime = new OsuSpriteText
                        {
                            Margin   = new MarginPadding(2),
                            TextSize = 14,
                            Anchor   = Anchor.TopLeft,
                            Origin   = Anchor.TopRight,
                        },
                        bottomTime = new OsuSpriteText
                        {
                            Margin   = new MarginPadding(2),
                            TextSize = 14,
                            Anchor   = Anchor.BottomLeft,
                            Origin   = Anchor.BottomRight,
                        },
                    }
                }
            });

            timeRangeBindable.TriggerChange();

            adjustmentCollection.Add(new TestSpeedAdjustmentContainer(new MultiplierControlPoint()));

            AddStep("Add hit object", () => adjustmentCollection.Add(new TestDrawableHitObject(new HitObject {
                StartTime = Time.Current + 2000
            })));
        }
示例#3
0
文件: VolumeMeter.cs 项目: mc-nya/osu
 protected override void LoadComplete()
 {
     base.LoadComplete();
     Bindable.TriggerChange();
 }
示例#4
0
        private void load(Storage storage, GameHost host)
        {
            interactive = host.Window != null;
            config      = new TestBrowserConfig(storage);

            exit = host.Exit;

            rateBindable = new BindableDouble(1)
            {
                MinValue = 0,
                MaxValue = 2,
            };

            var rateAdjustClock = new StopwatchClock(true);
            var framedClock     = new FramedClock(rateAdjustClock);

            Children = new Drawable[]
            {
                leftContainer = new Container
                {
                    RelativeSizeAxes = Axes.Y,
                    Size             = new Vector2(test_list_width, 1),
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            Colour           = Color4.DimGray,
                            RelativeSizeAxes = Axes.Both
                        },
                        new FillFlowContainer
                        {
                            Direction        = FillDirection.Vertical,
                            RelativeSizeAxes = Axes.Both,
                            Children         = new Drawable[]
                            {
                                searchTextBox = new TextBox
                                {
                                    OnCommit = delegate
                                    {
                                        var firstVisible = leftFlowContainer.FirstOrDefault(b => b.IsPresent);
                                        if (firstVisible != null)
                                        {
                                            LoadTest(firstVisible.TestType);
                                        }
                                    },
                                    Height           = 20,
                                    RelativeSizeAxes = Axes.X,
                                    PlaceholderText  = "type to search"
                                },
                                new ScrollContainer
                                {
                                    Padding = new MarginPadding {
                                        Top = 3, Bottom = 20
                                    },
                                    RelativeSizeAxes         = Axes.Both,
                                    ScrollbarOverlapsContent = false,
                                    Child = leftFlowContainer = new SearchContainer <TestCaseButton>
                                    {
                                        Padding          = new MarginPadding(3),
                                        Direction        = FillDirection.Vertical,
                                        Spacing          = new Vector2(0, 5),
                                        AutoSizeAxes     = Axes.Y,
                                        RelativeSizeAxes = Axes.X,
                                    }
                                }
                            }
                        }
                    }
                },
                mainContainer = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Left = test_list_width
                    },
                    Children = new Drawable[]
                    {
                        toolbar = new Toolbar
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = 50,
                            Depth            = -1,
                        },
                        testContentContainer = new Container
                        {
                            Clock            = framedClock,
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Top = 50
                            },
                            Child = compilingNotice = new Container
                            {
                                Alpha        = 0,
                                Anchor       = Anchor.Centre,
                                Origin       = Anchor.Centre,
                                Masking      = true,
                                Depth        = float.MinValue,
                                CornerRadius = 5,
                                AutoSizeAxes = Axes.Both,
                                Children     = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = Color4.Black,
                                    },
                                    new SpriteText
                                    {
                                        TextSize = 30,
                                        Text     = @"Compiling new version..."
                                    }
                                },
                            }
                        }
                    }
                }
            };

            searchTextBox.Current.ValueChanged += newValue => leftFlowContainer.SearchTerm = newValue;

            backgroundCompiler = new DynamicClassCompiler <TestCase>
            {
                CompilationStarted  = compileStarted,
                CompilationFinished = compileFinished,
            };
            try
            {
                backgroundCompiler.Start();
            }
            catch
            {
                //it's okay for this to fail for now.
            }

            foreach (Assembly asm in assemblies)
            {
                toolbar.AssemblyDropdown.AddDropdownItem(asm.GetName().Name, asm);
            }

            toolbar.AssemblyDropdown.Current.ValueChanged += updateList;
            toolbar.RunAllSteps.Current.ValueChanged      += v => runTests(null);
            toolbar.RateAdjustSlider.Current.BindTo(rateBindable);

            rateBindable.ValueChanged += v => rateAdjustClock.Rate = v;
            rateBindable.TriggerChange();
        }
示例#5
0
        private void load(Storage storage, GameHost host)
        {
            interactive = host.Window != null;
            config      = new TestBrowserConfig(storage);

            rateBindable = new BindableDouble(1)
            {
                MinValue = 0,
                MaxValue = 1,
            };

            var rateAdjustClock = new StopwatchClock(true);
            var framedClock     = new FramedClock(rateAdjustClock);

            Children = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Y,
                    Size             = new Vector2(200, 1),
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            Colour           = Color4.DimGray,
                            RelativeSizeAxes = Axes.Both
                        },
                        new ScrollContainer
                        {
                            RelativeSizeAxes         = Axes.Both,
                            ScrollbarOverlapsContent = false,
                            Child = leftFlowContainer = new FillFlowContainer <TestCaseButton>
                            {
                                Padding          = new MarginPadding(3),
                                Direction        = FillDirection.Vertical,
                                Spacing          = new Vector2(0, 5),
                                AutoSizeAxes     = Axes.Y,
                                RelativeSizeAxes = Axes.X,
                            }
                        }
                    }
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Left = 200
                    },
                    Children = new Drawable[]
                    {
                        toolbar = new Toolbar
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = 50,
                            Depth            = -1,
                            RunAllSteps      = () => CurrentTest.RunAllSteps(() => toolbar.RunComplete(), toolbar.RunComplete),
                        },
                        testContentContainer = new Container
                        {
                            Clock            = framedClock,
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Top = 50
                            },
                            Child = compilingNotice = new Container
                            {
                                Alpha        = 0,
                                Anchor       = Anchor.Centre,
                                Origin       = Anchor.Centre,
                                Masking      = true,
                                Depth        = float.MinValue,
                                CornerRadius = 5,
                                AutoSizeAxes = Axes.Both,
                                Children     = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = Color4.Black,
                                    },
                                    new SpriteText
                                    {
                                        TextSize = 30,
                                        Text     = @"Compiling new version..."
                                    }
                                },
                            }
                        }
                    }
                }
            };

            backgroundCompiler = new DynamicClassCompiler <TestCase>
            {
                CompilationStarted  = compileStarted,
                CompilationFinished = compileFinished,
            };
            try
            {
                backgroundCompiler.Start();
            }
            catch
            {
                //it's okay for this to fail for now.
            }

            foreach (Assembly asm in assemblies)
            {
                toolbar.AssemblyDropdown.AddDropdownItem(asm.GetName().Name, asm);
            }

            toolbar.AssemblyDropdown.Current.ValueChanged += updateList;
            toolbar.RateAdjustSlider.Current.BindTo(rateBindable);

            rateBindable.ValueChanged += v => rateAdjustClock.Rate = v;
            rateBindable.TriggerChange();
        }