Skip to content

Commit

Permalink
bruh
Browse files Browse the repository at this point in the history
  • Loading branch information
MATRIX-feather committed Sep 21, 2024
1 parent bb9c74a commit 8434bde
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void Search(SearchOption searchOption)
}

//TODO: 实现新版网易云API的查询
if (true)
if (LyricPlugin.DisableCloudLookup)
{
setState(SearchState.Success);
searchOption.OnFinish?.Invoke(new APILyricResponseRoot());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public partial class LyricPlugin : BindableControlledPlugin
/// </summary>
public override TargetLayer Target => TargetLayer.Foreground;

public static bool DisableCloudLookup => false;

public override IPluginConfigManager CreateConfigManager(Storage storage)
=> new LyricConfigManager(storage);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,8 @@ public Toolbox()
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight
},
//TODO: 实现新版查询后移除此文本
new OsuSpriteText
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Colour = Color4.Gold,
Text = "在线查询功能暂时不可用,我们正在寻找新的适配方案"
},
buttonFillFlow = new FillFlowContainer
{
//TODO: REMOVE THIS
Scale = new Vector2(0),
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Spacing = new Vector2(5),
Expand Down Expand Up @@ -124,8 +114,14 @@ public void AddButtonRange(IconButton[] range, bool isRootScreen)
}
}

[Resolved]
private IImplementLLin llin { get; set; }

[Resolved]
private LyricConfigManager lcm { get; set; }

[BackgroundDependencyLoader]
private void load(LyricConfigManager lcm, IImplementLLin llin, LyricPlugin plugin)
private void load(LyricPlugin plugin)
{
udh ??= plugin.UserDefinitionHelper;

Expand All @@ -146,7 +142,25 @@ private void load(LyricConfigManager lcm, IImplementLLin llin, LyricPlugin plugi
});
}, true);

//TODO: UNDO THIS
if (LyricPlugin.DisableCloudLookup)
initToolboxNoContent();
else
initToolbox();
}

private void initToolboxNoContent()
{
buttonFillFlow.Scale = new Vector2(0);

contentFillFlow.Add(
new OsuSpriteText
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Colour = Color4.Gold,
Text = "在线查询功能暂时不可用,我们正在寻找新的适配方案"
});

contentFillFlow.Add(new SettingsSlider<double>
{
Anchor = Anchor.TopRight,
Expand All @@ -156,9 +170,21 @@ private void load(LyricConfigManager lcm, IImplementLLin llin, LyricPlugin plugi
RelativeSizeAxes = Axes.X,
Padding = new MarginPadding { Right = 10 }
});
}

private void initToolbox()
{
textBox = new OsuTextBox();
textBox.OnCommit += (sender, isNewText) =>
{
if (int.TryParse(sender.Text, out var id))
plugin.GetLyricFor(id);
else
{
textBox.Text = "";
}
};

//TODO: UNDO THIS TOO
/*
contentFillFlow.AddRange(new Drawable[]
{
new SettingsSlider<double>
Expand Down Expand Up @@ -220,18 +246,6 @@ private void load(LyricConfigManager lcm, IImplementLLin llin, LyricPlugin plugi
}
}
});
*/

textBox = new OsuTextBox();
textBox.OnCommit += (sender, isNewText) =>
{
if (int.TryParse(sender.Text, out var id))
plugin.GetLyricFor(id);
else
{
textBox.Text = "";
}
};
}

private string resolveBeatmapVerboseString(WorkingBeatmap working)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ public string TranslatedText
set
{
currentLineTranslated?.MoveToY(5, fadeOutDuration.Value, fadeOutEasing)
.FadeOut(fadeOutDuration.Value, fadeOutEasing).Then().Expire();
.FadeOut(fadeOutDuration.Value, fadeOutEasing)
.Then()
.Expire();

lyricContainer.Add(currentLineTranslated = new OsuSpriteText
{
Expand Down

0 comments on commit 8434bde

Please sign in to comment.