Example #1
0
    void OnGUI()
    {
        if (connected)
        {
            if (nameSet)
            {
                messageWindow.Draw(chatOutputPosition);

                if (Event.current.Equals(Event.KeyboardEvent("return")) && GUI.GetNameOfFocusedControl().Equals("TextInput"))
                {
                    ProcessInput();
                }
                GUI.SetNextControlName("TextInput");
                chatInput = GUI.TextField(chatInputRect, chatInput);
            }
            else
            {
                //Require the user set their name before they're fully joined to the chat server.
                GUI.Label(chatOutputRect, "Please enter your name");
                if (Event.current.Equals(Event.KeyboardEvent("return")) && GUI.GetNameOfFocusedControl().Equals("NameInput") && myName.Length > 0)
                {
                    SetName(myName);
                }

                GUI.SetNextControlName("NameInput");
                myName = GUI.TextField(chatInputRect, myName);

                GUI.FocusControl("NameInput");
            }
        }
    }
Example #2
0
 public void DrawMessageLog()
 {
     MessageWindow.Draw();
     MessageWindow.PrintLog();
 }
 void OnGUI()
 {
     consoleWindow.Draw(consolePosition);
 }