예제 #1
0
파일: OsuGameBase.cs 프로젝트: citylims/osu
        protected override void LoadComplete()
        {
            base.LoadComplete();

            GlobalActionContainer globalBinding;

            CursorOverrideContainer = new CursorOverrideContainer {
                RelativeSizeAxes = Axes.Both
            };
            CursorOverrideContainer.Child = globalBinding = new GlobalActionContainer(this)
            {
                RelativeSizeAxes = Axes.Both,
                Child            = content = new OsuTooltipContainer(CursorOverrideContainer.Cursor)
                {
                    RelativeSizeAxes = Axes.Both
                }
            };

            base.Content.Add(new DrawSizePreservingFillContainer {
                Child = CursorOverrideContainer
            });

            KeyBindingStore.Register(globalBinding);
            dependencies.Cache(globalBinding);

            // TODO: This is temporary until we reimplement the local FPS display.
            // It's just to allow end-users to access the framework FPS display without knowing the shortcut key.
            fpsDisplayVisible = LocalConfig.GetBindable <bool>(OsuSetting.ShowFpsDisplay);
            fpsDisplayVisible.ValueChanged += val => { FrameStatisticsMode = val ? FrameStatisticsMode.Minimal : FrameStatisticsMode.None; };
            fpsDisplayVisible.TriggerChange();
        }
예제 #2
0
        public TestCaseCursors()
        {
            Child = inputManager = new ManualInputManager
            {
                Child = cursorOverrideContainer = new CursorOverrideContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Children         = new[]
                    {
                        // Middle user
                        cursorBoxes[0] = new CustomCursorBox(Color4.Green)
                        {
                            Anchor           = Anchor.Centre,
                            Origin           = Anchor.Centre,
                            RelativeSizeAxes = Axes.Both,
                            Size             = new Vector2(0.5f),
                        },
                        // Top-left user
                        cursorBoxes[1] = new CustomCursorBox(Color4.Blue)
                        {
                            RelativeSizeAxes = Axes.Both,
                            Size             = new Vector2(0.4f)
                        },
                        // Bottom-right user
                        cursorBoxes[2] = new CustomCursorBox(Color4.Red)
                        {
                            Anchor           = Anchor.BottomRight,
                            Origin           = Anchor.BottomRight,
                            RelativeSizeAxes = Axes.Both,
                            Size             = new Vector2(0.4f)
                        },
                        // Bottom-left local
                        cursorBoxes[3] = new CustomCursorBox(Color4.Magenta, false)
                        {
                            Anchor           = Anchor.BottomLeft,
                            Origin           = Anchor.BottomLeft,
                            RelativeSizeAxes = Axes.Both,
                            Size             = new Vector2(0.4f)
                        },
                        // Top-right local
                        cursorBoxes[4] = new CustomCursorBox(Color4.Cyan, false)
                        {
                            Anchor           = Anchor.TopRight,
                            Origin           = Anchor.TopRight,
                            RelativeSizeAxes = Axes.Both,
                            Size             = new Vector2(0.4f)
                        },
                        // Left-local
                        cursorBoxes[5] = new CustomCursorBox(Color4.Yellow, false)
                        {
                            Anchor           = Anchor.CentreLeft,
                            Origin           = Anchor.CentreLeft,
                            RelativeSizeAxes = Axes.Both,
                            Size             = new Vector2(0.2f, 1),
                        },
                    }
                }
            };

            returnUserInput();

            AddToggleStep("Smooth transitions", b => cursorBoxes.ForEach(box => box.SmoothTransition = b));

            testUserCursor();
            testLocalCursor();
            testUserCursorOverride();
            testMultipleLocalCursors();
            returnUserInput();
        }
예제 #3
0
        private void load()
        {
            dependencies.Cache(contextFactory = new DatabaseContextFactory(Host));

            dependencies.Cache(new LargeTextureStore(new RawTextureLoaderStore(new NamespacedResourceStore <byte[]>(Resources, @"Textures"))));

            dependencies.CacheAs(this);
            dependencies.Cache(LocalConfig);

            runMigrations();

            dependencies.Cache(SkinManager = new SkinManager(Host.Storage, contextFactory, Host, Audio));
            dependencies.CacheAs <ISkinSource>(SkinManager);

            var api = new APIAccess(LocalConfig);

            dependencies.Cache(api);
            dependencies.CacheAs <IAPIProvider>(api);

            dependencies.Cache(RulesetStore    = new RulesetStore(contextFactory));
            dependencies.Cache(FileStore       = new FileStore(contextFactory, Host.Storage));
            dependencies.Cache(BeatmapManager  = new BeatmapManager(Host.Storage, contextFactory, RulesetStore, api, Audio, Host));
            dependencies.Cache(ScoreStore      = new ScoreStore(Host.Storage, contextFactory, Host, BeatmapManager, RulesetStore));
            dependencies.Cache(KeyBindingStore = new KeyBindingStore(contextFactory, RulesetStore));
            dependencies.Cache(SettingsStore   = new SettingsStore(contextFactory));
            dependencies.Cache(new OsuColour());

            fileImporters.Add(BeatmapManager);
            fileImporters.Add(ScoreStore);
            fileImporters.Add(SkinManager);

            //this completely overrides the framework default. will need to change once we make a proper FontStore.
            dependencies.Cache(Fonts = new FontStore {
                ScaleAdjust = 100
            });

            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/FontAwesome"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/osuFont"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Medium"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-MediumItalic"));

            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-Basic"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-Hangul"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-CJK-Basic"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-CJK-Compatibility"));

            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Regular"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-RegularItalic"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-SemiBold"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-SemiBoldItalic"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Bold"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BoldItalic"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Light"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-LightItalic"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Black"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BlackItalic"));

            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera"));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera-Light"));

            var defaultBeatmap = new DummyWorkingBeatmap(this);

            Beatmap = new NonNullableBindable <WorkingBeatmap>(defaultBeatmap);
            BeatmapManager.DefaultBeatmap = defaultBeatmap;

            // tracks play so loud our samples can't keep up.
            // this adds a global reduction of track volume for the time being.
            Audio.Track.AddAdjustment(AdjustableProperty.Volume, new BindableDouble(0.8));

            Beatmap.ValueChanged += b =>
            {
                var trackLoaded = lastBeatmap?.TrackLoaded ?? false;

                // compare to last beatmap as sometimes the two may share a track representation (optimisation, see WorkingBeatmap.TransferTo)
                if (!trackLoaded || lastBeatmap?.Track != b.Track)
                {
                    if (trackLoaded)
                    {
                        Debug.Assert(lastBeatmap != null);
                        Debug.Assert(lastBeatmap.Track != null);

                        lastBeatmap.RecycleTrack();
                    }

                    Audio.Track.AddItem(b.Track);
                }

                lastBeatmap = b;
            };

            FileStore.Cleanup();

            AddInternal(api);

            GlobalActionContainer globalBinding;

            CursorOverrideContainer = new CursorOverrideContainer {
                RelativeSizeAxes = Axes.Both
            };
            CursorOverrideContainer.Child = globalBinding = new GlobalActionContainer(this)
            {
                RelativeSizeAxes = Axes.Both,
                Child            = content = new OsuTooltipContainer(CursorOverrideContainer.Cursor)
                {
                    RelativeSizeAxes = Axes.Both
                }
            };

            base.Content.Add(new DrawSizePreservingFillContainer {
                Child = CursorOverrideContainer
            });

            KeyBindingStore.Register(globalBinding);
            dependencies.Cache(globalBinding);
        }