akadoc/Assets/scripts/chat_window.cs

38 lines
711 B
C#

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class chat_window : MonoBehaviour {
public Text text_chat;
public ScrollRect scrollrect;
GameObject chat_input;
TchatAnim tchatAnim;
string message_old;
// Use this for initialization
void Start () {
chat_input = GameObject.Find ("tchat_complet");
tchatAnim = chat_input.GetComponent<TchatAnim> ();
text_chat.text = "";
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown ("space") && tchatAnim.message != message_old) {
scrollrect.verticalNormalizedPosition = 0;
text_chat.text += "perceval > " + tchatAnim.message + "\n";
message_old= tchatAnim.message;
}
}
}