mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-26 22:10:17 +00:00
make some vars available in Inspector
This commit is contained in:
parent
ad2b733e2a
commit
5a4b6ebbe9
1 changed files with 6 additions and 3 deletions
|
@ -8,6 +8,10 @@ namespace SanAndreasUnity.UI
|
||||||
{
|
{
|
||||||
string m_chatText = "";
|
string m_chatText = "";
|
||||||
|
|
||||||
|
public ScreenCorner screenCorner = ScreenCorner.BottomRight;
|
||||||
|
public Vector2 padding = new Vector2(40, 40);
|
||||||
|
public float textInputWidth = 200;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
|
@ -20,15 +24,14 @@ namespace SanAndreasUnity.UI
|
||||||
|
|
||||||
string buttonText = "Send";
|
string buttonText = "Send";
|
||||||
Vector2 buttonSize = GUIUtils.CalcScreenSizeForText(buttonText, GUI.skin.button);
|
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))
|
if (GUI.Button(rect, buttonText))
|
||||||
{
|
{
|
||||||
Chat.ChatManager.SendChatMessageToAllPlayersAsLocalPlayer(m_chatText);
|
Chat.ChatManager.SendChatMessageToAllPlayersAsLocalPlayer(m_chatText);
|
||||||
m_chatText = "";
|
m_chatText = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
float textInputWidth = 200;
|
rect.xMin -= this.textInputWidth;
|
||||||
rect.xMin -= textInputWidth;
|
|
||||||
rect.xMax -= buttonSize.x + 15;
|
rect.xMax -= buttonSize.x + 15;
|
||||||
m_chatText = GUI.TextField(rect, m_chatText, 100);
|
m_chatText = GUI.TextField(rect, m_chatText, 100);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue