private void load() { Child = new DrawSizePreservingFillContainer { Children = new Drawable[] { new TestBrowser(), new CursorContainer(), }, }; }
private void load() { Child = new DrawSizePreservingFillContainer { Children = new Drawable[] { new TestBrowser("mapping_builder"), //Specify the namespace to discover tests from new CursorContainer(), }, }; }
protected MusicVisualizerGameBase() { Name = "MusicVisualizer"; // Ensure game and tests scale with window size and screen DPI. base.Content.Add(Content = new DrawSizePreservingFillContainer { // You may want to change TargetDrawSize to your "default" resolution, which will decide how things scale and position when using absolute coordinates. TargetDrawSize = new Vector2(1366, 768) }); }
private void load() { Child = new DrawSizePreservingFillContainer { Children = new Drawable[] { new TestBrowser("CirclesGalore"), // lgtm [cs/local-not-disposed] new CursorContainer() // lgtm [cs/local-not-disposed] }, }; }
private void load() { base.LoadComplete(); Child = new DrawSizePreservingFillContainer { Children = new Drawable[] { new TestBrowser("Gale"), new CursorContainer(), }, }; }
public DrawableRank(ScoreRank rank) { this.rank = rank; RelativeSizeAxes = Axes.Both; FillMode = FillMode.Fit; FillAspectRatio = 2; var rankColour = OsuColour.ForRank(rank); InternalChild = new DrawSizePreservingFillContainer { TargetDrawSize = new Vector2(64, 32), Strategy = DrawSizePreservationStrategy.Minimum, Child = new CircularContainer { Masking = true, RelativeSizeAxes = Axes.Both, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = rankColour, }, new Triangles { RelativeSizeAxes = Axes.Both, ColourDark = rankColour.Darken(0.1f), ColourLight = rankColour.Lighten(0.1f), Velocity = 0.25f, }, new OsuSpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, Spacing = new Vector2(-3, 0), Padding = new MarginPadding { Top = 5 }, Colour = getRankNameColour(), Font = OsuFont.Numeric.With(size: 25), Text = GetRankName(rank), ShadowColour = Color4.Black.Opacity(0.3f), ShadowOffset = new Vector2(0, 0.08f), Shadow = true, }, } } }; }
public ScalingContainer(ScalingMode?targetMode = null) { this.targetMode = targetMode; RelativeSizeAxes = Axes.Both; InternalChild = sizableContainer = new AlwaysInputContainer { RelativeSizeAxes = Axes.Both, RelativePositionAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, Child = content = new DrawSizePreservingFillContainer() }; }
protected override void LoadComplete() { base.LoadComplete(); // Aspect ratio container Child = _content = new DrawSizePreservingFillContainer { TargetDrawSize = new Vector2(1440, 1080), Strategy = DrawSizePreservationStrategy.Minimum }; _content.Add(_rootScreen = new WorkspaceScreen()); // Close host when root screen exits _rootScreen.Exited += _ => Host.Exit(); }
public TestCaseDrawSizePreservingFillContainer() { DrawSizePreservingFillContainer fillContainer; Child = new Container { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(500), Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Red, }, new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding(10), Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black, }, fillContainer = new DrawSizePreservingFillContainer { Child = new TestCaseSizing(), }, } }, } }; AddStep("Strategy: Minimum", () => fillContainer.Strategy = DrawSizePreservationStrategy.Minimum); AddStep("Strategy: Maximum", () => fillContainer.Strategy = DrawSizePreservationStrategy.Maximum); AddStep("Strategy: Average", () => fillContainer.Strategy = DrawSizePreservationStrategy.Average); AddStep("Strategy: Separate", () => fillContainer.Strategy = DrawSizePreservationStrategy.Separate); AddSliderStep("Width", 50, 650, 500, v => Child.Width = v); AddSliderStep("Height", 50, 650, 500, v => Child.Height = v); AddStep("Override Size to 1x1", () => Child.Size = Vector2.One); }
private void load() { Resources.AddStore(new DllResourceStore(@"GamesToGo.Game.dll")); Textures.AddStore(Host.CreateTextureLoaderStore(new OnlineStore())); Textures.AddStore(Host.CreateTextureLoaderStore(new StorageBackedResourceStore(store))); dependencies.CacheAs(this); base.Content.Add(content = new DrawSizePreservingFillContainer { TargetDrawSize = new Vector2(1080, 1920), Strategy = DrawSizePreservationStrategy.Minimum, }); content.Add(stack = new ScreenStack { RelativeSizeAxes = Axes.Both, Depth = 0, }); content.Add(api = new APIController()); dependencies.Cache(api); dependencies.Cache(stack); content.Add(infoOverlay = new SplashInfoOverlay(SplashPosition.Top, 150, 60) { Depth = -1 }); dependencies.Cache(infoOverlay); Invitations.BindCollectionChanged((_, e) => { switch (e.Action) { case NotifyCollectionChangedAction.Add: infoOverlay.Show(@$ "{e.NewItems.Cast<Invitation>().Last().Sender.Username} te ha invitado a jugar", Colour4.LightBlue); break; case NotifyCollectionChangedAction.Remove: break; } }); }
private void load(FrameworkConfigManager config, Storage store) //Esta es la manera en la que se acceden a elementos de las dependencias, su tipo y un nombre local. { Host.Window.Title = Name; Resources.AddStore(new DllResourceStore(@"GamesToGo.Editor.dll")); Textures.AddStore(Host.CreateTextureLoaderStore(new OnlineStore())); Textures.AddStore(Host.CreateTextureLoaderStore(new StorageBackedResourceStore(store))); Textures.AddExtension(""); dependencies.CacheAs(dbContext = new Context(Host.Storage.GetDatabaseConnectionString(Name))); previewEvents(); previewActions(); previewArguments(); try { dbContext.Database.Migrate(); } catch { Host.Storage.DeleteDatabase(Name); try { dbContext.Database.Migrate(); } catch { //Can't get a database going, bail! Exit(); } store.DeleteDirectory("files"); } finally { foreach (var _ in dbContext.Projects) { } foreach (var _ in dbContext.Files) { } foreach (var _ in dbContext.Relations) { } } //Ventana sin bordes, sin requerir modo exclusivo. config.GetBindable <WindowMode>(FrameworkSetting.WindowMode).Value = WindowMode.Borderless; config.GetBindable <FrameSync>(FrameworkSetting.FrameSync).Value = FrameSync.VSync; config.GetBindable <ConfineMouseMode>(FrameworkSetting.ConfineMouseMode).Value = ConfineMouseMode.Never; //Para agregar un elemento a las dependencias se agrega a su caché. En este caso se agrega el "juego" como un GamesToGoEditor dependencies.CacheAs(this); base.Content.Add(content = new DrawSizePreservingFillContainer { TargetDrawSize = new Vector2(1920, 1080) }); //Cargamos y agregamos nuestra pila de pantallas a la ventana. content.Add(stack = new ScreenStack { RelativeSizeAxes = Axes.Both, Depth = 0 }); content.Add(api = new APIController()); dependencies.Cache(api); content.Add(splashOverlay = new SplashInfoOverlay(SplashPosition.Bottom, 80, 30) { Depth = -2 }); dependencies.Cache(splashOverlay); content.Add(imageFinder = new ImageFinderOverlay { Depth = -1 }); dependencies.Cache(imageFinder); content.Add(optionsOverlay = new MultipleOptionOverlay { Depth = -3 }); dependencies.Cache(optionsOverlay); }
public LazerPlayerBase() { Name = "Music Player for osu!lazer"; base.Content.Add(Content = new DrawSizePreservingFillContainer()); }
protected override void LoadComplete() { base.LoadComplete(); // The next time this is updated is in UpdateAfterChildren, which occurs too late and results // in the cursor being shown for a few frames during the intro. // This prevents the cursor from showing until we have a screen with CursorVisible = true MenuCursorContainer.CanShowCursor = currentScreen?.CursorVisible ?? false; // todo: all archive managers should be able to be looped here. SkinManager.PostNotification = n => notifications?.Post(n); SkinManager.GetStableStorage = GetStorageForStableInstall; BeatmapManager.PostNotification = n => notifications?.Post(n); BeatmapManager.GetStableStorage = GetStorageForStableInstall; BeatmapManager.PresentBeatmap = PresentBeatmap; AddRange(new Drawable[] { new VolumeControlReceptor { RelativeSizeAxes = Axes.Both, ActionRequested = action => volume.Adjust(action), ScrollActionRequested = (action, amount, isPrecise) => volume.Adjust(action, amount, isPrecise), }, screenContainer = new ScalingContainer(ScalingMode.ExcludeOverlays) { RelativeSizeAxes = Axes.Both, }, mainContent = new DrawSizePreservingFillContainer(), overlayContent = new Container { RelativeSizeAxes = Axes.Both, Depth = float.MinValue }, idleTracker = new IdleTracker(6000) }); loadComponentSingleFile(screenStack = new Loader(), d => { screenStack.ModePushed += screenAdded; screenStack.Exited += screenRemoved; screenContainer.Add(screenStack); }); loadComponentSingleFile(Toolbar = new Toolbar { Depth = -5, OnHome = delegate { CloseAllOverlays(false); intro?.ChildScreen?.MakeCurrent(); }, }, overlayContent.Add); loadComponentSingleFile(volume = new VolumeOverlay(), overlayContent.Add); loadComponentSingleFile(onscreenDisplay = new OnScreenDisplay(), Add); loadComponentSingleFile(screenshotManager, Add); //overlay elements loadComponentSingleFile(direct = new DirectOverlay { Depth = -1 }, mainContent.Add); loadComponentSingleFile(social = new SocialOverlay { Depth = -1 }, mainContent.Add); loadComponentSingleFile(channelManager = new ChannelManager(), AddInternal); loadComponentSingleFile(chatOverlay = new ChatOverlay { Depth = -1 }, mainContent.Add); loadComponentSingleFile(settings = new MainSettings { GetToolbarHeight = () => ToolbarOffset, Depth = -1 }, overlayContent.Add); loadComponentSingleFile(userProfile = new UserProfileOverlay { Depth = -2 }, mainContent.Add); loadComponentSingleFile(beatmapSetOverlay = new BeatmapSetOverlay { Depth = -3 }, mainContent.Add); loadComponentSingleFile(musicController = new MusicController { Depth = -5, Position = new Vector2(0, Toolbar.HEIGHT), Anchor = Anchor.TopRight, Origin = Anchor.TopRight, }, overlayContent.Add); loadComponentSingleFile(notifications = new NotificationOverlay { GetToolbarHeight = () => ToolbarOffset, Depth = -4, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, }, overlayContent.Add); loadComponentSingleFile(accountCreation = new AccountCreationOverlay { Depth = -6, }, overlayContent.Add); loadComponentSingleFile(dialogOverlay = new DialogOverlay { Depth = -7, }, overlayContent.Add); loadComponentSingleFile(externalLinkOpener = new ExternalLinkOpener { Depth = -8, }, overlayContent.Add); dependencies.Cache(idleTracker); dependencies.Cache(settings); dependencies.Cache(onscreenDisplay); dependencies.Cache(social); dependencies.Cache(direct); dependencies.Cache(chatOverlay); dependencies.Cache(channelManager); dependencies.Cache(userProfile); dependencies.Cache(musicController); dependencies.Cache(beatmapSetOverlay); dependencies.Cache(notifications); dependencies.Cache(dialogOverlay); dependencies.Cache(accountCreation); chatOverlay.StateChanged += state => channelManager.HighPollRate.Value = state == Visibility.Visible; Add(externalLinkOpener = new ExternalLinkOpener()); var singleDisplaySideOverlays = new OverlayContainer[] { settings, notifications }; overlays.AddRange(singleDisplaySideOverlays); foreach (var overlay in singleDisplaySideOverlays) { overlay.StateChanged += state => { if (state == Visibility.Hidden) { return; } singleDisplaySideOverlays.Where(o => o != overlay).ForEach(o => o.Hide()); }; } // eventually informational overlays should be displayed in a stack, but for now let's only allow one to stay open at a time. var informationalOverlays = new OverlayContainer[] { beatmapSetOverlay, userProfile }; overlays.AddRange(informationalOverlays); foreach (var overlay in informationalOverlays) { overlay.StateChanged += state => { if (state == Visibility.Hidden) { return; } informationalOverlays.Where(o => o != overlay).ForEach(o => o.Hide()); }; } // ensure only one of these overlays are open at once. var singleDisplayOverlays = new OverlayContainer[] { chatOverlay, social, direct }; overlays.AddRange(singleDisplayOverlays); foreach (var overlay in singleDisplayOverlays) { overlay.StateChanged += state => { // informational overlays should be dismissed on a show or hide of a full overlay. informationalOverlays.ForEach(o => o.Hide()); if (state == Visibility.Hidden) { return; } singleDisplayOverlays.Where(o => o != overlay).ForEach(o => o.Hide()); }; } OverlayActivationMode.ValueChanged += v => { if (v != OverlayActivation.All) { CloseAllOverlays(); } }; void updateScreenOffset() { float offset = 0; if (settings.State == Visibility.Visible) { offset += ToolbarButton.WIDTH / 2; } if (notifications.State == Visibility.Visible) { offset -= ToolbarButton.WIDTH / 2; } screenContainer.MoveToX(offset, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint); } settings.StateChanged += _ => updateScreenOffset(); notifications.StateChanged += _ => updateScreenOffset(); }