public void SetChatText(string a_text) { if (a_text != null && a_text.Length > 0) { if (null == m_labelChat && null != m_labelChatPrefab) { GameObject gameObject = (GameObject)Object.Instantiate(m_labelChatPrefab, base.transform.position + m_labelChatOffset, Quaternion.identity); gameObject.transform.parent = base.transform; m_labelChat = gameObject.GetComponent <ChatLabel>(); } if (null != m_labelChat) { m_labelChat.SetText(a_text); } } }
private void Update() { if (null != m_label && null != m_client && Time.time > m_nextUpdateTime) { bool flag = (base.transform.position - m_client.GetPos()).sqrMagnitude < m_displayLabelDist * m_displayLabelDist; m_label.SetText((!flag) ? string.Empty : LNG.Get(m_lngKey), true); m_nextUpdateTime = Time.time + Random.Range(0.5f, 1.5f); } }
public void OnShow(SockWorldChatData data, ChatCellType _type) { m_type = _type; gid = data.roleid; if (_type == ChatCellType.ChatCellType_NORMAL) { mNormalType.gameObject.SetActive(true); mVideoType.gameObject.SetActive(false); int m_hight = mNormalDis.height; mName.text = data.roleName; mNormalDis.SetText(data.content); mLevel.text = data.rolelv.ToString(); BgBig.height = BgBig.height + mNormalDis.height - m_hight; BgSmall.height = BgSmall.height + mNormalDis.height - m_hight; BoxCollider box1 = this.gameObject.GetComponent <BoxCollider>(); box1.size = new Vector3(BgBig.width, BgBig.height, 0f); box1.center = new Vector3(0, -(mNormalDis.height - m_hight) / 2, 0f); } else { mNormalType.gameObject.SetActive(false); mVideoType.gameObject.SetActive(true); // mVideoDis.gameObject.SetActive(false); int m_hight = mVideoDis.height; mName.text = data.roleName; mVideoDis.SetText(data.content); mLevel.text = data.rolelv.ToString(); BgBig.height = BgBig.height + mVideoDis.height - m_hight; BgSmall.height = BgSmall.height + mVideoDis.height - m_hight; BoxCollider box1 = this.gameObject.GetComponent <BoxCollider>(); box1.size = new Vector3(BgBig.width, BgBig.height, 0f); box1.center = new Vector3(0, -(mVideoDis.height - m_hight) / 2, 0f); AnalysisString(data.content); } if (data.iconid == 0) { AtlasMgr.mInstance.SetHeadSprite(mHead, "10104"); } else { AtlasMgr.mInstance.SetHeadSprite(mHead, data.iconid.ToString()); } DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); long lTime = data.time * 10000; // TimeSpan toNow = new TimeSpan(lTime+dtStart.Ticks); DateTime dt = new DateTime(lTime + dtStart.Ticks); // long time_JAVA_Long = data.time;//java长整型日期,毫秒为单位 // DateTime dt_1970 = new DateTime(1970,1,1); // long tricks_1970 = dt_1970.Ticks;//1970年1月1日刻度 // long time_tricks = tricks_1970 + time_JAVA_Long*10000;//日志日期刻度 // DateTime dt = new DateTime(time_tricks);//转化为DateTime mTime.text = dt.Year + "/" + dt.Month + "/" + dt.Day + " " + dt.Hour + ":" + dt.Minute + ":" + dt.Second; }
void OnSend() { m_txtChat.SetText(m_input.label.text); }