void ApplyAutocompleteText()
{
int startLength = 0;
if (consoleText.ToLower().StartsWith("print "))
{
startLength += 6;
}
string[] dotSplits = consoleText.Split('.');
bool hasMethodNames = foundMethodNames.Count > 0;
bool hasFieldNames = foundFieldNames.Count > 0;
bool hasPropertyNames = foundPropertyNames.Count > 0;
if (hasMethodNames || hasFieldNames || hasPropertyNames)
{
int numWindows = 0;
if (hasMethodNames) numWindows++;
if (hasFieldNames || hasPropertyNames) numWindows++;
string noCall = consoleText.Substring(startLength, consoleText.Length - startLength);
consoleText = consoleText.Substring(0, startLength) + noCall.Substring(0, noCall.LastIndexOf('.')) + ".";
if (autocompleteWindowIndex == 0 && hasMethodNames)
{
consoleText += foundMethodNames[autocompleteIndex];
}
else
{
if (autocompleteIndex < foundFieldNames.Count)
{
consoleText += foundFieldNames[autocompleteIndex];
}
else
{
consoleText += foundPropertyNames[autocompleteIndex - foundFieldNames.Count];
}
}
focusOnTextField = true;
}
else if (foundComponentNames.Count > 0)
{
string noCall = consoleText.Substring(startLength, consoleText.Length - startLength);
consoleText = consoleText.Substring(0, startLength) + noCall.Substring(0, noCall.LastIndexOf('.')) + ".";
consoleText += foundComponentNames[autocompleteIndex] + ".";
focusOnTextField = true;
}
else if (foundGameObjectNames.Count > 0)
{
string noCall = consoleText.Substring(startLength, consoleText.Length - startLength);
consoleText = consoleText.Substring(0, startLength) + noCall.Substring(0, consoleText.LastIndexOf(dotSplits[dotSplits.Length - 1]));
consoleText += foundGameObjectNames[autocompleteIndex] + ".";
focusOnTextField = true;
}
}
}