using UnityEngine; using System.Collections; public class ChatBarGlobalView : View { public Transform container; public ChatBarGlobalItem itemPrefab; protected override void OnInitCompleted () { ChatManager.GetInstance ().GlobalMsgGot.AddListener (OnGotGlobalMsg); ListHelper.FillList (container, ChatManager.GetInstance ().GetGlobalMsgList (), itemPrefab, ChatManager.MAX_GLOBAL, ListHelper.Order.DESC); } protected override void OnDestroy () { base.OnDestroy (); ChatManager.GetInstance ().GlobalMsgGot.RemoveListener (OnGotGlobalMsg); } private void OnGotGlobalMsg(ChatMsg chatMsg) { ListHelper.AddToList (container, chatMsg, itemPrefab, ChatManager.MAX_GLOBAL, ListHelper.Order.DESC); } }