示例#1
0
        internal bool HandlePressAt(TrackingPoint point)
        {
            HitObject found = FindObjectAt(point);

            if (found == null)
            {
                return(false);
            }

            if (Clock.AudioTime < found.StartTime - DifficultyManager.HitWindow300)
            {
                List <HitObject> objects = ActiveStreamObjects;

                int index = objects.IndexOf(found);

                if (index > 0)
                {
                    //check last hitObject has been hit already and isn't still active
                    HitObject last = ActiveStreamObjects[index - 1];
                    if (found.connectedObject != last && !last.IsHit && Clock.AudioTime < last.StartTime)
                    {
                        found.Shake();
                        return(true);
                    }
                }
            }

            TriggerScoreChange(found.Hit(), found);
            return(true);
        }
        internal override IncreaseScoreType Hit(HitObject h)
        {
            lastHitObject = h;

            IncreaseScoreType hitValue = h.Hit();


            int index = hitObjects.BinarySearch(h);

            currentHitObjectIndex = index < 0 ? ~index : index;

            if (hitValue == IncreaseScoreType.Ignore)
            {
                return(hitValue);
            }

            if (perfectMod && hitValue < IncreaseScoreType.ManiaHit300)
            {
                hitValue = IncreaseScoreType.MissMania;
            }

            HitCircleMania be = (HitCircleMania)h;

            if (ManiaStage.Skin.SeparateScore)
            {
                be.Column.Host.TriggerScoreIncrease(hitValue);
            }
            else
            {
                foreach (StageMania stage in ManiaStage)
                {
                    stage.TriggerScoreIncrease(hitValue);
                }
            }

            if (hitValue > IncreaseScoreType.Ignore)
            {
                Player.Instance.OnHitSuccess(h);
                be.Column.AddHitLight();

                //Rest LN hitlight at the end of notes
                be.Column.HasLongHitLight = false;
            }

            OnHit(hitValue, "", h);
            return(hitValue);
        }
示例#3
0
        public void Update()
        {
            AllowSpinnerOptimisation = false;

            List <HitObject> activeObjects = ActiveStreamObjects;

            if (activeObjects == null)
            {
                return;
            }

            int lowestActiveObject = -1;

            ProcessTo = activeObjects.Count - 1;
            //initialise to the last object. if we don't find an earlier one below, this will be used.

            ActiveObject = null;
            NextObject   = null;

            for (int i = ProcessFrom; i < activeObjects.Count; i++)
            {
                HitObject h = activeObjects[i];

                int hitObjectNow = h.ClockingNow;

                if (h.IsVisible || !h.IsHit)
                {
                    h.Update();

                    if (h.StartTime <= hitObjectNow && h.EndTime > hitObjectNow)
                    {
                        ActiveObject = h;
                    }
                    else if (h.StartTime > hitObjectNow)
                    {
                        if (NextObject == null && !h.IsHit)
                        {
                            NextObject = h;
                        }
                    }

                    if (!AllowSpinnerOptimisation)
                    {
                        AllowSpinnerOptimisation |= h is Spinner && h.Sprites[0].Alpha == 1;
                    }

                    if (Player.Autoplay && !h.IsHit && hitObjectNow >= h.StartTime)
                    {
                        TriggerScoreChange(h.Hit(), h);
                    }
                    if (Clock.AudioTimeSource.IsElapsing)
                    {
                        TriggerScoreChange(h.CheckScoring(), h);
                    }

                    if (lowestActiveObject < 0)
                    {
                        lowestActiveObject = i;
                    }
                }
                else
                {
                    if (h is Slider s && s.EndTime < hitObjectNow)
                    {
                        s.DisposePathTexture();
                    }
                }

                if (h.StartTime > hitObjectNow + 4000 && !h.IsVisible)
                {
                    ProcessTo = i;
                    break; //stop processing after a decent amount of leeway...
                }
            }

            if (lowestActiveObject >= 0)
            {
                ProcessFrom = lowestActiveObject;
            }

            if (nextStreamChange > 0 && nextStreamChange <= Clock.AudioTime)
            {
                if (OnStreamChanged != null)
                {
                    OnStreamChanged(ActiveStream);
                }

                nextStreamChange = 0;
            }

            streamSpriteManagers[(int)(ActiveStream)].Update();

            spriteManager.Update();
        }