static int MoveTextEnd(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); TMPro.TMP_InputField obj = (TMPro.TMP_InputField)ToLua.CheckObject(L, 1, typeof(TMPro.TMP_InputField)); bool arg0 = LuaDLL.luaL_checkboolean(L, 2); obj.MoveTextEnd(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void Tick(ChatSystemClient chatSystem) { // Handle outgoing messages foreach (var l in m_ChatLinesToSend) { if (chatSystem != null) { chatSystem.SendMessage(l); } else { AddLine(l); } } m_ChatLinesToSend.Clear(); // Handle incoming messages if (chatSystem != null) { while (chatSystem.incomingMessages.Count > 0) { var message = chatSystem.incomingMessages.Dequeue(); AddLine(message); } } if (m_MoveToEnd) { field.MoveTextEnd(true); m_MoveToEnd = false; } if (!m_IsOpen && Game.Input.GetKeyDown(activationKey)) { field.textComponent.enabled = true; field.interactable = true; field.ActivateInputField(); m_MoveToEnd = true; m_IsOpen = true; Game.Input.SetBlock(Game.Input.Blocker.Chat, true); FadeBackgrounds(1.0f, 0.2f); foreach (var line in m_Lines) { line.Show(); } } else if (m_IsOpen && !field.isFocused) { m_IsOpen = false; Game.Input.SetBlock(Game.Input.Blocker.Chat, false); field.interactable = false; FadeBackgrounds(0.0f, 0.7f); foreach (var line in m_Lines) { line.changeTime = Time.time; } } else if (m_IsOpen && Input.GetKeyDown(KeyCode.Tab)) { var text = field.text; for (int i = 0, l = messagePrefixes.Length; i < l; ++i) { var prefixMatch = text.PrefixMatch(messagePrefixes[i]); if (prefixMatch > 1) { var oldCaretReverse = field.text.Length - field.caretPosition; defaultPrefix = messagePrefixes[(i + 1) % l]; field.text = defaultPrefix + text.Substring(prefixMatch); field.caretPosition = field.text.Length - oldCaretReverse; break; } } } if (!m_IsOpen) { // Fade out old lines foreach (var line in m_Lines) { if (Time.time - line.changeTime > 4.0f) { line.Hide(); } } field.textComponent.enabled = false; } }