diff --git a/osu.Game/Overlays/Options/Online/InGameChatOptions.cs b/osu.Game/Overlays/Options/Online/InGameChatOptions.cs index 29316b60fc..ac459f2910 100644 --- a/osu.Game/Overlays/Options/Online/InGameChatOptions.cs +++ b/osu.Game/Overlays/Options/Online/InGameChatOptions.cs @@ -10,7 +10,8 @@ namespace osu.Game.Overlays.Options.Online { protected override string Header => "In-game Chat"; - private CheckBoxOption filterWords, filterForeign, logPMs, blockPMs; + private CheckBoxOption filterWords, filterForeign, logPMs, blockPMs; + private TextBoxOption chatIgnoreList, chatHighlightWords; public InGameChatOptions() { @@ -21,9 +22,9 @@ namespace osu.Game.Overlays.Options.Online logPMs = new CheckBoxOption { LabelText = "Log private messages" }, blockPMs = new CheckBoxOption { LabelText = "Block private messages from non-friends" }, new SpriteText { Text = "Chat ignore list (space-seperated list)" }, - new TextBox { Height = 20, RelativeSizeAxes = Axes.X }, + chatIgnoreList = new TextBoxOption { Height = 20, RelativeSizeAxes = Axes.X }, new SpriteText { Text = "Chat highlight words (space-seperated list)" }, - new TextBox { Height = 20, RelativeSizeAxes = Axes.X }, + chatHighlightWords = new TextBoxOption { Height = 20, RelativeSizeAxes = Axes.X }, }; } @@ -37,6 +38,8 @@ namespace osu.Game.Overlays.Options.Online filterForeign.Bindable = osuGame.Config.GetBindable(OsuConfig.ChatRemoveForeign); logPMs.Bindable = osuGame.Config.GetBindable(OsuConfig.LogPrivateMessages); blockPMs.Bindable = osuGame.Config.GetBindable(OsuConfig.BlockNonFriendPM); + chatIgnoreList.Bindable = osuGame.Config.GetBindable(OsuConfig.IgnoreList); + chatHighlightWords.Bindable = osuGame.Config.GetBindable(OsuConfig.HighlightWords); } } } diff --git a/osu.Game/Overlays/Options/TextBoxOption.cs b/osu.Game/Overlays/Options/TextBoxOption.cs new file mode 100644 index 0000000000..ffd9c86b71 --- /dev/null +++ b/osu.Game/Overlays/Options/TextBoxOption.cs @@ -0,0 +1,49 @@ +using System; +using osu.Framework.Configuration; +using osu.Framework.Graphics.UserInterface; + +namespace osu.Game.Overlays.Options +{ + public class TextBoxOption : TextBox + { + private Bindable bindable; + + public Bindable Bindable + { + set + { + if (bindable != null) + bindable.ValueChanged -= bindableValueChanged; + bindable = value; + if (bindable != null) + { + base.Text = bindable.Value; + bindable.ValueChanged += bindableValueChanged; + } + } + } + + protected override string InternalText + { + get { return base.InternalText; } + set + { + base.InternalText = value; + if (bindable != null) + bindable.Value = value; + } + } + + private void bindableValueChanged(object sender, EventArgs e) + { + Text = bindable.Value; + } + + protected override void Dispose(bool isDisposing) + { + if (bindable != null) + bindable.ValueChanged -= bindableValueChanged; + base.Dispose(isDisposing); + } + } +} \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 4977317f0c..842cb1e546 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -234,6 +234,7 @@ +