コード例 #1
0
        /// <summary>
        ///     Updates the combo display and its animations
        /// </summary>
        /// <param name="gameTime"></param>
        private void UpdateComboDisplay(GameTime gameTime)
        {
            // Gradually tween the position back to what it was originally.
            ComboDisplay.Y = MathHelper.Lerp(ComboDisplay.Y, OriginalComboDisplayY, (float)Math.Min(GameBase.Game.TimeSinceLastFrame / 30, 1) / 2);

            if (OldCombo == Screen.Ruleset.ScoreProcessor.Combo)
            {
                return;
            }

            // Set the new one
            ComboDisplay.UpdateValue(Screen.Ruleset.ScoreProcessor.Combo);

            // If the combo needs repositioning, do so accordingly.
            if ((int)Math.Floor(Math.Log10(OldCombo) + 1) != (int)Math.Floor(Math.Log10(Screen.Ruleset.ScoreProcessor.Combo) + 1))
            {
                ComboDisplay.X = -ComboDisplay.TotalWidth / 2f;
            }

            // Set the position and scale  of the combo display, so that we can perform some animations.
            ComboDisplay.Y = OriginalComboDisplayY - 5;

            // Gradually tween the position back to what it was originally.
            ComboDisplay.Y = MathHelper.Lerp(ComboDisplay.Y, OriginalComboDisplayY, (float)Math.Min(GameBase.Game.TimeSinceLastFrame / 30, 1) / 2);
            OldCombo       = Screen.Ruleset.ScoreProcessor.Combo;
        }
コード例 #2
0
        /// <summary>
        ///     Updates the combo display and its animations
        /// </summary>
        /// <param name="gameTime"></param>
        private void UpdateComboDisplay(GameTime gameTime)
        {
            // Gradually tween the position back to what it was originally.
            ComboDisplay.Y = MathHelper.Lerp(ComboDisplay.Y, OriginalComboDisplayY, (float)Math.Min(GameBase.Game.TimeSinceLastFrame / 30, 1) / 2);

            if (OldCombo == Screen.Ruleset.ScoreProcessor.Combo)
            {
                return;
            }

            // Set the new one
            ComboDisplay.UpdateValue(Screen.Ruleset.ScoreProcessor.Combo);

            // Set the position and scale  of the combo display, so that we can perform some animations.
            ComboDisplay.Y = OriginalComboDisplayY - 5;

            // Gradually tween the position back to what it was originally.
            ComboDisplay.Y = MathHelper.Lerp(ComboDisplay.Y, OriginalComboDisplayY, (float)Math.Min(GameBase.Game.TimeSinceLastFrame / 30, 1) / 2);
            OldCombo       = Screen.Ruleset.ScoreProcessor.Combo;
        }
コード例 #3
0
        protected override IReadOnlyList <IElement> CreateElements()
        {
            var settings = Program.Settings;
            var elements = new List <Element>();

            // Background elements
            // Beware the adding order. Usually these elements should be updated first.
            elements.Add(new SyncTimer(this));
            elements.Add(new AudioController(this));
            elements.Add(new ScoreLoader(this));

            // Background
            if (!string.IsNullOrEmpty(settings.Media.BackgroundAnimation) && File.Exists(settings.Media.BackgroundAnimation))
            {
                elements.Add(new BackgroundVideo(this));
            }
            else if (!string.IsNullOrEmpty(settings.Media.BackgroundImage) && File.Exists(settings.Media.BackgroundImage))
            {
                elements.Add(new BackgroundImage(this));
            }

#if DEBUG
            //elements.Add(new MiniCube(this));
#endif

            // ** Stage ** //
            {
                var gamingAreaElements = new List <Element>();

                gamingAreaElements.Add(new NoteReactor(this));
                if (settings.Style.SlideMotionPosition == SlideMotionPosition.Below)
                {
                    gamingAreaElements.Add(new SlideMotion(this));
                }
                gamingAreaElements.Add(new RibbonsLayer(this));
                if (settings.Style.SlideMotionPosition == SlideMotionPosition.Above)
                {
                    gamingAreaElements.Add(new SlideMotion(this));
                }
                gamingAreaElements.Add(new TapPointsMergingAnimation(this));
                gamingAreaElements.Add(new NotesLayer(this)
                {
                    GlobalSpeedScale = 1.3f
                });
                gamingAreaElements.Add(new TapPoints(this));
                gamingAreaElements.Add(new HitRankAnimation(this));

                var stage = new GamingArea(this, gamingAreaElements.ToArray());
                elements.Add(stage);
            }

            // Overlays

            {
                var comboDisplayElements = new List <Element>();

                comboDisplayElements.Add(new ComboAura(this));
                comboDisplayElements.Add(new ComboText(this));
                comboDisplayElements.Add(new ComboNumbers(this));

                var comboDisplay = new ComboDisplay(this, comboDisplayElements.ToArray());
                elements.Add(comboDisplay);
            }

            elements.Add(new AvatarDisplay(this));

            elements.Add(new SongTitle(this));

            elements.Add(new CuteIdol(this));

            elements.Add(new HelpOverlay(this)
            {
                Text    = settings.LocalStrings.PressSpaceToStart,
                Visible = false
            });

            if (settings.SystemUI.FpsOverlay.Use)
            {
                elements.Add(new FpsOverlay(this)
                {
                    FillColor = settings.SystemUI.FpsOverlay.TextFill,
                    FontSize  = settings.SystemUI.FpsOverlay.FontSize
                });
            }

            if (settings.SystemUI.DebugOverlay.Use)
            {
                elements.Add(new DebugOverlay(this)
                {
                    FillColor = settings.SystemUI.DebugOverlay.TextFill,
                    FontSize  = settings.SystemUI.DebugOverlay.FontSize
                });
            }

            if (settings.SystemUI.SyncTimerOverlay.Use)
            {
                elements.Add(new SyncTimerOverlay(this)
                {
                    FillColor = settings.SystemUI.SyncTimerOverlay.TextFill,
                    FontSize  = settings.SystemUI.SyncTimerOverlay.FontSize
                });
            }

            return(elements.ToArray());
        }