TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ GetInputText()

static string Terraria.Main.GetInputText ( string oldString,
bool allowMultiLine = false )
inlinestatic

Definition at line 19324 of file Main.cs.

19325 {
19326 //IL_012a: Unknown result type (might be due to invalid IL or missing references)
19327 //IL_01ee: Unknown result type (might be due to invalid IL or missing references)
19328 //IL_01f3: Unknown result type (might be due to invalid IL or missing references)
19329 //IL_01f8: Unknown result type (might be due to invalid IL or missing references)
19330 //IL_01fd: Unknown result type (might be due to invalid IL or missing references)
19331 //IL_02e9: Unknown result type (might be due to invalid IL or missing references)
19332 if (dedServ)
19333 {
19334 return "";
19335 }
19336 if (!hasFocus)
19337 {
19338 return oldString;
19339 }
19340 inputTextEnter = false;
19341 inputTextEscape = false;
19342 string text = oldString;
19343 string text2 = "";
19344 if (text == null)
19345 {
19346 text = "";
19347 }
19348 bool flag = false;
19349 if (((KeyboardState)(ref inputText)).IsKeyDown((Keys)162) || ((KeyboardState)(ref inputText)).IsKeyDown((Keys)163))
19350 {
19351 if (((KeyboardState)(ref inputText)).IsKeyDown((Keys)90) && !((KeyboardState)(ref oldInputText)).IsKeyDown((Keys)90))
19352 {
19353 text = "";
19354 }
19355 else if (((KeyboardState)(ref inputText)).IsKeyDown((Keys)88) && !((KeyboardState)(ref oldInputText)).IsKeyDown((Keys)88))
19356 {
19357 Platform.Get<IClipboard>().Value = oldString;
19358 text = "";
19359 }
19360 else if ((((KeyboardState)(ref inputText)).IsKeyDown((Keys)67) && !((KeyboardState)(ref oldInputText)).IsKeyDown((Keys)67)) || (((KeyboardState)(ref inputText)).IsKeyDown((Keys)45) && !((KeyboardState)(ref oldInputText)).IsKeyDown((Keys)45)))
19361 {
19362 Platform.Get<IClipboard>().Value = oldString;
19363 }
19364 else if (((KeyboardState)(ref inputText)).IsKeyDown((Keys)86) && !((KeyboardState)(ref oldInputText)).IsKeyDown((Keys)86))
19365 {
19367 }
19368 }
19369 else
19370 {
19371 if (inputText.PressingShift())
19372 {
19373 if (((KeyboardState)(ref inputText)).IsKeyDown((Keys)46) && !((KeyboardState)(ref oldInputText)).IsKeyDown((Keys)46))
19374 {
19375 Platform.Get<IClipboard>().Value = oldString;
19376 text = "";
19377 }
19378 if (((KeyboardState)(ref inputText)).IsKeyDown((Keys)45) && !((KeyboardState)(ref oldInputText)).IsKeyDown((Keys)45))
19379 {
19381 }
19382 }
19383 for (int i = 0; i < keyCount; i++)
19384 {
19385 int num = keyInt[i];
19386 string text3 = keyString[i];
19387 if (num == 13)
19388 {
19389 inputTextEnter = true;
19390 }
19391 else if (num == 27)
19392 {
19393 inputTextEscape = true;
19394 }
19395 else if (num >= 32 && num != 127)
19396 {
19397 text2 += text3;
19398 }
19399 }
19400 }
19401 keyCount = 0;
19402 text += text2;
19404 inputText = Keyboard.GetState();
19405 Keys[] pressedKeys = ((KeyboardState)(ref inputText)).GetPressedKeys();
19406 Keys[] pressedKeys2 = ((KeyboardState)(ref oldInputText)).GetPressedKeys();
19407 if (((KeyboardState)(ref inputText)).IsKeyDown((Keys)8) && ((KeyboardState)(ref oldInputText)).IsKeyDown((Keys)8))
19408 {
19409 backSpaceRate -= 0.05f;
19410 if (backSpaceRate < 0f)
19411 {
19412 backSpaceRate = 0f;
19413 }
19414 if (backSpaceCount <= 0)
19415 {
19416 backSpaceCount = (int)Math.Round(backSpaceRate);
19417 flag = true;
19418 }
19420 }
19421 else
19422 {
19423 backSpaceRate = 7f;
19424 backSpaceCount = 15;
19425 }
19426 for (int j = 0; j < pressedKeys.Length; j++)
19427 {
19428 bool flag2 = true;
19429 for (int k = 0; k < pressedKeys2.Length; k++)
19430 {
19431 if ((int)pressedKeys[j] == (int)pressedKeys2[k])
19432 {
19433 flag2 = false;
19434 }
19435 }
19436 if (string.Concat(pressedKeys[j]) == "Back" && (flag2 || flag) && text.Length > 0)
19437 {
19438 TextSnippet[] array = ChatManager.ParseMessage(text, Color.White).ToArray();
19439 text = ((!array[^1].DeleteWhole) ? text.Substring(0, text.Length - 1) : text.Substring(0, text.Length - array[^1].TextOriginal.Length));
19440 }
19441 }
19442 return text;
19443 }
static int keyCount
Definition Main.cs:736
static string PasteTextIn(bool allowMultiLine, string newKeys)
Definition Main.cs:19445
static bool inputTextEscape
Definition Main.cs:1896
static KeyboardState inputText
Definition Main.cs:2110
static bool hasFocus
Definition Main.cs:1934
static bool dedServ
Definition Main.cs:1301
static int backSpaceCount
Definition Main.cs:2062
static KeyboardState oldInputText
Definition Main.cs:2112
static int[] keyInt
Definition Main.cs:740
static float backSpaceRate
Definition Main.cs:2064
static string[] keyString
Definition Main.cs:738
static bool inputTextEnter
Definition Main.cs:1894
static List< TextSnippet > ParseMessage(string text, Color baseColor)

References Terraria.Main.backSpaceCount, Terraria.Main.backSpaceRate, Terraria.Main.dedServ, Terraria.UI.Chat.TextSnippet.DeleteWhole, Terraria.Main.hasFocus, Terraria.Main.inputText, Terraria.Main.inputTextEnter, Terraria.Main.inputTextEscape, Terraria.GameInput.Keyboard, Terraria.Main.keyCount, Terraria.Main.keyInt, Terraria.Main.keyString, Terraria.Main.oldInputText, Terraria.UI.Chat.ChatManager.ParseMessage(), Terraria.Main.PasteTextIn(), Terraria.Enums.Platform, and Terraria.UI.Chat.TextSnippet.TextOriginal.

Referenced by Terraria.Main.DoUpdate_HandleChat(), Terraria.Main.DrawMenu(), Terraria.GameContent.UI.Elements.UISearchBar.DrawSelf(), Terraria.GameContent.UI.States.UIVirtualKeyboard.DrawSelf(), Terraria.ModLoader.UI.UIFocusInputTextField.DrawSelf(), Terraria.ModLoader.UI.UIInputTextField.DrawSelf(), Terraria.Main.InputTextChest(), Terraria.Main.InputTextSign(), Terraria.Social.WeGame.NetClientSocialModule.OnAuthSuccess(), Terraria.Social.Steam.NetClientSocialModule.OnLobbyEntered(), and Terraria.GameContent.UI.Elements.UIWorldListItem.PlayGame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: