码迷,mamicode.com
首页 > 编程语言 > 详细

Unity的聊天室

时间:2014-11-27 14:26:13      阅读:220      评论:0      收藏:0      [点我收藏+]

标签:style   blog   io   ar   color   sp   for   on   div   

using UnityEngine;
using System.Collections;

public class Userwords : MonoBehaviour {
        
    private UIInput input;
    public UITextList textlist;

    void Start () {
    
    }
    

    void Update () {
    
    }
    void Awake()
    {
        input=this.GetComponent<UIInput>();
        GameObject grid1=GameObject.Find("ChatSendBg");//获取需要监听的按钮对象
        UIEventListener.Get(grid1).onClick=OnClickBtn;//设置这个按钮的监听,指向本类的OnClickBtn方法中
    }
    void OnClickBtn(GameObject go)
    {
        switch(go.name)
        {
        case "ChatSendBg":
        input.value=this.transform.GetComponentInChildren<UILabel>().text;
        string chatMessage=input.value;
        textlist.Add(chatMessage);
        input.value="";
        break;
        }
    }
}

 

Unity的聊天室

标签:style   blog   io   ar   color   sp   for   on   div   

原文地址:http://www.cnblogs.com/heisaijuzhen/p/4126177.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!