private void load(FrameworkConfigManager config, Storage storage) { Dropdown <FrameSync> frameSyncDropdown; AddRange(new Drawable[] { new Button { Anchor = Anchor.Centre, Origin = Anchor.Centre, Text = "Open Arbor Folder", Size = new Vector2(100, 40), Action = storage.OpenInNativeExplorer, BackgroundColour = Color4.Gray, }, frameSyncDropdown = new BasicDropdown <FrameSync> { Anchor = Anchor.Centre, Origin = Anchor.BottomCentre, Position = new Vector2(0, -100), Width = 80, Items = Enum.GetValues(typeof(FrameSync)).Cast <FrameSync>(), } }); config.BindWith(FrameworkSetting.FrameSync, frameSyncDropdown.Current); }
public UserInterfaceTestScene() { base.Content.AddRange(new Drawable[] { new ThemableBox { RelativeSizeAxes = Axes.Both, Colour = ThemeSlot.White, }, content = new FillFlowContainer { Direction = FillDirection.Vertical, Spacing = new Vector2(0, 10), RelativeSizeAxes = Axes.Both, }, Selector = new BasicDropdown <Theme> { Width = 200, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Margin = new MarginPadding(20), Items = new[] { Theme.Light, Theme.Dark, } } }); Selector.Current = Provider.Current; }
public TestSceneRecognition() { cameraManager = createSuitableCameraManager(Scheduler); Add(cameraSpriteContainer = new Container { RelativeSizeAxes = Axes.Both }); Add(new FillFlowContainer { AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Width = 200.0f, Margin = new MarginPadding(5), Spacing = new Vector2(0, 5), Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Children = new Drawable[] { cameraTypeSelector = new BasicDropdown <CameraType> { RelativeSizeAxes = Axes.X, Items = Enum.GetValues <CameraType>(), }, virtualCameraControls = new FillFlowContainer { AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, Spacing = new Vector2(0, 5), Children = new Drawable[] { virtualCameraLooping = new BasicCheckbox { LabelText = @"Toggle Looping" }, pauseButton = new BasicButton { Text = @"Pause", Height = 40, RelativeSizeAxes = Axes.X, Action = () => { if (Camera is CameraVirtual virtualCamera) { if (virtualCamera.Paused) { pauseButton.Text = @"Pause"; virtualCamera.Resume(); } else { pauseButton.Text = @"Unpause"; virtualCamera.Pause(); } } } } } },
public TestSceneGetMicrophoneList() { var manager = new MicrophoneManager(); Child = new BasicDropdown <string> { X = 100, Y = 100, Width = 300, Items = manager.MicrophoneDeviceNames }; }
protected override void LoadComplete() { base.LoadComplete(); AddRange(new Drawable[] { new Box { Size = new Vector2(684), Anchor = Anchor.Centre, Origin = Anchor.Centre, Colour = Colour4.Red, }, new Container { Size = new Vector2(512), Anchor = Anchor.Centre, Origin = Anchor.Centre, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Colour4.Blue, }, display = new CameraSprite { RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, Anchor = Anchor.Centre, Origin = Anchor.Centre, } } }, deviceList = new BasicDropdown <string> { Width = 300, Margin = new MarginPadding(10), Items = camera.CameraDeviceNames }, }); camera.OnNewDevice += updateDevices; camera.OnLostDevice += updateDevices; device.BindTo(deviceList.Current); device.ValueChanged += (v) => display.CameraID = camera.CameraDeviceNames.ToList().IndexOf(v.NewValue); }
public void TestChangeCurrent() { Bindable <string> bindable = new Bindable <string>("test"); Bindable <string> bindable2 = new Bindable <string>("test2"); var dropdown = new BasicDropdown <string> { Current = bindable }; AddStep("add dropdown", () => Add(dropdown)); AddAssert("ensure current bound", () => dropdown.Current.Value == bindable.Value); AddStep("change target", () => dropdown.Current = bindable2); AddAssert("ensure current switched", () => dropdown.Current.Value == bindable2.Value); AddAssert("ensure original intact", () => dropdown.Current.Value != bindable.Value); AddStep("change value", () => bindable2.Value = "test3"); AddAssert("ensure current bound", () => dropdown.Current.Value == bindable2.Value); AddAssert("ensure original intact", () => dropdown.Current.Value != bindable.Value); }
public void TestUnbindDoesntUnbindBound() { Bindable <string> bindable = new Bindable <string>("test"); Bindable <string> boundBindable = bindable.GetBoundCopy(); Assert.That(boundBindable.Value, Is.EqualTo(bindable.Value)); var dropdown = new BasicDropdown <string> { Current = bindable }; AddStep("add dropdown", () => Add(dropdown)); AddStep("expire", () => dropdown.Expire()); AddUntilStep("wait for dispose", () => dropdown.IsDisposed); AddStep("update unrelated bindable", () => bindable.Value = "test2"); AddAssert("ensure current unbound", () => dropdown.Current.Value != bindable.Value); AddAssert("ensure externals still bound", () => boundBindable.Value == bindable.Value); }
private void load(TestBrowser browser) { BasicCheckbox runAllStepsCheckbox; InternalChild = new FillFlowContainer { Spacing = new Vector2(5), Direction = FillDirection.Horizontal, RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Children = new Drawable[] { new SpriteText { Padding = new MarginPadding(5), Text = "Assembly:" }, assemblyDropdown = new BasicDropdown <Assembly> { Width = 250, }, runAllStepsCheckbox = new BasicCheckbox { LabelText = "Run all steps", LabelPadding = new MarginPadding { Left = 5, Right = 10 }, AutoSizeAxes = Axes.Y, Width = 140, Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, }, } }; assemblyDropdown.Current.BindTo(browser.Assembly); runAllStepsCheckbox.Current.BindTo(browser.RunAllSteps); }
/// <summary> /// Creates a new TestBrowser that displays the TestCases of every assembly that start with either "osu" or the specified namespace (if it isn't null) /// </summary> /// <param name="assemblyNamespace">Assembly prefix which is used to match assemblies whose tests should be displayed</param> public TestBrowser(string assemblyNamespace = null) { assemblyDropdown = new BasicDropdown <Assembly> { Width = 400, }; assemblyDropdown.Current.ValueChanged += updateList; var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies().ToList(); var loadedPaths = loadedAssemblies.Where(a => !a.IsDynamic).Select(a => a.Location).ToArray(); var referencedPaths = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*Test*.dll"); var toLoad = referencedPaths.Where(r => !loadedPaths.Contains(r, StringComparer.InvariantCultureIgnoreCase)).ToList(); toLoad.ForEach(path => loadedAssemblies.Add(AppDomain.CurrentDomain.Load(AssemblyName.GetAssemblyName(path)))); //we want to build the lists here because we're interested in the assembly we were *created* on. foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies().Where(n => n.FullName.StartsWith("osu") || assemblyNamespace != null && n.FullName.StartsWith(assemblyNamespace))) { var tests = asm.GetLoadableTypes().Where(t => t.IsSubclassOf(typeof(TestCase)) && !t.IsAbstract).ToList(); if (!tests.Any()) { continue; } assemblyDropdown.AddDropdownItem(asm.GetName().Name, asm); foreach (Type type in tests) { TestTypes.Add(type); } } TestTypes.Sort((a, b) => string.Compare(a.Name, b.Name, StringComparison.Ordinal)); }
private void load() { SpriteText playbackSpeedDisplay; InternalChildren = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black, }, new Container { Padding = new MarginPadding(10), RelativeSizeAxes = Axes.Both, Child = new GridContainer { RelativeSizeAxes = Axes.Both, ColumnDimensions = new[] { new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.Distributed), }, Content = new[] { new Drawable[] { new FillFlowContainer { Spacing = new Vector2(5), Direction = FillDirection.Horizontal, RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Children = new Drawable[] { new SpriteText { Padding = new MarginPadding(5), Text = "Current Assembly:" }, AssemblyDropdown = new BasicDropdown <Assembly> { Width = 300, }, RunAllSteps = new BasicCheckbox { LabelText = "Run all steps", AutoSizeAxes = Axes.Y, Width = 140, Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, }, } }, new GridContainer { RelativeSizeAxes = Axes.Both, ColumnDimensions = new[] { new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.Distributed), new Dimension(GridSizeMode.AutoSize), }, Content = new[] { new Drawable[] { new SpriteText { Padding = new MarginPadding(5), Text = "Rate:" }, RateAdjustSlider = new BasicSliderBar <double> { RelativeSizeAxes = Axes.Both, Colour = Color4.MediumPurple, SelectionColor = Color4.White, }, playbackSpeedDisplay = new SpriteText { Padding = new MarginPadding(5), }, } } } } }, }, }, }; RateAdjustSlider.Current.ValueChanged += v => playbackSpeedDisplay.Text = v.ToString("0%"); }
private void load() { SpriteText playbackSpeedDisplay; InternalChildren = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black, }, new Container { Padding = new MarginPadding(10), RelativeSizeAxes = Axes.Both, Child = new GridContainer { RelativeSizeAxes = Axes.Both, ColumnDimensions = new[] { new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.Distributed), }, Content = new[] { new Drawable[] { new FillFlowContainer { Spacing = new Vector2(5), Direction = FillDirection.Horizontal, RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Children = new Drawable[] { new SpriteText { Padding = new MarginPadding(5), Text = "Current Assembly:" }, AssemblyDropdown = new BasicDropdown <Assembly> { Width = 300, }, runAllButton = new Button { Text = "Run all steps", BackgroundColour = Color4.MediumPurple, Action = delegate { runAllButton.Enabled.Value = false; runAllButton.BackgroundColour = Color4.DimGray; RunAllSteps?.Invoke(); }, Width = 140, RelativeSizeAxes = Axes.Y, }, } }, new GridContainer { RelativeSizeAxes = Axes.Both, ColumnDimensions = new[] { new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.Distributed), new Dimension(GridSizeMode.AutoSize), }, Content = new[] { new Drawable[] { new SpriteText { Padding = new MarginPadding(5), Text = "Playback Speed:" }, RateAdjustSlider = new BasicSliderBar <double> { RelativeSizeAxes = Axes.Both, Colour = Color4.MediumPurple, SelectionColor = Color4.White, }, playbackSpeedDisplay = new SpriteText { Padding = new MarginPadding(5), }, } } } } }, }, }, }; RateAdjustSlider.Current.ValueChanged += v => playbackSpeedDisplay.Text = v.ToString("0%"); }
private void load() { InternalChildren = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = new Colour4(106, 100, 104, 255), //Color fondo general }, new GridContainer { RelativeSizeAxes = Axes.Both, ColumnDimensions = new[] { new Dimension(), }, RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize), new Dimension(), }, Content = new[] { new Drawable[] { new Container { Depth = 0, AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Children = new Drawable[] { new Container { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.X, Height = 180, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Colour4.Black.Opacity(0.8f), }, new Container { Padding = new MarginPadding(15), Size = new Vector2(180), Child = new ProjectImageChangerButton(), }, new SpriteText { Text = @"Nombre del proyecto:", Position = new Vector2(180, 17), }, titleTextBox = new BasicTextBox { Text = project.DatabaseObject.Name, Position = new Vector2(340, 10), Height = TEXT_ELEMENT_SIZE, Width = 775, }, new SpriteText { Anchor = Anchor.TopCentre, Text = @"Minimo Jugadores:", Position = new Vector2(560, 17), }, minPlayersTextBox = new NumericTextBox(false) { LengthLimit = 2, Text = Math.Max(2, project.DatabaseObject.MinNumberPlayers).ToString(), Anchor = Anchor.TopCentre, Position = new Vector2(694, 10), Height = TEXT_ELEMENT_SIZE, Width = 50, CommitOnFocusLost = true, }, new SpriteText { Anchor = Anchor.TopCentre, Text = @"Maximo Jugadores:", Position = new Vector2(760, 17), }, maxPlayersTextBox = new NumericTextBox(false) { LengthLimit = 2, Text = Math.Min(32, project.DatabaseObject.MaxNumberPlayers).ToString(), Anchor = Anchor.TopCentre, Position = new Vector2(898, 10), Height = TEXT_ELEMENT_SIZE, Width = 50, CommitOnFocusLost = true, }, new SpriteText { Text = @"Descripción:", Position = new Vector2(245, 70), }, descriptionTextBox = new BasicTextBox { Text = project.DatabaseObject.Description, Position = new Vector2(340, 70), Height = TEXT_ELEMENT_SIZE, Width = 1732, }, new SpriteText { Origin = Anchor.TopRight, Text = @"Chat recomendado:", Position = new Vector2(329, 130), }, chatDropdown = new GamesToGoDropdown <ChatRecommendation> { Width = 200, Position = new Vector2(340, 130), Items = Enum.GetValues(typeof(ChatRecommendation)).Cast <ChatRecommendation>(), }, new SpriteText { Text = @"Etiquetas:", Position = new Vector2(556, 130), }, tags = new TagSelectionContainer(TEXT_ELEMENT_SIZE) { Size = new Vector2(1272, TEXT_ELEMENT_SIZE), Position = new Vector2(635, 130), }, }, }, }, }, }, new Drawable[] { new GridContainer { Depth = 1, RelativeSizeAxes = Axes.Both, ColumnDimensions = new[] { new Dimension(GridSizeMode.Relative, 1 / 6f), new Dimension(GridSizeMode.Relative, 1 / 6f), new Dimension(GridSizeMode.Relative, 1 / 6f), new Dimension(), }, RowDimensions = new[] { new Dimension(), }, Content = new[] { new Drawable[] { new ProjectObjectManagerContainer <Card>(), new ProjectObjectManagerContainer <Token>(), new ProjectObjectManagerContainer <Board>(), new GridContainer { RelativeSizeAxes = Axes.Both, RowDimensions = new[] { new Dimension(GridSizeMode.Absolute, 50), new Dimension(), }, ColumnDimensions = new[] { new Dimension(), }, Content = new[] { new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Colour4.MediumPurple, }, new FillFlowContainer { RelativeSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, Width = .4f, Child = editingText = new SpriteText { Font = new FontUsage(size: 45), Text = @"Condiciones de Victoria Turnos Turno de preparación", Position = new Vector2(5, 2.5f), }, }, new FillFlowContainer { RelativeSizeAxes = Axes.Both, Width = .6f, Direction = FillDirection.Horizontal, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { toggleButton = new IteratingButton { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Size = new Vector2(200, 35), X = -5, Text = @"Turnos", }, }, }, }, }, }, }, }, }, }, new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { victoryContainer = new VictoryConditionsContainer { State = { Value = Visibility.Visible }, }, turnsOverlay = new TurnsOverlay(), preparationTurnOverlay = new PreparationTurnOverlay(), }, }, }, }, }, }, }, }, }, }, }, argumentListing, selectorOverlay, }; toggleButton.Actions.Add(showVictoryConditions); toggleButton.Actions.Add(showTurns); toggleButton.Actions.Add(showPreparationTurn); chatDropdown.Current.Value = project.ChatRecommendation; chatDropdown.Current.BindValueChanged(cht => project.ChatRecommendation = cht.NewValue); descriptionTextBox.Current.BindValueChanged(obj => project.DatabaseObject.Description = obj.NewValue); titleTextBox.Current.BindValueChanged(obj => project.DatabaseObject.Name = obj.NewValue); maxPlayersTextBox.OnCommit += (_, __) => checkPlayerNumber(false); minPlayersTextBox.OnCommit += (_, __) => checkPlayerNumber(true); tags.Current.Value = project.DatabaseObject.Tags; tags.Current.BindValueChanged(tag => project.DatabaseObject.Tags = tag.NewValue); checkPlayerNumber(false); }
private void load() { InternalChildren = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = new Colour4(106, 100, 104, 255), //Color fondo general }, new GridContainer { RelativeSizeAxes = Axes.Both, ColumnDimensions = new[] { new Dimension(), }, RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize), new Dimension(), }, Content = new[] { new Drawable[] { new Container { Depth = 0, AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Children = new Drawable[] { new Container { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.X, Height = 180, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Colour4.Black.Opacity(0.8f), }, new Container { Padding = new MarginPadding(15), Size = new Vector2(180), Child = new ImageChangerButton { RelativeSizeAxes = Axes.Both, }, }, new SpriteText { Text = @"Nombre del proyecto:", Position = new Vector2(180, 17), }, titleTextBox = new BasicTextBox { Text = project.DatabaseObject.Name, Position = new Vector2(340, 10), Height = 35, Width = 775, }, new SpriteText { Anchor = Anchor.TopCentre, Text = @"Minimo Jugadores:", Position = new Vector2(560, 17), }, minPlayersTextBox = new NumericTextBox(2) //Restringir la cantidad de digitos a 2 { Text = Math.Max(2, project.DatabaseObject.MinNumberPlayers).ToString(), Anchor = Anchor.TopCentre, Position = new Vector2(694, 10), Height = 35, Width = 50, CommitOnFocusLost = true, }, new SpriteText { Anchor = Anchor.TopCentre, Text = @"Maximo Jugadores:", Position = new Vector2(760, 17), }, maxPlayersTextBox = new NumericTextBox(2) //Restringir la cantidad de digitos a 2 { Text = Math.Min(32, project.DatabaseObject.MaxNumberPlayers).ToString(), Anchor = Anchor.TopCentre, Position = new Vector2(898, 10), Height = 35, Width = 50, CommitOnFocusLost = true, }, new SpriteText { Text = @"Descripción:", Position = new Vector2(245, 70), }, descriptionTextBox = new BasicTextBox { Text = project.DatabaseObject.Description, Position = new Vector2(340, 70), Height = 35, Width = 1732, }, new SpriteText { Origin = Anchor.TopRight, Text = @"Chat recomendado:", Position = new Vector2(329, 130), }, chatDropdown = new GamesToGoDropdown <ChatRecommendation> { Width = 200, Position = new Vector2(340, 130), Items = Enum.GetValues(typeof(ChatRecommendation)).Cast <ChatRecommendation>(), }, }, }, }, }, }, new Drawable[] { new Container { Depth = 1, RelativeSizeAxes = Axes.Both, Width = 0.5f, Children = new Drawable[] { new ProjectObjectManagerContainer <Card> { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Width = 1 / 3f, }, new ProjectObjectManagerContainer <Token> { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Width = 1 / 3f, }, new ProjectObjectManagerContainer <Board> { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, Width = 1 / 3f, }, }, }, }, }, }, }; chatDropdown.Current.Value = project.ChatRecommendation; chatDropdown.Current.BindValueChanged(cht => project.ChatRecommendation = cht.NewValue); descriptionTextBox.Current.BindValueChanged(obj => project.DatabaseObject.Description = obj.NewValue); titleTextBox.Current.BindValueChanged(obj => project.DatabaseObject.Name = obj.NewValue); maxPlayersTextBox.OnCommit += (_, __) => checkPlayerNumber(false); minPlayersTextBox.OnCommit += (_, __) => checkPlayerNumber(true); checkPlayerNumber(false); }