示例#1
0
文件: Column.cs 项目: gpsbird/osu-1
        internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result)
        {
            if (!result.IsHit || !judgedObject.DisplayResult || !DisplayJudgements.Value)
            {
                return;
            }

            var explosion = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.HitExplosion, Index), _ =>
                                                  new DefaultHitExplosion(judgedObject.AccentColour.Value, judgedObject is DrawableHoldNoteTick))
            {
                RelativeSizeAxes = Axes.Both
            };

            hitObjectArea.Explosions.Add(explosion);

            explosion.Delay(200).Expire(true);
        }
示例#2
0
        public void TestCatcherAnimationStateReverted()
        {
            DrawableCatchHitObject drawableObject = null;
            JudgementResult        result         = null;

            AddStep("catch kiai fruit", () =>
            {
                drawableObject = createDrawableObject(new TestKiaiFruit());
                result         = attemptCatch(drawableObject);
            });
            checkState(CatcherAnimationState.Kiai);
            AddStep("revert result", () =>
            {
                catcher.OnRevertResult(drawableObject, result);
            });
            checkState(CatcherAnimationState.Idle);
        }
示例#3
0
        protected override void ApplyResult(JudgementResult result)
        {
            base.ApplyResult(result);

            double hpIncrease = result.Judgement.HealthIncreaseFor(result);

            if (result.Type == HitResult.Miss)
            {
                hpIncrease *= hpMissMultiplier;
            }
            else
            {
                hpIncrease *= hpMultiplier;
            }

            Health.Value += hpIncrease;
        }
示例#4
0
        /// <summary>
        /// Checks if the score is in a failed state and notifies subscribers.
        /// <para>
        /// This can only ever notify subscribers once.
        /// </para>
        /// </summary>
        protected void UpdateFailed(JudgementResult result)
        {
            if (HasFailed)
            {
                return;
            }

            if (!DefaultFailCondition && FailConditions?.Invoke(this, result) != true)
            {
                return;
            }

            if (Failed?.Invoke() != false)
            {
                HasFailed = true;
            }
        }
示例#5
0
        private void applyNewResult(JudgementResult judgementResult)
        {
            scoreProcessor.ApplyResult(judgementResult);

            foreach (var playfield in playfields)
            {
                var hit = new DrawableTestHit(new Hit(), judgementResult.Type);
                playfield.Add(hit);

                playfield.OnNewResult(hit, judgementResult);
            }

            foreach (var mascot in mascots)
            {
                mascot.LastResult.Value = judgementResult;
            }
        }
示例#6
0
 /// <summary>
 /// Records the judgement result for the specified hit object.
 /// </summary>
 public void RecordJudgement(BaseHitObjectView hitObjectView, JudgementResult judgement, bool isPassive, KeyCode keyCode = KeyCode.None)
 {
     if (nextFrame != null && judgement != null && hitObjectView != null && judgement.HitResult != HitResultType.None)
     {
         nextFrame.AddJudgement((j) =>
         {
             j.SetFromJudgementResult(judgement);
             j.IsPassive = isPassive;
             j.InputKey  = keyCode;
             while (hitObjectView != null)
             {
                 j.HitObjectIndexPath.Insert(0, hitObjectView.ObjectIndex);
                 hitObjectView = hitObjectView.BaseParentView;
             }
         });
     }
 }
示例#7
0
        private void onNewTickResult(DrawableHitObject obj, JudgementResult result)
        {
            if (result.Type > HitResult.Miss)
            {
                rollingHits++;
            }
            else
            {
                rollingHits--;
            }

            rollingHits = MathHelper.Clamp(rollingHits, 0, rolling_hits_for_engaged_colour);

            Color4 newColour = Interpolation.ValueAt((float)rollingHits / rolling_hits_for_engaged_colour, colourIdle, colourEngaged, 0, 1);

            MainPiece.FadeAccent(newColour, 100);
        }
示例#8
0
        internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result)
        {
            if (!DisplayJudgements.Value)
            {
                return;
            }
            if (!judgedObject.DisplayResult)
            {
                return;
            }

            switch (result.Judgement)
            {
            case TaikoStrongJudgement _:
                if (result.IsHit)
                {
                    hitExplosionContainer.Children.FirstOrDefault(e => e.JudgedObject == ((DrawableStrongNestedHit)judgedObject).MainObject)?.VisualiseSecondHit();
                }
                break;

            case TaikoDrumRollTickJudgement _:
                if (!result.IsHit)
                {
                    break;
                }

                var drawableTick = (DrawableDrumRollTick)judgedObject;

                addDrumRollHit(drawableTick);
                break;

            default:
                judgementContainer.Add(new DrawableTaikoJudgement(result, judgedObject)
                {
                    Anchor = result.IsHit ? Anchor.TopLeft : Anchor.CentreLeft,
                    Origin = result.IsHit ? Anchor.BottomCentre : Anchor.Centre,
                    RelativePositionAxes = Axes.X,
                    X = result.IsHit ? judgedObject.Position.X : 0,
                });

                var type = (judgedObject.HitObject as Hit)?.Type ?? HitType.Centre;
                addExplosion(judgedObject, result.Type, type);
                break;
            }
        }
示例#9
0
        protected sealed override void ApplyResultInternal(JudgementResult result)
        {
            result.ComboAtJudgement        = Combo.Value;
            result.HighestComboAtJudgement = HighestCombo.Value;

            if (result.FailedAtJudgement)
            {
                return;
            }

            if (!result.Type.IsScorable())
            {
                return;
            }

            if (result.Type.AffectsCombo())
            {
                switch (result.Type)
                {
                case HitResult.Miss:
                case HitResult.LargeTickMiss:
                    Combo.Value = 0;
                    break;

                default:
                    Combo.Value++;
                    break;
                }
            }

            double scoreIncrease = result.Type.IsHit() ? result.Judgement.NumericResultFor(result) : 0;

            if (!result.Type.IsBonus())
            {
                baseScore           += scoreIncrease;
                rollingMaxBaseScore += result.Judgement.MaxNumericResult;
            }

            scoreResultCounts[result.Type] = scoreResultCounts.GetOrDefault(result.Type) + 1;

            hitEvents.Add(CreateHitEvent(result));
            lastHitObject = result.HitObject;

            updateScore();
        }
示例#10
0
        private void onNewResult(DrawableHitObject judgedObject, JudgementResult result)
        {
            hitPolicy.HandleHit(judgedObject);

            if (!judgedObject.DisplayResult || !DisplayJudgements.Value)
            {
                return;
            }

            judgementLayer.Add(poolDictionary[result.Type].Get(doj => doj.Apply(result, judgedObject)));

            if (judgedObject.HitObject.Kiai && result.Type != HitResult.Miss)
            {
                float angle = judgedObject switch
                {
                    DrawableBeat b => b.HitObject.Angle,
                    DrawableSlider s => s.HitObject.Nodes.Last().Angle,
                      _ => 0
                };

                var isHardBeat = judgedObject is DrawableHardBeat;

                switch (effect.Value)
                {
                case KiaiType.Turbulent:
                    for (int i = 0; i < (isHardBeat ? RNG.Next(60, 100) : RNG.Next(3, 9)); i++)
                    {
                        SliderParticleEmitter.AddParticle((isHardBeat ? RNG.NextSingle(0, 360) : angle), Inversed, result.Type);
                    }

                    break;

                case KiaiType.Classic:
                    kiaiExplosionContainer.Add(new KiaiHitExplosion(colour.ForHitResult(judgedObject.Result.Type), judgedObject is DrawableHardBeat, Inversed, judgedObject is DrawableHardBeat ? 32 : 10)
                    {
                        Position = judgedObject is DrawableHardBeat ? Vector2.Zero : Extensions.GetCircularPosition(.5f, angle),
                        Angle    = angle,
                        Anchor   = Anchor.Centre,
                        Origin   = Anchor.Centre
                    });

                    break;
                }
            }
        }
示例#11
0
        public void OnNewResult(DrawableCatchHitObject hitObject, JudgementResult result)
        {
            if (!result.Type.IsScorable())
            {
                return;
            }

            if (hitObject.HitObject.LastInCombo)
            {
                if (result.Judgement is CatchJudgement catchJudgement && catchJudgement.ShouldExplodeFor(result))
                {
                    MovableCatcher.Explode();
                }
                else
                {
                    MovableCatcher.Drop();
                }
            }
示例#12
0
        protected override void ApplyResult(JudgementResult result)
        {
            base.ApplyResult(result);

            if (result.Type == HitResult.Miss)
            {
                if (!result.Judgement.IsBonus)
                {
                    Health.Value -= hpDrainRate * (harshness * 2);
                }
                return;
            }

            if (result.Judgement is CatchJudgement catchJudgement)
            {
                Health.Value += Math.Max(catchJudgement.HealthIncreaseFor(result) - hpDrainRate, 0) * harshness;
            }
        }
示例#13
0
        public override void OnNewJudgement(JudgementResult judgement)
        {
            if (!judgement.IsHit)
            {
                return;
            }

            judgementsContainer.Add(new JudgementLine
            {
                Y      = getRelativeJudgementPosition(judgement.TimeOffset),
                Anchor = alignment == Anchor.x2 ? Anchor.x0 : Anchor.x2,
                Origin = Anchor.y1 | (alignment == Anchor.x2 ? Anchor.x0 : Anchor.x2),
            });

            arrow.MoveToY(
                getRelativeJudgementPosition(floatingAverage = floatingAverage * 0.9 + judgement.TimeOffset * 0.1)
                , arrow_move_duration, Easing.Out);
        }
示例#14
0
        public void Apply(JudgementResult result, DrawableHitObject hitObject)
        {
            this.result = result.Type;
            judgementPiece.JudgementText.Text   = result.Type.GetDisplayNameForSentakkiResult().ToUpperInvariant();
            judgementPiece.JudgementText.Colour = result.Type.GetColorForSentakkiResult();

            if (result.HitObject.HitWindows is HitWindows.EmptyHitWindows || result.Type == HitResult.Miss || !detailedJudgements.Value)
            {
                timingPiece.Alpha = 0;
            }
            else
            {
                timingPiece.Alpha = 1;
                if (result.TimeOffset >= 16)
                {
                    timingPiece.Text   = "LATE";
                    timingPiece.Colour = Color4.OrangeRed;
                }
                else if (result.TimeOffset <= -16)
                {
                    timingPiece.Text   = "EARLY";
                    timingPiece.Colour = Color4.GreenYellow;
                }
                else
                {
                    timingPiece.Text   = "CRITICAL";
                    timingPiece.Colour = Color4.Orange;
                }
            }
            LifetimeStart = result.TimeAbsolute;

            switch (hitObject)
            {
            case DrawableSentakkiLanedHitObject laned:
                Position = SentakkiExtensions.GetPositionAlongLane(240, laned.HitObject.Lane);
                Rotation = laned.HitObject.Lane.GetRotationForLane();
                break;

            default:
                Position = hitObject.Position;
                Rotation = 0;
                break;
            }
        }
示例#15
0
        protected sealed override void ApplyResultInternal(JudgementResult result)
        {
            result.ComboAtJudgement        = Combo.Value;
            result.HighestComboAtJudgement = HighestCombo.Value;

            if (result.FailedAtJudgement)
            {
                return;
            }

            scoreResultCounts[result.Type] = scoreResultCounts.GetValueOrDefault(result.Type) + 1;

            if (!result.Type.IsScorable())
            {
                return;
            }

            if (result.Type.IncreasesCombo())
            {
                Combo.Value++;
            }
            else if (result.Type.BreaksCombo())
            {
                Combo.Value = 0;
            }

            double scoreIncrease = result.Type.IsHit() ? result.Judgement.NumericResultFor(result) : 0;

            if (!result.Type.IsBonus())
            {
                baseScore           += scoreIncrease;
                rollingMaxBaseScore += result.Judgement.MaxNumericResult;
            }

            if (result.Type.IsBasic())
            {
                basicHitObjects++;
            }

            hitEvents.Add(CreateHitEvent(result));
            lastHitObject = result.HitObject;

            updateScore();
        }
示例#16
0
        private void performJudgement(HitResult type, Judgement judgement = null)
        {
            var judgedObject = new DrawableFruit(new Fruit())
            {
                AccentColour = { Value = judgedObjectColour }
            };

            var result = new JudgementResult(judgedObject.HitObject, judgement ?? new Judgement())
            {
                Type = type
            };

            scoreProcessor.ApplyResult(result);

            foreach (var counter in CreatedDrawables.Cast <CatchComboDisplay>())
            {
                counter.OnNewResult(judgedObject, result);
            }
        }
示例#17
0
        protected override void ApplyResult(JudgementResult result)
        {
            base.ApplyResult(result);

            bool isTick = result.Judgement is HoldNoteTickJudgement;

            if (isTick)
            {
                if (result.IsHit)
                {
                    Health.Value += hpMultiplier * hp_increase_tick;
                }
            }
            else
            {
                switch (result.Type)
                {
                case HitResult.Miss:
                    Health.Value += hpMissMultiplier * hp_increase_miss;
                    break;

                case HitResult.Meh:
                    Health.Value += hpMultiplier * hp_increase_bad;
                    break;

                case HitResult.Ok:
                    Health.Value += hpMultiplier * hp_increase_ok;
                    break;

                case HitResult.Good:
                    Health.Value += hpMultiplier * hp_increase_good;
                    break;

                case HitResult.Great:
                    Health.Value += hpMultiplier * hp_increase_great;
                    break;

                case HitResult.Perfect:
                    Health.Value += hpMultiplier * hp_increase_perfect;
                    break;
                }
            }
        }
示例#18
0
        private void onNewResult(DrawableHitObject judgedObject, JudgementResult result)
        {
            // Hitobjects that block future hits should miss previous hitobjects if they're hit out-of-order.
            hitPolicy.HandleHit(judgedObject);

            if (!judgedObject.DisplayResult || !DisplayJudgements.Value)
            {
                return;
            }

            DrawableOsuJudgement explosion = new DrawableOsuJudgement(result, judgedObject)
            {
                Origin   = Anchor.Centre,
                Position = ((OsuHitObject)judgedObject.HitObject).StackedEndPosition,
                Scale    = new Vector2(((OsuHitObject)judgedObject.HitObject).Scale)
            };

            judgementLayer.Add(explosion);
        }
示例#19
0
        private void onNewResult(DrawableHitObject obj, JudgementResult result)
        {
            if (!(obj is DrawableDrumRollTick))
            {
                return;
            }

            if (result.IsHit)
            {
                rollingHits++;
            }
            else
            {
                rollingHits--;
            }

            rollingHits = Math.Clamp(rollingHits, 0, rolling_hits_for_engaged_colour);

            updateColour(100);
        }
示例#20
0
        protected override void ApplyResultInternal(JudgementResult result)
        {
            result.HealthAtJudgement = Health.Value;
            result.FailedAtJudgement = HasFailed;

            if (HasFailed)
            {
                return;
            }

            Health.Value += GetHealthIncreaseFor(result);

            if (meetsAnyFailCondition(result))
            {
                if (Failed?.Invoke() != false)
                {
                    HasFailed = true;
                }
            }
        }
示例#21
0
        protected sealed override void ApplyResultInternal(JudgementResult result)
        {
            result.ComboAtJudgement = Combo.Value;
            result.HighestComboAtJudgement = HighestCombo.Value;

            if (result.FailedAtJudgement)
                return;

            if (result.Judgement.AffectsCombo)
            {
                switch (result.Type)
                {
                    case HitResult.None:
                        break;

                    case HitResult.Miss:
                        Combo.Value = 0;
                        break;

                    default:
                        Combo.Value++;
                        break;
                }
            }

            if (result.Judgement.IsBonus)
            {
                if (result.IsHit)
                    bonusScore += result.Judgement.NumericResultFor(result);
            }
            else
            {
                if (result.HasResult)
                    scoreResultCounts[result.Type] = scoreResultCounts.GetOrDefault(result.Type) + 1;

                baseScore += result.Judgement.NumericResultFor(result);
                rollingMaxBaseScore += result.Judgement.MaxNumericResult;
            }

            updateScore();
        }
示例#22
0
        private void onNewResult(DrawableHitObject judgedObject, JudgementResult result)
        {
            if (!judgedObject.DisplayResult || !DisplayJudgements.Value)
            {
                return;
            }

            var sentakkiObj = (DrawableSentakkiHitObject)judgedObject;

            var b = sentakkiObj.HitObject.Angle + 90;
            var a = b *= (float)(Math.PI / 180);
            DrawableSentakkiJudgement explosion;

            switch (judgedObject)
            {
            case DrawableTouchHold _:
                explosion = new DrawableSentakkiJudgement(result, sentakkiObj)
                {
                    Origin = Anchor.Centre,
                    Anchor = Anchor.Centre,
                };
                break;

            default:
                explosion = new DrawableSentakkiJudgement(result, sentakkiObj)
                {
                    Origin   = Anchor.Centre,
                    Anchor   = Anchor.Centre,
                    Position = new Vector2(-(240 * (float)Math.Cos(a)), -(240 * (float)Math.Sin(a))),
                    Rotation = sentakkiObj.HitObject.Angle,
                };
                break;
            }

            judgementLayer.Add(explosion);

            if (result.IsHit && judgedObject.HitObject.Kiai)
            {
                ring.KiaiBeat();
            }
        }
示例#23
0
        /// <summary>
        /// Whether the current state of <see cref="HealthProcessor"/> or the provided <paramref name="result"/> meets any fail condition.
        /// </summary>
        /// <param name="result">The judgement result.</param>
        private bool meetsAnyFailCondition(JudgementResult result)
        {
            if (DefaultFailCondition)
            {
                return(true);
            }

            if (FailConditions != null)
            {
                foreach (var condition in FailConditions.GetInvocationList())
                {
                    bool conditionResult = (bool)condition.Method.Invoke(condition.Target, new object[] { this, result });
                    if (conditionResult)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
        public void Apply(JudgementResult result, DrawableHitObject hitObject)
        {
            this.result = result.Type;
            judgementBody.JudgementText.Text   = result.Type.GetDescription().ToUpperInvariant();
            judgementBody.JudgementText.Colour = colours.ForHitResult(result.Type);

            LifetimeStart = result.TimeAbsolute;

            switch (hitObject)
            {
            case DrawableSentakkiLanedHitObject laned:
                Position = SentakkiExtensions.GetPositionAlongLane(240, laned.HitObject.Lane);
                Rotation = laned.HitObject.Lane.GetRotationForLane();
                break;

            default:
                Position = hitObject.Position;
                Rotation = 0;
                break;
            }
        }
示例#25
0
        private void onNewResult(DrawableHitObject judgedObject, JudgementResult result)
        {
            if (!judgedObject.DisplayResult || !DisplayJudgements.Value || !(judgedObject is DrawableSentakkiLanedHitObject laned))
            {
                return;
            }

            if (!result.IsHit)
            {
                return;
            }

            if (judgedObject is DrawableSlideBody)
            {
                return;
            }

            var explosion = explosionPool.Get(e => e.Apply(laned.HitObject));

            explosionLayer.Add(explosion);
        }
示例#26
0
        internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result)
        {
            // Add judgement
            if (!judgedObject.DisplayResult || !DisplayJudgements.Value)
            {
                return;
            }

            if (!(judgedObject is DrawableNote note))
            {
                return;
            }

            judgements.Clear();
            judgements.Add(new DrawableNoteJudgement(result, judgedObject)
            {
                Anchor = Anchor.Centre,
                Origin = Anchor.Centre,
                Y      = calculator.YPositionAt(note.HitObject.Tone + 2)
            });

            // Add hit explosion
            if (!result.IsHit)
            {
                return;
            }

            var explosion = new SkinnableDrawable(new KaraokeSkinComponent(KaraokeSkinComponents.HitExplosion), _ =>
                                                  new DefaultHitExplosion(judgedObject.AccentColour.Value, judgedObject is DrawableNote))
            {
                Y = calculator.YPositionAt(note.HitObject.Tone)
            };

            // todo : shpuld be added into hitObjectArea.Explosions
            // see how mania ruleset do
            hitObjectArea.Add(explosion);

            explosion.Delay(200).Expire(true);
        }
示例#27
0
        private void onNewResult(DrawableHitObject obj, JudgementResult result)
        {
            if (!(obj is DrawableDrumRollTick))
            {
                return;
            }

            if (result.Type > HitResult.Miss)
            {
                rollingHits++;
            }
            else
            {
                rollingHits--;
            }

            rollingHits = Math.Clamp(rollingHits, 0, rolling_hits_for_engaged_colour);

            Color4 newColour = Interpolation.ValueAt((float)rollingHits / rolling_hits_for_engaged_colour, colourIdle, colourEngaged, 0, 1);

            (MainPiece as IHasAccentColour)?.FadeAccent(newColour, 100);
        }
示例#28
0
文件: Stage.cs 项目: Azyyyyyy/osu
        internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result)
        {
            if (!judgedObject.DisplayResult || !DisplayJudgements.Value)
            {
                return;
            }

            // Tick judgements should not display text.
            if (judgedObject is DrawableHoldNoteTick)
            {
                return;
            }

            judgements.Clear(false);
            judgements.Add(judgementPool.Get(j =>
            {
                j.Apply(result, judgedObject);

                j.Anchor = Anchor.Centre;
                j.Origin = Anchor.Centre;
            }));
        }
示例#29
0
        private void onJudgementChanged(JudgementResult judgement)
        {
            lastJudgement = judgement;

            var attrib = getAttributeAtTime(judgement);

            if (gameplayState == null || attrib == null)
            {
                IsValid = false;
                return;
            }

            // awkward but we need to make sure the true mods are not passed to PerformanceCalculator as it makes a mess of track applications.
            var scoreInfo = gameplayState.Score.ScoreInfo.DeepClone();

            scoreInfo.Mods = clonedMods;

            var calculator = gameplayState.Ruleset.CreatePerformanceCalculator(attrib, scoreInfo);

            Current.Value = (int)Math.Round(calculator?.Calculate() ?? 0, MidpointRounding.AwayFromZero);
            IsValid       = true;
        }
示例#30
0
        protected override void ApplyResultInternal(JudgementResult result)
        {
            result.HealthAtJudgement = Health.Value;
            result.FailedAtJudgement = HasFailed;

            if (HasFailed)
            {
                return;
            }

            Health.Value += GetHealthIncreaseFor(result);

            if (!DefaultFailCondition && FailConditions?.Invoke(this, result) != true)
            {
                return;
            }

            if (Failed?.Invoke() != false)
            {
                HasFailed = true;
            }
        }