/// <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));
public SpecificBeatmapPatternGenerator(FastRandom random, HitObject hitObject, Beatmap beatmap, int availableColumns, Pattern previousPattern) : base(random, hitObject, beatmap, availableColumns, previousPattern) { }
public void Delete(HitObject hitObject) { }
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) { }
private bool isKat(HitObject h) { return(h.hitSound.HasFlag(HitSound.Clap) || h.hitSound.HasFlag(HitSound.Whistle)); }
protected DrawableHitObject(HitObject hitObject) { HitObject = hitObject; }
public BosuHitObjectLifetimeEntry(HitObject hitObject) : base(hitObject) { }
private bool isHit(HitObject h) { return(h.type.HasFlag(HitObject.Type.Circle)); }
protected override HitObjectLifetimeEntry CreateLifetimeEntry(HitObject hitObject) => new BosuHitObjectLifetimeEntry(hitObject);
protected override HitObjectLifetimeEntry CreateLifetimeEntry(HitObject hitObject) => new SentakkiHitObjectLifetimeEntry(hitObject, sentakkiRulesetConfig, drawableSentakkiRuleset);
// 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; }
protected override SelectionBlueprint CreateBlueprintFor(HitObject hitObject) => new TimelineHitObjectBlueprint(hitObject) { OnDragHandled = handleScrollViaDrag };
private double getDeltaTime(HitObject h) { return(deltaTimes.GetValueOrDefault(h, 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; }
protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableHitCircle((HitCircle)hitObject);
protected override IEnumerable <TestHitObject> ConvertHitObject(HitObject original, IBeatmap beatmap, CancellationToken cancellationToken) => throw new NotImplementedException();
public OsuJudgementResult(HitObject hitObject, Judgement judgement) : base(hitObject, judgement) { }
protected virtual JudgementResult CreateResult(HitObject hitObject, Judgement judgement) => new JudgementResult(hitObject, judgement);
protected virtual void OnConversionGenerated(HitObject original, IEnumerable <HitObject> result, IBeatmapConverter beatmapConverter) { }
public void BeginPlacement(HitObject hitObject) { }
/// <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();
protected abstract DrawableHitObject CreateHitObject(HitObject hitObject);
/// <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);
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 }, } }, }; }
/// <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) { }
public void Remove(HitObject hitObject) => blueprintContainer.RemoveBlueprintFor(DrawableRuleset.Remove(hitObject));
/// <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);
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; } } }
// 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; }