12345678910111213141516171819202122232425262728293031323334353637 |
- using UnityEngine;
- using UnityEngine.UI;
- using System.Collections;
- public class ClanChatItem : ItemRenderer
- {
- public const float DURATION = 20f;
- public Text contentTxt;
- private float startTime;
- public override object data {
- get {
- return base.data;
- }
- set {
- base.data = value;
- ChatMsg chatMsg = value as ChatMsg;
- if (chatMsg != null) {
- contentTxt.text = UserCache.GetNick (chatMsg.sender) + " " + Language.GetStr ("ChatPanel", "say") + " " + chatMsg.content;
- startTime = GameTime.time;
- }
- }
- }
-
- // Update is called once per frame
- void Update ()
- {
- if(GameTime.time - startTime >= DURATION)
- {
- this.transform.SetAsFirstSibling ();
- this.gameObject.SetActive (false);
- }
- }
- }
|