Exemple #1
0
        internal override void UpdateFlashlight()
        {
            if (s_Flashlight.Texture == null || spriteManagerFlashlight.SpriteList.Count == 0 || !s_Flashlight.Texture.TextureGl.Loaded)
            {
                if (AllowSubmission)
                {
                    CurrentScore.InvalidateSubmission();
                    player.AddFlashlightFlag();

                    ConfigManager.PurgeHashCache();
                    GameBase.ChangeMode(OsuModes.Update);
                }
                return;
            }

            s_Flashlight.Position = GameBase.GameField.FieldToDisplay(catcher1.Position) / GameBase.WindowManager.Ratio;

            if (!Player.Paused)
            {
                SliderOsu s = player.ActiveHitObject as SliderOsu;
                if (s != null && s.IsSliding)
                {
                    if (!s_LightsOut.IsVisible)
                    {
                        s_LightsOut.Alpha = 0.8f;
                    }
                }
                else if (s_LightsOut.IsVisible)
                {
                    s_LightsOut.Alpha = 0;
                }

                float targetScale = 8.0f;

                if (!EventManager.BreakMode)
                {
                    if (ComboCounter.HitCombo < 100)
                    {
                        targetScale = 5.2f;
                    }
                    else if (ComboCounter.HitCombo < 200)
                    {
                        targetScale = 4.6f;
                    }
                    else
                    {
                        targetScale = 4.0f;
                    }
                }

                if (s_Flashlight.Scale > targetScale)
                {
                    s_Flashlight.Scale = (float)Math.Max(s_Flashlight.Scale - 0.1 * GameBase.FrameRatio, targetScale);
                }
                else if (s_Flashlight.Scale < targetScale)
                {
                    s_Flashlight.Scale = (float)Math.Min(s_Flashlight.Scale + 0.1 * GameBase.FrameRatio, targetScale);
                }
            }
        }
        internal override void UpdateFlashlight()
        {
            if (s_Flashlight.Texture == null || !s_Flashlight.Texture.TextureGl.Loaded)
            {
                if (CurrentScore.AllowSubmission)
                {
                    CurrentScore.InvalidateSubmission();
                    NotificationManager.ShowMessageMassive("Couldn't draw Flashlight texture - disabling ranking.", 2000);

                    ConfigManager.PurgeHashCache();
                    GameBase.ChangeMode(OsuModes.Update);
                }

                return;
            }
            if (spriteManagerFlashlight.SpriteList.Count == 0)
            {
                player.AddFlashlightFlag();
            }
        }
Exemple #3
0
        internal override void UpdateInput()
        {
            if (!IsInitialized || Player.Paused)
            {
                return;
            }

            int frameCheck = 0;

            if (!InputManager.ReplayMode)
            {
                InputManager.leftButton1  |= KeyboardHandler.IsKeyDown(BindingManager.For(Bindings.FruitsDash));
                InputManager.leftButton1  |= JoystickHandler.IsKeyDown(BindingManager.For(Bindings.FruitsDash));
                InputManager.leftButton1i |= InputManager.leftButton1;
                if (InputManager.leftButton1i)
                {
                    InputManager.leftButton = ButtonState.Pressed;
                }
            }

            Dashing = InputManager.leftButton == ButtonState.Pressed;

            if (Dashing)
            {
                frameCheck += 4;
            }

            float currentMovementSpeed = baseMovementSpeed * specialMovementModifier;

            if (!Dashing)
            {
                currentMovementSpeed /= 2;
            }

            if (InputManager.ReplayMode || Player.Relaxing)
            {
                float newPos = InputManager.ReplayGamefieldCursor.X;

                if (InputManager.NewReplayFrame)
                {
                    LeftPressed  = catcher1.Position.X > newPos;
                    RightPressed = catcher1.Position.X < newPos;
                }

                if (catcher1.Position.X != newPos)
                {
#if DEBUG
                    if (!ModManager.CheckActive(Mods.Autoplay) && (Math.Abs(catcher1.Position.X - newPos) > currentMovementSpeed * GameBase.SIXTY_FRAME_TIME))
                    {
                        NotificationManager.ShowMessageMassive("Impossible movement (" + Math.Abs(catcher1.Position.X - newPos) + " vs " + (currentMovementSpeed * GameBase.SIXTY_FRAME_TIME) + ")", 1000);
                    }
#endif

                    catcher1.FlipHorizontal = catcher1.Position.X > newPos;

                    catcher1.Position.X = newPos;
                }
            }
            else
            {
                if (GameBase.ElapsedMilliseconds > 33)
                {
                    return;
                }

                if (Math.Abs(catcher1.Position.X - checkPosition) > 0.01f)
                {
                    catcher1.Position.X = checkPosition;
                    CurrentScore.InvalidateSubmission();
                }


                if ((RightPressed = KeyboardHandler.IsKeyDown(BindingManager.For(Bindings.FruitsRight)) || JoystickHandler.IsKeyDown(BindingManager.For(Bindings.FruitsRight))))
                {
                    frameCheck             += 1;
                    catcher1.Position.X     = (float)(catcher1.Position.X + currentMovementSpeed * GameBase.ElapsedMilliseconds);
                    catcher1.FlipHorizontal = false;
                }

                if ((LeftPressed = KeyboardHandler.IsKeyDown(BindingManager.For(Bindings.FruitsLeft)) || JoystickHandler.IsKeyDown(BindingManager.For(Bindings.FruitsLeft))))
                {
                    frameCheck             += 2;
                    catcher1.Position.X     = (float)(catcher1.Position.X - currentMovementSpeed * GameBase.ElapsedMilliseconds);
                    catcher1.FlipHorizontal = true;
                }
            }

            checkSpecialWaitingState();

            importantFrame      = frameCheck != importantFrameCheck;
            importantFrameCheck = frameCheck;

            catcher1.Position.X = OsuMathHelper.Clamp(catcher1.Position.X, 0, 512);
            checkPosition       = catcher1.Position.X;
        }