mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 04:42:58 +08:00
Naming adjustments
This commit is contained in:
parent
53a2b65dbd
commit
9ac6c271ac
@ -6,6 +6,8 @@ using System.Collections.Generic;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Comments;
|
using osu.Game.Overlays.Comments;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -23,8 +25,21 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
[Cached]
|
[Cached]
|
||||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
|
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
|
||||||
|
|
||||||
|
private readonly OsuSpriteText text;
|
||||||
|
private readonly TestCommentEditor commentEditor;
|
||||||
|
private readonly TestCancellableCommentEditor cancellableCommentEditor;
|
||||||
|
|
||||||
public TestSceneCommentEditor()
|
public TestSceneCommentEditor()
|
||||||
{
|
{
|
||||||
|
Add(new Container
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Child = text = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Font = OsuFont.GetFont()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Add(new FillFlowContainer
|
Add(new FillFlowContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
@ -35,12 +50,29 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
Spacing = new Vector2(0, 20),
|
Spacing = new Vector2(0, 20),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new TestCommentEditor(),
|
commentEditor = new TestCommentEditor
|
||||||
new TestCancellableCommentEditor()
|
{
|
||||||
|
OnCommit = onCommit
|
||||||
|
},
|
||||||
|
cancellableCommentEditor = new TestCancellableCommentEditor
|
||||||
|
{
|
||||||
|
OnCommit = onCommit
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onCommit(string value)
|
||||||
|
{
|
||||||
|
text.Text = $@"Invoked text: {value}";
|
||||||
|
|
||||||
|
Scheduler.AddDelayed(() =>
|
||||||
|
{
|
||||||
|
commentEditor.IsLoading = false;
|
||||||
|
cancellableCommentEditor.IsLoading = false;
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
|
||||||
private class TestCommentEditor : CommentEditor
|
private class TestCommentEditor : CommentEditor
|
||||||
{
|
{
|
||||||
protected override string FooterText => @"Footer text. And it is pretty long. Cool.";
|
protected override string FooterText => @"Footer text. And it is pretty long. Cool.";
|
||||||
|
@ -24,6 +24,12 @@ namespace osu.Game.Overlays.Comments
|
|||||||
|
|
||||||
public Action<string> OnCommit;
|
public Action<string> OnCommit;
|
||||||
|
|
||||||
|
public bool IsLoading
|
||||||
|
{
|
||||||
|
get => commitButton.IsLoading;
|
||||||
|
set => commitButton.IsLoading = value;
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract string FooterText { get; }
|
protected abstract string FooterText { get; }
|
||||||
|
|
||||||
protected abstract string CommitButtonText { get; }
|
protected abstract string CommitButtonText { get; }
|
||||||
@ -107,7 +113,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
|
|
||||||
textbox.OnCommit += (u, v) =>
|
textbox.OnCommit += (u, v) =>
|
||||||
{
|
{
|
||||||
if (!commitButton.IsReady.Value)
|
if (commitButton.IsBlocked.Value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
commitButton.Click();
|
commitButton.Click();
|
||||||
@ -119,7 +125,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
current.BindValueChanged(text => commitButton.IsReady.Value = !string.IsNullOrEmpty(text.NewValue), true);
|
current.BindValueChanged(text => commitButton.IsBlocked.Value = string.IsNullOrEmpty(text.NewValue), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class EditorTextbox : BasicTextBox
|
private class EditorTextbox : BasicTextBox
|
||||||
@ -156,9 +162,9 @@ namespace osu.Game.Overlays.Comments
|
|||||||
{
|
{
|
||||||
private const int duration = 200;
|
private const int duration = 200;
|
||||||
|
|
||||||
public readonly BindableBool IsReady = new BindableBool();
|
public readonly BindableBool IsBlocked = new BindableBool();
|
||||||
|
|
||||||
public override bool PropagatePositionalInputSubTree => IsReady.Value && base.PropagatePositionalInputSubTree;
|
public override bool PropagatePositionalInputSubTree => !IsBlocked.Value && base.PropagatePositionalInputSubTree;
|
||||||
|
|
||||||
protected override IEnumerable<Drawable> EffectTargets => new[] { background };
|
protected override IEnumerable<Drawable> EffectTargets => new[] { background };
|
||||||
|
|
||||||
@ -186,17 +192,17 @@ namespace osu.Game.Overlays.Comments
|
|||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
IsReady.BindValueChanged(onReadyStateChanged, true);
|
IsBlocked.BindValueChanged(onBlockedStateChanged, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onReadyStateChanged(ValueChangedEvent<bool> isReady)
|
private void onBlockedStateChanged(ValueChangedEvent<bool> isBlocked)
|
||||||
{
|
{
|
||||||
drawableText.FadeColour(isReady.NewValue ? Color4.White : colourProvider.Foreground1, duration, Easing.OutQuint);
|
drawableText.FadeColour(isBlocked.NewValue ? colourProvider.Foreground1 : Color4.White, duration, Easing.OutQuint);
|
||||||
|
|
||||||
if (isReady.NewValue)
|
if (isBlocked.NewValue)
|
||||||
background.FadeColour(IsHovered ? HoverColour : IdleColour, duration, Easing.OutQuint);
|
|
||||||
else
|
|
||||||
background.FadeColour(colourProvider.Background5, duration, Easing.OutQuint);
|
background.FadeColour(colourProvider.Background5, duration, Easing.OutQuint);
|
||||||
|
else
|
||||||
|
background.FadeColour(IsHovered ? HoverColour : IdleColour, duration, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Drawable CreateContent() => new CircularContainer
|
protected override Drawable CreateContent() => new CircularContainer
|
||||||
|
Loading…
Reference in New Issue
Block a user