Skip to content

Commit

Permalink
IHasCalculatedProperty interface should not give the isUpdate() check…
Browse files Browse the repository at this point in the history
… command.

Because stage info doesn't know if the property is updated or not. It depends on the property (e.g. lyric) in the beatmap also.
If the user wants to re-calculate the stage info after doing some changes in the editor, then just call this method.
  • Loading branch information
andy840119 committed Dec 8, 2024
1 parent 35db307 commit f15e537
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 34 deletions.
22 changes: 0 additions & 22 deletions osu.Game.Rulesets.Karaoke/Stages/Infos/Preview/PreviewStageInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,32 +40,12 @@ public class PreviewStageInfo : StageInfo, IHasCalculatedProperty

#region Validation

private bool calculatedPropertyIsUpdated;

/// <summary>
/// Mark the stage info's calculated property as invalidate.
/// </summary>
/// <returns></returns>
public void TriggerRecalculate()
{
calculatedPropertyIsUpdated = false;
}

/// <summary>
/// Check if the stage info's calculated property is calculated and the value is the latest.
/// </summary>
/// <returns></returns>
public bool IsUpdated() => calculatedPropertyIsUpdated;

/// <summary>
/// If the calculated property is not updated, then re-calculate the property inside the stage info in the <see cref="KaraokeBeatmapProcessor"/>
/// </summary>
/// <param name="beatmap"></param>
public void ValidateCalculatedProperty(IBeatmap beatmap)
{
if (IsUpdated())
return;

var calculator = new PreviewStageTimingCalculator(beatmap, StageDefinition);

// also, clear all mapping in the layout and re-create one.
Expand All @@ -85,8 +65,6 @@ public void ValidateCalculatedProperty(IBeatmap beatmap)
});
layoutCategory.AddToMapping(element, lyric);
}

calculatedPropertyIsUpdated = true;
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,6 @@ namespace osu.Game.Rulesets.Karaoke.Stages.Infos.Types;

public interface IHasCalculatedProperty
{
/// <summary>
/// Mark the stage info's calculated property as invalidate.
/// </summary>
/// <returns></returns>
void TriggerRecalculate();

/// <summary>
/// Check if the stage info's calculated property is calculated and the value is the latest.
/// </summary>
/// <returns></returns>
bool IsUpdated();

/// <summary>
/// If the calculated property is not updated, then re-calculate the property inside the stage info in the <see cref="KaraokeBeatmapProcessor"/>
/// </summary>
Expand Down

0 comments on commit f15e537

Please sign in to comment.