Ejemplo n.º 1
0
 /// <summary>
 /// Adds a <see cref="HitObject"/> to the <see cref="Beatmaps.Beatmap"/> and visualises it.
 /// </summary>
 /// <param name="hitObject">The <see cref="HitObject"/> to add.</param>
 public void Add(HitObject hitObject) => blueprintContainer.AddBlueprintFor(DrawableRuleset.Add(hitObject));
Ejemplo n.º 2
0
 public SpecificBeatmapPatternGenerator(FastRandom random, HitObject hitObject, Beatmap beatmap, int availableColumns, Pattern previousPattern)
     : base(random, hitObject, beatmap, availableColumns, previousPattern)
 {
 }
Ejemplo n.º 3
0
 public void Delete(HitObject hitObject)
 {
 }
Ejemplo n.º 4
0
 public SpecificBeatmapPatternGenerator(FastRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern)
     : base(random, hitObject, beatmap, previousPattern)
 {
 }
 protected override DrawableHitObject CreateNestedHitObject(HitObject hitObject) =>
 new DrawableTestHitObject((TestHitObject)hitObject);
 public HitokoriHitObjectLifetimeEntry(HitObject hitObject) : base(hitObject)
 {
 }
Ejemplo n.º 7
0
 private bool isKat(HitObject h)
 {
     return(h.hitSound.HasFlag(HitSound.Clap) || h.hitSound.HasFlag(HitSound.Whistle));
 }
Ejemplo n.º 8
0
 protected DrawableHitObject(HitObject hitObject)
 {
     HitObject = hitObject;
 }
Ejemplo n.º 9
0
 public BosuHitObjectLifetimeEntry(HitObject hitObject)
     : base(hitObject)
 {
 }
Ejemplo n.º 10
0
 private bool isHit(HitObject h)
 {
     return(h.type.HasFlag(HitObject.Type.Circle));
 }
Ejemplo n.º 11
0
 protected override HitObjectLifetimeEntry CreateLifetimeEntry(HitObject hitObject) => new BosuHitObjectLifetimeEntry(hitObject);
Ejemplo n.º 12
0
 protected override HitObjectLifetimeEntry CreateLifetimeEntry(HitObject hitObject) => new SentakkiHitObjectLifetimeEntry(hitObject, sentakkiRulesetConfig, drawableSentakkiRuleset);
Ejemplo n.º 13
0
    // Vision Sweep
    public void VisionSweep()
    {
        // Empty the list
        seenObject.Clear();

        // Vision should be + and - so we need to halve it.
        float visionModifier = (visionAngle / 2);

        // We will need to reset to the center once we have done a sweep
        Quaternion resetRotation = transform.localRotation;

        // Capture All Hits
        RaycastHit[] hits;

        // Loop round + and - to create a vision cone
        visionAngle = (visionAngle > 360) ? (0) : (visionAngle);
        visionAngle = (visionAngle < 0) ? (360) : (visionAngle);

        for (int i = 0; i < visionAngle; i ++)
        {
            // Move the rotation based on I.
            Quaternion rotation = Quaternion.Euler (transform.localRotation.x, transform.localRotation.y + (i - visionModifier), transform.localRotation.z);
            transform.localRotation = rotation;

            // Cast a ray
            Vector3 fwd = transform.TransformDirection (Vector3.forward);
            hits = Physics.RaycastAll (transform.position, fwd, radarRange);

            // We have hit something... bettr check what?
            if (hits.Length > 0) {
                for(int j = 0; j < hits.Length; j++) {

                    // We hit a wall... Best stop there...
                    if(hits[j].transform.gameObject.tag == "Wall") {
                        j = hits.Length + 1;
                    } else {

                        // We hit something and it wasnt a wall.. add it to the array.
                        HitObject hitOBJ = new HitObject(hits[j].transform.gameObject, hits[j].distance, i - visionModifier);

                        // Check if we have already added this object... we scan with VERY high fidelity.
                        if (!HasDuplicate(hitOBJ))
                            seenObject.Add(hitOBJ);
                    }
                }

            }
            // Uncomment the next line for debug on the sweep.
         	Debug.DrawLine(transform.position, (transform.position + (transform.forward * radarRange)) , Color.red);
        }

        // Reset the rotation to the center.
        transform.rotation = resetRotation;
        seen = seenObject.Count;
    }
Ejemplo n.º 14
0
 protected override SelectionBlueprint CreateBlueprintFor(HitObject hitObject) => new TimelineHitObjectBlueprint(hitObject)
 {
     OnDragHandled = handleScrollViaDrag
 };
Ejemplo n.º 15
0
 private double getDeltaTime(HitObject h)
 {
     return(deltaTimes.GetValueOrDefault(h, 0));
 }
Ejemplo n.º 16
0
 /////////////////////////////////////////////
 /// --Helper Functions-- (PRIVATE)
 /////////////////////////////////////////////
 public bool HasDuplicate(HitObject h)
 {
     bool check = false;
     foreach( HitObject h2 in seenObject) {
         if (h2.seenOBJ == h.seenOBJ)
             check = true;
     }
     return check;
 }
Ejemplo n.º 17
0
 protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableHitCircle((HitCircle)hitObject);
 protected override IEnumerable <TestHitObject> ConvertHitObject(HitObject original, IBeatmap beatmap, CancellationToken cancellationToken) =>
 throw new NotImplementedException();
Ejemplo n.º 19
0
 public OsuJudgementResult(HitObject hitObject, Judgement judgement)
     : base(hitObject, judgement)
 {
 }
Ejemplo n.º 20
0
 protected virtual JudgementResult CreateResult(HitObject hitObject, Judgement judgement) => new JudgementResult(hitObject, judgement);
Ejemplo n.º 21
0
 protected virtual void OnConversionGenerated(HitObject original, IEnumerable <HitObject> result, IBeatmapConverter beatmapConverter)
 {
 }
Ejemplo n.º 22
0
 public void BeginPlacement(HitObject hitObject)
 {
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Creates the conversion mapping for a <see cref="HitObject"/>. A conversion mapping stores important information about the conversion process.
 /// This is generated _after_ the <see cref="HitObject"/> has been converted.
 /// <para>
 /// This should be used to validate the integrity of the conversion process after a conversion has occurred.
 /// </para>
 /// </summary>
 protected virtual TConvertMapping CreateConvertMapping(HitObject source) => new TConvertMapping();
Ejemplo n.º 24
0
 protected abstract DrawableHitObject CreateHitObject(HitObject hitObject);
Ejemplo n.º 25
0
 /// <summary>
 /// Creates the conversion value for a <see cref="HitObject"/>. A conversion value stores information about the converted <see cref="HitObject"/>.
 /// <para>
 /// This should be used to validate the integrity of the converted <see cref="HitObject"/>.
 /// </para>
 /// </summary>
 /// <param name="hitObject">The converted <see cref="HitObject"/>.</param>
 protected abstract IEnumerable <TConvertValue> CreateConvertValue(HitObject hitObject);
Ejemplo n.º 26
0
            public BufferedWedgeInfo(WorkingBeatmap beatmap)
            {
                BeatmapInfo     beatmapInfo = beatmap.BeatmapInfo;
                BeatmapMetadata metadata    = beatmapInfo.Metadata ?? beatmap.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();

                List <InfoLabel> labels = new List <InfoLabel>();

                if (beatmap.Beatmap != null)
                {
                    HitObject lastObject = beatmap.Beatmap.HitObjects.LastOrDefault();
                    double    endTime    = (lastObject as IHasEndTime)?.EndTime ?? lastObject?.StartTime ?? 0;

                    labels.Add(new InfoLabel(new BeatmapStatistic
                    {
                        Name    = "Length",
                        Icon    = FontAwesome.fa_clock_o,
                        Content = beatmap.Beatmap.HitObjects.Count == 0 ? "-" : TimeSpan.FromMilliseconds(endTime - beatmap.Beatmap.HitObjects.First().StartTime).ToString(@"m\:ss"),
                    }));

                    labels.Add(new InfoLabel(new BeatmapStatistic
                    {
                        Name    = "BPM",
                        Icon    = FontAwesome.fa_circle,
                        Content = getBPMRange(beatmap.Beatmap),
                    }));

                    //get statistics from the current ruleset.
                    labels.AddRange(beatmapInfo.Ruleset.CreateInstance().GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s)));
                }

                PixelSnapping         = true;
                CacheDrawnFrameBuffer = true;
                RelativeSizeAxes      = Axes.Both;

                Children = new Drawable[]
                {
                    // We will create the white-to-black gradient by modulating transparency and having
                    // a black backdrop. This results in an sRGB-space gradient and not linear space,
                    // transitioning from white to black more perceptually uniformly.
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = Color4.Black,
                    },
                    // We use a container, such that we can set the colour gradient to go across the
                    // vertices of the masked container instead of the vertices of the (larger) sprite.
                    new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        ColourInfo       = ColourInfo.GradientVertical(Color4.White, Color4.White.Opacity(0.3f)),
                        Children         = new[]
                        {
                            // Zoomed-in and cropped beatmap background
                            new BeatmapBackgroundSprite(beatmap)
                            {
                                RelativeSizeAxes = Axes.Both,
                                Anchor           = Anchor.Centre,
                                Origin           = Anchor.Centre,
                                FillMode         = FillMode.Fill,
                            },
                        },
                    },
                    new DifficultyColourBar(beatmap.BeatmapInfo)
                    {
                        RelativeSizeAxes = Axes.Y,
                        Width            = 20,
                    },
                    new FillFlowContainer
                    {
                        Name      = "Top-aligned metadata",
                        Anchor    = Anchor.TopLeft,
                        Origin    = Anchor.TopLeft,
                        Direction = FillDirection.Vertical,
                        Margin    = new MarginPadding {
                            Top = 10, Left = 25, Right = 10, Bottom = 20
                        },
                        AutoSizeAxes = Axes.Both,
                        Children     = new Drawable[]
                        {
                            new OsuSpriteText
                            {
                                Font     = @"Exo2.0-MediumItalic",
                                Text     = beatmapInfo.Version,
                                TextSize = 24,
                            },
                        }
                    },
                    new FillFlowContainer
                    {
                        Name      = "Bottom-aligned metadata",
                        Anchor    = Anchor.BottomLeft,
                        Origin    = Anchor.BottomLeft,
                        Direction = FillDirection.Vertical,
                        Margin    = new MarginPadding {
                            Top = 15, Left = 25, Right = 10, Bottom = 20
                        },
                        AutoSizeAxes = Axes.Both,
                        Children     = new Drawable[]
                        {
                            new OsuSpriteText
                            {
                                Font     = @"Exo2.0-MediumItalic",
                                Text     = !string.IsNullOrEmpty(metadata.Source) ? metadata.Source + " — " + metadata.Title : metadata.Title,
                                TextSize = 28,
                            },
                            new OsuSpriteText
                            {
                                Font     = @"Exo2.0-MediumItalic",
                                Text     = metadata.Artist,
                                TextSize = 17,
                            },
                            new FillFlowContainer
                            {
                                Margin = new MarginPadding {
                                    Top = 10
                                },
                                Direction    = FillDirection.Horizontal,
                                AutoSizeAxes = Axes.Both,
                                Children     = new[]
                                {
                                    new OsuSpriteText
                                    {
                                        Font     = @"Exo2.0-Medium",
                                        Text     = "mapped by ",
                                        TextSize = 15,
                                    },
                                    new OsuSpriteText
                                    {
                                        Font     = @"Exo2.0-Bold",
                                        Text     = metadata.Author,
                                        TextSize = 15,
                                    },
                                }
                            },
                            new FillFlowContainer
                            {
                                Margin = new MarginPadding {
                                    Top = 20, Left = 10
                                },
                                Spacing      = new Vector2(40, 0),
                                AutoSizeAxes = Axes.Both,
                                Children     = labels
                            },
                        }
                    },
                };
            }
Ejemplo n.º 27
0
 /// <summary>
 /// Invoked when a <see cref="HitObject"/> is added to this <see cref="Playfield"/>.
 /// </summary>
 /// <param name="hitObject">The added <see cref="HitObject"/>.</param>
 protected virtual void OnHitObjectAdded(HitObject hitObject)
 {
 }
Ejemplo n.º 28
0
 public void Remove(HitObject hitObject) => blueprintContainer.RemoveBlueprintFor(DrawableRuleset.Remove(hitObject));
Ejemplo n.º 29
0
 /// <summary>
 /// Invoked when a <see cref="HitObject"/> is removed from this <see cref="Playfield"/>.
 /// </summary>
 /// <param name="hitObject">The removed <see cref="HitObject"/>.</param>
 protected virtual void OnHitObjectRemoved(HitObject hitObject)
 {
 }
 protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableSlider((Slider)hitObject);
Ejemplo n.º 31
0
 protected virtual HitObjectLifetimeEntry CreateLifetimeEntry([NotNull] HitObject hitObject) => new HitObjectLifetimeEntry(hitObject);
        public HitObjectPatternGenerator(FastRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, double previousTime, Vector2 previousPosition, double density,
                                         PatternType lastStair, IBeatmap originalBeatmap)
            : base(random, hitObject, beatmap, previousPattern, originalBeatmap)
        {
            StairType = lastStair;

            TimingControlPoint timingPoint = beatmap.ControlPointInfo.TimingPointAt(hitObject.StartTime);
            EffectControlPoint effectPoint = beatmap.ControlPointInfo.EffectPointAt(hitObject.StartTime);

            var positionData = hitObject as IHasPosition;

            float  positionSeparation = ((positionData?.Position ?? Vector2.Zero) - previousPosition).Length;
            double timeSeparation     = hitObject.StartTime - previousTime;

            if (timeSeparation <= 80)
            {
                // More than 187 BPM
                convertType |= PatternType.ForceNotStack | PatternType.KeepSingle;
            }
            else if (timeSeparation <= 95)
            {
                // More than 157 BPM
                convertType |= PatternType.ForceNotStack | PatternType.KeepSingle | lastStair;
            }
            else if (timeSeparation <= 105)
            {
                // More than 140 BPM
                convertType |= PatternType.ForceNotStack | PatternType.LowProbability;
            }
            else if (timeSeparation <= 125)
            {
                // More than 120 BPM
                convertType |= PatternType.ForceNotStack;
            }
            else if (timeSeparation <= 135 && positionSeparation < 20)
            {
                // More than 111 BPM stream
                convertType |= PatternType.Cycle | PatternType.KeepSingle;
            }
            else if (timeSeparation <= 150 && positionSeparation < 20)
            {
                // More than 100 BPM stream
                convertType |= PatternType.ForceStack | PatternType.LowProbability;
            }
            else if (positionSeparation < 20 && density >= timingPoint.BeatLength / 2.5)
            {
                // Low density stream
                convertType |= PatternType.Reverse | PatternType.LowProbability;
            }
            else if (density < timingPoint.BeatLength / 2.5 || effectPoint.KiaiMode)
            {
                // High density
            }
            else
            {
                convertType |= PatternType.LowProbability;
            }

            if (!convertType.HasFlag(PatternType.KeepSingle))
            {
                if (HitObject.Samples.Any(s => s.Name == HitSampleInfo.HIT_FINISH) && TotalColumns != 8)
                {
                    convertType |= PatternType.Mirror;
                }
                else if (HitObject.Samples.Any(s => s.Name == HitSampleInfo.HIT_CLAP))
                {
                    convertType |= PatternType.Gathered;
                }
            }
        }
Ejemplo n.º 33
0
    // Collision Sweep
    public void WallSweep()
    {
        // Clear the wall array
        walls = new float[visionAngleWalls];
        wallObjects.Clear ();

        // Vision should be + and - so we need to halve it.
        float visionModifier = (visionAngleWalls / 2);

        // We will need to reset to the center once we have done a sweep
        Quaternion resetRotation = transform.localRotation;

        // Capture All Hits
        RaycastHit hit;

        // Loop round + and - to create a vision cone
        for (int i = 0; i < visionAngleWalls; i ++){

            // Move the rotation based on I.
            Quaternion rotation = Quaternion.Euler (transform.localRotation.x, transform.localRotation.y + (i - visionModifier), transform.localRotation.z);
            transform.localRotation = rotation;

            // Cast a ray
            Vector3 fwd = transform.TransformDirection (Vector3.forward);

            // We have hit something... bettr check what?
            if (Physics.Raycast (transform.position, fwd, out hit, radarRangeWalls)) {

                //registers the hit
                walls[i] = hit.distance;

                // We hit something and it wasnt a wall.. add it to the array.
                HitObject hitOBJ = new HitObject(hit.transform.gameObject, hit.distance, i - visionModifier);

                // Check if we have already added this object... we scan with VERY high fidelity.
                if (!HasDuplicate(hitOBJ))
                    wallObjects.Add(hitOBJ);

            } else {
                walls[i] = radarRangeWalls;
            }
            // Uncomment the next line for debug on the sweep.
            Debug.DrawLine(transform.position, (transform.position + (transform.forward * radarRangeWalls)) , Color.blue);
        }

        // Reset the rotation to the center.
        transform.rotation = resetRotation;
    }