Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
MistaOmega committed Sep 25, 2024
1 parent af49b16 commit 1b48d28
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions NitroxClient/GameLogic/ChatUI/PlayerChatManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ private IEnumerator SelectChatAsync()
}
}

public void DeselectChat() => Player.main.StartCoroutine(DeselectChatAsync());
private IEnumerator DeselectChatAsync()
{
yield return new WaitUntil(() => PlayerChat.IsReady);
playerChat.Deselect();
}

public void AddMessage(string playerName, string message, Color color) => Player.main.StartCoroutine(AddMessageAsync(playerName, message, color));
private IEnumerator AddMessageAsync(string playerName, string message, Color color)
{
Expand Down
9 changes: 8 additions & 1 deletion NitroxClient/MonoBehaviours/Gui/Chat/PlayerChatInputField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,11 @@ private void Update()
sentMessages.Add(InputField.text);
_sentMessagesIndex = sentMessages.Count;
playerChatManager.SendMessage();
playerChatManager.DeselectChat(); // return to game after message sent
}
}
}

// Chat history stuff
// GetKeyDown means it's only getting executed once per press
if (UnityEngine.Input.GetKeyDown(KeyCode.UpArrow))
Expand Down Expand Up @@ -153,6 +154,12 @@ private void Update()
FreezeTime = true;
}
}

// Reselect chat if Y is pressed
if (UnityEngine.Input.GetKeyDown(KeyCode.Y))
{
playerChatManager.SelectChat();
}
}

private IEnumerator MoveToEndOfText()
Expand Down

0 comments on commit 1b48d28

Please sign in to comment.