1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 10:52:53 +08:00

use runOnceImmediately instead of duplicating logic

This commit is contained in:
Liam DeVoe 2023-06-19 18:20:16 -04:00
parent 591277e0f9
commit f7dde53f9b

View File

@ -88,9 +88,7 @@ namespace osu.Game.Overlays.Comments
{ {
Height = 40, Height = 40,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
PlaceholderText = GetTextBoxPlaceholder(API.IsLoggedIn), Current = Current
Current = Current,
ReadOnly = !API.IsLoggedIn
}, },
new Container new Container
{ {
@ -126,7 +124,6 @@ namespace osu.Game.Overlays.Comments
Spacing = new Vector2(5, 0), Spacing = new Vector2(5, 0),
Child = commitButton = new EditorButton Child = commitButton = new EditorButton
{ {
Text = GetCommitButtonText(API.IsLoggedIn),
Action = () => commitOrLogIn(Current.Value) Action = () => commitOrLogIn(Current.Value)
} }
}, },
@ -152,7 +149,7 @@ namespace osu.Game.Overlays.Comments
{ {
base.LoadComplete(); base.LoadComplete();
Current.BindValueChanged(_ => updateCommitButtonState(), true); Current.BindValueChanged(_ => updateCommitButtonState(), true);
User.BindValueChanged(_ => updateStateForLoggedIn()); User.BindValueChanged(_ => updateStateForLoggedIn(), true);
} }
protected abstract void OnCommit(string text); protected abstract void OnCommit(string text);