mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 07:22:55 +08:00
Add TextBoxOption and wire it up
This commit is contained in:
parent
d6dafd6b70
commit
a81f099d40
@ -11,6 +11,7 @@ namespace osu.Game.Overlays.Options.Online
|
|||||||
protected override string Header => "In-game Chat";
|
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()
|
public InGameChatOptions()
|
||||||
{
|
{
|
||||||
@ -21,9 +22,9 @@ namespace osu.Game.Overlays.Options.Online
|
|||||||
logPMs = new CheckBoxOption { LabelText = "Log private messages" },
|
logPMs = new CheckBoxOption { LabelText = "Log private messages" },
|
||||||
blockPMs = new CheckBoxOption { LabelText = "Block private messages from non-friends" },
|
blockPMs = new CheckBoxOption { LabelText = "Block private messages from non-friends" },
|
||||||
new SpriteText { Text = "Chat ignore list (space-seperated list)" },
|
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 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<bool>(OsuConfig.ChatRemoveForeign);
|
filterForeign.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.ChatRemoveForeign);
|
||||||
logPMs.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.LogPrivateMessages);
|
logPMs.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.LogPrivateMessages);
|
||||||
blockPMs.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.BlockNonFriendPM);
|
blockPMs.Bindable = osuGame.Config.GetBindable<bool>(OsuConfig.BlockNonFriendPM);
|
||||||
|
chatIgnoreList.Bindable = osuGame.Config.GetBindable<string>(OsuConfig.IgnoreList);
|
||||||
|
chatHighlightWords.Bindable = osuGame.Config.GetBindable<string>(OsuConfig.HighlightWords);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
49
osu.Game/Overlays/Options/TextBoxOption.cs
Normal file
49
osu.Game/Overlays/Options/TextBoxOption.cs
Normal file
@ -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<string> bindable;
|
||||||
|
|
||||||
|
public Bindable<string> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -232,6 +232,7 @@
|
|||||||
<Compile Include="Overlays\Options\Online\PrivacyOptions.cs" />
|
<Compile Include="Overlays\Options\Online\PrivacyOptions.cs" />
|
||||||
<Compile Include="Overlays\Options\Online\NotificationsOptions.cs" />
|
<Compile Include="Overlays\Options\Online\NotificationsOptions.cs" />
|
||||||
<Compile Include="Overlays\Options\CheckBoxOption.cs" />
|
<Compile Include="Overlays\Options\CheckBoxOption.cs" />
|
||||||
|
<Compile Include="Overlays\Options\TextBoxOption.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj">
|
<ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj">
|
||||||
|
Loading…
Reference in New Issue
Block a user