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:
parent
e7272ef710
commit
d6b810f606
1 changed files with 19 additions and 0 deletions
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue