make some vars available in Inspector

This commit is contained in:
in0finite 2019-11-16 16:59:34 +01:00
parent ad2b733e2a
commit 5a4b6ebbe9

View file

@ -8,6 +8,10 @@ namespace SanAndreasUnity.UI
{
string m_chatText = "";
public ScreenCorner screenCorner = ScreenCorner.BottomRight;
public Vector2 padding = new Vector2(40, 40);
public float textInputWidth = 200;
void Start()
@ -20,15 +24,14 @@ namespace SanAndreasUnity.UI
string buttonText = "Send";
Vector2 buttonSize = GUIUtils.CalcScreenSizeForText(buttonText, GUI.skin.button);
Rect rect = GUIUtils.GetCornerRect(ScreenCorner.BottomRight, buttonSize, new Vector2(40, 40));
Rect rect = GUIUtils.GetCornerRect(this.screenCorner, buttonSize, this.padding);
if (GUI.Button(rect, buttonText))
{
Chat.ChatManager.SendChatMessageToAllPlayersAsLocalPlayer(m_chatText);
m_chatText = "";
}
float textInputWidth = 200;
rect.xMin -= textInputWidth;
rect.xMin -= this.textInputWidth;
rect.xMax -= buttonSize.x + 15;
m_chatText = GUI.TextField(rect, m_chatText, 100);