Exemplo n.º 1
0
        private void CreateKeyBeam(HybridLabel label, JudgeKind kind, bool isEarly)
        {
            Vector3 color = Vector3.One;

            bool doAnim = true;

            switch (kind)
            {
            case JudgeKind.Passive: doAnim = false; goto case JudgeKind.Perfect;

            case JudgeKind.Perfect: color = new Vector3(1, 1, 0.5f); break;

            case JudgeKind.Critical: color = new Vector3(1, 1, 0); break;

            case JudgeKind.Near: color = isEarly ? new Vector3(1.0f, 0, 1.0f) : new Vector3(0.5f, 1, 0.25f); break;

            case JudgeKind.Bad:
            case JudgeKind.Miss: color = new Vector3(1, 0, 0); break;
            }

            m_highwayView.BeginKeyBeam(label, color);
            if (doAnim)
            {
                m_critRootWorld.TriggerButtonAnimation((int)label, color);
            }
        }
Exemplo n.º 2
0
        private float GetTempRollValue(time_t position, HybridLabel label, out float valueMult, bool oneMinus = false)
        {
            var s = m_audioPlayback.Chart[label];

            valueMult = 1.0f;

            var mrAnalog = s.MostRecent <AnalogEntity>(position);

            if (mrAnalog == null || position > mrAnalog.AbsoluteEndPosition)
            {
                return(0);
            }

            if (mrAnalog.RangeExtended)
            {
                valueMult = 2.0f;
            }
            float result = mrAnalog.SampleValue(position);

            if (oneMinus)
            {
                return(1 - result);
            }
            else
            {
                return(result);
            }
        }
Exemplo n.º 3
0
        public Entity AddEntity(HybridLabel lane, string entityType, tick_t position, tick_t duration)
        {
            var entity = (Entity)Activator.CreateInstance(Entity.GetEntityTypeById(entityType));

            entity.Position = position;
            entity.Duration = duration;

            AddEntity(lane, entity);
            return(entity);
        }
Exemplo n.º 4
0
        public ButtonJudge(Chart chart, HybridLabel label)
            : base(chart, label)
        {
            tick_t tickStep   = (Chart.MaxBpm >= 255 ? 2.0 : 1.0) / (4 * 4);
            tick_t tickMargin = 2 * tickStep;

            foreach (var entity in chart[label])
            {
                var button = (ButtonEntity)entity;

                if (button.IsInstant)
                {
                    m_stateTicks.Add(new StateTick(button, button.AbsolutePosition, JudgeState.ChipAwaitPress));
                    m_scoreTicks.Add(new ScoreTick(button, button.AbsolutePosition, TickKind.Chip));
                }
                else
                {
                    m_stateTicks.Add(new StateTick(button, button.AbsolutePosition, JudgeState.HoldAwaitPress));
                    // end state is placed at the last score tick

                    int numTicks = MathL.FloorToInt((double)(button.Duration - tickMargin) / (double)tickStep);
                    if (numTicks <= 0)
                    {
                        m_scoreTicks.Add(new ScoreTick(button, button.AbsolutePosition + button.AbsoluteDuration / 2, TickKind.Hold));
                        m_stateTicks.Add(new StateTick(button, button.AbsolutePosition + button.AbsoluteDuration / 2, JudgeState.HoldAwaitRelease));
                    }
                    else
                    {
                        for (int i = 0; i < numTicks; i++)
                        {
                            tick_t pos = button.Position + tickMargin + tickStep * i;
                            m_scoreTicks.Add(new ScoreTick(button, chart.CalcTimeFromTick(pos), TickKind.Hold));

                            if (i == numTicks - 1)
                            {
                                m_stateTicks.Add(new StateTick(button, chart.CalcTimeFromTick(pos), JudgeState.HoldAwaitRelease));
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 5
0
 public void RemoveEntityAtTick(HybridLabel lane, tick_t tick) => Chart[lane].Remove(Chart[lane].Find(tick, false));
Exemplo n.º 6
0
 public void AddEntity(HybridLabel lane, Entity entity) => Chart[lane].Add(entity);
Exemplo n.º 7
0
 public void ForEachEntityInRangeTicks(HybridLabel laneLabel, tick_t startTick, tick_t endTick, bool includeDuration, DynValue function) =>
 Chart[laneLabel].ForEachInRange(startTick, endTick, includeDuration, entity => Script.Call(function, entity));
Exemplo n.º 8
0
 public Entity?GetEntityAtTick(HybridLabel laneLabel, tick_t tick, bool includeDuration) => Chart[laneLabel].Find(tick, includeDuration);
Exemplo n.º 9
0
 public Entity?GetEntityAtTick(HybridLabel laneLabel, tick_t tick) => Chart[laneLabel].Find(tick, true);
Exemplo n.º 10
0
        public LaserJudge(Chart chart, HybridLabel label)
            : base(chart, label)
        {
            tick_t tickStep = (Chart.MaxBpm >= 255 ? 2.0 : 1.0) / (4 * 4);

            // score ticks first
            foreach (var entity in chart[label])
            {
                var root = (AnalogEntity)entity;
                if (root.PreviousConnected != null)
                {
                    continue;
                }

                // now we're working with the root
                var start = root;
                while (start != null)
                {
                    var next = start;
                    while (next.NextConnected is AnalogEntity a && !a.IsInstant)
                    {
                        next = a;
                    }

                    Debug.Assert(next.Position >= start.Position);
                    if (next.Position > start.Position)
                    {
                        Debug.Assert(!next.IsInstant);
                    }

                    tick_t startPos     = start.Position;
                    bool   endsWithSlam = next.NextConnected is AnalogEntity && next.IsInstant;

                    int numTicks = MathL.Max(1, MathL.FloorToInt((double)(next.EndPosition - startPos) / (double)tickStep));
                    if (endsWithSlam && next.EndPosition - (startPos + tickStep * numTicks) < tickStep)
                    {
                        numTicks--;
                    }

                    for (int i = 0; i < numTicks; i++)
                    {
                        tick_t pos = startPos + i * tickStep;

                        var kind = (i == 0 && start.IsInstant) ? TickKind.Slam : TickKind.Segment;
                        m_scoreTicks.Add(new ScoreTick(root, chart.CalcTimeFromTick(pos), kind));
                    }

                    start = next.NextConnected as AnalogEntity;
                }
            }

            // state ticks seconds
            foreach (var entity in chart[label])
            {
                var root = (AnalogEntity)entity;
                if (root.PreviousConnected != null)
                {
                    continue;
                }

                time_t cursorResetTime = root.AbsolutePosition - m_cursorResetDistance;
                time_t laserBeginTime  = root.AbsolutePosition - m_directionChangeRadius;

                if (root.Previous is AnalogEntity p)
                {
                    cursorResetTime = MathL.Max((double)p.AbsoluteEndPosition, (double)cursorResetTime);
                    laserBeginTime  = MathL.Max((double)p.AbsoluteEndPosition, (double)laserBeginTime);
                }

                m_stateTicks.Add(new StateTick(root, root, cursorResetTime, JudgeState.CursorReset));
                m_stateTicks.Add(new StateTick(root, root, laserBeginTime, JudgeState.LaserBegin));

                if (root.DirectionSign != 0)
                {
                    m_stateTicks.Add(new StateTick(root, root, root.AbsolutePosition, JudgeState.SwitchDirection));
                }

                if (root.NextConnected is AnalogEntity segment)
                {
                    while (segment != null)
                    {
                        if (segment.DirectionSign != ((AnalogEntity)segment.Previous).DirectionSign)
                        {
                            m_stateTicks.Add(new StateTick(root, segment, segment.AbsolutePosition, JudgeState.SwitchDirection));
                        }
                        else if (segment.IsInstant)
                        {
                            m_stateTicks.Add(new StateTick(root, segment, segment.AbsolutePosition, JudgeState.SameDirectionSlam));
                        }

                        if (segment.NextConnected == null)
                        {
                            m_stateTicks.Add(new StateTick(root, segment, segment.AbsoluteEndPosition, JudgeState.LaserEnd));
                        }
                        segment = segment.NextConnected as AnalogEntity;
                    }
                }
                else
                {
                    m_stateTicks.Add(new StateTick(root, root, root.AbsoluteEndPosition, JudgeState.LaserEnd));
                }
            }
        }
Exemplo n.º 11
0
 protected StreamJudge(Chart chart, HybridLabel label)
 {
     Chart = chart;
     Label = label;
 }