2
0
Fork 0
mirror of https://github.com/GTA-ASM/SanAndreasUnity synced 2025-02-20 14:58:29 +00:00

chat message can be sent

This commit is contained in:
in0finite 2019-11-15 17:02:45 +01:00
parent e7272ef710
commit d6b810f606

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using UnityEngine;
using SanAndreasUnity.Behaviours;
using System.Linq;
using SanAndreasUnity.Utilities;
namespace SanAndreasUnity.UI {
@ -30,6 +31,8 @@ namespace SanAndreasUnity.UI {
public Color openedWindowTextColor = Color.green;
string m_chatText = "";
void Awake () {
@ -141,6 +144,22 @@ namespace SanAndreasUnity.UI {
GUI.EndGroup ();
// chat input
string buttonText = "Send";
Vector2 buttonSize = GUIUtils.CalcScreenSizeForText(buttonText, GUI.skin.button);
Rect rect = GUIUtils.GetCornerRect(ScreenCorner.BottomRight, buttonSize, new Vector2(40, 40));
if (GUI.Button(rect, buttonText))
{
Chat.ChatManager.SendChatMessageToAllPlayersAsLocalPlayer(m_chatText);
m_chatText = "";
}
float textInputWidth = 200;
rect.xMin -= textInputWidth;
rect.xMax -= buttonSize.x + 15;
m_chatText = GUI.TextField(rect, m_chatText, 100);
}
}