Removed generic parameter function

This commit is contained in:
MrTheMake
2017-09-22 16:17:03 +02:00
parent 02bc429911
commit 34fb6ccdf5

View File

@ -482,21 +482,22 @@ namespace osu.Game.Overlays
if (postText[0] == '/') if (postText[0] == '/')
{ {
string unhandeledParameters = postText.Substring(1); string[] parameters = postText.Substring(1).Split(new[] { ' ' }, 2);
string commandKeyword = cutFirstParameter(ref unhandeledParameters); string command = parameters[0];
string content = parameters.Length == 2 ? parameters[1] : string.Empty;
switch (commandKeyword) switch (command)
{ {
case "me": case "me":
if (string.IsNullOrWhiteSpace(unhandeledParameters)) if (string.IsNullOrWhiteSpace(content))
{ {
currentChannel.AddNewMessages(new ErrorMessage("Usage: /me [action]")); currentChannel.AddNewMessages(new ErrorMessage("Usage: /me [action]"));
return; return;
} }
isAction = true; isAction = true;
postText = unhandeledParameters; postText = content;
break; break;
case "help": case "help":
@ -504,7 +505,7 @@ namespace osu.Game.Overlays
return; return;
default: default:
currentChannel.AddNewMessages(new ErrorMessage($@"""/{commandKeyword}"" is not supported! For a list of supported commands see /help")); currentChannel.AddNewMessages(new ErrorMessage($@"""/{command}"" is not supported! For a list of supported commands see /help"));
return; return;
} }
} }
@ -528,13 +529,6 @@ namespace osu.Game.Overlays
api.Queue(req); api.Queue(req);
} }
private string cutFirstParameter(ref string parameters)
{
string result = parameters.Split(' ')[0];
parameters = result.Length == parameters.Length ? "" : parameters.Substring(result.Length + 1);
return result;
}
private void transformChatHeightTo(double newChatHeight, double duration = 0, Easing easing = Easing.None) private void transformChatHeightTo(double newChatHeight, double duration = 0, Easing easing = Easing.None)
{ {
this.TransformTo(this.PopulateTransform(new TransformChatHeight(), newChatHeight, duration, easing)); this.TransformTo(this.PopulateTransform(new TransformChatHeight(), newChatHeight, duration, easing));