mirror of
https://github.com/ppy/osu.git
synced 2024-11-07 18:07:28 +08:00
disable button when select other reason
This commit is contained in:
parent
899860dd77
commit
31df626f0e
@ -24,8 +24,6 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
||||
private OsuEnumDropdown<T> reasonDropdown = null!;
|
||||
private OsuTextBox commentsTextBox = null!;
|
||||
private RoundedButton submitButton = null!;
|
||||
|
||||
public bool CanSubmitEmptyReason = false;
|
||||
public LocalisableString Header;
|
||||
|
||||
protected ReportPopover(LocalisableString headerString)
|
||||
@ -102,13 +100,21 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
||||
}
|
||||
};
|
||||
|
||||
if (!CanSubmitEmptyReason)
|
||||
{
|
||||
commentsTextBox.Current.BindValueChanged(e =>
|
||||
{
|
||||
submitButton.Enabled.Value = !string.IsNullOrWhiteSpace(e.NewValue);
|
||||
}, true);
|
||||
}
|
||||
commentsTextBox.Current.BindValueChanged(_ => updateStatus());
|
||||
|
||||
reasonDropdown.Current.BindValueChanged(_ => updateStatus());
|
||||
|
||||
updateStatus();
|
||||
}
|
||||
|
||||
private void updateStatus()
|
||||
{
|
||||
submitButton.Enabled.Value = !string.IsNullOrWhiteSpace(commentsTextBox.Current.Value) || CheckCanSubmitEmptyComment(reasonDropdown.Current.Value);
|
||||
}
|
||||
|
||||
protected virtual bool CheckCanSubmitEmptyComment(T reason)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,11 @@ namespace osu.Game.Overlays.Chat
|
||||
public ReportChatPopover(APIUser? user)
|
||||
: base(ReportStrings.UserTitle(user?.Username ?? @"Someone"))
|
||||
{
|
||||
CanSubmitEmptyReason = true;
|
||||
}
|
||||
|
||||
protected override bool CheckCanSubmitEmptyComment(ChatReportReason reason)
|
||||
{
|
||||
return reason != ChatReportReason.Other;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user